# Interactively manipulating molecule geometry

**URL:** <https://community.wolfram.com/t/interactively-manipulating-molecule-geometry/22360>\
**Category:** Staff Picks\
**Tags:** chemistry, wolfram-add-ons, graphics-and-visualization, interface-construction, packages-and-paclets, staff-pick\
**Created:** [July 12, 2023, 3:47pm UTC](https://community.wolfram.com/t/interactively-manipulating-molecule-geometry/22360 "2023-07-12T15:47:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonb](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jasonb/32/20741_2.png) [@jasonb](https://community.wolfram.com/u/jasonb)\
**Post date:** [July 12, 2023, 3:47pm UTC](https://community.wolfram.com/t/interactively-manipulating-molecule-geometry/22360/1 "2023-07-12T15:47:58Z")

</div>

![molecule_manipulate3D.gif](https://global.discourse-cdn.com/wolfram/original/2X/a/aaf3afb33fd6d41d2de7aec1dac46655f24f9218.gif)

Version 12 of the Wolfram Language introduced the [`Molecule`](https://reference.wolfram.com/language/ref/Molecule.html) object type, which represents a molecule as a chemical graph with atoms, bond, stereochemistry, with specified 2D and 3D coordinates. The [`MoleculeModify`](https://reference.wolfram.com/language/ref/MoleculeModify.html) 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](https://resources.wolframcloud.com/PacletRepository/resources/WolframChemistry/ChemistryFunctions/ref/MoleculeManipulate3D.html) - a part of the [ChemistryFunctions paclet](https://resources.wolframcloud.com/PacletRepository/resources/WolframChemistry/ChemistryFunctions/) available from the Wolfram Language Paclet Repository.

To install the paclet use

```auto
PacletInstall["WolframChemistry/ChemistryFunctions"]

```

To load the paclet in a kernel session use

```auto
Needs["WolframChemistry`ChemistryFunctions`"]

```

Doing this will make [all of the functions](https://resources.wolframcloud.com/PacletRepository/resources/WolframChemistry/ChemistryFunctions/guide/WolframChemistryFunctions.html) in the paclet available. Then use something simple like

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

```

and you will see this dynamic output:

 ![ScreenShot2023-07-12at10.42.59AM.png](https://global.discourse-cdn.com/wolfram/original/2X/6/685a1a4c20164a3afedd7bc4c20d772ed2f671c0.png)

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.

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [July 13, 2023, 3:47pm UTC](https://community.wolfram.com/t/interactively-manipulating-molecule-geometry/22360/2 "2023-07-13T15:47:05Z")

</div>

![news-congrads-kkluyshnik-02-04-19.jpg](https://global.discourse-cdn.com/wolfram/original/3X/6/a/6a310c2d0904616faf4e6e148260c9f29ab9f4eb.jpeg) – you have earned _ **Featured Contributor Badge** _ ![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)  
Your exceptional post has been selected for our editorial column _ **Staff Picks** _ [http://wolfr.am/StaffPicks](http://wolfr.am/StaffPicks) and [Your Profile](http://community.wolfram.com/web/jasonb) is now distinguished by a _ **Featured Contributor Badge** _ and is displayed on the [Featured Contributor Board](https://community.wolfram.com/people). Thank you!
