Beispiel #1
0
    def __init__(self, complex_data=None, molecules_data=None):
        if complex_data is None: complex_data = {'name': None}
        if molecules_data is None: molecules_data = []
        GroupOfSites.__init__(self, name=complex_data['name'])
        self.qm_energy = None
        self.molecules = []
        # load molecules
        num_extra = 0
        num_atoms = 0
        for mol_data in molecules_data:
            natoms = mol_data['num atoms']
            mol_name = mol_data['name']
            sym = mol_data['symmetry']

            atoms = []
            try:
                atoms_order = mol_data['atoms order']
            except KeyError:
                atoms_order = [a+1+num_atoms for a in range(natoms)]
            for i in atoms_order:
                index, elem, crds, q = complex_data['atoms'][i-1] # indices start with 1
                index += num_extra
                atom = (index, elem, crds, q)
                atoms.append(atom)

            d = {
                    'name': mol_name,
                    'atoms': atoms,
                    'symmetry': sym,
                }

            m = Molecule(data=d)
            self.add_molecule(m)
            num_extra += len(m.extra_sites)
            num_atoms += len(m.atoms)

        self.decomposition = {
                'electrostatic': None,
                'dispersion': None,
                'exchange': None,
                }
Beispiel #2
0
 def __init__(self, mol1, mol2):
     name = '%s-%s' % (mol1.name, mol2.name)
     GroupOfSites.__init__(self, name)
     AtomsInMolecule.__init__(self, name)
     self.mol1 = mol1
     self.mol2 = mol2
     self.molecules = (mol1, mol2)
     iatom = 1
     isite = 1
     for m in self.molecules:
         for site in m.sites:
             site.set_index(isite)
             self.add_site(site)
             isite += 1
         for atom in m.atoms:
             atom.set_index(iatom)
             self.add_atom(atom)
             iatom += 1
     self.decomposition = {
             'electrostatic': None,
             '6': None,
             '12': None,
             'LJ': None,
             }