DISTANCE
This is part of the colvar module

Calculate the distance between a pair of atoms.

By default the distance is computed taking into account periodic boundary conditions. This behavior can be changed with the NOPBC flag. Moreover, single components in Cartesian space (x,y, and z, with COMPONENTS) or single components projected to the three lattice vectors (a,b, and c, with SCALED_COMPONENTS) can be also computed.

Notice that Cartesian components will not have the proper periodicity! If you have to study e.g. the permeation of a molecule across a membrane, better to use SCALED_COMPONENTS.

Examples

The following input tells plumed to print the distance between atoms 3 and 5, the distance between atoms 2 and 4 and the x component of the distance between atoms 2 and 4.

Click on the labels of the actions for more information on what each action computes
tested on master
d1: DISTANCE 
ATOMS
the pair of atom that we are calculating the distance between.
=3,5 d2: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=2,4 d2c: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=2,4
COMPONENTS
( default=off ) calculate the x, y and z components of the distance separately and store them as label.x,

The following input computes the end-to-end distance for a polymer of 100 atoms and keeps it at a value around 5.

Click on the labels of the actions for more information on what each action computes
tested on master