MoleculeSubstructure[mol,atoms,bonds]
represents the substructure in the molecule mol defined by given atoms and bonds.
MoleculeSubstructure[mol,atoms]
represents the substructure with the indicated atoms and any bonds between them.
MoleculeSubstructure
MoleculeSubstructure[mol,atoms,bonds]
represents the substructure in the molecule mol defined by given atoms and bonds.
MoleculeSubstructure[mol,atoms]
represents the substructure with the indicated atoms and any bonds between them.
Details
- MoleculeSubstructure is used to represent a given molecule pattern or functional group within the molecule.
- atoms should be a list of integers corresponding to the positions of the substructure atoms in AtomList[mol].
- bonds can be a list of integers corresponding to the positions of the substructure bonds in BondList[mol].
- bonds can also be entered as a list of atom index pairs, {{i,j},…} or as a list of bonds {Bond[{i,j},"type"],…}.
- Properties of a MoleculeSubstructure object ms can be obtained from ms["property"].
- A list of available properties can be obtained using ms["Properties"].
- Available properties include:
-
"Molecule" the parent molecule "AtomCount" number of substructure atoms "AtomIndices" indices of substructure atoms "AtomList" list of substructure atoms "BondCount" number of substructure bonds "BondIndices" indices of substructure bonds "BondList" list of substructure bonds "SMILES" SMILES string for substructure "SMARTS" SMARTS string for substructure
Examples
open all close allBasic Examples (2)
Create a molecule substructure by specifying a list of atom indices:
MoleculeSubstructure[Molecule[{"C", "C", "C", "C", "N", "S", "O", "O", "C", "C", "C", "C", "C", "C", "S", "C", "N", "C",
Atom["C", "HydrogenCount" -> 1], Atom["C", "HydrogenCount" -> 1], "C", "C", "C", "C", "C", "C",
"C", "N", "C", "O", "O", Atom["C", "HydrogenCo ... 32, "Direction" -> "Clockwise"],
Association["StereoType" -> "Tetrahedral", "ChiralCenter" -> 35,
"Direction" -> "Counterclockwise"], Association["StereoType" -> "Tetrahedral",
"ChiralCenter" -> 36, "Direction" -> "Clockwise"]}}], {9, 10, 11, 12, 13, 14}]MoleculePlot[%]Create a molecule substructure by specifying a list of atoms and a list of bonds:
MoleculeSubstructure[Molecule[{"C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "O", "O"},
{Bond[{1, 2}, "Aromatic"], Bond[{2, 3}, "Aromatic"], Bond[{3, 4}, "Aromatic"],
Bond[{4, 5}, "Aromatic"], Bond[{5, 6}, "Aromatic"], Bond[{6, 1}, "Aromatic"], ... 316665229797361}, {-1.501279914855957, -0.2655333366394044},
{-1.5020800857543946, -1.2655333366394044}, {-2.368479927062988, -1.7647333183288576},
{-2.3692800979614255, -2.7647333183288576}, {-3.2340799026489258, -1.2641333236694337}}}], {4, 5, 6, 10, 9, 8, 7, 1, 2, 3}, {Bond[{1, 2}, "Aromatic"], Bond[{2, 3}, "Aromatic"], Bond[{3, 4}, "Aromatic"], Bond[{4, 5}, "Aromatic"], Bond[{5, 6}, "Aromatic"], Bond[{1, 7}, "Aromatic"], Bond[{7, 8}, "Aromatic"], Bond[{8, 9}, "Aromatic"], Bond[{9, 10}, "Aromatic"], Bond[{10, 6}, "Aromatic"]}]Note that the bond between atoms 1 and 6 is not included in the substructure:
MoleculePlot[%]Scope (1)
Use MoleculeSubstructureCases to find all occurrences of a substructure within a molecule:
MoleculeSubstructureCases[Molecule[{"O", "C", Atom["C", "HydrogenCount" -> 1], "O", Atom["C", "HydrogenCount" -> 1],
Atom["C", "HydrogenCount" -> 1], Atom["C", "HydrogenCount" -> 1],
Atom["C", "HydrogenCount" -> 1], "F", "O", "O", "N", "C", "C", Atom["N", "HydrogenCou ... "Direction" -> "Clockwise"], Association["StereoType" -> "Tetrahedral",
"ChiralCenter" -> 7, "Direction" -> "Counterclockwise"],
Association["StereoType" -> "Tetrahedral", "ChiralCenter" -> 8,
"Direction" -> "Counterclockwise"]}}], MoleculePattern[{"N", "C", "C", "C", "C"}, {Bond[{1, 2}, _], Bond[{2, 3}, _], Bond[{3, 4}, _],
Bond[{4, 5}, _], Bond[{5, 1}, _]}]]Visualize the substructures in place:
MoleculePlot /@ %Properties & Relations (1)
To test if an expression is a valid molecule substructure, use MoleculeSubstructureQ:
MoleculeSubstructureQ[MoleculeSubstructure[1, 2]]Related Guides
History
Text
Wolfram Research (2026), MoleculeSubstructure, Wolfram Language function, https://reference.wolfram.com/language/ref/MoleculeSubstructure.html.
CMS
Wolfram Language. 2026. "MoleculeSubstructure." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MoleculeSubstructure.html.
APA
Wolfram Language. (2026). MoleculeSubstructure. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MoleculeSubstructure.html
BibTeX
@misc{reference.wolfram_2026_moleculesubstructure, author="Wolfram Research", title="{MoleculeSubstructure}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/MoleculeSubstructure.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_moleculesubstructure, organization={Wolfram Research}, title={MoleculeSubstructure}, year={2026}, url={https://reference.wolfram.com/language/ref/MoleculeSubstructure.html}, note=[Accessed: 12-June-2026]}