Replicates molecule site properties (specie, coords, etc.) in the
        MoleculeGraph.

        :return:
173005
def set_node_attributes(self):
        

        species = {}
        coords = {}
        properties = {}
        for node in self.graph.nodes():
            species[node] = self.molecule[node].specie.symbol
            coords[node] = self.molecule[node].coords
            properties[node] = self.molecule[node].properties

        nx.set_node_attributes(self.graph, species, "specie")
        nx.set_node_attributes(self.graph, coords, "coords")
        nx.set_node_attributes(self.graph, properties, "properties")
395525
def put_everything_together(self):
        
        molecule_list = [self.filestart]+[self.white_circles]+[self.draw_molecule]+[self.draw.draw_hbonds]+[self.draw.draw_pi_lines]+[self.draw.draw_saltbridges]+[self.draw.cloud]+[self.draw_plots]+[self.end_symbol]
        self.final_molecule = "".join(map(str,molecule_list))
629258
def copy(self):
        '''

        '''
        return type(self)(self.name, self.start, self.stop, self.feature_type,
                          gene=self.gene, locus_tag=self.locus_tag,
                          qualifiers=self.qualifiers, strand=self.strand)
343139
def get_optimized_molecule(self):
        """"""
        opt_coor = self.get_optimization_coordinates()
        if len(opt_coor) == 0:
            return None
        else:
            return Molecule(
                self.molecule.numbers,
                opt_coor[-1],
            )
916856
def generate_defect_structure(self, supercell=(1, 1, 1)):
        
        defect_structure = self.bulk_structure.copy()
        defect_structure.make_supercell(supercell)

        # consider modifying velocity property to make sure defect site is decorated
        # consistently with bulk structure for final defect_structure
        defect_properties = self.site.properties.copy()
        if ('velocities' in self.bulk_structure.site_properties) and \
            'velocities' not in defect_properties:
            if all( vel == self.bulk_structure.site_properties['velocities'][0]
                    for vel in self.bulk_structure.site_properties['velocities']):
                defect_properties['velocities'] = self.bulk_structure.site_properties['velocities'][0]
            else:
                raise ValueError("No velocity property specified for defect site and "
                                 "bulk_structure velocities are not homogeneous. Please specify this "
                                 "property within the initialized defect_site object.")

        #create a trivial defect structure to find where supercell transformation moves the lattice
        site_properties_for_fake_struct = {prop: [val] for prop,val in defect_properties.items()}
        struct_for_defect_site = Structure( self.bulk_structure.copy().lattice,
                                             [self.site.specie],
                                             [self.site.frac_coords],
                                             to_unit_cell=True,
                                             site_properties = site_properties_for_fake_struct)
        struct_for_defect_site.make_supercell(supercell)
        defect_site = struct_for_defect_site[0]

        poss_deflist = sorted(
            defect_structure.get_sites_in_sphere(defect_site.coords, 2, include_index=True), key=lambda x: x[1])
        defindex = poss_deflist[0][2]

        subsite = defect_structure.pop(defindex)
        defect_structure.append(self.site.specie.symbol, subsite.coords, coords_are_cartesian=True,
                                properties = defect_site.properties)
        defect_structure.set_charge(self.charge)
        return defect_structure
485064
def build(self):
        """"""
        self._molecules = []
        if self.handedness == 'l':
            handedness = -1
        else:
            handedness = 1
        rot_ang = self.rot_ang * handedness
        for i in range(self.num_of_repeats):
            dup_unit = copy.deepcopy(self.repeat_unit)
            z = (self.rise * i) * numpy.array([0, 0, 1])
            dup_unit.translate(z)
            dup_unit.rotate(rot_ang * i, [0, 0, 1])
            self.extend(dup_unit)
        self.relabel_all()
        return
113560
def add_properties(props, mol):
    
    if not props:
        return
    # The properties supersedes all charge and radical values in the atom block
    for _, atom in mol.atoms_iter():
        atom.charge = 0
        atom.multi = 1
        atom.mass = None
    for prop in props.get("CHG", []):
        mol.atom(prop[0]).charge = prop[1]
    for prop in props.get("RAD", []):
        mol.atom(prop[0]).multi = prop[1]
    for prop in props.get("ISO", []):
        mol.atom(prop[0]).mass = prop[1]
973460
def points_properties_df(self):
        
        pprops = {}
        for each in self.points:
            p = each.properties.asdict.copy()
            p.pop("device", None)
            p.pop("network", None)
            p.pop("simulated", None)
            p.pop("overridden", None)
            pprops[each.properties.name] = p

        df = pd.DataFrame(pprops)
        return df
819910
def from_dict(cls, d):
        
        m = Molecule.from_dict(d['molecule'])
        return cls(m, d['graphs'])
