rdkit.Chem.rdchem module

Module containing the core chemistry functionality of the RDKit

class rdkit.Chem.rdchem.Atom(self, what: str)
class rdkit.Chem.rdchem.Atom(self, other: rdkit.Chem.rdchem.Atom)
class rdkit.Chem.rdchem.Atom(self, num: int)

Bases: object

The class to store Atoms. Note that, though it is possible to create one, having an Atom on its own (i.e not associated with a molecule) is not particularly useful.

Overloaded function.

  1. __init__(self, what: str) -> None

  2. __init__(self, other: rdkit.Chem.rdchem.Atom) -> None

  3. __init__(self, num: int) -> None

Constructor, takes the atomic number

ClearProp(self, key: str) None

Removes a particular property from an Atom (does nothing if not already set).

ARGUMENTS:
  • key: the name of the property to be removed.

ClearPropertyCache(self) None

Clears implicit and explicit valence information.

DescribeQuery(self) str

returns a text description of the query. Primarily intended for debugging purposes.

GetAtomMapNum(self) int

Gets the atoms map number, returns 0 if not set

GetAtomicNum(self) int

Returns the atomic number.

GetBonds(self) rdkit.Chem.rdchem._BondSeqHolder2

Returns a sequence-like object of the atom’s bonds.

GetBoolProp(self, key: str) object
GetBoolProp(self, key: str, default: object) object

Overloaded function.

  1. GetBoolProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a bool).

RETURNS: a bool

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetBoolProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a bool).

  • default: value to return if the property is not present.

RETURNS: a bool, or default if the property is not present.

GetChiralTag(self) rdkit.Chem.rdchem.ChiralType
GetDegree(self) int

Returns the degree of the atom in the molecule.

The degree of an atom is defined to be its number of directly-bonded neighbors. The degree is independent of bond orders, but is dependent

on whether or not Hs are explicit in the graph.

GetDoubleProp(self, key: str) object
GetDoubleProp(self, key: str, default: object) object

Overloaded function.

  1. GetDoubleProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a double).

RETURNS: a double

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetDoubleProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a double).

  • default: value to return if the property is not present.

RETURNS: a double, or default if the property is not present.

GetExplicitBitVectProp(self, key: str) object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a ExplicitBitVect).

RETURNS: an ExplicitBitVect

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

GetExplicitValence(self) int

DEPRECATED, please use GetValence(Chem.ValenceType,EXPLICIT) instead. Returns the explicit valence of the atom.

GetFormalCharge(self) int
GetHybridization(self) rdkit.Chem.rdchem.HybridizationType

Returns the atom’s hybridization.

GetIdx(self) int

Returns the atom’s index (ordering in the molecule)

GetImplicitValence(self) int

DEPRECATED, please use getValence(Chem.ValenceType,IMPLICIT) instead. Returns the number of implicit Hs on the atom.

GetIntProp(self, key: str) object
GetIntProp(self, key: str, default: object) object

Overloaded function.

  1. GetIntProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an int).

RETURNS: an int

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetIntProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an int).

  • default: value to return if the property is not present.

RETURNS: an int, or default if the property is not present.

GetIsAromatic(self) bool
GetIsotope(self) int
GetMass(self) float
GetMonomerInfo(self) rdkit.Chem.rdchem.AtomMonomerInfo

Returns the atom’s MonomerInfo object, if there is one.

GetNeighbors(self) rdkit.Chem.rdchem._AtomSeqHolder2

Returns a sequence-like object of the atom’s neighbors.

GetNoImplicit(self) bool

Returns whether or not the atom is allowed to have implicit Hs.

GetNumExplicitHs(self) int
GetNumImplicitHs(self) int

Returns the total number of implicit Hs on the atom.

GetNumRadicalElectrons(self) int
GetOwningMol(self) rdkit.Chem.rdchem.Mol

Returns the Mol that owns this atom.

GetPDBResidueInfo(self) rdkit.Chem.rdchem.AtomPDBResidueInfo

Returns the atom’s MonomerInfo object, if there is one.

GetProp(self, key: str, autoConvert: bool = False) object
GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) object

Overloaded function.

  1. GetProp(self, key: str, autoConvert: bool = False) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

RETURNS: a string

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

  • default: value to return if the property is not present.

RETURNS: the property value, or default if the property is not present.

GetPropNames(self, includePrivate: bool = False, includeComputed: bool = False) list[str]

Returns a list of the properties set on the Atom.

GetPropsAsDict(self, includePrivate: bool = True, includeComputed: bool = True, autoConvertStrings: bool = True) dict

Returns a dictionary populated with properties. When possible, string values will be converted to integers or doubles (trimming if necessary)

n.b. Some properties are not able to be converted to python types.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to False.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to False.

  • autoConvertStrings: (optional) toggles automatic conversion of string properties to integers or doubles.

    Defaults to True.

RETURNS: a dictionary

GetQueryType(self) str
GetSmarts(self, doKekule: bool = False, allHsExplicit: bool = False, isomericSmiles: bool = True) str

returns the SMARTS (or SMILES) string for an Atom

GetSymbol(self) str

Returns the atomic symbol (a string)

GetTotalDegree(self) int

Returns the degree of the atom in the molecule including Hs.

The degree of an atom is defined to be its number of directly-bonded neighbors. The degree is independent of bond orders.

GetTotalNumHs(self, includeNeighbors: bool = False) int

Returns the total number of Hs (explicit and implicit) on the atom.

ARGUMENTS:

  • includeNeighbors: (optional) toggles inclusion of neighboring H atoms in the sum. Defaults to 0.

GetTotalValence(self) int

Returns the total valence (explicit + implicit) of the atom.

GetUnsignedProp(self, key: str) object
GetUnsignedProp(self, key: str, default: object) object

Overloaded function.

  1. GetUnsignedProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an unsigned integer).

RETURNS: an integer (Python has no unsigned type)

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetUnsignedProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an unsigned integer).

  • default: value to return if the property is not present.

RETURNS: an integer, or default if the property is not present.

GetValence(self, which: rdkit.Chem.rdchem.ValenceType) int

Returns the valence (explicit or implicit) of the atom.

HasOwningMol(self) bool

Returns whether or not this instance belongs to a molecule.

HasProp(self, key: str) int

Queries a Atom to see if a particular property has been assigned.

ARGUMENTS:
  • key: the name of the property to check for (a string).

HasQuery(self) bool

Returns whether or not the atom has an associated query

HasValenceViolation(self) bool

Returns whether the atom has a valence violation or not.

InvertChirality(self) bool
IsInRing(self) bool

Returns whether or not the atom is in a ring

IsInRingSize(self, size: int) bool

Returns whether or not the atom is in a ring of a particular size.

ARGUMENTS:
  • size: the ring size to look for

Match(self, other: rdkit.Chem.rdchem.Atom) bool

Returns whether or not this atom matches another Atom.

Each Atom (or query Atom) has a query function which is used for this type of matching.

ARGUMENTS:
  • other: the other Atom to which to compare

NOATOM = 4294967295
NeedsUpdatePropertyCache(self) bool

Returns true or false depending on whether implicit and explicit valence of the molecule have already been calculated.

SetAtomMapNum(self, mapno: int, strict: bool = False) None

Sets the atoms map number, a value of 0 clears the atom map

SetAtomicNum(self, newNum: int) None

Sets the atomic number, takes an integer value as an argument

SetBoolProp(self, key: str, val: bool) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (a bool).

  • value: the property value (a bool).

SetChiralTag(self, what: rdkit.Chem.rdchem.ChiralType) None
SetDoubleProp(self, key: str, val: float) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (a double).

  • value: the property value (a double).

SetExplicitBitVectProp(self, key: str, val: rdkit.DataStructs.cDataStructs.ExplicitBitVect) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (an ExplicitBitVect).

  • value: the property value (an ExplicitBitVect).

SetFormalCharge(self, what: int) None
SetHybridization(self, what: rdkit.Chem.rdchem.HybridizationType) None
Sets the hybridization of the atom.

The argument should be a HybridizationType

SetIntProp(self, key: str, val: int) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (a int).

  • value: the property value (a int).

SetIsAromatic(self, what: bool) None
SetIsotope(self, what: int) None
SetMonomerInfo(self, info: rdkit.Chem.rdchem.AtomMonomerInfo) None

Sets the atom’s MonomerInfo object.

SetNoImplicit()
SetNoImplicit(self, whatSets a marker on the atom that disallows implicit Hs.

This holds even if the atom would otherwise have implicit Hs added.

: bool) -> None

