rdkit.Chem.inchi module — The RDKit 2025.09.6 documentation

# rdkit.Chem.inchi module

rdkit.Chem.inchi.GetInchiVersion() → str :

  returns the version of the InChI software being used

  C++ signature :

    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetInchiVersion()

exception rdkit.Chem.inchi.InchiReadWriteError

  Bases: `Exception`

rdkit.Chem.inchi.InchiToInchiKey(inchi)

  Return the InChI key for the given InChI string. Return None on error

rdkit.Chem.inchi.MolBlockToInchi(molblock, options='', logLevel=None, treatWarningAsError=False)

  Returns the standard InChI string for a mol block

  Keyword arguments: logLevel – the log level used for logging logs and messages from InChI API. set to None to diable the logging completely treatWarningAsError – set to True to raise an exception in case of a molecule that generates warning in calling InChI API. The resultant InChI string and AuxInfo string as well as the error message are encoded in the exception.

  Returns: the standard InChI string returned by InChI API for the input molecule

rdkit.Chem.inchi.MolBlockToInchiAndAuxInfo(molblock, options='', logLevel=None, treatWarningAsError=False)

  Returns the standard InChI string and InChI auxInfo for a mol block

  Keyword arguments: logLevel – the log level used for logging logs and messages from InChI API. set to None to diable the logging completely treatWarningAsError – set to True to raise an exception in case of a molecule that generates warning in calling InChI API. The resultant InChI string and AuxInfo string as well as the error message are encoded in the exception.

  Returns: a tuple of the standard InChI string and the auxInfo string returned by InChI API, in that order, for the input molecule

rdkit.Chem.inchi.MolFromInchi(inchi, sanitize=True, removeHs=True, logLevel=None, treatWarningAsError=False)

  Construct a molecule from a InChI string

  Keyword arguments: sanitize – set to True to enable sanitization of the molecule. Default is True removeHs – set to True to remove Hydrogens from a molecule. This only makes sense when sanitization is enabled logLevel – the log level used for logging logs and messages from InChI API. set to None to diable the logging completely treatWarningAsError – set to True to raise an exception in case of a molecule that generates warning in calling InChI API. The resultant molecule and error message are part of the excpetion

  Returns: a rdkit.Chem.rdchem.Mol instance

rdkit.Chem.inchi.MolToInchi(mol, options='', logLevel=None, treatWarningAsError=False)

  Returns the standard InChI string for a molecule

  Keyword arguments: logLevel – the log level used for logging logs and messages from InChI API. set to None to diable the logging completely treatWarningAsError – set to True to raise an exception in case of a molecule that generates warning in calling InChI API. The resultant InChI string and AuxInfo string as well as the error message are encoded in the exception.

  Returns: the standard InChI string returned by InChI API for the input molecule

rdkit.Chem.inchi.MolToInchiAndAuxInfo(mol, options='', logLevel=None, treatWarningAsError=False)

  Returns the standard InChI string and InChI auxInfo for a molecule

  Keyword arguments: logLevel – the log level used for logging logs and messages from InChI API. set to None to diable the logging completely treatWarningAsError – set to True to raise an exception in case of a molecule that generates warning in calling InChI API. The resultant InChI string and AuxInfo string as well as the error message are encoded in the exception.

  Returns: a tuple of the standard InChI string and the auxInfo string returned by InChI API, in that order, for the input molecule

rdkit.Chem.inchi.MolToInchiKey(mol, options='')

  Returns the standard InChI key for a molecule

  Returns: the standard InChI key returned by InChI API for the input molecule