Mouse Manual

From Jmol
Revision as of 12:39, 27 April 2015 by Hansonr (talk | contribs) (Allowing whole-molecule atom shifting and rotation)
Jump to navigation Jump to search
Jmol / JSmol Tutorials


Reference: English – Other: Español · Français · 日本語 ·

Manual for manipulating the molecules using the mouse in Jmol (also called 'mouse gestures')


  1. In the usual configuration, "main button" is the left button, and "secondary button" is the right button.
  2. Reportedly, on single-button mice Alt drag may be equivalent to drag with middle button.

main button middle button secondary button
(left) (middle) (right)
Open Jmol menu Ctrl + click
or click on 'Jmol' logo
Rotate around X,Y drag
Move along X,Y (= translate) Shift + double-click and drag double-click and drag Ctrl + drag
works both when clicking on the molecule or away from it
Reset and centre Shift + double-click* double-click*
*only works if double-click is done away from the molecule
Rotate around Z Shift + drag horizontally drag horizontally Shift + drag horizontally
(possibly fails in Mac's)
Zoom in / out Shift + drag vertically drag vertically
or use mouse wheel
Implemented only on Jmol 10.00.22 prerelease and later:
Only work after a slab on command has been issued
Slab (slab from front) Ctrl+Shift + drag (vertically) *
Depth (slab from back) Ctrl+Shift + double-click and drag (vertically) *
Shift the slab (change slab and depth maintaining constant thickness) Alt+Ctrl+Shift + drag (vertically) *
*if this fails on a Mac, try pressing the mouse button first, then the Ctrl Shift keys, then drag
Slab can be tested in this page

How to select

  • Use the appropriate picking command, e.g.

set picking group

to toggle selection for an entire amino acid by clicking on one of its atoms,
  • Click on an atom will toggle selection status.
  • Most useful while

set display selected

is set to monitor the selection status.

To toggle the selection status of individula atoms:
Using the menus:

  1. Jmol->Main Menu->Select->Selection Halos (This is optional but very helpful. It shows you which atoms are selected by plaing a golden ring around it.)
  2. Jmol->Main Menu->Select->None (Needed because "select all" is the default at load time. Notice the non-zero number in parenthesis after the word select in the main menu. That is the number of items currently selected.
  3. Jmol->Main Menu->Set picking->Select Atom

Now click an atom once to select, click again to deselect. The halos let me know the current selection state of each atom and the count in parenthesis after the Select in Jmol->Main Menu gives me a count of the number of atoms selected.

How to make measurements

  • Distance (2 atoms):
    1. double-click on the starting atom
    2. to fix a distance measurement, double-click on second atom
  • Angle (3 atoms):
    1. double-click on the starting atom
    2. click on the second atom (central atom in angle)
    3. to fix an angle measurement, double-click on third atom
  • Torsion angle or dihedral (4 atoms)
    1. double-click on the starting atom
    2. click on the second atom
    3. click on the third atom
    4. to fix a dihedral angle measurement, double-click on fourth atom
  • In all cases:
    • move pointer over destination atom in order to see measurement results without leaving a permanent measurement
    • move outside the window in order to cancel the measurement
    • make the same measurement again in order to delete the measurement

How to change atom coordinates

This section describes how to set up a Jmol applet or application so that users can move individual atoms within a model with the mouse.

By default, mouse-based transformations such as rotations and translations are applied to all atoms identically. All that is happening is that the view ("the tranformation matrix, (show transform)" is modified; the stored coordinates of the atoms are not changed. But Jmol can also be configured to allow users to move specific atoms or sets of atoms and store the changed coordinates permanently.

In situations where it is desired to allow users to change atom coordinates using the mouse, certain settings must be made. This section summarizes the rather complex mix of possible settings and some of the standard combinations that are particularly useful

Default settings

The five settings involved and their default values are given below.

set picking identify

set pickingStyle toggle

set dragSelected false

set allowRotateSelected false

set allowMoveAtoms false;

The names of these settings are not necessarily self-explanatory. set picking identify just means that when an atom is clicked, a message is posted to the Jmol console indicating the identity of the atom picked. set pickingStyle toggle specifies the overall standard Jmol mouse bindings (but see below for a "drag" option); set dragSelected false species, within that framework, what is to happen with simple left-mouse dragging. The two alllow... settings allow restricting atom motion in ways described below.

Allowing whole-molecule atom shifting and rotation

A common need is to enable users to translate and rotate whole molecules just by clicking on them and dragging. In this way, all intramolecular relationships remain the same, and bonds are not destroyed. This is enabled using

set dragSelected true

set allowRotateSelected true

The standard Jmol mouse operations are still present, but added to that set are alt-drag (rotating a molecule around its center of geometry) and alt-shift-drag (moving a molecule). In certain cases, it can be useful to turn off the rotation option. set allowRotateSelected false does that, disallowing rotation and making alt-drag the same as alt-shift-drag.

Allowing moving and rotating of specific atoms

It is not always desired to restrict atom coordinate changes to whole molecules (for example, when proteins with associated water molecules are involved.) But then we need some indication of which atoms are to be moved. This is done by a number of possible means.

selected atoms Perhaps the simplest is to use the currently selected atom set. This is done by adding set allowMoveAtoms true.

[Note: a design flaw and associated bug in Jmol prior to 14.3.13 results in the odd behavior that setting allowMoveAtoms surreptitiously also sets both dragSelected and allowRotateSelected to the same values internally (the design flaw) without indicating that (the bug). This has been very confusing and is fixed for future versions.]

Additional options

The table below summarizes additional options that involve how atoms are selected using special mouse settings. The following two settings are assumed:

set allowMoveAtoms TRUE

set allowRotateSelected TRUE

There are additional switches available that influence what can be done and how it can be done:

  1. set picking
  2. set pickingStyle
  3. set dragSelected

The table below summarizes information for three of the possible setting combinations (tested in Jmol 14.3.13).

Basic options:
Option Set 1: Option Set 2: Option Set 3:
Click Type Click Target Comment Click Type Click Target Comment Click Type Click Target Comment
Atom Movement (only selected atoms)
(along screen axes)
drag any atom drag any atom shift-alt-drag anywhere
(perpendicular to screen)
shift-drag any atom not available not available
rotate alt-drag any atom not available alt-drag anywhere
Atom Selection
select a single atom not available shift-drag around an unselected atom click an unselected atom
alt-drag around an atom double-click an atom other atoms are deselected
deselect a single atom not available shift-drag around a selected atom click a selected atom
select multiple atoms not available shift-drag around unselected atoms not available
alt-drag around atoms
deselect multiple atoms not available shift-drag around selected atoms not available

Option set 1 (+ basic options) totally disables mouse-based selection changes and enables all three movement types (x/y-shift, z-shift, rotate).

Option set 2 (+ basic options) enables mouse-based single/multiple atom selection changes and enables only one movement type (x/y-shift).

Option set 3 (+ basic options) enables mouse-based single atom selection changes and enables two movement types (x/y-shift, rotate).