ANGLE
This is part of the colvar module

Calculate an angle.

This command can be used to compute the angle between three atoms. Alternatively if four atoms appear in the atom specification it calculates the angle between two vectors identified by two pairs of atoms.

If three atoms are given, the angle is defined as:

\[ \theta=\arccos\left(\frac{ {\bf r}_{21}\cdot {\bf r}_{23}}{ |{\bf r}_{21}| |{\bf r}_{23}|}\right) \]

Here \( {\bf r}_{ij}\) is the distance vector among the i-th and the j-th listed atom.

If four atoms are given, the angle is defined as:

\[ \theta=\arccos\left(\frac{ {\bf r}_{21}\cdot {\bf r}_{34}}{ |{\bf r}_{21}| |{\bf r}_{34}|}\right) \]

Notice that angles defined in this way are non-periodic variables and their value is limited by definition between 0 and \(\pi\).

The vectors \( {\bf r}_{ij}\) are by default evaluated taking periodic boundary conditions into account. This behavior can be changed with the NOPBC flag.

The atoms involved can be specified using
ATOMS the list of atoms involved in this collective variable (either 3 or 4 atoms). For more information on how to specify lists of atoms see Groups and Virtual Atoms
Options
NUMERICAL_DERIVATIVES ( default=off ) calculate the derivatives for these quantities numerically
NOPBC

( default=off ) ignore the periodic boundary conditions when calculating distances

Examples

This command tells plumed to calculate the angle between the vector connecting atom 1 to atom 2 and the vector connecting atom 2 to atom 3 and to print it on file COLVAR1. At the same time, the angle between vector connecting atom 1 to atom 2 and the vector connecting atom 3 to atom 4 is printed on file COLVAR2.


a: ANGLE ATOMS=1,2,3
# equivalently one could state:
# a: ANGLE ATOMS=1,2,2,3

b: ANGLE ATOMS=1,2,3,4

PRINT ARG=a FILE=COLVAR1
PRINT ARG=b FILE=COLVAR2