This keyword can be used to calculate the number of contacts between two groups of atoms and is defined as
\[\sum_{i\in A} \sum_{i\in B} s_{ij}
\]
where \(s_{ij}\) is 1 if the contact between atoms \(i\) and \(j\) is formed, zero otherwise. In actuality, \(s_{ij}\) is replaced with a switching function so as to ensure that the calculated CV has continuous derivatives. The default switching function is:
but it can be changed using the optional SWITCH option.
To make your calculation faster you can use a neighbor list, which makes it that only a relevant subset of the pairwise distance are calculated at every step.
If GROUPB is empty, it will sum the \(\frac{N(N-1)}{2}\) pairs in GROUPA. This avoids computing twice permuted indexes (e.g. pair (i,j) and (j,i)) thus running at twice the speed.
Notice that if there are common atoms between GROUPA and GROUPB the switching function should be equal to one. These "self contacts" are discarded by plumed (since version 2.1), so that they actually count as "zero".
Examples
The following example instructs plumed to calculate the total coordination number of the atoms in group 1-10 with the atoms in group 20-100. For atoms 1-10 coordination numbers are calculated that count the number of atoms from the second group that are within 0.3 nm of the central atom. A neighbor list is used to make this calculation faster, this neighbor list is updated every 100 steps.
Click on the labels of the actions for more information on what each action computes
COORDINATIONGROUPAFirst list of atoms. =1-10 GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted). =20-100 R_0 could not find this keyword =0.3 NLIST( default=off ) Use a neighbor list to speed up the calculation NL_CUTOFFThe cutoff for the neighbor list =0.5 NL_STRIDEThe frequency with which we are updating the atoms in the neighbor list =100 The COORDINATION action with label
The following is a dummy example which should compute the value 0 because the self interaction of atom 1 is skipped. Notice that in plumed 2.0 "self interactions" were not skipped, and the same calculation should return 1.
Click on the labels of the actions for more information on what each action computes
c: COORDINATIONGROUPAFirst list of atoms. =1 GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted). =1 R_0 could not find this keyword =0.3 The COORDINATION action with label c calculates a single scalar valuePRINTARGthe input for this action is the scalar output from one or more other actions. =cSTRIDEcompulsory keyword ( default=1 )
the frequency with which the quantities of interest should be output =10 The PRINT action with label
Here's an example that shows what happens when providing COORDINATION with a single group:
Click on the labels of the actions for more information on what each action computes
# define some huge group:group: GROUPATOMSthe numerical indexes for the set of atoms in the group. =1-1000 The GROUP action with label group defines a group of atoms so that they can be referred to later in the input# Here's coordination of a group against itself:c1: COORDINATIONGROUPAFirst list of atoms. =groupGROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted). =groupR_0 could not find this keyword =0.3 The COORDINATION action with label c1 calculates a single scalar value# Here's coordination within a single group:x: COORDINATIONGROUPAFirst list of atoms. =groupR_0 could not find this keyword =0.3 The COORDINATION action with label x calculates a single scalar value# This is just multiplying times 2 the variable x:c2: COMBINEARGthe input to this function. =xCOEFFICIENTScompulsory keyword ( default=1.0 )
the coefficients of the arguments in your function =2 PERIODICcompulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function. =NO The COMBINE action with label c2 calculates a single scalar value# the two variables c1 and c2 should be identical, but the calculation of c2 is twice faster# since it runs on half of the pairs.PRINTARGthe input for this action is the scalar output from one or more other actions. =c1,c2STRIDEcompulsory keyword ( default=1 )
the frequency with which the quantities of interest should be output =10 The PRINT action with label
# define some huge group:group: GROUPATOMSthe numerical indexes for the set of atoms in the group. =1-1000 The GROUP action with label group defines a group of atoms so that they can be referred to later in the input# Here's coordination of a group against itself:c1: COORDINATIONGROUPAFirst list of atoms. =groupGROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted). =groupR_0 could not find this keyword =0.3 The COORDINATION action with label c1 calculates a single scalar value# Here's coordination within a single group:x: COORDINATIONGROUPAFirst list of atoms. =groupR_0 could not find this keyword =0.3 The COORDINATION action with label x calculates a single scalar value# This is just multiplying times 2 the variable x:# the two variables c1 and c2 should be identical, but the calculation of c2 is twice faster# since it runs on half of the pairs.PRINTARGthe input for this action is the scalar output from one or more other actions. =c1,c2 STRIDEcompulsory keyword ( default=1 )
the frequency with which the quantities of interest should be output =10 The PRINT action with label
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 value of the coordination
The atoms involved can be specified using
GROUPA
First list of atoms. For more information on how to specify lists of atoms see Groups and Virtual Atoms
GROUPB
Second list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted). For more information on how to specify lists of atoms see Groups and Virtual Atoms
Compulsory keywords
NN
( default=6 ) The n parameter of the switching function
MM
( default=0 ) The m parameter of the switching function; 0 implies 2*NN
D_0
( default=0.0 ) The d_0 parameter of the switching function
R_0
The r_0 parameter of the switching function
Options
NUMERICAL_DERIVATIVES
( default=off ) calculate the derivatives for these quantities numerically
NOPBC
( default=off ) ignore the periodic boundary conditions when calculating distances
SERIAL
( default=off ) Perform the calculation in serial - for debug purpose
PAIR
( default=off ) Pair only 1st element of the 1st group with 1st element in the second, etc
NLIST
( default=off ) Use a neighbor list to speed up the calculation
NL_CUTOFF
The cutoff for the neighbor list
NL_STRIDE
The frequency with which we are updating the atoms in the neighbor list
SWITCH
This keyword is used if you want to employ an alternative to the continuous switching function defined above. The following provides information on the switchingfunction that are available. When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords.