Skill Tracer
Skills › Scientific Agent Skills › rdkit › api_reference.md

api_reference.md

458 lines · skills/rdkit/references/api_reference.md at 5f2bc03

Open on GitHub
1# RDKit API Reference
2
3This document provides a selected reference for RDKit's Python API, organized by functionality.
4
5Signatures below show selected keyword arguments, not complete overloads. Tested
6on RDKit 2026.03.6; use keywords when omitted arguments precede them.
7

RDKit API Reference

This document provides a selected reference for RDKit's Python API, organized by functionality.

Signatures below show selected keyword arguments, not complete overloads. Tested on RDKit 2026.03.6; use keywords when omitted arguments precede them.

Raw lines 1 to 7
8## Core Module: rdkit.Chem
9
10The fundamental module for working with molecules.

Core Module: rdkit.Chem

The fundamental module for working with molecules.

Raw lines 8 to 11
12### Molecule I/O
14**Reading Molecules:**
16- `Chem.MolFromSmiles(smiles, sanitize=True)` - Parse SMILES string
17- `Chem.MolFromSmarts(smarts)` - Parse SMARTS pattern
18- `Chem.MolFromMolFile(filename, sanitize=True, removeHs=True)` - Read MOL file
19- `Chem.MolFromMolBlock(molblock, sanitize=True, removeHs=True)` - Parse MOL block string
20- `Chem.MolFromMol2File(filename, sanitize=True, removeHs=True)` - Read MOL2 file
21- `Chem.MolFromMol2Block(molblock, sanitize=True, removeHs=True)` - Parse MOL2 block
22- `Chem.MolFromPDBFile(filename, sanitize=True, removeHs=True)` - Read PDB file
23- `Chem.MolFromPDBBlock(pdbblock, sanitize=True, removeHs=True)` - Parse PDB block
24- `Chem.MolFromInchi(inchi, sanitize=True, removeHs=True)` - Parse InChI string
25- `Chem.MolFromSequence(text, sanitize=True)` - Create molecule from peptide sequence
27MOL2 parsing expects supported atom typing (notably Corina conventions); PDB
28connectivity inference does not validate bond orders, protonation, missing atoms
29or biological assembly identity. These are format readers, not preparation pipelines.
31**Writing Molecules:**
33- `Chem.MolToSmiles(mol, isomericSmiles=True, canonical=True)` - Convert to SMILES
34- `Chem.MolToSmarts(mol, isomericSmiles=True)` - Convert to SMARTS
35- `Chem.MolToMolBlock(mol, includeStereo=True, confId=-1)` - Convert to MOL block
36- `Chem.MolToMolFile(mol, filename, includeStereo=True, confId=-1)` - Write MOL file
37- `Chem.MolToPDBBlock(mol, confId=-1)` - Convert to PDB block
38- `Chem.MolToPDBFile(mol, filename, confId=-1)` - Write PDB file
39- `Chem.MolToInchi(mol, options='')` - Convert to InChI
40- `Chem.MolToInchiKey(mol, options='')` - Generate InChI key
41- `Chem.MolToSequence(mol)` - Convert to peptide sequence
43**Batch I/O:**
45- `Chem.SDMolSupplier(filename, sanitize=True, removeHs=True)` - SDF file reader
46- `Chem.ForwardSDMolSupplier(fileobj, sanitize=True, removeHs=True)` - Forward-only SDF reader
47- `Chem.MultithreadedSDMolSupplier(filename, numWriterThreads=1)` - Parallel SDF reader; experimental, output order may change
48- `Chem.SmilesMolSupplier(filename, delimiter=' ', titleLine=True)` - SMILES file reader
49- `Chem.SDWriter(filename)` - SDF file writer
50- `Chem.SmilesWriter(filename, delimiter=' ', includeHeader=True)` - SMILES file writer

Molecule I/O

Reading Molecules:

  • Chem.MolFromSmiles(smiles, sanitize=True) - Parse SMILES string
  • Chem.MolFromSmarts(smarts) - Parse SMARTS pattern
  • Chem.MolFromMolFile(filename, sanitize=True, removeHs=True) - Read MOL file
  • Chem.MolFromMolBlock(molblock, sanitize=True, removeHs=True) - Parse MOL block string
  • Chem.MolFromMol2File(filename, sanitize=True, removeHs=True) - Read MOL2 file
  • Chem.MolFromMol2Block(molblock, sanitize=True, removeHs=True) - Parse MOL2 block
  • Chem.MolFromPDBFile(filename, sanitize=True, removeHs=True) - Read PDB file
  • Chem.MolFromPDBBlock(pdbblock, sanitize=True, removeHs=True) - Parse PDB block
  • Chem.MolFromInchi(inchi, sanitize=True, removeHs=True) - Parse InChI string
  • Chem.MolFromSequence(text, sanitize=True) - Create molecule from peptide sequence

MOL2 parsing expects supported atom typing (notably Corina conventions); PDB connectivity inference does not validate bond orders, protonation, missing atoms or biological assembly identity. These are format readers, not preparation pipelines.

Writing Molecules:

  • Chem.MolToSmiles(mol, isomericSmiles=True, canonical=True) - Convert to SMILES
  • Chem.MolToSmarts(mol, isomericSmiles=True) - Convert to SMARTS
  • Chem.MolToMolBlock(mol, includeStereo=True, confId=-1) - Convert to MOL block
  • Chem.MolToMolFile(mol, filename, includeStereo=True, confId=-1) - Write MOL file
  • Chem.MolToPDBBlock(mol, confId=-1) - Convert to PDB block
  • Chem.MolToPDBFile(mol, filename, confId=-1) - Write PDB file
  • Chem.MolToInchi(mol, options='') - Convert to InChI
  • Chem.MolToInchiKey(mol, options='') - Generate InChI key
  • Chem.MolToSequence(mol) - Convert to peptide sequence

