How to Measure Distances and Display Interactions in PyMOL

Getting Started with PyMOL: Measuring Distances, Angles, and Visualizing Interactions

 

When analyzing your system, measuring key distances and angles is crucial in gaining a comprehensive understanding of your system, detecting important interactions, and tracking their changes along the course of your Molecular Dynamics (MD) simulations.

These measurements can provide a deeper understanding of the dynamics and structure of your system, helping you make informed decisions and progress in your research.

For this reason, among many other features, PyMOL also gives you built-in tools to measure distances and angles within your system, making it easier to obtain these valuable insights. These tools provide a convenient and efficient way to measure important parameters in your system.

In this article, I will guide you through the process of measuring distances and angles in PyMOL, both through the command line and the GUI. I’ll provide simple examples so you can get the hang of it and then you can customize the measurements for your own system.

 

 

Knowing the interactions between specific atoms in your system is crucial in analyzing your system of interest. PyMOL offers the ability to measure and display the distances, angles, and dihedrals between atoms, residues, or molecules.

As is often the case in PyMOL you can accomplish this action in two ways: through the GUI or the command line.

The first method is ideal when you see a pair of atoms in the interface and want to quickly measure their distance while the second approach is advantageous if you want to select certain atoms without knowing their exact location.

Let’s consider both of them.

 

Sometimes you just want a quick and dirty way to measure the distance between two atoms you identified in the structure. In such cases, you can use the PyMOL interface to select the atoms of interest and then proceed to measure the distance between them via the Wizard menu.

Drag your cursor to the upper menu bar: Wizard $\Rightarrow$ Measurement

You will be asked to pick two atoms (the selected atoms will be highlighted with pink boxes).

Once you are done a new object will be created (measure01). It will show the distance value (in Å) and a dotted line connecting the two atoms will be displayed in the interface. You can show it and hide it by simply clicking on it.

 

The distance value between C1 and C3 in a propane molecule displayed in PyMOL.

Distance between two atoms in PyMOL (2.3Å)

 

 

When you start a measurement process through the Wizard tool you will notice that In the bottom right a new Measurement Menu will appear. From there, you can handle the various measurements in your project.

One interesting thing you can do is to measure other bonded interactions such as angles and dihedrals by changing the Measurement Mode to Angles or Dihedrals.

To measure an angle you will need to pick three atoms. The angle value will be displayed in the interface.

 

The angle value between three atoms in a propane molecule displayed in PyMOL.

Angle between three atoms in PyMOL (108.5°)

 

Torsional angles are “1-4 interactions” therefore to measure them you will need to select four atoms:

 

The torsional value between four atoms in a propane molecule displayed in PyMOL.

Dihedral angle displayed in PyMOL (174.1°)

 

 

If you know of a specific interaction that might be important for your system then you can measure the distance by using the distance command.

You simply need to provide two selections, and it will output a new object showing the distances between them. Optionally, you can decide to only show the distances within a certain cutoff and to change the measurement mode.

To make this process efficient you will need to be practical with the selection algebra in PyMOL. You can find more info on PyMOL selections here.

1
distance name_object, sele_1, sele_2 (, cutoff, mode=X)
Syntax
  1. Select the distance command
  2. Specify the name for the newly created object that will hold the distances (name_object).
  3. Create the first selection (sele_1)
  4. The second one (sele_2)
Optional
  1. Set a cutoff distance in Å (cutoff). Only distances within this range will be added to the object.
  2. The distance tool has 5 modes that you can define with 0, 1, 2, 3, and 4. By default, PyMOL will give mode=0 where all the interatomic distances are shown. Other useful ones could be mode=2 (show only polar contacts) and mode=4 (show distance between centroids).

 

This will output a new object (name_object) displaying the distances between the two selections you specified. As you can imagine, you can get very creative with the command by playing with the selection tool. This gives you much more control over the measurement.

Now let’s explore some generic examples to give you a better understanding of how to use the distance command in PyMOL.

To measure the distance between two atoms in PyMOL you can specify their indices if you know them. For example, to measure the distance between atom 100 and atom 103 you can use:

1
distance distance_100_103, id 100, id 103

 

This will create a distance_100_103 object showing a dotted line connecting the two selected atoms and the distance in Å.

Note

If you don’t want to create a new object but just want to print the distance you can use the get_distance instead.

1
get_distance id X, id Y

 

Let’s say that you know of a key interaction between a specific atom (e.g., id 1000) and atoms in a certain residue (e.g., resi 120) in your system. To find out all the distances between them you can use:

1
distance atom_resid, id 1000, resi 120

 

The representation can get quite messy. If you want a clearer vision you can choose to show only the ones within 4Å:

1
distance atom_resid_4A, id 1000, resi 120, 4 

 

You can also use the distance command to show the distances between a ligand in your protein and a residue (or a set of residues in the binding site). For instance, if you have a generic ligand named LIG and you want to explore the possible interactions with a key residue (e.g., resi 118) you can use:

1
distance lig_res118, resn LIG, resi 118

 

As always, you can specify a cutoff of your choice (e.g., 3.5Å) after the selections:

1
distance lig_res118_cutoff, resn LIG, resi 118, 3.5

 

Another common analysis you may want to do is to select a group of residues (e.g., resi 118+119+120) that you know are important for the stabilization of the ligand in the binding site, and analyze which atoms are within a certain cutoff.

1
distance lig_bs, resn LIG, resi 118+119+120, 3.5

 

You can show the polar interactions (including Hydrogen bonds) between a ligand and a set of residues by activating mode=2 of the distance measurement.

Let’s say you have a ligand named LIG and a group of residues (e.g., resi 118+119+120) that you know are important for the stabilization of the ligand in the binding site. You can show the polar interactions between them like this:

1
distance polar, resn LIG, resi 118+119+120, mode=2 

 

Hydrogen bonds and polar interactions displayed in PyMOL.
 

If you would like to get a similar image I suggest you read:

 

To measure angles you can use the angle command which works similarly to the one we use to measure distances. However, here you will need three selections. Also in this case, being familiar with the selection algebra in PyMOL will be particularly helpful.

1
angle name_object, sele_1, sele_2, sele_3
Syntax
  1. Select the angle command
  2. Specify the name for the newly created object that will hold the angle (name_object).
  3. Create the first selection (sele_1)
  4. The second one (sele_2)
  5. The third one sele_3

 

To measure the angle between three atoms (e.g., 100, 200, 300):

1
angle angle_100_200_300, id 100, id 200, id 300

 

To measure the angle between the $C_{\alpha}$ in three different residues (100, 105, 110):

1
angle angle_ca, resi 100 and name CA, resi 105 and name CA,  resi 110 and name CA