SetNumExplicitHs(self, what: int) None
SetNumRadicalElectrons(self, num: int) None
SetPDBResidueInfo(self, info: rdkit.Chem.rdchem.AtomMonomerInfo) None

Sets the atom’s MonomerInfo object.

SetProp(self, key: str, val: str) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a string).

SetUnsignedProp(self, key: str, val: int) None

Sets an atomic property

ARGUMENTS:
  • key: the name of the property to be set (an unsigned integer).

  • value: the property value (a int >= 0).

UpdatePropertyCache(self, strict: bool = True) None

Regenerates computed properties like implicit valence and ring information.

class rdkit.Chem.rdchem.AtomCoordsMatcher(self)
class rdkit.Chem.rdchem.AtomCoordsMatcher(self, refConfId: int = -1, queryConfId: int = -1, tol: float = 0.0001)

Bases: object

Allows using atom coordinates as part of substructure matching

Overloaded function.

  1. __init__(self) -> None

  2. __init__(self, refConfId: int = -1, queryConfId: int = -1, tol: float = 0.0001) -> None

constructor taking reference and query conformer IDs and a distance tolerance

property queryConfId

query conformer ID

property refConfId

reference conformer ID

property tol2

squared distance tolerance

exception rdkit.Chem.rdchem.AtomKekulizeException(msg: str)

Bases: AtomSanitizeException

class rdkit.Chem.rdchem.AtomMonomerInfo(self)
class rdkit.Chem.rdchem.AtomMonomerInfo(self, type: rdkit.Chem.rdchem.AtomMonomerType, name: str = '', residueName: str = '', resNum: int = 0, chainId: str = '', monomerClass: str = '')

Bases: object

The class to store monomer information attached to Atoms

GetChainId(self) str
GetMonomerClass(self) str
GetMonomerType(self) rdkit.Chem.rdchem.AtomMonomerType
GetName(self) str
GetResidueName(self) str
GetResidueNumber(self) int
SetChainId(self, val: str) None
SetMonomerClass(self, val: str) None
SetMonomerType(self, typ: rdkit.Chem.rdchem.AtomMonomerType) None
SetName(self, nm: str) None
SetResidueName(self, val: str) None
SetResidueNumber(self, val: int) None
class rdkit.Chem.rdchem.AtomMonomerType(*values)

Bases: Enum

OTHER = 2
PDBRESIDUE = 1
UNKNOWN = 0
class rdkit.Chem.rdchem.AtomPDBResidueInfo(self)
class rdkit.Chem.rdchem.AtomPDBResidueInfo(self, atomName: str, serialNumber: int = 1, altLoc: str = '', residueName: str = '', residueNumber: int = 0, chainId: str = '', insertionCode: str = '', occupancy: float = 1.0, tempFactor: float = 0.0, isHeteroAtom: bool = False, secondaryStructure: int = 0, segmentNumber: int = 0, monomerClass: str = '')

Bases: AtomMonomerInfo

The class to store PDB residue information attached to Atoms

GetAltLoc(self) str
GetChainId(self) str
GetInsertionCode(self) str
GetIsHeteroAtom(self) bool
GetMonomerClass(self) str
GetOccupancy(self) float
GetResidueName(self) str
GetResidueNumber(self) int
GetSecondaryStructure(self) int
GetSegmentNumber(self) int
GetSerialNumber(self) int
GetTempFactor(self) float
SetAltLoc(self, val: str) None
SetChainId(self, val: str) None
SetInsertionCode(self, val: str) None
SetIsHeteroAtom(self, val: bool) None
SetMonomerClass(self, val: str) None
SetOccupancy(self, val: float) None
SetResidueName(self, val: str) None
SetResidueNumber(self, val: int) None
SetSecondaryStructure(self, val: int) None
SetSegmentNumber(self, val: int) None
SetSerialNumber(self, val: int) None
SetTempFactor(self, val: float) None
exception rdkit.Chem.rdchem.AtomSanitizeException(msg: str)

Bases: MolSanitizeException

exception rdkit.Chem.rdchem.AtomValenceException(msg: str)

Bases: AtomSanitizeException

class rdkit.Chem.rdchem.Bond

Bases: object

The class to store Bonds. Note: unlike Atoms, is it currently impossible to construct Bonds from Python.

ClearProp(self, key: str) None

Removes a particular property from an Bond (does nothing if not already set).

ARGUMENTS:
  • key: the name of the property to be removed.

DescribeQuery(self) str

returns a text description of the query. Primarily intended for debugging purposes.

GetBeginAtom(self) rdkit.Chem.rdchem.Atom

Returns the bond’s first atom.

GetBeginAtomIdx(self) int

Returns the index of the bond’s first atom.

GetBondDir(self) rdkit.Chem.rdchem.BondDir

Returns the type of the bond as a BondDir

GetBondType(self) rdkit.Chem.rdchem.BondType

Returns the type of the bond as a BondType

GetBondTypeAsDouble(self) float

Returns the type of the bond as a double (i.e. 1.0 for SINGLE, 1.5 for AROMATIC, 2.0 for DOUBLE)

GetBoolProp(self, key: str) object
GetBoolProp(self, key: str, default: object) object

Overloaded function.

  1. GetBoolProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a boolean).

RETURNS: a boolean

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetBoolProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a boolean).

  • default: value to return if the property is not present.

RETURNS: a bool, or default if the property is not present.

GetDoubleProp(self, key: str) object
GetDoubleProp(self, key: str, default: object) object

Overloaded function.

  1. GetDoubleProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a double).

RETURNS: a double

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetDoubleProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a double).

  • default: value to return if the property is not present.

RETURNS: a double, or default if the property is not present.

GetEndAtom(self) rdkit.Chem.rdchem.Atom

Returns the bond’s second atom.

GetEndAtomIdx(self) int

Returns the index of the bond’s first atom.

GetIdx(self) int

Returns the bond’s index (ordering in the molecule)

GetIntProp(self, key: str) object
GetIntProp(self, key: str, default: object) object

Overloaded function.

  1. GetIntProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an int).

RETURNS: an int

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetIntProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an int).

  • default: value to return if the property is not present.

RETURNS: an int, or default if the property is not present.

GetIsAromatic(self) bool
GetIsConjugated(self) bool

Returns whether or not the bond is considered to be conjugated.

GetOtherAtom(self, what: rdkit.Chem.rdchem.Atom) rdkit.Chem.rdchem.Atom

Given one of the bond’s atoms, returns the other one.

GetOtherAtomIdx(self, thisIdx: int) int

Given the index of one of the bond’s atoms, returns the index of the other.

GetOwningMol(self) rdkit.Chem.rdchem.Mol

Returns the Mol that owns this bond.

GetProp(self, key: str, autoConvert: bool = False) object
GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) object

Overloaded function.

  1. GetProp(self, key: str, autoConvert: bool = False) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

RETURNS: a string

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

  • default: value to return if the property is not present.

RETURNS: the property value, or default if the property is not present.

GetPropNames(self, includePrivate: bool = False, includeComputed: bool = False) list[str]

Returns a list of the properties set on the Bond.

GetPropsAsDict(self, includePrivate: bool = True, includeComputed: bool = True, autoConvertStrings: bool = True) dict

Returns a dictionary populated with properties. When possible, string values will be converted to integers or doubles (trimming if necessary)

n.b. Some properties are not able to be converted to python types.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to False.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to False.

  • autoConvertStrings: (optional) toggles automatic conversion of string properties to integers or doubles.

    Defaults to True.

RETURNS: a dictionary

GetSmarts(self, allBondsExplicit: bool = False) str

returns the SMARTS (or SMILES) string for a Bond

GetStereo(self) rdkit.Chem.rdchem.BondStereo

Returns the stereo configuration of the bond as a BondStereo

GetStereoAtoms(self) list[int]

Returns the indices of the atoms setting this bond’s stereochemistry.

GetUnsignedProp(self, key: str) object
GetUnsignedProp(self, key: str, default: object) object

Overloaded function.

  1. GetUnsignedProp(self, key: str) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an unsigned integer).

RETURNS: an int (Python has no unsigned type)

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetUnsignedProp(self, key: str, default: object) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (an unsigned integer).

  • default: value to return if the property is not present.

RETURNS: an integer, or default if the property is not present.

GetValenceContrib(self, at: rdkit.Chem.rdchem.Atom) float

Returns the contribution of the bond to the valence of an Atom.

ARGUMENTS:

  • atom: the Atom to consider.

HasOwningMol(self) bool

Returns whether or not this instance belongs to a molecule.

