rxn.chemutils.conversion.smiles_to_mol

rxn.chemutils.conversion.smiles_to_mol(smiles, sanitize=True, find_radicals=True)[source]

Convert a SMILES string to an RDKit Mol.

Mainly a wrapper around MolFromSmiles that raises InvalidSmiles when necessary.

Raises

InvalidSmiles for empty or invalid SMILES strings.

Parameters
  • smiles (str) – SMILES string to convert.

  • sanitize (bool, default: True) – whether to sanitize the molecules or not. Note: sanitization here corresponds to doing a sanitization with SANITIZE_ALL.

  • find_radicals (bool, default: True) – usually, it will be very practical to have this set to True, otherwise the imported Mol instances will potentially “add” hydrogen atoms to radical atoms. However, in some cases it may be useful to de-activate it because it may cause problems on aromatic molecules. Irrelevant if sanitize=True.

Return type

Mol

Returns

Mol instance.