15117
def setup_hydrocarbon_ff(graph):
    """"""
    # A) Define parameters.
    # the bond parameters:
    bond_params = {
        (6, 1): 310*kcalmol/angstrom**2,
        (6, 6): 220*kcalmol/angstrom**2,
    }
    # for every (a, b), also add (b, a)
    for key, val in list(bond_params.items()):
        if key[0] != key[1]:
            bond_params[(key[1], key[0])] = val
    # the bend parameters
    bend_params = {
        (1, 6, 1): 35*kcalmol/rad**2,
        (1, 6, 6): 30*kcalmol/rad**2,
        (6, 6, 6): 60*kcalmol/rad**2,
    }
    # for every (a, b, c), also add (c, b, a)
    for key, val in list(bend_params.items()):
        if key[0] != key[2]:
            bend_params[(key[2], key[1], key[0])] = val

    # B) detect all internal coordinates and corresponding energy terms.
    terms = []
    # bonds
    for i0, i1 in graph.edges:
        K = bond_params[(graph.numbers[i0], graph.numbers[i1])]
        terms.append(BondStretchTerm(K, i0, i1))
    # bends (see b_bending_angles.py for the explanation)
    for i1 in range(graph.num_vertices):
        n = list(graph.neighbors[i1])
        for index, i0 in enumerate(n):
            for i2 in n[:index]:
                K = bend_params[(graph.numbers[i0], graph.numbers[i1], graph.numbers[i2])]
                terms.append(BendAngleTerm(K, i0, i1, i2))

    # C) Create and return the force field
    return ForceField(terms)
1019027
def coordinates(self):
        
        if self._coordinates is False:
            self._coordinates = None
            self.__pull_combined_properties()
        return self._coordinates
655724
private void cloneAndSortMappings(IReaction reaction, IReaction copyOfReaction,
            Map<IAtomContainer, int[]> permutationMap) {

        // make a lookup for the indices of the atoms in the copy
        final Map<IChemObject, Integer> indexMap = new HashMap<IChemObject, Integer>();
        List<IAtomContainer> all = ReactionManipulator.getAllAtomContainers(copyOfReaction);
        int globalIndex = 0;
        for (IAtomContainer ac : all) {
            for (IAtom atom : ac.atoms()) {
                indexMap.put(atom, globalIndex);
                globalIndex++;
            }
        }

        Map<IAtom, IAtom> atomAtomMap = atomAtomMap(reaction, copyOfReaction, permutationMap);
        List<IMapping> map = cloneMappings(reaction, atomAtomMap);

        Comparator<IMapping> mappingSorter = new Comparator<IMapping>() {

            /**
             * {@inheritDoc}
             */
            @Override
            public int compare(IMapping o1, IMapping o2) {
                IChemObject o10 = o1.getChemObject(0);
                IChemObject o20 = o2.getChemObject(0);
                return indexMap.get(o10).compareTo(indexMap.get(o20));
            }

        };
        Collections.sort(map, mappingSorter);
        int mappingIndex = 0;
        for (IMapping mapping : map) {
            mapping.getChemObject(0).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex);
            mapping.getChemObject(1).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex);
            copyOfReaction.addMapping(mapping);
            mappingIndex++;
        }

    }
99366
def add_spin_by_site(self, spins):
        
        if len(spins) != len(self.sites):
            raise ValueError("Spin of all sites must be "
                             "specified in the dictionary.")

        for site, spin in zip(self.sites, spins):
            new_sp = {}
            for sp, occu in site.species.items():
                sym = sp.symbol
                oxi_state = getattr(sp, "oxi_state", None)
                new_sp[Specie(sym, oxidation_state=oxi_state,
                              properties={'spin': spin})] = occu
            site.species = new_sp
680028
def copy(self):
        """"""

        model = self.__class__(self._database)
        model._limits_lower = dict(self._limits_lower)
        model._limits_upper = dict(self._limits_upper)
        model._reaction_set = set(self._reaction_set)
        model._compound_set = set(self._compound_set)
        return model
982949
def structure(self):
        
        masses = self.masses
        atoms = self.atoms.copy()
        if "nx" in atoms.columns:
            atoms.drop(["nx", "ny", "nz"], axis=1, inplace=True)
        atoms["molecule-ID"] = 1
        ld_copy = self.__class__(self.box, masses, atoms)
        topologies = ld_copy.disassemble()[-1]
        molecule = topologies[0].sites
        coords = molecule.cart_coords - np.array(self.box.bounds)[:, 0]
        species = molecule.species
        latt = self.box.to_lattice()
        site_properties = {}
        if "q" in atoms:
            site_properties["charge"] = atoms["q"].values
        if self.velocities is not None:
            site_properties["velocities"] = self.velocities.values
        return Structure(latt, species, coords, coords_are_cartesian=True,
                         site_properties=site_properties)
953326
def pymatgen_mol(self):
        
        sp = []
        coords = []
        for atom in ob.OBMolAtomIter(self._obmol):
            sp.append(atom.GetAtomicNum())
            coords.append([atom.GetX(), atom.GetY(), atom.GetZ()])
        return Molecule(sp, coords)
677268
def _clone(self, deepcopy=True):
        """"""
        clone = self._clone_base()
        values_to_clone = ("spec", "projection", "skip", "limit",
                           "max_time_ms", "max_await_time_ms", "comment",
                           "max", "min", "ordering", "explain", "hint",
                           "batch_size", "max_scan", "manipulate",
                           "query_flags", "modifiers", "collation")
        data = dict((k, v) for k, v in iteritems(self.__dict__)
                    if k.startswith('_Cursor__') and k[9:] in values_to_clone)
        if deepcopy:
            data = self._deepcopy(data)
        clone.__dict__.update(data)
        return clone