HasProp(self, key: str) int

Queries a Bond to see if a particular property has been assigned.

ARGUMENTS:
  • key: the name of the property to check for (a string).

HasQuery(self) bool

Returns whether or not the bond has an associated query

InvertChirality(self) bool
IsInRing(self) bool

Returns whether or not the bond is in a ring of any size.

IsInRingSize(self, size: int) bool

Returns whether or not the bond is in a ring of a particular size.

ARGUMENTS:
  • size: the ring size to look for

Match(self, what: rdkit.Chem.rdchem.Bond) bool

Returns whether or not this bond matches another Bond.

Each Bond (or query Bond) has a query function which is used for this type of matching.

ARGUMENTS:
  • other: the other Bond to which to compare

SetBondDir(self, what: rdkit.Chem.rdchem.BondDir) None

Set the type of the bond as a BondDir

SetBondType(self, bT: rdkit.Chem.rdchem.BondType) None

Set the type of the bond as a BondType

SetBoolProp(self, key: str, val: bool) None

Sets a bond property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a boolean).

SetDoubleProp(self, key: str, val: float) None

Sets a bond property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a double).

SetIntProp(self, key: str, val: int) None

Sets a bond property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (an int).

SetIsAromatic(self, what: bool) None
SetIsConjugated(self, what: bool) None
SetProp(self, key: str, val: str) None

Sets a bond property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a string).

SetStereo(self, what: rdkit.Chem.rdchem.BondStereo) None

Set the stereo configuration of the bond as a BondStereo

SetStereoAtoms(self, bgnIdx: int, endIdx: int) None

Set the indices of the atoms setting this bond’s stereochemistry.

SetUnsignedProp(self, key: str, val: int) None

Sets a bond property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (an int >= 0).

class rdkit.Chem.rdchem.BondDir(*values)

Bases: Enum

BEGINDASH = 2
BEGINWEDGE = 1
EITHERDOUBLE = 5
ENDDOWNRIGHT = 3
ENDUPRIGHT = 4
NONE = 0
UNKNOWN = 6
class rdkit.Chem.rdchem.BondStereo(*values)

Bases: Enum

STEREOANY = 1
STEREOATROPCCW = 7
STEREOATROPCW = 6
STEREOCIS = 4
STEREOE = 3
STEREONONE = 0
STEREOTRANS = 5
STEREOZ = 2
class rdkit.Chem.rdchem.BondType(*values)

Bases: Enum

AROMATIC = 12
DATIVE = 17
DATIVEL = 18
DATIVEONE = 16
DATIVER = 19
DOUBLE = 2
FIVEANDAHALF = 11
FOURANDAHALF = 10
HEXTUPLE = 6
HYDROGEN = 14
IONIC = 13
ONEANDAHALF = 7
OTHER = 20
QUADRUPLE = 4
QUINTUPLE = 5
SINGLE = 1
THREEANDAHALF = 9
THREECENTER = 15
TRIPLE = 3
TWOANDAHALF = 8
UNSPECIFIED = 0
ZERO = 21
class rdkit.Chem.rdchem.ChiralType(*values)

Bases: Enum

CHI_ALLENE = 5
CHI_OCTAHEDRAL = 8
CHI_OTHER = 3
CHI_SQUAREPLANAR = 6
CHI_TETRAHEDRAL = 4
CHI_TETRAHEDRAL_CCW = 2
CHI_TETRAHEDRAL_CW = 1
CHI_TRIGONALBIPYRAMIDAL = 7
CHI_UNSPECIFIED = 0
class rdkit.Chem.rdchem.CompositeQueryType(*values)

Bases: Enum

COMPOSITE_AND = 0
COMPOSITE_OR = 1
COMPOSITE_XOR = 2
class rdkit.Chem.rdchem.Conformer(self)
class rdkit.Chem.rdchem.Conformer(self, numAtoms: int)
class rdkit.Chem.rdchem.Conformer(self, other: rdkit.Chem.rdchem.Conformer)

Bases: object

The class to store 2D or 3D conformation of a molecule

Overloaded function.

  1. __init__(self) -> None

Constructor with the number of atoms specified

  1. __init__(self, numAtoms: int) -> None

Constructor with the number of atoms specified

  1. __init__(self, other: rdkit.Chem.rdchem.Conformer) -> None

ClearComputedProps(self) None

Removes all computed properties from the conformer.

ClearProp(self, key: str) None

Removes a property from the conformer.

ARGUMENTS:
  • key: the name of the property to clear (a string).

GetAtomPosition(self, aid: int) rdkit.Geometry.rdGeometry.Point3D

Get the position of an atom

GetBoolProp(self, key: str) object
GetBoolProp(self, key: str, default: object) object

Overloaded function.

  1. GetBoolProp(self, key: str) -> object

Returns the Bool value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: a bool

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetBoolProp(self, key: str, default: object) -> object

Returns the Bool value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: a bool, or default if the property is not present.

GetDoubleProp(self, key: str) object
GetDoubleProp(self, key: str, default: object) object

Overloaded function.

  1. GetDoubleProp(self, key: str) -> object

Returns the double value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: a double

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetDoubleProp(self, key: str, default: object) -> object

Returns the double value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: a double, or default if the property is not present.

GetId(self) int

Get the ID of the conformer

GetIntProp(self, key: str) object
GetIntProp(self, key: str, default: object) object

Overloaded function.

  1. GetIntProp(self, key: str) -> object

Returns the integer value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: an integer

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetIntProp(self, key: str, default: object) -> object

Returns the integer value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: an integer, or default if the property is not present.

GetNumAtoms(self) int

Get the number of atoms in the conformer

GetOwningMol(self) rdkit.Chem.rdchem.Mol

Get the owning molecule

GetPositions(self) numpy.ndarray[dtype=float64, shape=(*, *)]

Get positions of all the atoms

GetProp(self, key: str, autoConvert: bool = False) object
GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) object

Overloaded function.

  1. GetProp(self, key: str, autoConvert: bool = False) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

RETURNS: a string

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

  • default: value to return if the property is not present.

RETURNS: the property value, or default if the property is not present.

GetPropNames(self, includePrivate: bool = False, includeComputed: bool = False) list[str]

Returns a tuple with all property names for this conformer.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to 0.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to 0.

RETURNS: a tuple of strings

GetPropsAsDict(self, includePrivate: bool = False, includeComputed: bool = False, autoConvertStrings: bool = True) dict

Returns a dictionary populated with properties. When possible, string values will be converted to integers or doubles (trimming if necessary)

n.b. Some properties are not able to be converted to python types.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to False.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to False.

  • autoConvertStrings: (optional) toggles automatic conversion of string properties to integers or doubles.

    Defaults to True.

RETURNS: a dictionary

GetUnsignedProp(self, key: str) object
GetUnsignedProp(self, key: str, default: object) object

Overloaded function.

  1. GetUnsignedProp(self, key: str) -> object

Returns the unsigned int value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: an unsigned integer

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetUnsignedProp(self, key: str, default: object) -> object

Returns the unsigned int value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: an unsigned integer, or default if the property is not present.

HasOwningMol(self) bool

Returns whether or not this instance belongs to a molecule.

HasProp(self, key: str) int

Queries a conformer to see if a particular property has been assigned.

ARGUMENTS:
  • key: the name of the property to check for (a string).

Is3D(self) bool

returns the 3D flag of the conformer

Set3D(self, v: bool) None

Set the 3D flag of the conformer

SetAtomPosition(self, aid: int, loc: object) None
SetAtomPosition(self, atomId: int, position: rdkit.Geometry.rdGeometry.Point3D) None

Set the position of the specified atom

SetBoolProp(self, key: str, val: bool, computed: bool = False) None

Sets a boolean valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as a bool.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetDoubleProp(self, key: str, val: float, computed: bool = False) None

Sets a double valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as a double.

  • computed: (optional) marks the property as being computed.

    Defaults to 0.

SetId(self, id: int) None

Set the ID of the conformer

SetIntProp(self, key: str, val: int, computed: bool = False) None

Sets an integer valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (an unsigned number).

  • value: the property value as an integer.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetPositions(self, positions: numpy.ndarray[dtype=float64, shape=(*, *), order='C', writable=False]) None

Set positions of all the atoms given a 2D or 3D numpy array of type double

SetProp(self, key: str, val: str, computed: bool = False) None

Sets a molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a string).

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetUnsignedProp(self, key: str, val: int, computed: bool = False) None

Sets an unsigned integer valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as an unsigned integer.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

