rdkit
- Repo stars 39
- Author updated Live
- Author repo awesome-omni-skill
- Domain
- Other
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @diegosouzapw · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- Python
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: rdkit
description: Modern RDKit workflows for cheminformatics, including molecular fingerprints, drawing, and prope…
category: other
runtime: Python
---
# rdkit output preview
## PART A: Task fit
- Use case: Modern RDKit workflows for cheminformatics, including molecular fingerprints, drawing, and property calculations. Use when working with molecules, SMILES, molecular fingerprints (Morgan, ECFP, RDKit, atom pairs, topological torsions), molecule visualization/drawing, substructure search, or chemical property calculations. This skill provides up-to-date syntax patterns as RDKit's API evolves..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Installation / Core Imports / Molecule I/O” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Modern RDKit workflows for cheminformatics, including molecular fingerprints, drawing, and property calculations. Use when working with molecules, SMILES, molecular fingerprints (Morgan, ECFP, RDKit, atom pairs, topological torsions), molecule visualization/drawing, substructure search, or chemical property calculations. This skill provides up-to-date syntax patterns as RDKit's API evolves.”.
- **02** When the source has headings, the agent prioritizes “Installation / Core Imports / Molecule I/O” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “Installation / Core Imports / Molecule I/O”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: rdkit
description: Modern RDKit workflows for cheminformatics, including molecular fingerprints, drawing, and prope…
category: other
source: diegosouzapw/awesome-omni-skill
---
# rdkit
## When to use
- Modern RDKit workflows for cheminformatics, including molecular fingerprints, drawing, and property calculations. Use…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Installation / Core Imports / Molecule I/O” and keep inference separate from source facts.
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "rdkit" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Installation / Core Imports / Molecule I/O
rules -> SKILL.md triggers / order / output contract
runtime -> Python | read files, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} RDKit Skill
This skill provides up-to-date RDKit patterns. LLMs often have outdated RDKit syntax — always follow the patterns here.
Installation
uv pip install rdkit
Core Imports
from rdkit import Chem
from rdkit.Chem import AllChem, Descriptors, Draw, rdFingerprintGenerator
from rdkit.Chem import rdDepictor
from rdkit import DataStructs
Molecule I/O
# From SMILES
mol = Chem.MolFromSmiles('CCO')
# From file
mol = Chem.MolFromMolFile('molecule.mol')
mols = [m for m in Chem.SDMolSupplier('molecules.sdf') if m is not None]
# To SMILES
smiles = Chem.MolToSmiles(mol)
Fingerprints — USE THE NEW API
CRITICAL: Use rdFingerprintGenerator module, NOT the old functions like GetMorganFingerprint().
See references/fingerprints.md for complete documentation.
Quick Reference
from rdkit.Chem import rdFingerprintGenerator
# Morgan/ECFP fingerprints (ECFP4 = radius 2)
mfpgen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)
# RDKit fingerprint
rdkgen = rdFingerprintGenerator.GetRDKitFPGenerator(fpSize=2048)
# Atom pairs
apgen = rdFingerprintGenerator.GetAtomPairGenerator(fpSize=2048)
# Topological torsions
ttgen = rdFingerprintGenerator.GetTopologicalTorsionGenerator(fpSize=2048)
# Generate fingerprints (same API for all types)
fp = mfpgen.GetFingerprint(mol) # bit vector
cfp = mfpgen.GetCountFingerprint(mol) # count vector
np_fp = mfpgen.GetFingerprintAsNumPy(mol) # numpy array
Drawing Molecules
Use MolDraw2DCairo or MolDraw2DSVG with drawOptions() for customization.
See references/drawing.md for complete documentation.
Quick Reference
from rdkit.Chem import Draw, rdDepictor
# Generate 2D coordinates
rdDepictor.Compute2DCoords(mol)
rdDepictor.StraightenDepiction(mol)
# Simple drawing
img = Draw.MolToImage(mol, size=(300, 300))
img.save('molecule.png')
# Customized drawing
d2d = Draw.MolDraw2DCairo(350, 300)
dopts = d2d.drawOptions()
dopts.addAtomIndices = True # show atom indices
d2d.DrawMolecule(mol)
d2d.FinishDrawing()
with open('molecule.png', 'wb') as f:
f.write(d2d.GetDrawingText())
# Grid of molecules
img = Draw.MolsToGridImage(mols, molsPerRow=4, subImgSize=(200, 200))
Molecular Properties
from rdkit.Chem import Descriptors
mw = Descriptors.MolWt(mol)
logp = Descriptors.MolLogP(mol)
hbd = Descriptors.NumHDonors(mol)
hba = Descriptors.NumHAcceptors(mol)
tpsa = Descriptors.TPSA(mol)
rotatable = Descriptors.NumRotatableBonds(mol)
Substructure Search
# SMARTS pattern matching
pattern = Chem.MolFromSmarts('[OH]')
matches = mol.GetSubstructMatches(pattern) # returns tuple of tuples
# Check if has substructure
has_oh = mol.HasSubstructMatch(pattern)
Similarity
Always specify which fingerprint when reporting similarity — different fingerprints give very different values for the same molecule pair (e.g., RDKit FP: 0.79 vs Morgan2: 0.43).
from rdkit import DataStructs
# Tanimoto similarity between two fingerprints
sim = DataStructs.TanimotoSimilarity(fp1, fp2)
# Bulk similarity (one vs many)
sims = DataStructs.BulkTanimotoSimilarity(fp1, [fp2, fp3, fp4])
Molecule Properties
# Get/set/check properties on molecules, atoms, bonds
mol.SetProp('name', 'aspirin')
mol.GetProp('name')
mol.HasProp('name')
mol.ClearProp('name')
# Typed getters/setters
mol.SetDoubleProp('score', 3.14)
mol.GetDoubleProp('score')
mol.SetIntProp('count', 42)
# Get all properties
mol.GetPropsAsDict() # {key: value, ...}
# Private props (start with _) hidden by default
mol.GetPropsAsDict(includePrivate=True)
Pickling Gotcha
Properties are lost by default when pickling/serializing:
from rdkit import Chem
# Enable property preservation
Chem.SetDefaultPickleProperties(Chem.PropertyPickleOptions.AllProps)
# Or per-molecule
binary = mol.ToBinary(Chem.PropertyPickleOptions.AllProps)
Parsing & Sanitization
Control chemistry perception during parsing. See references/parsing.md for details.
# Custom parsing without sanitization
params = Chem.SmilesParserParams()
params.sanitize = False
params.removeHs = False
mol = Chem.MolFromSmiles(smiles, params=params)
# Manual sanitization after preprocessing
Chem.SanitizeMol(mol)
Chem.AssignStereochemistry(mol, cleanIt=True, force=True)
Decide Fit First
Design Intent
How To Use It
Boundaries And Review