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.


  • 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:
  • IncludeHydrogensAutomaticwhether 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:

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 a carboxylic acid with multiple hydroxyl groups:

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  (2)

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:

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_2022_applyreaction, author="Wolfram Research", title="{ApplyReaction}", year="2022", howpublished="\url{}", note=[Accessed: 28-November-2022 ]}


@online{reference.wolfram_2022_applyreaction, organization={Wolfram Research}, title={ApplyReaction}, year={2022}, url={}, note=[Accessed: 28-November-2022 ]}