exception rdkit.Chem.rdchem.ConformerException

Bases: ValueError

class rdkit.Chem.rdchem.EditableMol(self, m: rdkit.Chem.rdchem.Mol)

Bases: object

The EditableMol class.

This class can be used to add/remove bonds and atoms to a molecule. In order to use it, you need to first construct an EditableMol from a standard Mol:

>>> m = Chem.MolFromSmiles('CCC')
>>> em = Chem.EditableMol(m)
>>> em.AddAtom(Chem.Atom(8))
>>> em.AddBond(0,3,Chem.BondType.SINGLE)
>>> m2 = em.GetMol()
>>> Chem.SanitizeMol(m2)
>>> Chem.MolToSmiles(m2)
'CCCO'
Note: It is very, very easy to shoot yourself in the foot with

this class by constructing an unreasonable molecule.

Construct from a Mol

AddAtom(self, atom: rdkit.Chem.rdchem.Atom) int

add an atom, returns the index of the newly added atom

AddBond(self, beginAtomIdx: int, endAtomIdx: int, order: rdkit.Chem.rdchem.BondType = BondType.UNSPECIFIED) int

add a bond, returns the total number of bonds

BeginBatchEdit(self) None

starts batch editing

CommitBatchEdit(self) None

finishes batch editing and makes the actual edits

GetMol(self) rdkit.Chem.rdchem.Mol

Returns a Mol (a normal molecule)

RemoveAtom(self, idx: int) None

Remove the specified atom from the molecule

RemoveBond(self, idx1: int, idx2: int) None

Remove the specified bond from the molecule

ReplaceAtom(self, index: int, newAtom: rdkit.Chem.rdchem.Atom, updateLabel: bool = False, preserveProps: bool = False) None

replaces the specified atom with the provided one If updateLabel is True, the new atom becomes the active atom If preserveProps is True preserve keep the existing props unless explicit set on the new atom

ReplaceBond(self, index: int, newBond: rdkit.Chem.rdchem.Bond, preserveProps: bool = False) None

replaces the specified bond with the provided one. If preserveProps is True preserve keep the existing props unless explicit set on the new bond

RollbackBatchEdit(self) None

cancels batch editing

class rdkit.Chem.rdchem.FixedMolSizeMolBundle(self)

Bases: MolBundle

A class for storing groups of related molecules. Here related means that the molecules have to have the same number of atoms.

class rdkit.Chem.rdchem.HybridizationType(*values)

Bases: Enum

OTHER = 8
S = 1
SP = 2
SP2 = 3
SP2D = 5
SP3 = 4
SP3D = 6
SP3D2 = 7
UNSPECIFIED = 0
exception rdkit.Chem.rdchem.KekulizeException(msg: str)

Bases: MolSanitizeException

class rdkit.Chem.rdchem.Mol(self)
class rdkit.Chem.rdchem.Mol(self, pklString: bytes)
class rdkit.Chem.rdchem.Mol(self, pklString: bytes, propertyFlags: int)
class rdkit.Chem.rdchem.Mol(self, pklString: str)
class rdkit.Chem.rdchem.Mol(self, pklString: str, propertyFlags: int)
class rdkit.Chem.rdchem.Mol(self, mol: rdkit.Chem.rdchem.Mol, quickCopy: bool = False, confId: int = -1)

Bases: object

The Molecule class.

In addition to the expected Atoms and Bonds, molecules contain:
  • a collection of Atom and Bond bookmarks indexed with integers

    that can be used to flag and retrieve particular Atoms or Bonds using the {get|set}{Atom|Bond}Bookmark() methods.

  • a set of string-valued properties. These can have arbitrary string

    labels and can be set and retrieved using the {set|get}Prop() methods Molecular properties can be tagged as being computed, in which case

    they will be automatically cleared under certain circumstances (when the molecule itself is modified, for example).

    Molecules also have the concept of private properties, which are tagged

    by beginning the property name with an underscore (_).

Overloaded function.

  1. __init__(self) -> None

Constructor, takes no arguments

  1. __init__(self, pklString: bytes) -> None

Constructor from a binary string

  1. __init__(self, pklString: bytes, propertyFlags: int) -> None

Constructor from a binary string with property flags

  1. __init__(self, pklString: str) -> None

Constructor from a binary string

  1. __init__(self, pklString: str, propertyFlags: int) -> None

Constructor from a binary string with property flags

  1. __init__(self, mol: rdkit.Chem.rdchem.Mol, quickCopy: bool = False, confId: int = -1) -> None

Constructor from another molecule

AddConformer(self, conf: rdkit.Chem.rdchem.Conformer, assignId: bool = False) int

Add a conformer to the molecule and return the conformer ID

ClearComputedProps(self, includeRings: bool = True) None

Removes all computed properties from the molecule.

ClearProp(self, key: str) None

Removes a property from the molecule.

ARGUMENTS:
  • key: the name of the property to clear (a string).

ClearPropertyCache(self) None

Clears implicit and explicit valence information from all atoms.

Compute2DCoords = <nanobind.nb_func object>
ComputeGasteigerCharges = <nanobind.nb_func object>
Debug(useStdout=False)
GetAromaticAtoms(self) rdkit.Chem.rdchem._ROQAtomSeq

Returns a read-only sequence containing all of the molecule’s aromatic Atoms.

GetAtomWithIdx(self, idx: int) rdkit.Chem.rdchem.Atom

Returns a particular Atom.

ARGUMENTS:
  • idx: which Atom to return

NOTE: atom indices start at 0

GetAtoms(self) rdkit.Chem.rdchem._AtomSeqHolder1

Returns a sequence-like object of the molecule’s atoms.

GetAtomsMatchingQuery(self, qa: rdkit.Chem.rdchem.QueryAtom) rdkit.Chem.rdchem._ROQAtomSeq
Returns a read-only sequence containing all of the atoms in a molecule that match the query atom.

Atom query options are defined in the rdkit.Chem.rdqueries module.

GetBondBetweenAtoms(self, idx1: int, idx2: int) rdkit.Chem.rdchem.Bond

Returns the bond between two atoms, if there is one.

ARGUMENTS:
  • idx1,idx2: the Atom indices

Returns:

The Bond between the two atoms, if such a bond exists. If there is no Bond between the atoms, None is returned instead.

NOTE: atom indices start at 0

GetBondWithIdx(self, idx: int) rdkit.Chem.rdchem.Bond

Returns a particular Bond.

ARGUMENTS:
  • idx: which Bond to return

NOTE: bond indices start at 0

GetBonds(self) rdkit.Chem.rdchem._BondSeqHolder1

Returns a sequence-like object of the molecule’s bonds.

GetBoolProp(self, key: str) object
GetBoolProp(self, key: str, default: object) object

Overloaded function.

  1. GetBoolProp(self, key: str) -> object

Returns the Bool value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: a bool

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetBoolProp(self, key: str, default: object) -> object

Returns the Bool value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: a bool, or default if the property is not present.

GetConformer(self, id: int = -1) rdkit.Chem.rdchem.Conformer

Get the conformer with a specified ID

GetConformers(self) rdkit.Chem.rdchem._ROConformerSeq

Returns a read-only sequence containing all of the molecule’s Conformers.

GetDoubleProp(self, key: str) object
GetDoubleProp(self, key: str, default: object) object

Overloaded function.

  1. GetDoubleProp(self, key: str) -> object

Returns the double value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: a double

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetDoubleProp(self, key: str, default: object) -> object

Returns the double value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: a double, or default if the property is not present.

GetIntProp(self, key: str) object
GetIntProp(self, key: str, default: object) object

Overloaded function.

  1. GetIntProp(self, key: str) -> object

Returns the integer value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: an integer

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetIntProp(self, key: str, default: object) -> object

Returns the integer value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: an integer, or default if the property is not present.

GetName(self) str
Returns the molecule name stored as the _Name property.
NOTE:
  • If the _Name property has not been set, an empty string will be returned.

GetNumAtoms(self) int
GetNumAtoms(self, onlyExplicit: bool = True) int

Overloaded function.

  1. GetNumAtoms(self) -> int

Returns the number of atoms in the molecule.

  1. GetNumAtoms(self, onlyExplicit: bool = True) -> int

Returns the number of atoms in the molecule. Optionally, only count explicit atoms.

GetNumBonds(self, onlyHeavy: bool = True) int

Returns the number of Bonds in the molecule.

ARGUMENTS:
  • onlyHeavy: (optional) include only bonds to heavy atoms (not Hs)

    defaults to True.

GetNumConformers(self) int

Return the number of conformations on the molecule

