rmgpy.molecule.converter

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

rmgpy.molecule.converter.debug_rdkit_mol(rdmol, level=20)

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(mol, obmol, raise_atomtype_exception)

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(mol, rdkitmol, raise_atomtype_exception)

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(mol, return_mapping, save_order)

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

rmgpy.molecule.converter.to_rdkit_mol(mol, remove_h, return_mapping, sanitize, save_order)

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.