Skip to content

Molecule

Instance of molecule using RDKit Mol class.

It's instantiate by providing SMILES but it's also possible to use from_rdkit() class method to instantiate from RDKit Mol instance.

Example

from chem_kit import Molecule
mol = Molecule("CCO")

__eq__(self, other) special

Comparaison betwwen two Molecule instances is done by comparing cannonical SMILES (.smiles property)

__init__(self, smiles, aromaticity='mdl', preserve_H=False) special

Parameters:

Name Type Description Default
smiles str

SMILES of the molecule to create.

required
aromaticity str

Aromacity model to apply.

Possible values are :

  • custom
  • default
  • mdl
  • rdkit
  • simple

If None, default is "mdl".

'mdl'
preserve_H bool

Preserve H that are explicit in smiles.

False

from_rdkit(rdkit) classmethod

Instanciate by providing a RDKit instance rather than a smiles.

Parameters:

Name Type Description Default
rdkit Chem.Mol

rdkit.Chem.Mol instance

required

Returns:

Type Description
Molecule

Molecule instance

get_atoms(self)

Yield every atom in the molecule

get_ring_systems(self, includeSpiro=False)

Get all ring systems.

Note

From RDKit Cookbook

Returns:

Type Description
List[Set[int]]

List of set if atom id for each ring systems

get_substructure_match(self, smarts)

Apply RDKit GetSubstructMatches method.

Note

It highlight bonds as it seems to not working with the python API of RDKit.

Parameters:

Name Type Description Default
smarts str

the substructure to find.

required

Returns:

Type Description
Tuple[Tuple[int]]

Tuple of atom ids for each match

highlight_aromatics(self)

Highlight aromatics rings

rdkit: Chem.Mol property readonly

rdkit.Chem.Mol instance of the molecule. Use it to directly apply RDKit methods

smiles: str property readonly

Cannonical SMILES of the molecule

smiles_kekulized: str property readonly

Kekulized SMILES of the molecule