GetNumHeavyAtoms(self) int

Returns the number of heavy atoms (atomic number >1) in the molecule.

GetProp(self, key: str, autoConvert: bool = False) object
GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) object

Overloaded function.

  1. GetProp(self, key: str, autoConvert: bool = False) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

RETURNS: a string

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetProp(self, key: str, autoConvert: bool = False, default: object | None = None) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

  • default: value to return if the property is not present.

RETURNS: the property value, or default if the property is not present.

GetPropNames(self, includePrivate: bool = False, includeComputed: bool = False) list[str]

Returns a tuple with all property names for this molecule.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to 0.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to 0.

RETURNS: a tuple of strings

GetPropsAsDict(self, includePrivate: bool = False, includeComputed: bool = False, autoConvertStrings: bool = True) dict

Returns a dictionary populated with properties. When possible, string values will be converted to integers or doubles (trimming if necessary)

n.b. Some properties are not able to be converted to python types.

ARGUMENTS:
  • includePrivate: (optional) toggles inclusion of private properties in the result set.

    Defaults to False.

  • includeComputed: (optional) toggles inclusion of computed properties in the result set.

    Defaults to False.

  • autoConvertStrings: (optional) toggles automatic conversion of string properties to integers or doubles.

    Defaults to True.

RETURNS: a dictionary

GetRingInfo(self) rdkit.Chem.rdchem.RingInfo

Returns the number of molecule’s RingInfo object.

GetStereoGroups(self) list[rdkit.Chem.rdchem.StereoGroup]

Returns a list of StereoGroups defining the relative stereochemistry of the atoms.)

GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, useChirality: bool = False, useQueryQueryMatches: bool = False) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, useChirality: bool = False, useQueryQueryMatches: bool = False) list[int]

Overloaded function.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> list[int]

Returns the indices of the molecule’s atoms that match a substructure query.

ARGUMENTS:
  • query: a Molecule

  • params: parameters controlling the substructure match

RETURNS: a list of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> list[int]

  2. GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, useChirality: bool = False, useQueryQueryMatches: bool = False) -> list[int]

Returns the indices of the molecule’s atoms that match a substructure query.

ARGUMENTS:
  • query: a Molecule

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: a list of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, useChirality: bool = False, useQueryQueryMatches: bool = False) -> list[int]

GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) list[list[int]]

Overloaded function.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> list[list[int]]

Returns lists of the indices of the molecule’s atoms that match a substructure query.

ARGUMENTS:
  • query: a Molecule.

  • params: parameters controlling the substructure match

RETURNS: a list of lists of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> list[list[int]]

  2. GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) -> list[list[int]]

Returns lists of the indices of the molecule’s

atoms that match a substructure query.

ARGUMENTS:
  • query: a Molecule.

  • uniquify: (optional) determines whether or not the

matches are uniquified.

Defaults to 1.

  • useChirality: enables the use of stereochemistry in the

matching

  • useQueryQueryMatches: use query-query matching logic

  • maxMatches: The maximum number of matches that will be

returned.

In high-symmetry cases with medium-sized molecules, it is very easy to end up with a combinatorial explosion in the number of possible matches. This argument prevents that from having unintended consequences

RETURNS: a list of lists of integers

NOTE:
  • the ordering of the indices corresponds to the atom

ordering

in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) -> list[list[int]]

GetUnsignedProp(self, key: str) object
GetUnsignedProp(self, key: str, default: object) object

Overloaded function.

  1. GetUnsignedProp(self, key: str) -> object

Returns the unsigned int value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

RETURNS: an unsigned integer

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetUnsignedProp(self, key: str, default: object) -> object

Returns the unsigned int value of the property if possible.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • default: value to return if the property is not present.

RETURNS: an unsigned integer, or default if the property is not present.

HasProp(self, key: str) int

Queries a molecule to see if a particular property has been assigned.

ARGUMENTS:
  • key: the name of the property to check for (a string).

HasQuery(self) bool

Returns if any atom or bond in molecule has a query

HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) bool

Overloaded function.

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> bool

Queries whether or not the molecule contains a particular substructure.

ARGUMENTS: - query: a Molecule

  • params: parameters controlling the substructure match

RETURNS: True or False

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None = None) -> bool

  2. HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) -> bool

Queries whether or not the molecule contains a particular substructure.

ARGUMENTS:
  • query: a Molecule

  • recursionPossible: (optional)

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: True or False

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) -> bool

NeedsUpdatePropertyCache(self) bool

Returns true or false depending on whether implicit and explicit valence of the molecule have already been calculated.

RemoveAllConformers(self) None

Remove all the conformations on the molecule

RemoveConformer(self, id: int) None

Remove the conformer with the specified ID

SetBoolProp(self, key: str, val: bool, computed: bool = False) None

Sets a boolean valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as a bool.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetDoubleProp(self, key: str, val: float, computed: bool = False) None

Sets a double valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as a double.

  • computed: (optional) marks the property as being computed.

    Defaults to 0.

SetIntProp(self, key: str, val: int, computed: bool = False) None

Sets an integer valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (an unsigned number).

  • value: the property value as an integer.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetName(self, name: str) None
Sets the molecule name stored as the _Name property.
ARGUMENTS:
  • name: the name to set (a string).

SetProp(self, key: str, val: str, computed: bool = False) None

Sets a molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value (a string).

  • computed: (optional) marks the property as being computed.

    Defaults to False.

SetUnsignedProp(self, key: str, val: int, computed: bool = False) None

Sets an unsigned integer valued molecular property

ARGUMENTS:
  • key: the name of the property to be set (a string).

  • value: the property value as an unsigned integer.

  • computed: (optional) marks the property as being computed.

    Defaults to False.

ToBinary(self) bytes
ToBinary(self, propertyFlags: int) bytes

Overloaded function.

  1. ToBinary(self) -> bytes

Returns a binary string representation of the molecule.

  1. ToBinary(self, propertyFlags: int) -> bytes

Returns a binary string representation of the molecule pickling the specified properties.

UpdatePropertyCache(self, strict: bool = True) None

Regenerates computed properties like implicit valence and ring information.

class rdkit.Chem.rdchem.MolBundle(self)
class rdkit.Chem.rdchem.MolBundle(self, pklString: bytes)

Bases: object

A class for storing groups of related molecules.

Overloaded function.

  1. __init__(self) -> None

  2. __init__(self, pklString: bytes) -> None

Constructor from a binary string

AddMol(self, nmol: rdkit.Chem.rdchem.Mol) int
GetMol(self, idx: int) rdkit.Chem.rdchem.Mol
GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, useChirality: bool = False, useQueryQueryMatches: bool = False) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, useChirality: bool = False, useQueryQueryMatches: bool = False) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) list[int]
GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) list[int]

Overloaded function.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, useChirality: bool = False, useQueryQueryMatches: bool = False) -> list[int]

Returns the indices of the atoms from the first molecule in a bundle that matches a substructure query.

ARGUMENTS:
  • query: a Molecule

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: a tuple of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, useChirality: bool = False, useQueryQueryMatches: bool = False) -> list[int]

Returns the indices of the atoms from the first molecule in a bundle that matches a substructure query from a bundle.

ARGUMENTS:
  • query: a MolBundle

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: a tuple of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> list[int]

Returns the indices of the atoms from the first molecule in a bundle that matches a substructure query.

ARGUMENTS:
  • query: a Molecule

  • params: parameters controlling the substructure match

RETURNS: a tuple of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> list[int]

Returns the indices of the atoms from the first molecule in a bundle that matches a substructure query from a bundle.

ARGUMENTS:
  • query: a MolBundle

  • params: parameters controlling the substructure match

RETURNS: a tuple of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) list[list[int]]
GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) list[list[int]]

Overloaded function.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) -> list[list[int]]

Returns tuple of all indices of the atoms from the first molecule in a bundle that matches a substructure query.

ARGUMENTS:
  • query: a molecule.

  • uniquify: (optional) determines whether or not the matches are uniquified.

    Defaults to 1.

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

  • maxMatches: The maximum number of matches that will be returned.

    In high-symmetry cases with medium-sized molecules, it is very easy to end up with a combinatorial explosion in the number of possible matches. This argument prevents that from having unintended consequences

RETURNS: a tuple of tuples of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, uniquify: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000) -> list[list[int]]

Returns tuple of all indices of the atoms from the first molecule in a bundle that matches a substructure query from the second bundle.