Batch I/O:

  • Chem.SDMolSupplier(filename, sanitize=True, removeHs=True) - SDF file reader
  • Chem.ForwardSDMolSupplier(fileobj, sanitize=True, removeHs=True) - Forward-only SDF reader
  • Chem.MultithreadedSDMolSupplier(filename, numWriterThreads=1) - Parallel SDF reader; experimental, output order may change
  • Chem.SmilesMolSupplier(filename, delimiter=' ', titleLine=True) - SMILES file reader
  • Chem.SDWriter(filename) - SDF file writer
  • Chem.SmilesWriter(filename, delimiter=' ', includeHeader=True) - SMILES file writer
Raw lines 12 to 51
52### Molecular Manipulation
54**Sanitization:**
56- `Chem.SanitizeMol(mol, sanitizeOps=SANITIZE_ALL, catchErrors=False)` - Sanitize molecule
57- `Chem.DetectChemistryProblems(mol, sanitizeOps=SANITIZE_ALL)` - Detect sanitization issues
58- `Chem.AssignStereochemistry(mol, cleanIt=False, force=False)` - Assign stereochemistry
59- `Chem.FindPotentialStereo(mol)` - Potential stereoelements; upstream still marks this API experimental
60- `Chem.AssignStereochemistryFrom3D(mol, confId=-1)` - Assign stereo from 3D coords
62**Hydrogen Management:**
64- `Chem.AddHs(mol, explicitOnly=False, addCoords=False)` - Add explicit hydrogens
65- `Chem.RemoveHs(mol, implicitOnly=False, updateExplicitCount=False)` - Remove hydrogens
66- `Chem.RemoveAllHs(mol)` - Remove all hydrogens
68`RemoveHs` normally preserves isotopic hydrogen; `RemoveAllHs` can discard it.
69Choose explicit isotope/stereo preservation policy before either operation.
71**Aromaticity:**
73- `Chem.SetAromaticity(mol, model=AROMATICITY_RDKIT)` - Set aromaticity model
74- `Chem.Kekulize(mol, clearAromaticFlags=False)` - Kekulize aromatic bonds
75- `Chem.SetConjugation(mol)` - Set conjugation flags
77**Fragments:**
79- `Chem.GetMolFrags(mol, asMols=False, sanitizeFrags=True)` - Get disconnected fragments
80- `Chem.FragmentOnBonds(mol, bondIndices, addDummies=True)` - Fragment on specific bonds
81- `Chem.ReplaceSubstructs(mol, query, replacement, replaceAll=False)` - Replace substructures
82- `Chem.DeleteSubstructs(mol, query, onlyFrags=False)` - Delete substructures
84**Stereochemistry:**
86- `Chem.FindMolChiralCenters(mol, includeUnassigned=False, useLegacyImplementation=None)` - Find chiral centers
87- `Chem.FindPotentialStereo(mol, cleanIt=False)` - Find potential stereocenters

Molecular Manipulation

Sanitization:

  • Chem.SanitizeMol(mol, sanitizeOps=SANITIZE_ALL, catchErrors=False) - Sanitize molecule
  • Chem.DetectChemistryProblems(mol, sanitizeOps=SANITIZE_ALL) - Detect sanitization issues
  • Chem.AssignStereochemistry(mol, cleanIt=False, force=False) - Assign stereochemistry
  • Chem.FindPotentialStereo(mol) - Potential stereoelements; upstream still marks this API experimental
  • Chem.AssignStereochemistryFrom3D(mol, confId=-1) - Assign stereo from 3D coords

Hydrogen Management:

  • Chem.AddHs(mol, explicitOnly=False, addCoords=False) - Add explicit hydrogens
  • Chem.RemoveHs(mol, implicitOnly=False, updateExplicitCount=False) - Remove hydrogens
  • Chem.RemoveAllHs(mol) - Remove all hydrogens

RemoveHs normally preserves isotopic hydrogen; RemoveAllHs can discard it. Choose explicit isotope/stereo preservation policy before either operation.

Aromaticity:

  • Chem.SetAromaticity(mol, model=AROMATICITY_RDKIT) - Set aromaticity model
  • Chem.Kekulize(mol, clearAromaticFlags=False) - Kekulize aromatic bonds
  • Chem.SetConjugation(mol) - Set conjugation flags

Fragments:

  • Chem.GetMolFrags(mol, asMols=False, sanitizeFrags=True) - Get disconnected fragments
  • Chem.FragmentOnBonds(mol, bondIndices, addDummies=True) - Fragment on specific bonds
  • Chem.ReplaceSubstructs(mol, query, replacement, replaceAll=False) - Replace substructures
  • Chem.DeleteSubstructs(mol, query, onlyFrags=False) - Delete substructures

Stereochemistry:

  • Chem.FindMolChiralCenters(mol, includeUnassigned=False, useLegacyImplementation=None) - Find chiral centers
  • Chem.FindPotentialStereo(mol, cleanIt=False) - Find potential stereocenters
Raw lines 52 to 88
89### Substructure Searching
91**Basic Matching:**
93- `mol.HasSubstructMatch(query, useChirality=False)` - Check for substructure match
94- `mol.GetSubstructMatch(query, useChirality=False)` - Get first match
95- `mol.GetSubstructMatches(query, uniquify=True, useChirality=False)` - Get all matches
96- `mol.GetSubstructMatches(query, maxMatches=1000)` - Limit number of matches

Substructure Searching

Basic Matching:

  • mol.HasSubstructMatch(query, useChirality=False) - Check for substructure match
  • mol.GetSubstructMatch(query, useChirality=False) - Get first match
  • mol.GetSubstructMatches(query, uniquify=True, useChirality=False) - Get all matches
  • mol.GetSubstructMatches(query, maxMatches=1000) - Limit number of matches
