跳到正文
cccskills
免费在 GitHub 公开

rdkit

Use RDKit for molecular conformer generation, SMILES/InChI handling, molecular descriptors, fingerprints, and substructure searching. Python-based toolkit.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG星标 208(GitHub 208 + cccskills 0)

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md4.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

RDKit — Conformers and Molecular Representations

When to Use

  • User needs to generate multiple 3D conformers for a molecule
  • User wants to compute molecular fingerprints or descriptors
  • User needs SMILES canonicalization or InChI generation
  • User wants substructure matching or molecular similarity
  • User needs to embed a molecule and optimize geometry with MMFF94/UFF

Prerequisites

  1. RDKit installed (python -c "from rdkit import Chem; print(Chem.__version__)")

Workflow Steps

Conformer Generation

catgo_workflow_engine(action="add_task", params={
  "workflow_id": "wf_xxx",
  "task_type": "shell",
  "name": "rdkit_conf",
  "command": "python gen_conformers.py",
  "input_files": {
    "gen_conformers.py": "<script content>"
  },
  "system_name": "caffeine_conformers"
})

Script — Conformer Generation

from rdkit import Chem
from rdkit.Chem import AllChem, rdMolDescriptors

smiles = "CN1C=NC2=C1C(=O)N(C(=O)N2C)C"  # caffeine
mol = Chem.MolFromSmiles(smiles)
mol = Chem.AddHs(mol)

# Generate conformers
params = AllChem.ETKDGv3()
params.numThreads = 0  # use all cores
params.pruneRmsThresh = 0.5  # Angstrom RMSD pruning

cids = AllChem.EmbedMultipleConfs(mol, numConfs=50, params=params)
print(f"Generated {len(cids)} conformers")

# Optimize with MMFF94
results = AllChem.MMFFOptimizeMoleculeConfs(mol, numThreads=0)

# Sort by energy and write
energies = [(cid, res[1]) for cid, res in zip(cids, results) if res[0] == 0]
energies.sort(key=lambda x: x[1])

writer = Chem.SDWriter("conformers.sdf")
for cid, energy in energies[:20]:  # top 20 lowest energy
    mol.SetProp("Energy_kcal/mol", f"{energy:.2f}")
    writer.write(mol, confId=cid)
writer.close()

Script — Molecular Descriptors

from rdkit import Chem
from rdkit.Chem import Descriptors, rdMolDescriptors

mol = Chem.MolFromSmiles("CCO")

print(f"MW:       {Descriptors.MolWt(mol):.2f}")
print(f"LogP:     {Descriptors.MolLogP(mol):.2f}")
print(f"HBD:      {rdMolDescriptors.CalcNumHBD(mol)}")
print(f"HBA:      {rdMolDescriptors.CalcNumHBA(mol)}")
print(f"TPSA:     {Descriptors.TPSA(mol):.2f}")
print(f"RotBonds: {Descriptors.NumRotatableBonds(mol)}")

Script — Fingerprints and Similarity

from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem

mol1 = Chem.MolFromSmiles("c1ccccc1")  # benzene
mol2 = Chem.MolFromSmiles("c1ccncc1")  # pyridine

fp1 = AllChem.GetMorganFingerprintAsBitVect(mol1, radius=2, nBits=2048)
fp2 = AllChem.GetMorganFingerprintAsBitVect(mol2, radius=2, nBits=2048)

tanimoto = DataStructs.TanimotoSimilarity(fp1, fp2)
print(f"Tanimoto similarity: {tanimoto:.3f}")

Script — SMILES to XYZ

from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.MolFromSmiles("CCO")
mol = Chem.AddHs(mol)
AllChem.EmbedMolecule(mol, AllChem.ETKDGv3())
AllChem.MMFFOptimizeMolecule(mol)

# Write XYZ
conf = mol.GetConformer()
symbols = [a.GetSymbol() for a in mol.GetAtoms()]
coords = conf.GetPositions()

with open("molecule.xyz", "w") as f:
    f.write(f"{len(symbols)}\n")
    f.write("Generated by RDKit\n")
    for sym, (x, y, z) in zip(symbols, coords):
        f.write(f"{sym} {x:.6f} {y:.6f} {z:.6f}\n")

Parameter Guidance

ParameterTypical valueNotes
numConfs50-200More for flexible molecules
pruneRmsThresh0.5 AngRemove near-duplicate conformers
MMFF94 vs UFFMMFF94 preferredUFF as fallback for metals
Morgan radius2ECFP4 equivalent
nBits2048Fingerprint length

Common Pitfalls

  1. Forgetting AddHs — RDKit molecules from SMILES have implicit H. Call Chem.AddHs() before 3D embedding.
  2. Embedding failure — EmbedMolecule returns -1 on failure. Check return value; retry with useRandomCoords=True.
  3. MMFF94 unsupported atoms — MMFF94 does not cover all elements. Use UFF for organometallics.
  4. Stereo loss — ensure SMILES include stereochemistry (/, \, @, @@) if relevant.
  5. Large flexible molecules — conformer generation for molecules with >10 rotatable bonds needs many conformers (200+).
  6. Sanitization errors — invalid SMILES cause MolFromSmiles to return None. Always check for None.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

abinit

免费

Generate and manage ABINIT DFT calculations. Use when the user requests ABINIT, or needs DFPT phonons, GW calculations, or BSE optical spectra.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

Use when the user asks to place an adsorbate molecule on a surface, find adsorption sites, or set up a surface+adsorbate model for DFT.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

Use when the user asks for adsorption energy, binding energy, or wants to compare how strongly a molecule binds to a surface.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

Use when the user asks to analyze computational results: Gibbs free energy, OER/HER/CO2RR overpotentials, adsorption energy, convergence tests, DOS/d-band analysis, or Bader charge analysis.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

Use AmberTools antechamber for molecular force field parameterization. Generates GAFF/GAFF2 parameters and AM1-BCC or RESP charges for use in AMBER or LAMMPS classical MD simulations.

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

atom-ops

免费

One-shot recipes for adding, deleting, moving, and replacing individual atoms in the active CatGo viewer structure. Use whenever the user asks to "add an atom", "delete atoms", "remove this atom", "move atom N", "replace H with Li", or any single-atom edit — including "add a hydrogen on top of atom 12" / "delete atoms 5–9" / "swap the oxygen at site 3 for fluorine". Skips the discovery loop (no need to list structure tools or check adsorption sites first); goes straight to the matching `catgo_structure` action. Triggers in Chinese on 加原子, 删原子, 减原子, 移动原子, 替换原子, 增加氢, 删除氧, 把 ... 换成 ....

中文简介正在准备中。当前显示原文说明。

Hello-QM/catgo-LRG2082026年10月23日 更新

查看 Hello-QM 的全部技能

报告此技能的问题