ARGUMENTS:
  • query: a MolBundle.

  • uniquify: (optional) determines whether or not the matches are uniquified.

    Defaults to 1.

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

  • maxMatches: The maximum number of matches that will be returned.

    In high-symmetry cases with medium-sized molecules, it is very easy to end up with a combinatorial explosion in the number of possible matches. This argument prevents that from having unintended consequences

RETURNS: a tuple of tuples of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> list[list[int]]

Returns tuple of all indices of the atoms from the first molecule in a bundle that matches a substructure query.

ARGUMENTS:
  • query: a molecule.

  • params: parameters controlling the substructure match

RETURNS: a tuple of tuples of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

  1. GetSubstructMatches(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> list[list[int]]

Returns tuple of all indices of the atoms from the first molecule in a bundle that matches a substructure query from the second bundle.

ARGUMENTS:
  • query: a MolBundle.

  • params: parameters controlling the substructure match

RETURNS: a tuple of tuples of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) bool
HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) bool

Overloaded function.

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) -> bool

Queries whether or not any molecule in the bundle contains a particular substructure.

ARGUMENTS:
  • query: a Molecule

  • recursionPossible: (optional)

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: True or False

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, recursionPossible: bool = True, useChirality: bool = False, useQueryQueryMatches: bool = False) -> bool

Queries whether or not any molecule in the first bundle matches any molecule in the second bundle.

ARGUMENTS:
  • query: a MolBundle

  • recursionPossible: (optional)

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: True or False

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> bool

Queries whether or not any molecule in the bundle contains a particular substructure.

ARGUMENTS:
  • query: a Molecule

  • params: parameters controlling the substructure match

RETURNS: True or False

  1. HasSubstructMatch(self, query: rdkit.Chem.rdchem.MolBundle, params: rdkit.Chem.rdchem.SubstructMatchParameters | None) -> bool

Queries whether or not any molecule in the first bundle matches any molecule in the second bundle.

ARGUMENTS:
  • query: a MolBundle

  • params: parameters controlling the substructure match

RETURNS: True or False

Size(self) int
ToBinary(self) bytes

Returns a binary string representation of the MolBundle.

exception rdkit.Chem.rdchem.MolSanitizeException(msg: str)

Bases: _BaseSanitException

class rdkit.Chem.rdchem.PeriodicTable

Bases: object

A class which stores information from the Periodic Table.

It is not possible to create a PeriodicTable object directly from Python, use GetPeriodicTable() to get the global table.

The PeriodicTable object can be queried for a variety of properties:

  • GetAtomicWeight

  • GetAtomicNumber

  • GetElementSymbol

  • GetElementName

  • GetRow

  • GetRvdw (van der Waals radius)

  • GetRCovalent (covalent radius)

  • GetDefaultValence

  • GetValenceList

  • GetNOuterElecs (number of valence electrons)

  • GetMostCommonIsotope

  • GetMostCommonIsotopeMass

  • GetRb0

  • GetAbundanceForIsotope

  • GetMassForIsotope

When it makes sense, these can be queried using either an atomic number (integer) or an atomic symbol (string)

GetAbundanceForIsotope(self, atomicNumber: int, isotope: int) float
GetAbundanceForIsotope(self, elementSymbol: str, isotope: int) float
GetAtomicNumber(self, elementSymbol: str) int
GetAtomicWeight(self, atomicNumber: int) float
GetAtomicWeight(self, elementSymbol: str) float
GetDefaultValence(self, atomicNumber: int) int
GetDefaultValence(self, elementSymbol: str) int
GetElementName(self, atomicNumber: int) str
GetElementSymbol(self, atomicNumber: int) str
GetMassForIsotope(self, atomicNumber: int, isotope: int) float
GetMassForIsotope(self, elementSymbol: str, isotope: int) float
GetMaxAtomicNumber(self) int
GetMostCommonIsotope(self, atomicNumber: int) int
GetMostCommonIsotope(self, elementSymbol: str) int
GetMostCommonIsotopeMass(self, atomicNumber: int) float
GetMostCommonIsotopeMass(self, elementSymbol: str) float
GetNOuterElecs(self, atomicNumber: int) int
GetNOuterElecs(self, elementSymbol: str) int
GetRb0(self, atomicNumber: int) float
GetRb0(self, elementSymbol: str) float
GetRcovalent(self, atomicNumber: int) float
GetRcovalent(self, elementSymbol: str) float
GetRow(self, atomicNumber: int) int
GetRow(self, elementSymbol: str) int
GetRvdw(self, atomicNumber: int) float
GetRvdw(self, elementSymbol: str) float
GetValenceList(self, atomicNumber: int) list[int]
GetValenceList(self, elementSymbol: str) list[int]
class rdkit.Chem.rdchem.PropertyPickleOptions(*values)

Bases: IntEnum

AllProps = 65535
AtomProps = 2
BondProps = 4
ComputedProps = 32
CoordsAsDouble = 65536
MolProps = 1
NoConformers = 131072
NoProps = 0
PrivateProps = 16
QueryAtomData = 2
class rdkit.Chem.rdchem.QueryAtom

Bases: Atom

The class to store QueryAtoms. These cannot currently be constructed directly from Python

ExpandQuery(self, other: rdkit.Chem.rdchem.QueryAtom, how: rdkit.Chem.rdchem.CompositeQueryType = CompositeQueryType.COMPOSITE_AND, maintainOrder: bool = True) None

combines the query from other with ours

SetQuery(self, other: rdkit.Chem.rdchem.QueryAtom) None

Replace our query with a copy of the other query

class rdkit.Chem.rdchem.QueryBond

Bases: Bond

The class to store QueryBonds. These cannot currently be constructed directly from Python

ExpandQuery(self, other: rdkit.Chem.rdchem.QueryBond, how: rdkit.Chem.rdchem.CompositeQueryType = CompositeQueryType.COMPOSITE_AND, maintainOrder: bool = True) None

combines the query from other with ours

SetQuery(self, other: rdkit.Chem.rdchem.QueryBond) None

Replace our query with a copy of the other query

class rdkit.Chem.rdchem.RWMol(self)
class rdkit.Chem.rdchem.RWMol(self, pklString: bytes)
class rdkit.Chem.rdchem.RWMol(self, pklString: bytes, propertyFlags: int)
class rdkit.Chem.rdchem.RWMol(self, pklString: str)
class rdkit.Chem.rdchem.RWMol(self, pklString: str, propertyFlags: int)
class rdkit.Chem.rdchem.RWMol(self, mol: rdkit.Chem.rdchem.Mol, quickCopy: bool = False, confId: int = -1)

Bases: Mol

The RW molecule class (read/write)

This class is a more-performant version of the EditableMolecule class in that it is a ‘live’ molecule and shares the interface from the Mol class. All changes are performed without the need to create a copy of the molecule using GetMol() (this is still available, however).

n.b. Eventually this class may become a direct replacement for EditableMol

Overloaded function.

  1. __init__(self) -> None

Constructor, takes no arguments

  1. __init__(self, pklString: bytes) -> None

Constructor from a binary string

  1. __init__(self, pklString: bytes, propertyFlags: int) -> None

Constructor from a binary string with property flags

  1. __init__(self, pklString: str) -> None

Constructor from a binary string

  1. __init__(self, pklString: str, propertyFlags: int) -> None

Constructor from a binary string with property flags

  1. __init__(self, mol: rdkit.Chem.rdchem.Mol, quickCopy: bool = False, confId: int = -1) -> None

Constructor from an ROMol

AddAtom(self, atom: rdkit.Chem.rdchem.Atom) int

add an atom, returns the index of the newly added atom

AddBond(self, beginAtomIdx: int, endAtomIdx: int, order: rdkit.Chem.rdchem.BondType = BondType.UNSPECIFIED) int

add a bond, returns the new number of bonds

BeginBatchEdit(self) None

starts batch editing

CommitBatchEdit(self) None

finishes batch editing and makes the actual changes

GetMol(self) rdkit.Chem.rdchem.Mol

Returns a Mol (a normal molecule)

InsertMol(self, mol: rdkit.Chem.rdchem.Mol) None

Insert (add) the given molecule into this one

RemoveAtom(self, idx: int) None

Remove the specified atom from the molecule

RemoveBond(self, idx1: int, idx2: int) None

Remove the specified bond from the molecule

ReplaceAtom(self, index: int, newAtom: rdkit.Chem.rdchem.Atom, updateLabel: bool = False, preserveProps: bool = False) None

replaces the specified atom with the provided one If updateLabel is True, the new atom becomes the active atom If preserveProps is True preserve keep the existing props unless explicit set on the new atom

