returns a version of mol that is aligned with reference molecule ref.


aligns atoms in mol with index mi to the atoms in ref with index ri.


uses the molecule pattern patt to find an atom mapping between ref and mol.


aligns each of the moli with ref.


aligns the molecules and returns the property prop of the alignment.

Details and Options

  • MoleculeAlign returns a Molecule object with the AtomCoordinates option explicitly set.
  • The atom mapping {r1m1,r2m2,} can indicate a subset of the atoms, which will be aligned.
  • When at least three non-colinear atoms are included in the mapping, the alignment will be unique. When colinear atoms are provided, the orientation about that axis is undefined.
  • When no atom mapping is provided, ref must be present as a substructure in mol. If ref occurs multiple times, the first substructure match as found by FindMoleculeSubstructure is used.
  • When multiple molecules are aligned, the atom mapping can be provided in the form {r1{},r2{},} where the right-hand sides are lists of atom indices for each molecule to be aligned.
  • Multiple molecules can be aligned either pairwise to the reference molecule with MethodAutomatic or jointly to each other and the reference molecule with Method"JointRMS".
  • If ref does not contain 3D coordinates, they are generated automatically prior to alignment.
  • The following options can be specified:
  • Weights Automaticweights for the atomic positions
    Method Automaticthe method to use
  • prop can be one of the following:
  • "Molecule"the aligned molecules
    "Transformation"the transformation functions used
    "Error"the alignment root mean squared error


open allclose all

Basic Examples  (5)

Align one conformation of 2,3-dihydro-4-quinolone to another:

Align one conformation of water to another:

The coordinates have been rotated and translated into alignment with the reference:

Align two molecules:

Align two molecules with an explicit atom mapping:

Align two molecules using a MoleculePattern to determine the atom mapping:

Scope  (3)

MoleculeAlign can be used to align several conformers. Start by generating 10 conformations of adenosine with randomly oriented conformations:

Align the molecules and display them together:

Provide a pattern to specify which parts of the conformers should be aligned:

Menthol, a monoterpene, is a substructure of jujenol, a sesquiterpene. Here are the molecules:

Align jujenol to menthol:

Show the aligned result:

Align resveratrol, an endocrine disruptor, to estradiol, a hormone, using an explicitly specified atom mapping. Here are the molecules:

A utility function for visualizing the alignment:

Show the molecules together:

Align the phenol ring carbon atoms and two of the hydroxyl oxygen atoms of resveratrol to the A-ring carbon atoms and the two hydroxyl oxygen atoms of estradiol:

Show the aligned molecules:

Compute the RMS alignment error:

Options  (2)

Method  (1)

When aligning multiple molecules, the default method aligns each of the moving molecules pairwise with the reference molecule. Here are three conformations of butane:

The first has the anti conformation and will serve as the reference molecule. The other two are the gauche conformations. First align with the default pairwise method:

Here are the RMS deviations from the reference molecule:

Align the molecules simultaneously by minimizing the joint sum of squared deviations:

Note that the second and third molecules are now more closely aligned to each other, as well as to the reference molecule, than in the pairwise alignment.

Here is the joint RMS deviation:

Weights  (1)

Atom weights allow specified atoms to have more influence on the alignment. Here are three molecules to demonstrate this:

Here is the alignment with the default atom weights:

Increase the weight on the second atom:

Applications  (2)

Spironolactone is a drug that acts as an antagonist of the mineralocorticoid and androgen receptors, due to its similarity to the respective natural substrates aldosterone and testosterone. Generate molecules for spironolactone, aldosterone and testosterone:

Align the structure of spironolactone with that of aldosterone and visualize them together:

Align the structure of spironolactone with that of testosterone and visualize them together:

Classical anticonvulsant drugs have very similar structures. Here is a list of representatives of various classes of classical anticonvulsants:

Generate the molecules and find the lowest energy conformation of each:

Align the minimum energy conformations:

Visualize the different anticonvulsants together:

Wolfram Research (2021), MoleculeAlign, Wolfram Language function,


Wolfram Research (2021), MoleculeAlign, Wolfram Language function,


Wolfram Language. 2021. "MoleculeAlign." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2021). MoleculeAlign. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_moleculealign, author="Wolfram Research", title="{MoleculeAlign}", year="2021", howpublished="\url{}", note=[Accessed: 15-June-2024 ]}


@online{reference.wolfram_2024_moleculealign, organization={Wolfram Research}, title={MoleculeAlign}, year={2021}, url={}, note=[Accessed: 15-June-2024 ]}