rmgpy.molecule.converter

This module provides methods for converting molecules between RMG, RDKit, and OpenBabel.

rmgpy.molecule.converter.debug_rdkit_mol(rdmol, level=logging.INFO)

Takes an rdkit molecule object and logs some debugging information equivalent to calling rdmol.Debug() but uses our logging framework. Default logging level is INFO but can be controlled with the level parameter. Also returns the message as a string, should you want it for something.

rmgpy.molecule.converter.from_ob_mol(Molecule mol, obmol, bool raise_atomtype_exception=True) Molecule

Convert a OpenBabel Mol object obmol to a molecular structure. Uses OpenBabel to perform the conversion.

It estimates radical placement based on undervalence of atoms, and assumes overall spin multiplicity is radical count + 1

rmgpy.molecule.converter.from_rdkit_mol(Molecule mol, rdkitmol, bool raise_atomtype_exception=True) Molecule

Convert a RDKit Mol object rdkitmol to a molecular structure. Uses RDKit to perform the conversion. This Kekulizes everything, removing all aromatic atom types.

rmgpy.molecule.converter.to_ob_mol(Molecule mol, bool return_mapping=False, bool save_order=False)

Convert a molecular structure to an OpenBabel OBMol object. Uses OpenBabel to perform the conversion.

rmgpy.molecule.converter.to_rdkit_mol(Molecule mol, bool remove_h=True, bool return_mapping=False, bool sanitize=True, bool save_order=False)

Convert a molecular structure to a RDKit rdmol object. Uses RDKit to perform the conversion. Perceives aromaticity and, unless remove_h==False, removes Hydrogen atoms.

If return_mapping==True then it also returns a dictionary mapping the atoms to RDKit’s atom indices.