ReplaceBond(self, index: int, newBond: rdkit.Chem.rdchem.Bond, preserveProps: bool = False, keepSGroups: bool = True) None

replaces the specified bond with the provided one. If preserveProps is True preserve keep the existing props unless explicit set on the new bond. If keepSGroups is False, allSubstance Groups referencing the bond will be dropped.

RollbackBatchEdit(self) None

cancels batch editing

SetStereoGroups(self, stereo_groups: list) None

Set the stereo groups

class rdkit.Chem.rdchem.ResonanceFlags(*values)

Bases: IntEnum

ALLOW_CHARGE_SEPARATION = 2
ALLOW_INCOMPLETE_OCTETS = 1
KEKULE_ALL = 4
UNCONSTRAINED_ANIONS = 16
UNCONSTRAINED_CATIONS = 8
class rdkit.Chem.rdchem.ResonanceMolSupplier(self, mol: rdkit.Chem.rdchem.Mol, flags: int = 0, maxStructs: int = 1000)

Bases: object

A class which supplies resonance structures (as mols) from a mol.

Usage examples:

  1. Lazy evaluation: the resonance structures are not constructed

    until we ask for them:

    >>> suppl = ResonanceMolSupplier(mol)
    >>> for resMol in suppl:
    ...    resMol.GetNumAtoms()
    
  2. Lazy evaluation 2:

    >>> suppl = ResonanceMolSupplier(mol)
    >>> resMol1 = next(suppl)
    >>> resMol2 = next(suppl)
    >>> suppl.reset()
    >>> resMol3 = next(suppl)
    # resMol3 and resMol1 are the same:
    >>> MolToSmiles(resMol3)==MolToSmiles(resMol1)
    
  3. Random Access:

    >>> suppl = ResonanceMolSupplier(mol)
    >>> resMol1 = suppl[0]
    >>> resMol2 = suppl[1]
    

    NOTE: this will generate an IndexError if the supplier doesn’t have that many molecules.

  4. Random Access 2: looping over all resonance structures
    >>> suppl = ResonanceMolSupplier(mol)
    >>> nResMols = len(suppl)
    >>> for i in range(nResMols):
    ...   suppl[i].GetNumAtoms()
    
Enumerate(self) None

Ask ResonanceMolSupplier to enumerate resonance structures(automatically done as soon as any attempt to access them is made).

GetAtomConjGrpIdx(self, ai: int) int

Given an atom index, it returns the index of the conjugated groupthe atom belongs to, or -1 if it is not conjugated.

GetBondConjGrpIdx(self, bi: int) int

Given a bond index, it returns the index of the conjugated groupthe bond belongs to, or -1 if it is not conjugated.

GetIsEnumerated(self) bool

Returns true if resonance structure enumeration has already happened.

GetNumConjGrps(self) int

Returns the number of individual conjugated groups in the molecule.

GetProgressCallback(self) object

Get the ResonanceMolSupplierCallback subclass instance, or None if none was set.

GetSubstructMatch(self, query: rdkit.Chem.rdchem.Mol, useChirality: bool = False, useQueryQueryMatches: bool = False) list[int]

Returns the indices of the molecule’s atoms that match a substructure query, taking into account all resonance structures in ResonanceMolSupplier.

ARGUMENTS:
  • query: a Molecule

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

RETURNS: a tuple of integers

NOTES:
  • only a single match is returned

  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

GetSubstructMatches(self, query: rdkit.Chem.rdchem.Mol, uniquify: bool = False, useChirality: bool = False, useQueryQueryMatches: bool = False, maxMatches: int = 1000, numThreads: int = 1) list[list[int]]

Returns tuples of the indices of the molecule’s atoms that match a substructure query, taking into account all resonance structures in ResonanceMolSupplier.

ARGUMENTS:
  • query: a Molecule.

  • uniquify: (optional) determines whether or not the matches are uniquified.

    Defaults to 1.

  • useChirality: enables the use of stereochemistry in the matching

  • useQueryQueryMatches: use query-query matching logic

  • maxMatches: The maximum number of matches that will be returned.

    In high-symmetry cases with medium-sized molecules, it is very easy to end up with a combinatorial explosion in the number of possible matches. This argument prevents that from having unintended consequences

  • numThreads: The number of threads to be used (defaults to 1; 0 selects the

    number of concurrent threads supported by the hardware; negative values are added to the number of concurrent threads supported by the hardware).

RETURNS: a tuple of tuples of integers

NOTE:
  • the ordering of the indices corresponds to the atom ordering

    in the query. For example, the first index is for the atom in this molecule that matches the first atom in the query.

SetNumThreads(self, numThreads: int) None

Sets the number of threads to be used to enumerate resonance structures (defaults to 1; 0 selects the number of concurrent threads supported by the hardware; negative values are added to the number of concurrent threads supported by the hardware).

SetProgressCallback(self, callback: object | None) None

Pass an instance of a class derived from ResonanceMolSupplierCallback, which must implement the __call__() method.

WasCanceled(self) bool

Returns True if the resonance structure generation was canceled.

atEnd(self) bool

Returns whether or not we have hit the end of the resonance structure supplier.

reset(self) None

Resets our position in the resonance structure supplier to the beginning.

class rdkit.Chem.rdchem.ResonanceMolSupplierCallback(self)

Bases: object

Create a derived class from this abstract base class and implement the __call__() method. The __call__() method is called at each iteration of the algorithm, and provides a mechanism to monitor or stop its progress.

To have your callback called, pass an instance of your derived class to ResonanceMolSupplier.SetProgressCallback()

GetMaxStructures(self) int

Get the number of conjugated groups this molecule has.

GetNumConjGrps(self) int

Returns the number of individual conjugated groups in the molecule.

GetNumDiverseStructures(self, conjGrpIdx: int) int

Get the number of non-degenrate resonance structures generated so far for the passed conjugated group index.

GetNumStructures(self, conjGrpIdx: int) int

Get the number of resonance structures generated so far for the passed conjugated group index.

class rdkit.Chem.rdchem.RingInfo

Bases: object

contains information about a molecule’s rings

AddRing(self, atomIds: object, bondIds: object) None

Adds a ring to the set. Be very careful with this operation.

AreAtomsInSameRing(self, idx1: int, idx2: int) bool
AreAtomsInSameRingOfSize(self, idx1: int, idx2: int, size: int) bool
AreBondsInSameRing(self, idx1: int, idx2: int) bool
AreBondsInSameRingOfSize(self, idx1: int, idx2: int, size: int) bool
AreRingFamiliesInitialized(self) bool
AreRingsFused(self, ring1Idx: int, ring2Idx: int) bool
AtomMembers(self, idx: int) tuple
AtomRingFamilies(self) tuple
AtomRingSizes(self, idx: int) tuple
AtomRings(self) tuple
BondMembers(self, idx: int) tuple
BondRingFamilies(self) tuple
BondRingSizes(self, idx: int) tuple
BondRings(self) tuple
IsAtomInRingOfSize(self, idx: int, size: int) bool
IsBondInRingOfSize(self, idx: int, size: int) bool
IsRingFused(self, ringIdx: int) bool
MinAtomRingSize(self, idx: int) int
MinBondRingSize(self, idx: int) int
NumAtomRings(self, idx: int) int
NumBondRings(self, idx: int) int
NumFusedBonds(self, ringIdx: int) int
NumRelevantCycles(self) int
NumRingFamilies(self) int
NumRings(self) int
class rdkit.Chem.rdchem.StereoDescriptor(*values)

Bases: Enum

Bond_Cis = 3
Bond_Trans = 4
NoValue = 0
Tet_CCW = 2
Tet_CW = 1
class rdkit.Chem.rdchem.StereoGroup

Bases: object

A collection of atoms with a defined stereochemical relationship.

Used to help represent a sample with unknown stereochemistry, or that is a mix of diastereomers.

GetAtoms(self) tuple

access the atoms in the StereoGroup.

GetBonds(self) tuple

access the bonds in the StereoGroup.

GetGroupType(self) rdkit.Chem.rdchem.StereoGroupType

Returns the StereoGroupType.

GetReadId(self) int

return the StereoGroup’s original ID. Note that the ID only makes sense for AND/OR groups.

GetWriteId(self) int

return the StereoGroup’s ID that will be exported. Note that the ID only makes sense for AND/OR groups.

SetWriteId(self, id: int) None

return the StereoGroup’s ID that will be exported. Note that the ID only makes sense for AND/OR groups.

class rdkit.Chem.rdchem.StereoGroupType(*values)

Bases: Enum

