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.

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.

Click on the labels of the actions for more information on what each action computes
tested on master
a: ANGLE 
ATOMS
the list of atoms involved in this collective variable (either 3 or 4 atoms).
=1,2,3 # equivalently one could state: # a: ANGLE ATOMS=1,2,2,3 b: ANGLE
ATOMS
the list of atoms involved in this collective variable (either 3 or 4 atoms).
=1,2,3,4 PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=a
FILE
the name of the file on which to output these quantities
=COLVAR1 PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=b
FILE
the name of the file on which to output these quantities
=COLVAR2
Glossary of keywords and components
Description of components

By default the value of the calculated quantity can be referenced elsewhere in the input file by using the label of the action. Alternatively this Action can be used to calculate the following quantities by employing the keywords listed below. These quantities can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the quantity required from the list below.

Quantity Description
.#!value the ANGLE involving these atoms
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