applies the pattern reaction rxn to the list of molecules mols, returning a single list of products.


returns up to n lists of products.


returns a single set of products, using mapi to map the atoms in the i^(th) molecule to the i^(th) reactant.


represents an operator form of ApplyReaction that can be applied to a list of molecules.

Details and Options

  • ApplyReaction works by finding occurrences of the reactant patterns present in the PatternReaction in the list of molecules and applying the transformation.
  • Pattern matching is performed in order; the first MoleculePattern in the pattern reaction is searched for in the first input Molecule.
  • ApplyReaction has the following option:
  • IncludeHydrogens Automaticwhether hydrogens should be included in the pattern matching
  • When supplied, the mapi should be an association of atom indices between the given reactant pattern and molecule.


open allclose all

Basic Examples  (3)

Apply an autoionization reaction to water:

Apply a reaction between an organic acid and base:

Apply the same reaction with the reactants reversed, treating histidine as the acid and alanine as the base:

Apply a reaction to convert an alkene to an alcohol:

Find matching "Chemical" entities for the products:

Scope  (4)

Create a pattern reaction for the DielsAlder reaction from a reaction SMARTS string:

Apply the pattern reaction to a diene and a dienophile:

ApplyReaction will remove duplicate results, but sometimes for combinatorial purposes you might want all possible matchings between the reactant patterns and the input molecules. This is possible by first using FindMoleculeSubstructure with the nondefault option OverlapsTrue to obtain the atom mappings:

Use these mappings as the third argument for ApplyReaction:

It is easy to see that only two of the results are unique:

React a radical chlorine atom with methane:

Define a reaction for an intermolecular esterification:

Apply the pattern reaction to a carboxylic acid and an alcohol:

Apply the pattern reaction to a carboxylic acid and an isotopically labeled alcohol:

Define a pattern reaction for an intramolecular esterification:

Form a lactone (cyclic ester) from a hydroxylated carboxylic acid:

Find all possible lactones from mevalonic acid, a carboxylic acid with multiple hydroxyl groups:

Use an atom mapping to restrict the result to the product with the six-membered ring (mevalonolactone):

Options  (1)

IncludeHydrogens  (1)

By default, hydrogen atoms are only included in the pattern matching when the pattern includes an explicit hydrogen:

Use IncludeHydrogensAll to ensure that Atom[_] will match hydrogen atoms:

Applications  (3)

Define a pattern reaction for acetylation:

Acetylate salicylic acid to form aspirin:

Exhaustively acetylate the sugar sucrose:

Synthesize phthalide from o-phthalaldehyde by applying a sequence of reactions:

A pattern reaction representing amide formation for peptides:

Generate molecules corresponding to the standard amino acids:

Generate a peptide from its amino acid sequence:

The result is equivalent to the one obtained from BioSequence:

Properties & Relations  (1)

The result of ApplyReaction depends on the order in which the reactant molecules are supplied:

Neat Examples  (3)

The benzidine rearrangement is a rearrangement reaction for making biaryl amines:

Use the benzidine rearrangement to make benzidine from hydrazobenzene:

The Ugi reaction is a typical example of a multicomponent reaction. Here is a three-component version:

Various local anesthetics can be synthesized using the Ugi reaction, depending on the starting materials used:

These correspond to the anesthetics lidocaine and prilocaine:

Define a pattern reaction for forming a glycosidic bond:

Generate the molecules for the and anomers of glucose's cyclic form:

Construct all possible disaccharides that can be made from the two anomers of glucose:

A molecule of the anomer of fructose's cyclic form:

Form sucrose from glucose and fructose using an atom mapping:

Wolfram Research (2022), ApplyReaction, Wolfram Language function,


Wolfram Research (2022), ApplyReaction, Wolfram Language function,


Wolfram Language. 2022. "ApplyReaction." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2022). ApplyReaction. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_applyreaction, author="Wolfram Research", title="{ApplyReaction}", year="2022", howpublished="\url{}", note=[Accessed: 21-September-2023 ]}


@online{reference.wolfram_2023_applyreaction, organization={Wolfram Research}, title={ApplyReaction}, year={2022}, url={}, note=[Accessed: 21-September-2023 ]}