Exploiting contact matrices

A contact 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. There are various ways of defining whether a pair of atoms/molecules are adjacent or not. For example we can say two atoms are adjacent if the distance between them is less than some cutoff. Alternatively, if we have a have a pair of molecules, we might state they are adjacent if their centers of mass are within a certain cutoff and if the two molecules have the same orientation. Two electronegative atoms might be said to be adjacent if there is a hydrogen bond between them. For these reasons then PLUMED contains all of the following methods for calculating an adjacency matrix

CONTACT_MATRIX Adjacency matrix in which two atoms are adjacent if they are within a certain cutoff.
CONTACT_MATRIX_PROPER Adjacency matrix in which two atoms are adjacent if they are within a certain cutoff.
DISTANCE_MATRIX Calculate a matrix of distances
HBOND_MATRIX Adjacency matrix in which two atoms are adjacent if there is a hydrogen bond between them.
HBPAMM_MATRIX Adjacency matrix in which two electronegative atoms are adjacent if they are hydrogen bonded
TOPOLOGY_MATRIX Adjacency matrix in which two atoms are adjacent if they are connected topologically

Once you have calculated an adjacency matrix you can then perform any one of the following operations on this object in order to reduce it to a scalar number or a set of connected components.

DFSCLUSTERING Find the connected components of the matrix using the depth first search clustering algorithm.
SPRINT Calculate SPRINT topological variables from an adjacency matrix.

If the function you have chosen reduces your contact matrix to a set of connected components you then need a method to convert these connected components into a scalar number or to output this information to a file. The various things that you can do with a set of connected components are listed below:

CLUSTER_DIAMETER Print out the diameter of one of the connected components
CLUSTER_DISTRIBUTION Calculate functions of the distribution of properties in your connected components.
CLUSTER_DISTRIBUTION_CALC Calculate functions of the distribution of properties in your connected components.
CLUSTER_NATOMS Calculate the number of atoms in the cluster of interest
CLUSTER_PROPERTIES Calculate properties of the distribution of some quantities that are part of a connected component
CLUSTER_WEIGHTS Setup a vector that has one for all the atoms that form part of the cluster of interest and that has zero for all other atoms.
CLUSTER_WITHSURFACE Determine the atoms that are within a certain cutoff of the atoms in a cluster
OUTPUT_CLUSTER Output the indices of the atoms in one of the clusters identified by a clustering object