Raw lines 89 to 97
98### Molecular Properties
100**Atom Methods:**
102- `atom.GetSymbol()` - Atomic symbol
103- `atom.GetAtomicNum()` - Atomic number
104- `atom.GetDegree()` - Number of bonds
105- `atom.GetTotalDegree()` - Including hydrogens
106- `atom.GetFormalCharge()` - Formal charge
107- `atom.GetNumRadicalElectrons()` - Radical electrons
108- `atom.GetIsAromatic()` - Aromaticity flag
109- `atom.GetHybridization()` - Hybridization (SP, SP2, SP3, etc.)
110- `atom.GetIdx()` - Atom index
111- `atom.IsInRing()` - In any ring
112- `atom.IsInRingSize(size)` - In ring of specific size
113- `atom.GetChiralTag()` - Chirality tag
115**Bond Methods:**
117- `bond.GetBondType()` - Bond type (SINGLE, DOUBLE, TRIPLE, AROMATIC)
118- `bond.GetBeginAtomIdx()` - Starting atom index
119- `bond.GetEndAtomIdx()` - Ending atom index
120- `bond.GetIsConjugated()` - Conjugation flag
121- `bond.GetIsAromatic()` - Aromaticity flag
122- `bond.IsInRing()` - In any ring
123- `bond.GetStereo()` - Stereochemistry (STEREONONE, STEREOZ, STEREOE, etc.)
125**Molecule Methods:**
127- `mol.GetNumAtoms(onlyExplicit=True)` - Number of atoms
128- `mol.GetNumHeavyAtoms()` - Number of heavy atoms
129- `mol.GetNumBonds()` - Number of bonds
130- `mol.GetAtoms()` - Iterator over atoms
131- `mol.GetBonds()` - Iterator over bonds
132- `mol.GetAtomWithIdx(idx)` - Get specific atom
133- `mol.GetBondWithIdx(idx)` - Get specific bond
134- `mol.GetRingInfo()` - Ring information object
136**Ring Information:**
138- `Chem.GetSymmSSSR(mol)` - Symmetrized smallest-ring set (can exceed SSSR size)
139- `Chem.GetSSSR(mol)` - Smallest set of smallest rings; not an alias (cubane: 5 versus 6 symmetrized rings)
140- `ring_info.NumRings()` - Number of rings
141- `ring_info.AtomRings()` - Tuples of atom indices in rings
142- `ring_info.BondRings()` - Tuples of bond indices in rings

Molecular Properties

Atom Methods:

  • atom.GetSymbol() - Atomic symbol
  • atom.GetAtomicNum() - Atomic number
  • atom.GetDegree() - Number of bonds
  • atom.GetTotalDegree() - Including hydrogens
  • atom.GetFormalCharge() - Formal charge
  • atom.GetNumRadicalElectrons() - Radical electrons
  • atom.GetIsAromatic() - Aromaticity flag
  • atom.GetHybridization() - Hybridization (SP, SP2, SP3, etc.)
  • atom.GetIdx() - Atom index
  • atom.IsInRing() - In any ring
  • atom.IsInRingSize(size) - In ring of specific size
  • atom.GetChiralTag() - Chirality tag

Bond Methods:

  • bond.GetBondType() - Bond type (SINGLE, DOUBLE, TRIPLE, AROMATIC)
  • bond.GetBeginAtomIdx() - Starting atom index
  • bond.GetEndAtomIdx() - Ending atom index
  • bond.GetIsConjugated() - Conjugation flag
  • bond.GetIsAromatic() - Aromaticity flag
  • bond.IsInRing() - In any ring
  • bond.GetStereo() - Stereochemistry (STEREONONE, STEREOZ, STEREOE, etc.)

Molecule Methods:

  • mol.GetNumAtoms(onlyExplicit=True) - Number of atoms
  • mol.GetNumHeavyAtoms() - Number of heavy atoms
  • mol.GetNumBonds() - Number of bonds
  • mol.GetAtoms() - Iterator over atoms
  • mol.GetBonds() - Iterator over bonds
  • mol.GetAtomWithIdx(idx) - Get specific atom
  • mol.GetBondWithIdx(idx) - Get specific bond
  • mol.GetRingInfo() - Ring information object

Ring Information:

  • Chem.GetSymmSSSR(mol) - Symmetrized smallest-ring set (can exceed SSSR size)
  • Chem.GetSSSR(mol) - Smallest set of smallest rings; not an alias (cubane: 5 versus 6 symmetrized rings)
  • ring_info.NumRings() - Number of rings
  • ring_info.AtomRings() - Tuples of atom indices in rings
  • ring_info.BondRings() - Tuples of bond indices in rings
Raw lines 98 to 143
144## rdkit.Chem.AllChem
146Extended chemistry functionality.

rdkit.Chem.AllChem

Extended chemistry functionality.

Raw lines 144 to 147
148### 2D/3D Coordinate Generation
150- `AllChem.Compute2DCoords(mol, canonOrient=True, clearConfs=True)` - Generate 2D coordinates
151- `AllChem.EmbedMolecule(mol, maxAttempts=0, randomSeed=-1, useRandomCoords=False)` - Generate 3D conformer
152- `AllChem.EmbedMultipleConfs(mol, numConfs=10, maxAttempts=0, randomSeed=-1)` - Generate multiple conformers
153- `AllChem.ConstrainedEmbed(mol, core, useTethers=True)` - Constrained embedding
154- `AllChem.GenerateDepictionMatching2DStructure(mol, reference, refPattern=None)` - Align to template

2D/3D Coordinate Generation

  • AllChem.Compute2DCoords(mol, canonOrient=True, clearConfs=True) - Generate 2D coordinates
  • AllChem.EmbedMolecule(mol, maxAttempts=0, randomSeed=-1, useRandomCoords=False) - Generate 3D conformer
  • AllChem.EmbedMultipleConfs(mol, numConfs=10, maxAttempts=0, randomSeed=-1) - Generate multiple conformers
  • AllChem.ConstrainedEmbed(mol, core, useTethers=True) - Constrained embedding
  • AllChem.GenerateDepictionMatching2DStructure(mol, reference, refPattern=None) - Align to template
Raw lines 148 to 155
156### Force Field Optimization
158- `AllChem.UFFOptimizeMolecule(mol, maxIters=200, confId=-1)` - UFF optimization
159- `AllChem.MMFFOptimizeMolecule(mol, maxIters=200, confId=-1, mmffVariant='MMFF94')` - MMFF optimization
160- `AllChem.UFFGetMoleculeForceField(mol, confId=-1)` - Get UFF force field object
161- `AllChem.MMFFGetMoleculeForceField(mol, pyMMFFMolProperties, confId=-1)` - Get MMFF force field