STEREO_ABSOLUTE = 0
STEREO_AND = 2
STEREO_OR = 1
class rdkit.Chem.rdchem.StereoInfo

Bases: object

Class describing stereochemistry

NOATOM = 4294967295
property centeredOn

index of the item the stereo concerns

property controllingAtoms

indices of the atoms controlling the stereo

property descriptor

stereo descriptor

property permutation

permutation index (used for non-tetrahedral chirality)

property specified

whether or not it is specified

property type

the type of stereo

class rdkit.Chem.rdchem.StereoSpecified(*values)

Bases: IntEnum

Specified = 1
Unknown = 2
Unspecified = 0
class rdkit.Chem.rdchem.StereoType(*values)

Bases: Enum

Atom_Octahedral = 4
Atom_SquarePlanar = 2
Atom_Tetrahedral = 1
Atom_TrigonalBipyramidal = 3
Bond_Atropisomer = 7
Bond_Cumulene_Even = 6
Bond_Double = 5
Unspecified = 0
class rdkit.Chem.rdchem.SubstanceGroup

Bases: object

A collection of atoms and bonds with associated properties

AddAtomWithBookmark(self, mark: int) None
AddAtomWithIdx(self, idx: int) None
AddAttachPoint(self, aIdx: int, lvIdx: int, idStr: str) None
AddBondWithBookmark(self, mark: int) None
AddBondWithIdx(self, idx: int) None
AddBracket(self, pts: object) None
AddCState(self, bondIdx: int, vector: rdkit.Geometry.rdGeometry.Point3D) None
AddParentAtomWithBookmark(self, mark: int) None
AddParentAtomWithIdx(self, idx: int) None
ClearAttachPoints(self) None

Clear attachment points.

ClearBrackets(self) None

Clear bracket definitions.

ClearCStates(self) None

Clear CSTATE entries.

ClearProp(self, key: str) None

Removes a particular property (does nothing if not set).

GetAtoms(self) list[int]

returns a list of the indices of the atoms in this SubstanceGroup

GetAttachPoints(self) tuple
GetBonds(self) list[int]

returns a list of the indices of the bonds in this SubstanceGroup

GetBoolProp(self, key: str) bool
GetBoolProp(self, key: str, default: object) object

Overloaded function.

  1. GetBoolProp(self, key: str) -> bool

returns the value of a particular property

  1. GetBoolProp(self, key: str, default: object) -> object

returns the value of a particular property, or default if not present

GetBrackets(self) tuple
GetCStates(self) tuple
GetDoubleProp(self, key: str) float
GetDoubleProp(self, key: str, default: object) object

Overloaded function.

  1. GetDoubleProp(self, key: str) -> float

returns the value of a particular property

  1. GetDoubleProp(self, key: str, default: object) -> object

returns the value of a particular property, or default if not present

GetIndexInMol(self) int

returns the index of this SubstanceGroup in the owning molecule’s list.

GetIntProp(self, key: str) int
GetIntProp(self, key: str, default: object) object

Overloaded function.

  1. GetIntProp(self, key: str) -> int

returns the value of a particular property

  1. GetIntProp(self, key: str, default: object) -> object

returns the value of a particular property, or default if not present

GetOwningMol(self) rdkit.Chem.rdchem.Mol

returns the molecule owning this SubstanceGroup

GetParentAtoms(self) list[int]

returns a list of the indices of the parent atoms in this SubstanceGroup

GetProp(self, key: str, autoConvert: bool = False) object
GetProp(self, key: str, autoConvert: bool = False, default: object | None) object

Overloaded function.

  1. GetProp(self, key: str, autoConvert: bool = False) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

RETURNS: a string

NOTE:
  • If the property has not been set, a KeyError exception will be raised.

  1. GetProp(self, key: str, autoConvert: bool = False, default: object | None) -> object

Returns the value of the property.

ARGUMENTS:
  • key: the name of the property to return (a string).

  • autoConvert: if True attempt to convert the property into a python object

  • default: value to return if the property is not present.

RETURNS: the property value, or default if the property is not present.

GetPropNames(self, includePrivate: bool = False, includeComputed: bool = False) list[str]

Returns a list of the properties set on the SubstanceGroup.

GetPropsAsDict(self, includePrivate: bool = True, includeComputed: bool = True, autoConvertStrings: bool = True) dict
Returns a dictionary of the properties set on the SubstanceGroup.

n.b. some properties cannot be converted to python types.

GetStringVectProp(self, key: str) list[str]

returns the value of a particular property

GetUnsignedProp(self, key: str) int
GetUnsignedProp(self, key: str, default: object) object

Overloaded function.

  1. GetUnsignedProp(self, key: str) -> int

returns the value of a particular property

  1. GetUnsignedProp(self, key: str, default: object) -> object

returns the value of a particular property, or default if not present

GetUnsignedVectProp(self, key: str) list[int]

returns the value of a particular property

HasProp(self, key: str) bool

returns whether or not a particular property exists

SetAtoms(self, iterable: object) None

Set the list of the indices of the atoms in this SubstanceGroup. Note that this does not update properties, CStates or Attachment Points.

SetBonds(self, iterable: object) None

Set the list of the indices of the bonds in this SubstanceGroup. Note that this does not update properties, CStates or Attachment Points.

SetBoolProp(self, key: str, val: bool, computed: bool = False) None

sets the value of a particular property

SetDoubleProp(self, key: str, val: float, computed: bool = False) None

sets the value of a particular property

SetIntProp(self, key: str, val: int, computed: bool = False) None

sets the value of a particular property

SetParentAtoms(self, iterable: object) None

Set the list of the indices of the parent atoms in this SubstanceGroup. Note that this does not update properties, CStates or Attachment Points.

SetProp(self, key: str, val: str, computed: bool = False) None

sets the value of a particular property

SetUnsignedProp(self, key: str, val: int, computed: bool = False) None

sets the value of a particular property

class rdkit.Chem.rdchem.SubstanceGroupAttach(self)

Bases: object

AttachPoint for a SubstanceGroup

property aIdx

attachment index

property id

attachment id

property lvIdx

leaving atom or index (0 for implied)

class rdkit.Chem.rdchem.SubstanceGroupCState(self)

Bases: object

CSTATE for a SubstanceGroup

property bondIdx

(self) -> int

property vector

(self) -> RDGeom::Point3D

class rdkit.Chem.rdchem.SubstructMatchParameters(self)

Bases: object

Parameters controlling substructure matching

Constructor

property aromaticMatchesConjugated

aromatic and conjugated bonds match each other

property aromaticMatchesSingleOrDouble

aromatic and single or double bonds match each other

property atomProperties

atom properties that must be equivalent in order to match.

property bondProperties

bond properties that must be equivalent in order to match.

property extraAtomCheckOverridesDefaultCheck

if set, only the extraAtomCheck will be used to determine whether or not atoms match

property extraBondCheckOverridesDefaultCheck

if set, only the extraBondCheck will be used to determine whether or not bonds match

property maxMatches

maximum number of matches to return

property maxRecursiveMatches

maximum number of recursive matches to find

property numThreads

number of threads to use when multi-threading is possible.0 selects the number of concurrent threads supported by thehardware. negative values are added to the number of concurrentthreads supported by the hardware.

property recursionPossible

Allow recursive queries

setExtraAtomCheckFunc(self, func: object) None
allows you to provide a function that will be called

for each atom pair that matches during substructure searching, after all other comparisons have passed. The function should return true or false indicating whether or not that atom-match should be accepted.

setExtraBondCheckFunc(self, func: object) None
allows you to provide a function that will be called

for each bond pair that matches during substructure searching, after all other comparisons have passed. The function should return true or false indicating whether or not that bond-match should be accepted.

setExtraFinalCheck(self, func: object) None
allows you to provide a function that will be called

with the molecule

and a vector of atom IDs containing a potential match. The function should return true or false indicating whether or not that match should be accepted.

property specifiedStereoQueryMatchesUnspecified

If set, query atoms and bonds with specified stereochemistry will match atoms and bonds with unspecified stereochemistry.

property uniquify

uniquify (by atom index) match results

property useChirality

Use chirality in determining whether or not atoms/bonds match

property useEnhancedStereo

take enhanced stereochemistry into account while doing the match. This only has an effect if useChirality is also True.

property useGenericMatchers

use generic groups (=homology groups) as a post-filtering step (if any are present in the molecule)

property useQueryQueryMatches

Consider query-query matches, not just simple matches

class rdkit.Chem.rdchem.ValenceType(*values)

Bases: Enum

EXPLICIT = 1
IMPLICIT = 0