Message Boards Message Boards

Interactively manipulating molecule geometry

Posted 10 months ago

enter image description here

Version 12 of the Wolfram Language introduced the Molecule object type, which represents a molecule as a chemical graph with atoms, bond, stereochemistry, with specified 2D and 3D coordinates. The MoleculeModify function lets you programmatically alter the geometry via the "SetBondLength", "SetBondAngle", and "SetTorsionAngle" methods.

Now there is a function for modifying a molecule's 3D coordinates interactively: MoleculeManipulate3D - a part of the ChemistryFunctions paclet available from the Wolfram Language Paclet Repository.

To install the paclet use

PacletInstall["WolframChemistry/ChemistryFunctions"]

To load the paclet in a kernel session use

Needs["WolframChemistry`ChemistryFunctions`"]

Doing this will make all of the functions in the paclet available. Then use something simple like

m = Molecule["octane"];
MoleculeManipulate3D[m]

and you will see this dynamic output:

enter image description here

  1. 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.
  2. When two bonded atoms are selected a slider will appear that will change the given bond length. If the bond is part of a ring system the slider will not be enabled.
  3. When three atoms are selected a slider will appear which allows changing the given bond angle. If both bonds are part of a ring system the slider will not be enabled.
  4. When four atoms 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. If the bond between the second and third atoms is part of a ring system the slider will not be enabled.

Unfortunately the dynamics used in this function do not currently work in Wolfram Cloud notebooks.

POSTED BY: Jason Biggs

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract