default 9 bits descriptor
        7 bits of atomic number (0-127) and 2 bits of pi electrons (0-3)
335625
def node_desc(self, atoms):
        
        a1 = self.mol.atom(atoms[0])
        a2 = self.mol.atom(atoms[1])
        a1t = a1.number << 2 | a1.pi
        a2t = a2.number << 2 | a2.pi
        pair = sorted((a1t, a2t))
        return pair[0] << 9 | pair[1]
1138643
def give_zip_element_z_and_names(element_name):
    ''' '''

    #import numpy as np

    global z_bismuth
    z_bismuth = 83
    global z_for_elem
    z_for_elem = []
    global index_stable
    index_stable = []

    i_for_stable = 1
    i_for_unstable = 0
    for i in range(z_bismuth):
        z_for_elem.append(int(i+1))
        # the only elements below bismuth with no stable isotopes are Tc and Pm
        if i+1 == 43 or i+1 == 61:
            index_stable.append(i_for_unstable)
        else:
            index_stable.append(i_for_stable)

        dummy_index = np.zeros(len(element_name))
        for i in range(len(element_name)):
            if element_name[i] == 'Neutron':
                dummy_index[i] = 0
            elif element_name[i] == 'H':
                dummy_index[i] = 1
            elif element_name[i] == 'He':
                dummy_index[i] = 2
            elif element_name[i] == 'Li':
                dummy_index[i] = 3
            elif element_name[i] == 'Be':
                dummy_index[i] = 4
            elif element_name[i] == 'B':
                dummy_index[i] = 5
            elif element_name[i] == 'C':
                dummy_index[i] = 6
            elif element_name[i] == 'N':
                dummy_index[i] = 7
            elif element_name[i] == 'O':
                dummy_index[i] = 8
            elif element_name[i] == 'F':
                dummy_index[i] = 9
            elif element_name[i] == 'Ne':
                dummy_index[i] = 10
            elif element_name[i] == 'Na':
                dummy_index[i] = 11
            elif element_name[i] == 'Mg':
                dummy_index[i] = 12
            elif element_name[i] == 'Al':
                dummy_index[i] = 13
            elif element_name[i] == 'Si':
                dummy_index[i] = 14
            elif element_name[i] == 'P':
                dummy_index[i] = 15
            elif element_name[i] == 'S':
                dummy_index[i] = 16
            elif element_name[i] == 'Cl':
                dummy_index[i] = 17
            elif element_name[i] == 'Ar':
                dummy_index[i] = 18
            elif element_name[i] == 'K':
                dummy_index[i] = 19
            elif element_name[i] == 'Ca':
                dummy_index[i] = 20
            elif element_name[i] == 'Sc':
                dummy_index[i] = 21
            elif element_name[i] == 'Ti':
                dummy_index[i] = 22
            elif element_name[i] == 'V':
                dummy_index[i] = 23
            elif element_name[i] == 'Cr':
                dummy_index[i] = 24
            elif element_name[i] == 'Mn':
                dummy_index[i] = 25
            elif element_name[i] == 'Fe':
                dummy_index[i] = 26
            elif element_name[i] == 'Co':
                dummy_index[i] = 27
            elif element_name[i] == 'Ni':
                dummy_index[i] = 28
            elif element_name[i] == 'Cu':
                dummy_index[i] = 29
            elif element_name[i] == 'Zn':
                dummy_index[i] = 30
            elif element_name[i] == 'Ga':
                dummy_index[i] = 31
            elif element_name[i] == 'Ge':
                dummy_index[i] = 32
            elif element_name[i] == 'As':
                dummy_index[i] = 33
            elif element_name[i] == 'Se':
                dummy_index[i] = 34
            elif element_name[i] == 'Br':
                dummy_index[i] = 35
            elif element_name[i] == 'Kr':
                dummy_index[i] = 36
            elif element_name[i] == 'Rb':
                dummy_index[i] = 37
            elif element_name[i] == 'Sr':
                dummy_index[i] = 38
            elif element_name[i] == 'Y':
                dummy_index[i] = 39
            elif element_name[i] == 'Zr':
                dummy_index[i] = 40
            elif element_name[i] == 'Nb':
                dummy_index[i] = 41
            elif element_name[i] == 'Mo':
                dummy_index[i] = 42
            elif element_name[i] == 'Tc':
                dummy_index[i] = 43
            elif element_name[i] == 'Ru':
                dummy_index[i] = 44
            elif element_name[i] == 'Rh':
                dummy_index[i] = 45
            elif element_name[i] == 'Pd':
                dummy_index[i] = 46
            elif element_name[i] == 'Ag':
                dummy_index[i] = 47
            elif element_name[i] == 'Cd':
                dummy_index[i] = 48
            elif element_name[i] == 'In':
                dummy_index[i] = 49
            elif element_name[i] == 'Sn':
                dummy_index[i] = 50
            elif element_name[i] == 'Sb':
                dummy_index[i] = 51
            elif element_name[i] == 'Te':
                dummy_index[i] = 52
            elif element_name[i] == 'I':
                dummy_index[i] = 53
            elif element_name[i] == 'Xe':
                dummy_index[i] = 54
            elif element_name[i] == 'Cs':
                dummy_index[i] = 55
            elif element_name[i] == 'Ba':
                dummy_index[i] = 56
            elif element_name[i] == 'La':
                dummy_index[i] = 57
            elif element_name[i] == 'Ce':
                dummy_index[i] = 58
            elif element_name[i] == 'Pr':
                dummy_index[i] = 59
            elif element_name[i] == 'Nd':
                dummy_index[i] = 60
            elif element_name[i] == 'Pm':
                dummy_index[i] = 61
            elif element_name[i] == 'Sm':
                dummy_index[i] = 62
            elif element_name[i] == 'Eu':
                dummy_index[i] = 63
            elif element_name[i] == 'Gd':
                dummy_index[i] = 64
            elif element_name[i] == 'Tb':
                dummy_index[i] = 65
            elif element_name[i] == 'Dy':
                dummy_index[i] = 66
            elif element_name[i] == 'Ho':
                dummy_index[i] = 67
            elif element_name[i] == 'Er':
                dummy_index[i] = 68
            elif element_name[i] == 'Tm':
                dummy_index[i] = 69
            elif element_name[i] == 'Yb':
                dummy_index[i] = 70
            elif element_name[i] == 'Lu':
                dummy_index[i] = 71
            elif element_name[i] == 'Hf':
                dummy_index[i] = 72
            elif element_name[i] == 'Ta':
                dummy_index[i] = 73
            elif element_name[i] == 'W':
                dummy_index[i] = 74
            elif element_name[i] == 'Re':
                dummy_index[i] = 75
            elif element_name[i] == 'Os':
                dummy_index[i] = 76
            elif element_name[i] == 'Ir':
                dummy_index[i] = 77
            elif element_name[i] == 'Pt':
                dummy_index[i] = 78
            elif element_name[i] == 'Au':
                dummy_index[i] = 79
            elif element_name[i] == 'Hg':
                dummy_index[i] = 80
            elif element_name[i] == 'Tl':
                dummy_index[i] = 81
            elif element_name[i] == 'Pb':
                dummy_index[i] = 82
            elif element_name[i] == 'Bi':
                dummy_index[i] = 83
            elif element_name[i] == 'Po':
                dummy_index[i] = 84
            elif element_name[i] == 'At':
                dummy_index[i] = 85

        #if spe[0] == 'N   1':
        #       znum_int[0] = 0

        # here the index to connect name and atomic numbers.
        global index_z_for_elements
        index_z_for_elements = {}
        for a,b in zip(element_name,dummy_index):
            index_z_for_elements[a]=b
1371333
private static BitSet available(int[][] graph, IAtom[] atoms, EdgeToBondMap bonds) {

        final BitSet available = new BitSet();

        // for all atoms, select those that require a double-bond
        ATOMS: for (int i = 0; i < atoms.length; i++) {

            final IAtom atom = atoms[i];

            // preconditions
            if (atom.getAtomicNumber() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset atomic number");
            if (atom.getFormalCharge() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset formal charge");
            if (atom.getImplicitHydrogenCount() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset implicit hydrogen count");

            if (!atom.getFlag(ISAROMATIC)) continue;

            // count preexisting pi-bonds, a higher bond order causes a skip
            int nPiBonds = 0;
            for (final int w : graph[i]) {
                IBond.Order order = bonds.get(i, w).getOrder();
                if (order == DOUBLE) {
                    nPiBonds++;
                } else if (order.numeric() > 2) {
                    continue ATOMS;
                }
            }

            // check if a pi bond can be assigned
            final int element = atom.getAtomicNumber();
            final int charge = atom.getFormalCharge();
            final int valence = graph[i].length + atom.getImplicitHydrogenCount() + nPiBonds;

            if (available(element, charge, valence)) {
                available.set(i);
            }
        }

        return available;
    }
689855
def each_bit
      return enum_for(:each_bit) unless block_given?
      index = 0
      headbits = (self.bytesize - 1) * 8
      skipbits = 8 - @bits
      @data.each_byte do |byte|
        loop do
          break if index == @bitsize
          if index >= headbits
            bit = (byte >> (7 - ((index + skipbits) & 7))) & 1
          else
            bit = (byte >> (7 - (index & 7))) & 1
          end
          yield bit
          index += 1
          break if (index & 7) == 0
        end
      end
      return self
    end
37133
private int getAtomTypeXCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int nocounter = 0;
        IBond bond;
        for (IAtom neighbour : neighbours) {
            if ((neighbour.getSymbol().equals("N") || neighbour.getSymbol().equals("O"))
                    && !(Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) {
                //if (ac.getMaximumBondOrder(neighbours[i]) == 1.0) {
                bond = ac.getBond(neighbour, atom);
                if (bond.getOrder() != IBond.Order.DOUBLE) {
                    nocounter += 1;
                }
            }
        }
        return nocounter;
    }
37758
def get_descriptor(ctx):
    
    d_net = gluon.nn.Sequential()
    with d_net.name_scope():

        d_net.add(SNConv2D(num_filter=64, kernel_size=4, strides=2, padding=1, in_channels=3, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=128, kernel_size=4, strides=2, padding=1, in_channels=64, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=256, kernel_size=4, strides=2, padding=1, in_channels=128, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=512, kernel_size=4, strides=2, padding=1, in_channels=256, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=1, kernel_size=4, strides=1, padding=0, in_channels=512, ctx=ctx))

    return d_net
727827
def actual_bit_depth
      raise "The 'Bits Allocated' Element is missing from this DICOM instance. Unable to encode/decode pixel data." unless exists?("0028,0100")
      if photometry == PI_PALETTE_COLOR
      # Only one channel is checked and it is assumed that all channels have the same number of bits.
        return self['0028,1101'].value.split("\\").last.to_i
      else
        return bit_depth
      end
    end
821827
@Override
    public DescriptorValue calculate(IAtomContainer container) {

        double bpol = 0;
        int atomicNumber0;
        int atomicNumber1;
        double difference;
        try {
            IsotopeFactory ifac = Isotopes.getInstance();
            IElement element0;
            IElement element1;

            String symbol0;
            String symbol1;
            for (IBond bond : container.bonds()) {
                IAtom atom0 = bond.getBegin();
                IAtom atom1 = bond.getEnd();

                symbol0 = atom0.getSymbol();
                symbol1 = atom1.getSymbol();
                element0 = ifac.getElement(symbol0);
                element1 = ifac.getElement(symbol1);
                atomicNumber0 = element0.getAtomicNumber();
                atomicNumber1 = element1.getAtomicNumber();
                difference = polarizabilities[atomicNumber0] - polarizabilities[atomicNumber1];
                bpol += Math.abs(difference);
            }

            // after going through the bonds, we go through the atoms and see if they have
            // implicit H's and if so, consider the associated "implicit" bonds. Note that
            // if the count is UNSET, we assume it is 0
            for (IAtom atom : container.atoms()) {
                int impH = atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount();
                IElement elem = ifac.getElement(atom.getSymbol());
                int atnum = elem.getAtomicNumber();
                difference = Math.abs(polarizabilities[atnum] - polarizabilities[1]) * impH;
                bpol += difference;
            }
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(),
                    new DoubleResult(bpol), getDescriptorNames());
        } catch (Exception ex1) {
            logger.debug(ex1);
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                    Double.NaN), getDescriptorNames(), new CDKException("Problems with IsotopeFactory due to "
                    + ex1.toString(), ex1));
        }
    }
1255957
def get_number_of_atoms(self):
        
        strc = self.get_output_structure()
        if not strc:
            return None
        return Property(scalars=[Scalar(value=len(strc))], units="/unit cell")
54809
def read_atoms(fn, cycfn=None, pos_only=False, conv=1.0):
    
    f = paropen(fn, "r")

    l = f.readline().lstrip()
    while len(l) > 0 and ( l[0] == '#' or l[0] == '<' ):
        l = f.readline().lstrip()

    n_atoms = int(l)

    l = f.readline().lstrip()
    while len(l) > 0 and ( l[0] == '#' or l[0] == '<' ):
        l = f.readline().lstrip()

    l = f.readline().lstrip()
    while len(l) > 0 and ( l[0] == '#' or l[0] == '<' ):
        l = f.readline().lstrip()

    #
    # Read positions
    #

    forces = np.zeros( [ n_atoms, 3 ] )
    groups = np.zeros( [ n_atoms ] )
    gamma  = np.zeros( [ n_atoms ] )
    T      = np.zeros( [ n_atoms ] )

    ats = [ ]
    for i in range(n_atoms):
        s = l.split()
        #      type   x            y            z
        sym = None
        try:
            Z    = int(s[0])
            sym  = ase.data.chemical_symbols[Z]
        except:
            sym  = s[0]
        a = ase.Atom(sym, ( float(s[2])*conv, float(s[3])*conv, float(s[4])*conv ) )
        groups[i] = int(s[5])
        gamma[i]  = float(s[6])
        T[i]      = float(s[7])

        ats += [ a ]
        l = f.readline()
    this = ase.Atoms(ats, pbc=True)

    if not pos_only:
        while l and l == "":
            l = f.readline().strip()

        while l:
            key = l.strip(" <-#\r\n")

            if key.upper() == "VELOCITIES":
                for i in range(n_atoms):
                    s = f.readline().split()
                    m = this[i].mass
                    if m is None:
                        m = ase.data.atomic_masses[ase.data.chemical_symbols.index(this[i].symbol)]
                    this[i].momentum = ( m*float(s[0]), m*float(s[1]), m*float(s[2]) )

                l = None

            elif key.upper() == "FORCES":
                for i in range(n_atoms):
                    s = f.readline().split()
                    forces[i] =  np.array( [ float(s[0]), float(s[1]), float(s[2]) ] )

                l = None

            elif key.upper() == "CHARGES":
                for i in this:
                    l = f.readline()
                    if l and len(l.split()) == 1:
                        i.charge = float(l)

                l = None

            elif key.upper() == "CELL" or key.upper().split()[0:2] == ("BOX", "VECTORS" ):
                l1 = f.readline()
                l2 = f.readline()
                l3 = f.readline()

                this.set_cell( [ [float(x) for x in l1.split()],
                                 [float(x) for x in l2.split()],
                                 [float(x) for x in l3.split()] ] )

                l = None

            else:
                aux = [ ]
                l = f.readline().strip()
                while l and l[0] not in [ '<', '#' ]:
                    s = l.split()

                    aux += [ [float(x) for x in s] ]

                    l = f.readline().strip()

                if len(aux) == n_atoms:
                    this.set_array(key, np.asarray(aux))
                else:
                    print("Warning: Encountered field '%s' which does not seem to be per-atom data." % key)

            if l is None:
                l = f.readline().strip()
            while l and l == "":
                l = f.readline().strip()


    f.close()

    this.set_array("forces", forces)
    this.set_array("groups", groups)
    this.set_array("gamma", gamma)
    this.set_array("T", T)

    if cycfn:
        read_cyc(this, cycfn, conv=conv)

    return this
