MoleculeAlign
✖
MoleculeAlign
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 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 Automatic weights for the atomic positions Method Automatic the 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
Examples
open allclose allBasic Examples (5)Summary of the most common use cases
Align one conformation of 2,3-dihydro-4-quinolone to another:

https://wolfram.com/xid/0tp4bzxzgfm0g6-i5i9mn

Align one conformation of water to another:

https://wolfram.com/xid/0tp4bzxzgfm0g6-39kggb

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-r01niv


https://wolfram.com/xid/0tp4bzxzgfm0g6-bcw9q8

Align two molecules with an explicit atom mapping:

https://wolfram.com/xid/0tp4bzxzgfm0g6-s8ci20

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-rwllmj

Scope (3)Survey of the scope of standard use cases
MoleculeAlign can be used to align several conformers. Start by generating 10 conformations of adenosine with randomly oriented conformations:

https://wolfram.com/xid/0tp4bzxzgfm0g6-lskvqt

Align the molecules and display them together:

https://wolfram.com/xid/0tp4bzxzgfm0g6-wqrfz0

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-ji2yny

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-z026fr


https://wolfram.com/xid/0tp4bzxzgfm0g6-yp79nz


https://wolfram.com/xid/0tp4bzxzgfm0g6-ch9m08

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-cm7dql
A utility function for visualizing the alignment:

https://wolfram.com/xid/0tp4bzxzgfm0g6-ogakzx

https://wolfram.com/xid/0tp4bzxzgfm0g6-7aqmh

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:

https://wolfram.com/xid/0tp4bzxzgfm0g6-wpjte5


https://wolfram.com/xid/0tp4bzxzgfm0g6-ez6tr1

Compute the RMS alignment error:

https://wolfram.com/xid/0tp4bzxzgfm0g6-evvyjs

Options (2)Common values & functionality for each option
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:

https://wolfram.com/xid/0tp4bzxzgfm0g6-brrn5u

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:

https://wolfram.com/xid/0tp4bzxzgfm0g6-er0nar

Here are the RMS deviations from the reference molecule:

https://wolfram.com/xid/0tp4bzxzgfm0g6-v4tmcb

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-twl4ih

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:

https://wolfram.com/xid/0tp4bzxzgfm0g6-iy2pli

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-0x4yif

Here is the alignment with the default atom weights:

https://wolfram.com/xid/0tp4bzxzgfm0g6-htyedr

Increase the weight on the second atom:

https://wolfram.com/xid/0tp4bzxzgfm0g6-y9c8cl

Applications (2)Sample problems that can be solved with this function
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:

https://wolfram.com/xid/0tp4bzxzgfm0g6-ddfpxv

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-duqhnp

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-neo1i9

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

https://wolfram.com/xid/0tp4bzxzgfm0g6-si4bo
Generate the molecules and find the lowest energy conformation of each:

https://wolfram.com/xid/0tp4bzxzgfm0g6-d3awy7

Align the minimum energy conformations:

https://wolfram.com/xid/0tp4bzxzgfm0g6-6j3j9x
Visualize the different anticonvulsants together:

https://wolfram.com/xid/0tp4bzxzgfm0g6-fytqki

Wolfram Research (2021), MoleculeAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/MoleculeAlign.html.
Text
Wolfram Research (2021), MoleculeAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/MoleculeAlign.html.
Wolfram Research (2021), MoleculeAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/MoleculeAlign.html.
CMS
Wolfram Language. 2021. "MoleculeAlign." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MoleculeAlign.html.
Wolfram Language. 2021. "MoleculeAlign." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MoleculeAlign.html.
APA
Wolfram Language. (2021). MoleculeAlign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MoleculeAlign.html
Wolfram Language. (2021). MoleculeAlign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MoleculeAlign.html
BibTeX
@misc{reference.wolfram_2025_moleculealign, author="Wolfram Research", title="{MoleculeAlign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/MoleculeAlign.html}", note=[Accessed: 20-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_moleculealign, organization={Wolfram Research}, title={MoleculeAlign}, year={2021}, url={https://reference.wolfram.com/language/ref/MoleculeAlign.html}, note=[Accessed: 20-April-2025
]}