CONTACT_MATRIX
This is part of the adjmat module
It is only available if you configure PLUMED with ./configure –enable-modules=adjmat . Furthermore, this feature is still being developed so take care when using it and report any problems on the mailing list.

Adjacency matrix in which two atoms are adjacent if they are within a certain cutoff.

As discussed in the section of the manual on Exploiting contact matrices a useful tool for developing complex collective variables is the notion of the so called adjacency matrix. An adjacency matrix is an \(N \times N\) matrix in which the \(i\)th, \(j\)th element tells you whether or not the \(i\)th and \(j\)th atoms/molecules from a set of \(N\) atoms/molecules are adjacent or not. These matrices can then be further analysed using a number of other algorithms as is detailed in [66].

For this action the elements of the contact matrix are calculated using:

\[ a_{ij} = \sigma( |\mathbf{r}_{ij}| ) \]

where \(|\mathbf{r}_{ij}|\) is the magnitude of the vector connecting atoms \(i\) and \(j\) and where \(\sigma\) is a switchingfunction.

The atoms involved can be specified using
ATOMS The list of atoms for which you would like to calculate the contact matrix. The atoms involved must be specified as a list of labels of MultiColvar or labels of a MultiColvar functions actions. If you would just like to use the atomic positions you can use a DENSITY command to specify a group of atoms. Specifying your atomic positions using labels of other MultiColvar or MultiColvar functions commands is useful, however, as you can then exploit a much wider variety of functions of the contact matrix as described in Exploiting contact matrices. 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
SERIAL ( default=off ) do the calculation in serial. Do not parallelize
TIMINGS ( default=off ) output information on the timings of the various parts of the calculation
HIGHMEM

( default=off ) use a more memory intensive version of this collective variable

SWITCH

This keyword is used if you want to employ an alternative to the continuous swiching 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. You can use multiple instances of this keyword i.e. SWITCH1, SWITCH2, SWITCH3...

Examples

The input shown below calculates a \(6 \times 6\) matrix whose elements are equal to one if atom \(i\) and atom \(j\) are within 0.3 nm of each other and which is zero otherwise. The columns in this matrix are then summed so as to give the coordination number for each atom. The final quantity output in the colvar file is thus the average coordination number.

aa: CONTACT_MATRIX ATOMS=1-6 SWITCH={EXP D_0=0.2 R_0=0.1 D_MAX=0.66}
COLUMNSUMS MATRIX=mat MEAN LABEL=csums
PRINT ARG=csums.* FILE=colvar