MoleculeSubstructureCount
Count occurrences of a molecular substructure.
MoleculeSubstructureCount[mol, patt] returns the number of times patt occurs as a substructure in mol.
MoleculeSubstructureCount[patt] is the operator form that can be applied to a molecule.
Examples
Count five-carbon chains in hexane:
pattern = MoleculePattern["CCCCC"];
MoleculeSubstructureCount[Molecule["hexane"], pattern]Apply the same query to several molecules:
MoleculeSubstructureCount[pattern] /@
(Molecule /@ {"pentane", "hexane", "heptane"})Use FindMoleculeSubstructure when the matching atom indices are also needed.
Something isn't working? Report an issue.
Please visit the official Wolfram Language Reference for more details.