924819
def particles_ascii(self, prec=8):
        
        s = ""
        for p in self.particles:
            s += (("%%.%de "%prec) * 8)%(p.m, p.r, p.x, p.y, p.z, p.vx, p.vy, p.vz) + "\n"
        if len(s):
            s = s[:-1]
        return s
284514
def inttoLEB128(intinput):
    '''
    
    '''

    binstr = str(bin(intinput)) \
             .lstrip("0b").replace("b","").replace("L","") \
             .replace("'","").replace('"',"")
    if len(binstr) % 7:
        binstr = binstr.zfill(len(binstr) + 7 - (len(binstr) % 7))
    bytelist = ""
    for i in range(len(binstr) // 7):
        if i < ((len(binstr) // 7) - 1):
            pad = "1"
        else:
            pad = "0"
        currbyte = binstr[(len(binstr) - (7*i + 7)):(len(binstr) - (7*i))]
        currbyte = pad + currbyte
        currbyte = dechex(int(currbyte,2))
        # assert len(currbyte) == 2
        bytelist = bytelist + currbyte
    return bytelist
192516
public static void bits2prm_ld8k(
	 short bits[], int bitss,          /* input : serial bits (80)                       */
	 int   prm[], int ps            /* output: decoded parameters (11 parameters)     */
	)
	{
	   short i;
	   for (i = 0; i < LD8KConstants.PRM_SIZE; i++)
	     {
	        prm[i+ps] = bin2int(TabLD8k.bitsno[i], bits,bitss);
	        bitss  += TabLD8k.bitsno[i];
	     }

	}
792180
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) {
		int lengthBits;

		if (version < 10)
			lengthBits = bitsA;
		else if (version < 27)
			lengthBits = bitsB;
		else
			lengthBits = bitsC;
		return lengthBits;
	}
1152336
function writeBitField(setBits, bitIndex) {
	var bitLen = bitIndex.length;
	var blen = Math.ceil(bitLen / 8);
	var unused = blen * 8 - bitLen;
	var bits = Buffer.alloc(1 + blen); // zero-filled
	bits[0] = unused;
	for (var i = 0; i < bitLen; ++i) {
		var byteN = 1 + Math.floor(i / 8);
		var bit = 7 - (i % 8);
		var mask = 1 << bit;
		var name = bitIndex[i];
		if (name === undefined)
			continue;
		var bitVal = (setBits.indexOf(name) !== -1);
		if (bitVal) {
			bits[byteN] |= mask;
		}
	}
	return (bits);
}
1127871
def get_access_bits(self, c1, c2, c3):
        
        byte_6 = ((~c2[3] & 1) << 7) + ((~c2[2] & 1) << 6) + ((~c2[1] & 1) << 5) + ((~c2[0] & 1) << 4) + \
                 ((~c1[3] & 1) << 3) + ((~c1[2] & 1) << 2) + ((~c1[1] & 1) << 1) + (~c1[0] & 1)
        byte_7 = ((c1[3] & 1) << 7) + ((c1[2] & 1) << 6) + ((c1[1] & 1) << 5) + ((c1[0] & 1) << 4) + \
                 ((~c3[3] & 1) << 3) + ((~c3[2] & 1) << 2) + ((~c3[1] & 1) << 1) + (~c3[0] & 1)
        byte_8 = ((c3[3] & 1) << 7) + ((c3[2] & 1) << 6) + ((c3[1] & 1) << 5) + ((c3[0] & 1) << 4) + \
                 ((c2[3] & 1) << 3) + ((c2[2] & 1) << 2) + ((c2[1] & 1) << 1) + (c2[0] & 1)
        return byte_6, byte_7, byte_8
429316
protected void newAtomData() {
        atomCounter = 0;
        elsym = new ArrayList<String>();
        elid = new ArrayList<String>();
        eltitles = new ArrayList<String>();
        formalCharges = new ArrayList<String>();
        partialCharges = new ArrayList<String>();
        isotope = new ArrayList<String>();
        atomicNumbers = new ArrayList<String>();
        exactMasses = new ArrayList<String>();
        x3 = new ArrayList<String>();
        y3 = new ArrayList<String>();
        z3 = new ArrayList<String>();
        x2 = new ArrayList<String>();
        y2 = new ArrayList<String>();
        xfract = new ArrayList<String>();
        yfract = new ArrayList<String>();
        zfract = new ArrayList<String>();
        hCounts = new ArrayList<String>();
        atomParities = new ArrayList<String>();
        parityARef1 = new ArrayList<String>();
        parityARef2 = new ArrayList<String>();
        parityARef3 = new ArrayList<String>();
        parityARef4 = new ArrayList<String>();
        atomAromaticities = new ArrayList<String>();
        atomDictRefs = new ArrayList<String>();
        spinMultiplicities = new ArrayList<String>();
        occupancies = new ArrayList<String>();
        atomCustomProperty = new HashMap<Integer, List<String>>();
    }