Force Field Optimization

  • AllChem.UFFOptimizeMolecule(mol, maxIters=200, confId=-1) - UFF optimization
  • AllChem.MMFFOptimizeMolecule(mol, maxIters=200, confId=-1, mmffVariant='MMFF94') - MMFF optimization
  • AllChem.UFFGetMoleculeForceField(mol, confId=-1) - Get UFF force field object
  • AllChem.MMFFGetMoleculeForceField(mol, pyMMFFMolProperties, confId=-1) - Get MMFF force field
Raw lines 156 to 162
163### Conformer Analysis
165- `AllChem.GetConformerRMS(mol, confId1, confId2, prealigned=False)` - Calculate RMSD
166- `AllChem.GetConformerRMSMatrix(mol, prealigned=False)` - RMSD matrix
167- `AllChem.AlignMol(prbMol, refMol, prbCid=-1, refCid=-1)` - Align molecules
168- `AllChem.AlignMolConformers(mol)` - Align all conformers

Conformer Analysis

  • AllChem.GetConformerRMS(mol, confId1, confId2, prealigned=False) - Calculate RMSD
  • AllChem.GetConformerRMSMatrix(mol, prealigned=False) - RMSD matrix
  • AllChem.AlignMol(prbMol, refMol, prbCid=-1, refCid=-1) - Align molecules
  • AllChem.AlignMolConformers(mol) - Align all conformers
Raw lines 163 to 169
170### Reactions
172- `AllChem.ReactionFromSmarts(smarts, useSmiles=False)` - Create reaction from SMARTS
173- `reaction.RunReactants(reactants)` - Apply reaction
174- `reaction.RunReactant(reactant, reactionIdx)` - Apply to specific reactant
175- `AllChem.CreateDifferenceFingerprintForReaction(reaction)` - Reaction fingerprint

Reactions

  • AllChem.ReactionFromSmarts(smarts, useSmiles=False) - Create reaction from SMARTS
  • reaction.RunReactants(reactants) - Apply reaction
  • reaction.RunReactant(reactant, reactionIdx) - Apply to specific reactant
  • AllChem.CreateDifferenceFingerprintForReaction(reaction) - Reaction fingerprint
Raw lines 170 to 176
177### Fingerprints
179- Prefer `rdFingerprintGenerator.GetMorganGenerator()` for new Morgan fingerprint code
180- `AllChem.GetMorganFingerprint(mol, radius, useFeatures=False)` - Legacy Morgan fingerprint helper
181- `AllChem.GetMorganFingerprintAsBitVect(mol, radius, nBits=2048)` - Legacy Morgan bit vector helper
182- `AllChem.GetHashedMorganFingerprint(mol, radius, nBits=2048)` - Legacy hashed Morgan helper
183- `AllChem.GetErGFingerprint(mol)` - ErG fingerprint

Fingerprints

  • Prefer rdFingerprintGenerator.GetMorganGenerator() for new Morgan fingerprint code
  • AllChem.GetMorganFingerprint(mol, radius, useFeatures=False) - Legacy Morgan fingerprint helper
  • AllChem.GetMorganFingerprintAsBitVect(mol, radius, nBits=2048) - Legacy Morgan bit vector helper
  • AllChem.GetHashedMorganFingerprint(mol, radius, nBits=2048) - Legacy hashed Morgan helper
  • AllChem.GetErGFingerprint(mol) - ErG fingerprint
Raw lines 177 to 184
185## rdkit.Chem.Descriptors
187Molecular descriptor calculations.

rdkit.Chem.Descriptors

Molecular descriptor calculations.

Raw lines 185 to 188
189### Common Descriptors
191- `Descriptors.MolWt(mol)` - Molecular weight
192- `Descriptors.ExactMolWt(mol)` - Exact molecular weight
193- `Descriptors.HeavyAtomMolWt(mol)` - Heavy atom molecular weight
194- `Descriptors.MolLogP(mol)` - LogP (lipophilicity)
195- `Descriptors.MolMR(mol)` - Molar refractivity
196- `Descriptors.TPSA(mol)` - Topological polar surface area
197- `Descriptors.NumHDonors(mol)` - Hydrogen bond donors
198- `Descriptors.NumHAcceptors(mol)` - Hydrogen bond acceptors
199- `Descriptors.NumRotatableBonds(mol)` - Rotatable bonds
200- `Descriptors.NumAromaticRings(mol)` - Aromatic rings
201- `Descriptors.NumSaturatedRings(mol)` - Saturated rings
202- `Descriptors.NumAliphaticRings(mol)` - Aliphatic rings
203- `Descriptors.NumAromaticHeterocycles(mol)` - Aromatic heterocycles
204- `Descriptors.NumRadicalElectrons(mol)` - Radical electrons
205- `Descriptors.NumValenceElectrons(mol)` - Valence electrons

Common Descriptors

  • Descriptors.MolWt(mol) - Molecular weight
  • Descriptors.ExactMolWt(mol) - Exact molecular weight
  • Descriptors.HeavyAtomMolWt(mol) - Heavy atom molecular weight
  • Descriptors.MolLogP(mol) - LogP (lipophilicity)
  • Descriptors.MolMR(mol) - Molar refractivity
  • Descriptors.TPSA(mol) - Topological polar surface area
  • Descriptors.NumHDonors(mol) - Hydrogen bond donors
  • Descriptors.NumHAcceptors(mol) - Hydrogen bond acceptors
  • Descriptors.NumRotatableBonds(mol) - Rotatable bonds
  • Descriptors.NumAromaticRings(mol) - Aromatic rings
  • Descriptors.NumSaturatedRings(mol) - Saturated rings
  • Descriptors.NumAliphaticRings(mol) - Aliphatic rings
  • Descriptors.NumAromaticHeterocycles(mol) - Aromatic heterocycles
  • Descriptors.NumRadicalElectrons(mol) - Radical electrons
  • Descriptors.NumValenceElectrons(mol) - Valence electrons
Raw lines 189 to 206
207### Batch Calculation
209- `Descriptors.CalcMolDescriptors(mol)` - Calculate all descriptors as dictionary

