CGenFF Molecule

cgenff_molecule.write_stream_file()

Convert to RDKit & SMILES

We are missing bond orders if you are using this feature

molecule = cgenff_molecule.convert_to_rdkit()
molecule = cgenff_molecule.convert_to_smiles()

The conversion is still tricky here since we don't have bond orders. Information needs to come from somewhere and can be hard to guess by atomic valence with no connections.

molecule = Chem.Mol()
editable_molecule = Chem.EditableMol(molecule)

atom_index_mapping = {}

for i, row in enumerate(self.atoms):

    element = row.split()[1]
    atom_index_mapping[element] = i

for key in list(atom_index_mapping.keys()):

    periodic_table = GetPeriodicTable()
    number = periodic_table.GetAtomicNumber(key[0])
    editable_molecule.AddAtom(Chem.Atom(number))

 for row in self.bond_connectivity:

    atom_1 = row.split()[1]
    atom_2 = row.split()[2]

    editable_molecule.AddBond(
        atom_index_mapping[ atom_1 ],
        atom_index_mapping[ atom_2 ]
    )

    molecule = editable_molecule.GetMol()

    molecule.UpdatePropertyCache()
    Chem.SanitizeMol(molecule)

    AllChem.EmbedMolecule(molecule)
    AllChem.MMFFOptimizeMolecule(molecule)

Accessing Properties on CGenFF Molecule

print (cgenff_molecule.bond_parameters)
print (cgenff_molecule.angle_parameters)
print (cgenff_molecule.dihedral_parameters)
print (cgenff_molecule.atom_rows)
print (cgenff_molecule.improper_parameters)

Last updated