Function Repository Resource:

MoleculeManipulate3D

Source Notebook

Interactively change bond lengths, bond angles and torsion angles

Contributed by: Jason Biggs

ResourceFunction["MoleculeManipulate3D"][mol]

creates a dynamic 3D plot of mol with controls for changing bond lengths, bond angles, and torsion angles.

Details

MoleculeManipulate3D displays a 3D plot where individual atoms can be selected by clicking on them, just as in AtomSelector3D.
Once a first atom is selected, click that atom again to deselect it or click any atom that is bonded to the first atom to select two atoms. Clicking anywhere else will not change the selection.
To grow the number of selected atoms it is always necessary that the new atom is bonded to the most recently selected atom. For three- and four-atom groups, the atoms need to be connected in a linear chain. Clicking any atom that is not bonded to the most recently selected atom will have no effect.
When two bonded atoms, ai and aj, are selected a slider will appear that will change the given bond length. All atoms attached to atom aj are moved. If the bond is part of a ring system the slider will not be enabled.
When three atoms, {ai,aj,ak} are selected a slider will appear which allows changing the given bond angle. All atoms attached to atom ak are moved. If both bonds are part of a ring system the slider will not be enabled.
When four atoms, {ai,aj,ak,al} are selected a slider will appear which allows changing the signed torsion angle between the plane made by the first three atoms and the plane made by the last three atoms. All atoms attached to atom al are moved. If the bond between atoms aj and ak is part of a ring system the slider will not be enabled.
It is often necessary to rotate the molecule or increase the size of the 3D graphic in order to select a particular atom, this action should be possible without changing the currently selected atoms.
Pressing the "copy molecule" button will place a copy of the input molecule with the current coordinates into the clipboard.

Examples

Basic Examples (1) 

Manipulate the 3D structure for a secondary alcohol:

In[1]:=
ResourceFunction["MoleculeManipulate3D"][
 Molecule["3-cyclohexyldecan-8-ol"]]
Out[1]=

Scope (3) 

Select two bonded atoms to change a bond length:

In[2]:=
ResourceFunction["MoleculeManipulate3D"][Molecule["methanol"]]
Out[2]=

Select three atoms to change a bond angle:

In[3]:=
ResourceFunction["MoleculeManipulate3D"][Molecule["methanol"]]
Out[3]=

Select four atoms to change a torsion angle:

In[4]:=
ResourceFunction["MoleculeManipulate3D"][Molecule["methanol"]]
Out[4]=

Possible Issues (1) 

It is always necessary to select the atoms in the correct order. In the following example the oxygen atom was selected first and then a hydrogen atom, and a slider is present for changing this O-H bond. It is not possible to select the third atom at this point because it is not bonded to the other hydrogen atom. To modify the H-O-H bond angle you must first clear the selection and start from one of the hydrogen atoms:

In[5]:=
ResourceFunction["MoleculeManipulate3D"][Molecule["water"]]
Out[5]=

Publisher

WolframChemistry

Requirements

Wolfram Language 13.1 (June 2022) or above

Version History

  • 1.0.0 – 03 January 2024

Related Resources

License Information