Batch Calculation

  • Descriptors.CalcMolDescriptors(mol) - Calculate all descriptors as dictionary
Raw lines 207 to 210
211### Descriptor Lists
213- `Descriptors._descList` - Private, version-dependent registry; persist names/order with features

Descriptor Lists

  • Descriptors._descList - Private, version-dependent registry; persist names/order with features
Raw lines 211 to 214
215## rdkit.Chem.Draw
217Molecular visualization.

rdkit.Chem.Draw

Molecular visualization.

Raw lines 215 to 218
219### Image Generation
221- `Draw.MolToImage(mol, size=(300,300), kekulize=True, wedgeBonds=True, highlightAtoms=None)` - Generate PIL image
222- `Draw.MolToFile(mol, filename, size=(300,300), kekulize=True, wedgeBonds=True)` - Save to file
223- `Draw.MolsToGridImage(mols, molsPerRow=3, subImgSize=(200,200), legends=None)` - Grid of molecules
224- `Draw.MolsMatrixToGridImage(molsMatrix, subImgSize=(200,200), legendsMatrix=None)` - Nested grid
225- `Draw.ReactionToImage(rxn, subImgSize=(200,200))` - Reaction image

Image Generation

  • Draw.MolToImage(mol, size=(300,300), kekulize=True, wedgeBonds=True, highlightAtoms=None) - Generate PIL image
  • Draw.MolToFile(mol, filename, size=(300,300), kekulize=True, wedgeBonds=True) - Save to file
  • Draw.MolsToGridImage(mols, molsPerRow=3, subImgSize=(200,200), legends=None) - Grid of molecules
  • Draw.MolsMatrixToGridImage(molsMatrix, subImgSize=(200,200), legendsMatrix=None) - Nested grid
  • Draw.ReactionToImage(rxn, subImgSize=(200,200)) - Reaction image
Raw lines 219 to 226
227### Fingerprint Visualization
229- `Draw.DrawMorganBit(mol, bitId, bitInfo, whichExample=0)` - Visualize Morgan bit
230- `Draw.DrawMorganBits([(mol, bitId, bitInfo)], molsPerRow=3)` - Multiple Morgan bits
231- `Draw.DrawRDKitBit(mol, bitId, bitInfo, whichExample=0)` - Visualize RDKit bit

Fingerprint Visualization

  • Draw.DrawMorganBit(mol, bitId, bitInfo, whichExample=0) - Visualize Morgan bit
  • Draw.DrawMorganBits([(mol, bitId, bitInfo)], molsPerRow=3) - Multiple Morgan bits
  • Draw.DrawRDKitBit(mol, bitId, bitInfo, whichExample=0) - Visualize RDKit bit
Raw lines 227 to 232
233### IPython Integration
235- `from rdkit.Chem.Draw import IPythonConsole` - Optional Jupyter integration (requires IPython)
236- `IPythonConsole.ipython_useSVG` - Use SVG (True) or PNG (False)
237- `IPythonConsole.molSize` - Default molecule image size

IPython Integration

  • from rdkit.Chem.Draw import IPythonConsole - Optional Jupyter integration (requires IPython)
  • IPythonConsole.ipython_useSVG - Use SVG (True) or PNG (False)
  • IPythonConsole.molSize - Default molecule image size
Raw lines 233 to 238
239### Drawing Options
241- `rdMolDraw2D.MolDrawOptions()` - Get drawing options object
242 - `.addAtomIndices` - Show atom indices
243 - `.addBondIndices` - Show bond indices
244 - `.addStereoAnnotation` - Show stereochemistry
245 - `.bondLineWidth` - Line width
246 - `.highlightBondWidthMultiplier` - Highlight width
247 - `.minFontSize` - Minimum font size
248 - `.maxFontSize` - Maximum font size

Drawing Options

  • rdMolDraw2D.MolDrawOptions() - Get drawing options object
  • .addAtomIndices - Show atom indices
  • .addBondIndices - Show bond indices
  • .addStereoAnnotation - Show stereochemistry
  • .bondLineWidth - Line width
  • .highlightBondWidthMultiplier - Highlight width
  • .minFontSize - Minimum font size
  • .maxFontSize - Maximum font size
Raw lines 239 to 249
250## rdkit.Chem.rdMolDescriptors
252Additional descriptor calculations.
254- `rdMolDescriptors.CalcNumRings(mol)` - Number of rings
255- `rdMolDescriptors.CalcNumAromaticRings(mol)` - Aromatic rings
256- `rdMolDescriptors.CalcNumAliphaticRings(mol)` - Aliphatic rings
257- `rdMolDescriptors.CalcNumSaturatedRings(mol)` - Saturated rings
258- `rdMolDescriptors.CalcNumHeterocycles(mol)` - Heterocycles
259- `rdMolDescriptors.CalcNumAromaticHeterocycles(mol)` - Aromatic heterocycles
260- `rdMolDescriptors.CalcNumSpiroAtoms(mol)` - Spiro atoms
261- `rdMolDescriptors.CalcNumBridgeheadAtoms(mol)` - Bridgehead atoms
262- `rdMolDescriptors.CalcFractionCSP3(mol)` - Fraction of sp3 carbons
263- `rdMolDescriptors.CalcLabuteASA(mol)` - Labute accessible surface area
264- `rdMolDescriptors.CalcTPSA(mol)` - TPSA
265- `rdMolDescriptors.CalcMolFormula(mol)` - Molecular formula

rdkit.Chem.rdMolDescriptors

Additional descriptor calculations.

  • rdMolDescriptors.CalcNumRings(mol) - Number of rings
  • rdMolDescriptors.CalcNumAromaticRings(mol) - Aromatic rings
  • rdMolDescriptors.CalcNumAliphaticRings(mol) - Aliphatic rings
  • rdMolDescriptors.CalcNumSaturatedRings(mol) - Saturated rings
  • rdMolDescriptors.CalcNumHeterocycles(mol) - Heterocycles
  • rdMolDescriptors.CalcNumAromaticHeterocycles(mol) - Aromatic heterocycles
  • rdMolDescriptors.CalcNumSpiroAtoms(mol) - Spiro atoms
  • rdMolDescriptors.CalcNumBridgeheadAtoms(mol) - Bridgehead atoms
  • rdMolDescriptors.CalcFractionCSP3(mol) - Fraction of sp3 carbons
  • rdMolDescriptors.CalcLabuteASA(mol) - Labute accessible surface area
  • rdMolDescriptors.CalcTPSA(mol) - TPSA
  • rdMolDescriptors.CalcMolFormula(mol) - Molecular formula
