协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
molecule-io-core【开发与工程】Use for RDKit molecule creation, file/string I/O, validation, sanitization, atom/bond/ring queries, substructure matching, hydrogens, and editable molecule workflows. Route descriptors/fingerprints, conformers/drawing, reactions/standardization, and R-group workflows to their dedicated RDKit sub-skills.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task asks an agent to parse, validate, inspect, edit, serialize, or round-trip RDKit molecules from SMILES, SMARTS, MolBlocks, SDF, or delimited SMILES files.
Chem.MolFromSmiles, Chem.MolFromSmarts, Chem.MolFromMolBlock, or supplier classes.Chem.MolToSmiles, Chem.MolToMolBlock, Chem.SDWriter, or Chem.SmilesWriter.None molecules downstream.Chem.RWMol or Chem.EditableMol and re-sanitize the result.descriptors-fingerprints.conformers-drawing.reactions-standardization.data-cli-integration.references/molecule-io.md for parsing, suppliers, writers, and round-trip patterns.references/sanitization-and-queries.md for sanitization, hydrogens, atom/bond/ring queries, substructure matching, and molecule editing.references/troubleshooting.md for common failures and safe recovery patterns.scripts/molecule_io_smoke.py for a tiny standalone smoke test that canonicalizes SMILES and round-trips SDF.None before doing any chemistry.Chem.MolToSmiles(mol, isomericSmiles=True) when comparing or de-duplicating molecules.None, and preserve molecule names/properties when writing SDF.sanitize=False, run a deliberate Chem.SanitizeMol step before relying on valence, aromaticity, rings, descriptors, or substructure behavior.GetMol(), update property cache if needed, then sanitize or report the sanitization failure.from rdkit import Chem
mol = Chem.MolFromSmiles("CC(=O)O")
if mol is None:
raise ValueError("invalid SMILES")
canonical = Chem.MolToSmiles(mol, isomericSmiles=True)
query = Chem.MolFromSmarts("[CX3](=O)[OX2H1]")
matches = mol.GetSubstructMatches(query)
edited = Chem.RWMol(mol)
atom_index = edited.AddAtom(Chem.Atom("Cl"))
edited.AddBond(0, atom_index, Chem.BondType.SINGLE)
new_mol = edited.GetMol()
Chem.SanitizeMol(new_mol)
Run the bundled helper in any environment where RDKit is importable:
python scripts/molecule_io_smoke.py --smiles "CCO" "c1ccccc1" --include-invalid
It asserts that valid SMILES parse, invalid SMILES are reported, canonical SMILES are stable after a second parse, and a tiny SDF round-trip preserves molecule count and properties.