finds a mapping between the atom indices in mol and an occurrence of patt in mol.


finds all occurrences of patt in mol and returns all mappings.


finds at most n mappings.

Details and Options

  • FindMoleculeSubstructure returns a list of associations Association[p1->m1,p2->m2,] where pi and mi are atom indices in patt and mol, respectively.
  • By default, substructure matches are pruned to remove multiple matches to the same set of atoms. Use the option Overlaps->True to disable this behavior.


open allclose all

Basic Examples  (2)

Find phenyl rings in a molecule:

Find all alcohol functional groups:

Scope  (4)

Use an atomic symbol string as a pattern:

Indicate charge or mass number in the atomic symbol:

Use Atom to make a more general pattern. Find all charged atoms:

Find positively charged atoms:

Find negatively charged atoms:

Use Bond to define a pattern for any double bond:

Find only double bonds with a nitrogen atom:

Find double bonds with a charged atom:

Applications  (1)

Write a function to locate the nitrogen and carbonyl carbon at the N-terminus of a protein:

Apply the function to a peptide:

Highlight the atoms in a 2D plot:

Wolfram Research (2019), FindMoleculeSubstructure, Wolfram Language function,


Wolfram Research (2019), FindMoleculeSubstructure, Wolfram Language function,


Wolfram Language. 2019. "FindMoleculeSubstructure." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2019). FindMoleculeSubstructure. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_findmoleculesubstructure, author="Wolfram Research", title="{FindMoleculeSubstructure}", year="2019", howpublished="\url{}", note=[Accessed: 17-June-2024 ]}


@online{reference.wolfram_2024_findmoleculesubstructure, organization={Wolfram Research}, title={FindMoleculeSubstructure}, year={2019}, url={}, note=[Accessed: 17-June-2024 ]}