Raw lines 250 to 266
267## rdkit.Chem.Scaffolds
269Scaffold analysis.

rdkit.Chem.Scaffolds

Scaffold analysis.

Raw lines 267 to 270
271### Murcko Scaffolds
273- `MurckoScaffold.GetScaffoldForMol(mol)` - Get Murcko scaffold
274- `MurckoScaffold.MakeScaffoldGeneric(mol)` - Generic scaffold
275- `Chem.MurckoDecompose(mol)` - Return scaffold molecule (not scaffold/sidechain tuple)

Murcko Scaffolds

  • MurckoScaffold.GetScaffoldForMol(mol) - Get Murcko scaffold
  • MurckoScaffold.MakeScaffoldGeneric(mol) - Generic scaffold
  • Chem.MurckoDecompose(mol) - Return scaffold molecule (not scaffold/sidechain tuple)
Raw lines 271 to 276
277## rdkit.Chem.rdMolHash
279Molecular hashing and standardization.
281- `rdMolHash.MolHash(mol, hashFunction)` - Generate hash
282 - `rdMolHash.HashFunction.AnonymousGraph` - Anonymized structure
283 - `rdMolHash.HashFunction.CanonicalSmiles` - Canonical SMILES
284 - `rdMolHash.HashFunction.ElementGraph` - Element graph
285 - `rdMolHash.HashFunction.MurckoScaffold` - Murcko scaffold
286 - `rdMolHash.HashFunction.Regioisomer` - Regioisomer abstraction (cuts selected bonds; not a general stereo-removal hash)
287 - `rdMolHash.HashFunction.NetCharge` - Net charge
288 - `rdMolHash.HashFunction.HetAtomProtomer` - Heteroatom protomer
289 - `rdMolHash.HashFunction.HetAtomTautomer` - Heteroatom tautomer

rdkit.Chem.rdMolHash

Molecular hashing and standardization.

  • rdMolHash.MolHash(mol, hashFunction) - Generate hash
  • rdMolHash.HashFunction.AnonymousGraph - Anonymized structure
  • rdMolHash.HashFunction.CanonicalSmiles - Canonical SMILES
  • rdMolHash.HashFunction.ElementGraph - Element graph
  • rdMolHash.HashFunction.MurckoScaffold - Murcko scaffold
  • rdMolHash.HashFunction.Regioisomer - Regioisomer abstraction (cuts selected bonds; not a general stereo-removal hash)
  • rdMolHash.HashFunction.NetCharge - Net charge
  • rdMolHash.HashFunction.HetAtomProtomer - Heteroatom protomer
  • rdMolHash.HashFunction.HetAtomTautomer - Heteroatom tautomer
Raw lines 277 to 290
291## rdkit.Chem.MolStandardize
293Molecule standardization.
295Import the current standardization implementation from `rdkit.Chem.MolStandardize`:
297```python
298from rdkit.Chem.MolStandardize import rdMolStandardize
299```
301- `rdMolStandardize.Normalize(mol)` - Normalize functional groups
302- `rdMolStandardize.Reionize(mol)` - Apply acid/base charge-placement rules, not a pH model
303- `rdMolStandardize.RemoveFragments(mol)` - Remove fragments matching configured rules
304- `rdMolStandardize.Cleanup(mol)` - Remove H, disconnect metals, normalize, reionize, assign stereo; retains disconnected salts
305- `rdMolStandardize.FragmentParent(mol)` - Cleanup then select a fragment; explicit policy that discards components
306- `rdMolStandardize.Uncharger()` - Create uncharger object
307 - `.uncharge(mol)` - Neutralize eligible sites; permanent charges can remain
308- `rdMolStandardize.TautomerEnumerator()` - Enumerate tautomers
309 - `.Enumerate(mol)` - Generate tautomers
310 - `.Canonicalize(mol)` - Get canonical tautomer
312Canonical tautomer scoring is deterministic under its rules, not a prediction of
313the dominant solution tautomer. Enumeration may stop at configured limits and can
314remove stereo at tautomerizing sites; inspect the result status.

rdkit.Chem.MolStandardize

Molecule standardization.

Import the current standardization implementation from rdkit.Chem.MolStandardize:

from rdkit.Chem.MolStandardize import rdMolStandardize
  • rdMolStandardize.Normalize(mol) - Normalize functional groups
  • rdMolStandardize.Reionize(mol) - Apply acid/base charge-placement rules, not a pH model
  • rdMolStandardize.RemoveFragments(mol) - Remove fragments matching configured rules
  • rdMolStandardize.Cleanup(mol) - Remove H, disconnect metals, normalize, reionize, assign stereo; retains disconnected salts
  • rdMolStandardize.FragmentParent(mol) - Cleanup then select a fragment; explicit policy that discards components
  • rdMolStandardize.Uncharger() - Create uncharger object
  • .uncharge(mol) - Neutralize eligible sites; permanent charges can remain
  • rdMolStandardize.TautomerEnumerator() - Enumerate tautomers
  • .Enumerate(mol) - Generate tautomers
  • .Canonicalize(mol) - Get canonical tautomer

Canonical tautomer scoring is deterministic under its rules, not a prediction of the dominant solution tautomer. Enumeration may stop at configured limits and can remove stereo at tautomerizing sites; inspect the result status.

Raw lines 291 to 315
316## rdkit.DataStructs
318Fingerprint similarity and operations.

rdkit.DataStructs

Fingerprint similarity and operations.

