ROWSUMS
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.

Sum the rows of a adjacency matrix.

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. This action allows you to calculate the sum of the rows in this adjacency matrix and to then calculate further functions of these quantities.

Description of components

When the label of this action is used as the input for a second you are not referring to a scalar quantity as you are in regular collective variables. The label is used to reference the full set of quantities calculated by the action. This is usual when using MultiColvar functions. Generally when doing this the previously calculated multicolvar will be referenced using the DATA keyword rather than ARG.

This Action can be used to calculate the following scalar quantities directly. These quantities are calculated by employing the keywords listed below. These quantities can then be referenced elsewhere in the input file by using this Action's label followed by a dot and the name of the quantity. Some amongst them can be calculated multiple times with different parameters. In this case the quantities calculated can be referenced elsewhere in the input by using the name of the quantity followed by a numerical identifier e.g. label.lessthan-1, label.lessthan-2 etc. When doing this and, for clarity we have made the label of the components customizable. As such by using the LABEL keyword in the description of the keyword input you can customize the component name

Quantity Keyword Description
altmin ALT_MIN the minimum value. This is calculated using the formula described in the description of the keyword so as to make it continuous.
between BETWEEN the number/fraction of values within a certain range. This is calculated using one of the formula described in the description of the keyword so as to make it continuous. You can calculate this quantity multiple times using different parameters.
highest HIGHEST the lowest of the quantitities calculated by this action
lessthan LESS_THAN the number of values less than a target value. This is calculated using one of the formula described in the description of the keyword so as to make it continuous. You can calculate this quantity multiple times using different parameters.
lowest LOWEST the lowest of the quantitities calculated by this action
max MAX the maximum value. This is calculated using the formula described in the description of the keyword so as to make it continuous.
mean MEAN the mean value. The output component can be refererred to elsewhere in the input file by using the label.mean
min MIN the minimum value. This is calculated using the formula described in the description of the keyword so as to make it continuous.
moment MOMENTS the central moments of the distribution of values. The second moment would be referenced elsewhere in the input file using label.moment-2, the third as label.moment-3, etc.
morethan MORE_THAN the number of values more than a target value. This is calculated using one of the formula described in the description of the keyword so as to make it continuous. You can calculate this quantity multiple times using different parameters.
Compulsory keywords
MATRIX the action that calcualtes the adjacency matrix vessel we would like to analyse
Options
NOPBC ( default=off ) ignore the periodic boundary conditions when calculating distances
SERIAL ( default=off ) do the calculation in serial. Do not parallelize
LOWMEM ( default=off ) lower the memory requirements
TIMINGS

( default=off ) output information on the timings of the various parts of the calculation

ALT_MIN calculate the minimum value. To make this quantity continuous the minimum is calculated using \( \textrm{min} = -\frac{1}{\beta} \log \sum_i \exp\left( -\beta s_i \right) \) The value of \(\beta\) in this function is specified using (BETA= \(\beta\)). The final value can be referenced using label.altmin. You can use multiple instances of this keyword i.e. ALT_MIN1, ALT_MIN2, ALT_MIN3... The corresponding values are then referenced using label.altmin-1, label.altmin-2, label.altmin-3...
LOWEST this flag allows you to recover the lowest of these variables. The final value can be referenced using label.lowest
HIGHEST this flag allows you to recover the highest of these variables. The final value can be referenced using label.highest
MEAN take the mean of these variables. The final value can be referenced using label.mean. You can use multiple instances of this keyword i.e. MEAN1, MEAN2, MEAN3... The corresponding values are then referenced using label.mean-1, label.mean-2, label.mean-3...
MEAN take the mean of these variables. The final value can be referenced using label.mean. You can use multiple instances of this keyword i.e. MEAN1, MEAN2, MEAN3... The corresponding values are then referenced using label.mean-1, label.mean-2, label.mean-3...
MIN calculate the minimum value. To make this quantity continuous the minimum is calculated using \( \textrm{min} = \frac{\beta}{ \log \sum_i \exp\left( \frac{\beta}{s_i} \right) } \) The value of \(\beta\) in this function is specified using (BETA= \(\beta\)) The final value can be referenced using label.min. You can use multiple instances of this keyword i.e. MIN1, MIN2, MIN3... The corresponding values are then referenced using label.min-1, label.min-2, label.min-3...
MAX calculate the maximum value. To make this quantity continuous the maximum is calculated using \( \textrm{max} = \beta \log \sum_i \exp\left( \frac{s_i}{\beta}\right) \) The value of \(\beta\) in this function is specified using (BETA= \(\beta\)) The final value can be referenced using label.max. You can use multiple instances of this keyword i.e. MAX1, MAX2, MAX3... The corresponding values are then referenced using label.max-1, label.max-2, label.max-3...
LESS_THAN calculate the number of variables less than a certain target value. This quantity is calculated using \(\sum_i \sigma(s_i)\), where \(\sigma(s)\) is a switchingfunction. The final value can be referenced using label.lessthan. You can use multiple instances of this keyword i.e. LESS_THAN1, LESS_THAN2, LESS_THAN3... The corresponding values are then referenced using label.lessthan-1, label.lessthan-2, label.lessthan-3...
MORE_THAN calculate the number of variables more than a certain target value. This quantity is calculated using \(\sum_i 1.0 - \sigma(s_i)\), where \(\sigma(s)\) is a switchingfunction. The final value can be referenced using label.morethan. You can use multiple instances of this keyword i.e. MORE_THAN1, MORE_THAN2, MORE_THAN3... The corresponding values are then referenced using label.morethan-1, label.morethan-2, label.morethan-3...
BETWEEN calculate the number of values that are within a certain range. These quantities are calculated using kernel density estimation as described on histogrambead. The final value can be referenced using label.between. You can use multiple instances of this keyword i.e. BETWEEN1, BETWEEN2, BETWEEN3... The corresponding values are then referenced using label.between-1, label.between-2, label.between-3...
HISTOGRAM calculate a discretized histogram of the distribution of values. This shortcut allows you to calculates NBIN quantites like BETWEEN. The final value can be referenced using label.histogram. You can use multiple instances of this keyword i.e. HISTOGRAM1, HISTOGRAM2, HISTOGRAM3... The corresponding values are then referenced using label.histogram-1, label.histogram-2, label.histogram-3...
MOMENTS

calculate the moments of the distribution of collective variables. The \(m\)th moment of a distribution is calculated using \(\frac{1}{N} \sum_{i=1}^N ( s_i - \overline{s} )^m \), where \(\overline{s}\) is the average for the distribution. The moments keyword takes a lists of integers as input or a range. Each integer is a value of \(m\). The final calculated values can be referenced using moment- \(m\).

Examples

The first instruction in the following input file tells PLUMED to compute a \(10 \times 10\) matrix in which the \(ij\)-element tells you whether atoms \(i\) and \(j\) are within 1.0 nm of each other. The numbers in each of this rows are then added together and the average value is computed. As such the following input provides an alternative method for calculating the coordination numbers of atoms 1 to 10.

mat: CONTACT_MATRIX ATOMS=1-10 SWITCH={RATIONAL R_0=1.0}
rsums: ROWSUMS MATRIX=mat MEAN
PRINT ARG=rsums.* FILE=colvar

The following input demonstrates another way that an average coordination number can be computed. This input calculates the number of atoms with indices between 6 and 15 that are within the first coordination spheres of each of the atoms within indices between 1 and 5. The average coordination number is then calculated from these five coordination numbers and this quantity is output to a file.

mat2: CONTACT_MATRIX ATOMSA=1-5 ATOMSB=6-15 SWITCH={RATIONAL R_0=1.0}
rsums: ROWSUMS MATRIX=mat2 MEAN
PRINT ARG=rsums.* FILE=colvar