MoleculePattern
Define a reusable pattern of atoms and bonds.
MoleculePattern[{atom1, atom2, ...}, {bond1, bond2, ...}] represents a molecular substructure pattern.
MoleculePattern[smarts] creates a pattern from a SMARTS string.
Examples
Define a sulfur–oxygen single-bond pattern:
sulfurOxygenBond = MoleculePattern[
{"S", "O"},
{Bond[{1, 2}, "Single"]}
]Highlight every matching substructure:
molecule = Molecule["4-methylbenzenesulfonic acid"];
MoleculePlot[molecule, sulfurOxygenBond]Create a pattern from SMARTS and count its occurrences:
chain = MoleculePattern["CCCCC"];
MoleculeSubstructureCount[Molecule["hexane"], chain]See Bond, FindMoleculeSubstructure, and MoleculeSubstructureCount.
Something isn't working? Report an issue.
Please visit the official Wolfram Language Reference for more details.