Raw lines 316 to 319
320### Similarity Metrics
322- `DataStructs.TanimotoSimilarity(fp1, fp2)` - Tanimoto coefficient
323- `DataStructs.DiceSimilarity(fp1, fp2)` - Dice coefficient
324- `DataStructs.CosineSimilarity(fp1, fp2)` - Cosine similarity
325- `DataStructs.SokalSimilarity(fp1, fp2)` - Sokal similarity
326- `DataStructs.KulczynskiSimilarity(fp1, fp2)` - Kulczynski similarity
327- `DataStructs.McConnaugheySimilarity(fp1, fp2)` - McConnaughey similarity

Similarity Metrics

  • DataStructs.TanimotoSimilarity(fp1, fp2) - Tanimoto coefficient
  • DataStructs.DiceSimilarity(fp1, fp2) - Dice coefficient
  • DataStructs.CosineSimilarity(fp1, fp2) - Cosine similarity
  • DataStructs.SokalSimilarity(fp1, fp2) - Sokal similarity
  • DataStructs.KulczynskiSimilarity(fp1, fp2) - Kulczynski similarity
  • DataStructs.McConnaugheySimilarity(fp1, fp2) - McConnaughey similarity
Raw lines 320 to 328
329### Bulk Operations
331- `DataStructs.BulkTanimotoSimilarity(fp, fps)` - Tanimoto for list of fingerprints
332- `DataStructs.BulkDiceSimilarity(fp, fps)` - Dice for list
333- `DataStructs.BulkCosineSimilarity(fp, fps)` - Cosine for list

Bulk Operations

  • DataStructs.BulkTanimotoSimilarity(fp, fps) - Tanimoto for list of fingerprints
  • DataStructs.BulkDiceSimilarity(fp, fps) - Dice for list
  • DataStructs.BulkCosineSimilarity(fp, fps) - Cosine for list
Raw lines 329 to 334
335### Distance Metrics
337- `1 - DataStructs.TanimotoSimilarity(fp1, fp2)` - Tanimoto distance
338- `1 - DataStructs.DiceSimilarity(fp1, fp2)` - Dice distance

Distance Metrics

  • 1 - DataStructs.TanimotoSimilarity(fp1, fp2) - Tanimoto distance
  • 1 - DataStructs.DiceSimilarity(fp1, fp2) - Dice distance
Raw lines 335 to 339
340## rdkit.Chem.AtomPairs
342Atom pair fingerprints.
344- `Pairs.GetAtomPairFingerprint(mol, minLength=1, maxLength=30)` - Atom pair fingerprint
345- `Pairs.GetAtomPairFingerprintAsBitVect(mol)` - As bit vector
346- `Pairs.GetHashedAtomPairFingerprint(mol, nBits=2048, minLength=1, maxLength=30)` - Hashed version

rdkit.Chem.AtomPairs

Atom pair fingerprints.

  • Pairs.GetAtomPairFingerprint(mol, minLength=1, maxLength=30) - Atom pair fingerprint
  • Pairs.GetAtomPairFingerprintAsBitVect(mol) - As bit vector
  • Pairs.GetHashedAtomPairFingerprint(mol, nBits=2048, minLength=1, maxLength=30) - Hashed version
Raw lines 340 to 347
348## rdkit.Chem.AtomPairs.Torsions
350Topological torsion fingerprints.
352- `Torsions.GetTopologicalTorsionFingerprint(mol, targetSize=4)` - Torsion fingerprint
353- `Torsions.GetTopologicalTorsionFingerprintAsIntVect(mol, targetSize=4)` - As int vector
354- `Torsions.GetHashedTopologicalTorsionFingerprint(mol, nBits=2048, targetSize=4)` - Hashed version

rdkit.Chem.AtomPairs.Torsions

Topological torsion fingerprints.

  • Torsions.GetTopologicalTorsionFingerprint(mol, targetSize=4) - Torsion fingerprint
  • Torsions.GetTopologicalTorsionFingerprintAsIntVect(mol, targetSize=4) - As int vector
  • Torsions.GetHashedTopologicalTorsionFingerprint(mol, nBits=2048, targetSize=4) - Hashed version
Raw lines 348 to 355
356## rdkit.Chem.MACCSkeys
358MACCS structural keys.
360- `MACCSkeys.GenMACCSKeys(mol)` - Generate 167-bit vector (166 keys; bit 0 unused)

rdkit.Chem.MACCSkeys

MACCS structural keys.

  • MACCSkeys.GenMACCSKeys(mol) - Generate 167-bit vector (166 keys; bit 0 unused)
Raw lines 356 to 361
362## rdkit.Chem.ChemicalFeatures
364Pharmacophore features.
366- `ChemicalFeatures.BuildFeatureFactory(featureFile)` - Create feature factory
367- `factory.GetFeaturesForMol(mol)` - Get pharmacophore features
368- `feature.GetFamily()` - Feature family (Donor, Acceptor, etc.)
369- `feature.GetType()` - Feature type
370- `feature.GetAtomIds()` - Atoms involved in feature

rdkit.Chem.ChemicalFeatures

Pharmacophore features.

  • ChemicalFeatures.BuildFeatureFactory(featureFile) - Create feature factory
  • factory.GetFeaturesForMol(mol) - Get pharmacophore features
  • feature.GetFamily() - Feature family (Donor, Acceptor, etc.)
  • feature.GetType() - Feature type
  • feature.GetAtomIds() - Atoms involved in feature
Raw lines 362 to 371
372## rdkit.ML.Cluster.Butina
374Clustering algorithms.
376- `Butina.ClusterData(distances, nPts, distThresh, isDistData=True)` - Butina clustering
377 - Returns tuple of tuples with cluster members

rdkit.ML.Cluster.Butina

Clustering algorithms.

  • Butina.ClusterData(distances, nPts, distThresh, isDistData=True) - Butina clustering
  • Returns tuple of tuples with cluster members
Raw lines 372 to 378
379## rdkit.Chem.rdFingerprintGenerator
381Modern fingerprint generation API. Prefer this over legacy `AllChem.GetMorganFingerprint*` helpers for new code.
383- `rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048, includeChirality=False)` - Explicit radius 2; upstream default radius is 3
384- `rdFingerprintGenerator.GetRDKitFPGenerator(minPath=1, maxPath=7, fpSize=2048)` - RDKit FP generator
385- `rdFingerprintGenerator.GetAtomPairGenerator(minDistance=1, maxDistance=30)` - Atom pair generator
386- `rdFingerprintGenerator.GetTopologicalTorsionGenerator(fpSize=2048)` - Topological torsion generator
387- `generator.GetFingerprint(mol)` - Generate fingerprint
388- `generator.GetCountFingerprint(mol)` - Count-based fingerprint
389- `rdFingerprintGenerator.AdditionalOutput()` - Collect bit information for visualization and explanations

rdkit.Chem.rdFingerprintGenerator

Modern fingerprint generation API. Prefer this over legacy AllChem.GetMorganFingerprint* helpers for new code.

  • rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048, includeChirality=False) - Explicit radius 2; upstream default radius is 3
  • rdFingerprintGenerator.GetRDKitFPGenerator(minPath=1, maxPath=7, fpSize=2048) - RDKit FP generator
  • rdFingerprintGenerator.GetAtomPairGenerator(minDistance=1, maxDistance=30) - Atom pair generator
  • rdFingerprintGenerator.GetTopologicalTorsionGenerator(fpSize=2048) - Topological torsion generator
  • generator.GetFingerprint(mol) - Generate fingerprint
  • generator.GetCountFingerprint(mol) - Count-based fingerprint
  • rdFingerprintGenerator.AdditionalOutput() - Collect bit information for visualization and explanations
Raw lines 379 to 390
391## Common Parameters

Common Parameters

Raw lines 391 to 392
393### Sanitization Operations
395- `SANITIZE_NONE` - No sanitization
396- `SANITIZE_ALL` - All operations (default)
397- `SANITIZE_CLEANUP` - Basic cleanup
398- `SANITIZE_PROPERTIES` - Calculate properties
399- `SANITIZE_SYMMRINGS` - Symmetrize rings
400- `SANITIZE_KEKULIZE` - Kekulize aromatic rings
401- `SANITIZE_FINDRADICALS` - Find radical electrons
402- `SANITIZE_SETAROMATICITY` - Set aromaticity
403- `SANITIZE_SETCONJUGATION` - Set conjugation
404- `SANITIZE_SETHYBRIDIZATION` - Set hybridization
405- `SANITIZE_CLEANUPCHIRALITY` - Cleanup chirality

Sanitization Operations

  • SANITIZE_NONE - No sanitization
  • SANITIZE_ALL - All operations (default)
  • SANITIZE_CLEANUP - Basic cleanup
  • SANITIZE_PROPERTIES - Calculate properties
  • SANITIZE_SYMMRINGS - Symmetrize rings
  • SANITIZE_KEKULIZE - Kekulize aromatic rings
  • SANITIZE_FINDRADICALS - Find radical electrons
  • SANITIZE_SETAROMATICITY - Set aromaticity
  • SANITIZE_SETCONJUGATION - Set conjugation
  • SANITIZE_SETHYBRIDIZATION - Set hybridization
  • SANITIZE_CLEANUPCHIRALITY - Cleanup chirality
Raw lines 393 to 406
407### Bond Types
409- `BondType.SINGLE` - Single bond
410- `BondType.DOUBLE` - Double bond
411- `BondType.TRIPLE` - Triple bond
412- `BondType.AROMATIC` - Aromatic bond
413- `BondType.DATIVE` - Dative bond
414- `BondType.UNSPECIFIED` - Unspecified

Bond Types

  • BondType.SINGLE - Single bond
  • BondType.DOUBLE - Double bond
  • BondType.TRIPLE - Triple bond
  • BondType.AROMATIC - Aromatic bond
  • BondType.DATIVE - Dative bond
  • BondType.UNSPECIFIED - Unspecified
Raw lines 407 to 415
416### Hybridization
418- `HybridizationType.S` - S
419- `HybridizationType.SP` - SP
420- `HybridizationType.SP2` - SP2
421- `HybridizationType.SP3` - SP3
422- `HybridizationType.SP3D` - SP3D
423- `HybridizationType.SP3D2` - SP3D2

Hybridization

  • HybridizationType.S - S
  • HybridizationType.SP - SP
  • HybridizationType.SP2 - SP2
  • HybridizationType.SP3 - SP3
  • HybridizationType.SP3D - SP3D
  • HybridizationType.SP3D2 - SP3D2
Raw lines 416 to 424
425### Chirality
427- `ChiralType.CHI_UNSPECIFIED` - Unspecified
428- `ChiralType.CHI_TETRAHEDRAL_CW` - Clockwise
429- `ChiralType.CHI_TETRAHEDRAL_CCW` - Counter-clockwise

Chirality

  • ChiralType.CHI_UNSPECIFIED - Unspecified
  • ChiralType.CHI_TETRAHEDRAL_CW - Clockwise
  • ChiralType.CHI_TETRAHEDRAL_CCW - Counter-clockwise
Raw lines 425 to 430
431## Installation
433```bash
434# Existing uv/pip environment
435uv pip install "rdkit==2026.3.6"
437# Fresh conda-forge environment (upstream recommendation)
438conda create -c conda-forge -n my-rdkit-env rdkit
439```
441The PyPI package is now `rdkit`; `rdkit-pypi` is the legacy name for older releases.

Installation

# Existing uv/pip environment
uv pip install "rdkit==2026.3.6"

# Fresh conda-forge environment (upstream recommendation)
conda create -c conda-forge -n my-rdkit-env rdkit

The PyPI package is now rdkit; rdkit-pypi is the legacy name for older releases.

Raw lines 431 to 442
443## Importing
445```python
446# Core functionality
447from rdkit import Chem
448from rdkit.Chem import AllChem
450# Descriptors
451from rdkit.Chem import Descriptors
453# Drawing
454from rdkit.Chem import Draw
456# Similarity
457from rdkit import DataStructs
458```

Importing

# Core functionality
from rdkit import Chem
from rdkit.Chem import AllChem

# Descriptors
from rdkit.Chem import Descriptors

# Drawing
from rdkit.Chem import Draw

# Similarity
from rdkit import DataStructs
Raw lines 443 to 458