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

Measure how similar the environment around atoms is to that found in some reference crystal structure.

This CV was introduced in this article [91]. The starting point for the definition of the CV is the local atomic density around an atom. We consider an environment \(\chi\) around this atom and we define the density by

\[ \rho_{\chi}(\mathbf{r})=\sum\limits_{i\in\chi} \exp\left(- \frac{|\mathbf{r}_i-\mathbf{r}|^2} {2\sigma^2} \right), \]

where \(i\) runs over the neighbors in the environment \(\chi\), \(\sigma\) is a broadening parameter, and \(\mathbf{r}_i\) are the coordinates of the neighbors relative to the central atom. We now define a reference environment or template \(\chi_0\) that contains \(n\) reference positions \(\{\mathbf{r}^0_1,...,\mathbf{r}^0_n\}\) that describe, for instance, the nearest neighbors in a given lattice. \(\sigma\) is set using the SIGMA keyword and \(\chi_0\) is chosen with the CRYSTAL_STRUCTURE keyword. If only the SPECIES keyword is given then the atoms defined there will be the central and neighboring atoms. If instead the SPECIESA and SPECIESB keywords are given then SPECIESA determines the central atoms and SPECIESB the neighbors.

The environments \(\chi\) and \(\chi_0\) are compared using the kernel,

\[ k_{\chi_0}(\chi)= \int d\mathbf{r} \rho_{\chi}(\mathbf{r}) \rho_{\chi_0}(\mathbf{r}) . \]

Combining the two equations above and performing the integration analytically we obtain,

\[ k_{\chi_0}(\chi)= \sum\limits_{i\in\chi} \sum\limits_{j\in\chi_0} \pi^{3/2} \sigma^3 \exp\left(- \frac{|\mathbf{r}_i-\mathbf{r}^0_j|^2} {4\sigma^2} \right). \]

The kernel is finally normalized,

\[ \tilde{k}_{\chi_0}(\chi) = \frac{1}{n} \sum\limits_{i\in\chi} \sum\limits_{j\in\chi_0} \exp\left( - \frac{|\mathbf{r}_i-\mathbf{r}^0_j|^2} {4\sigma^2} \right), \]

such that \(\tilde{k}_{\chi_0}(\chi_0) = 1\). The above kernel is computed for each atom in the SPECIES or SPECIESA keywords. This quantity is a multicolvar so you can compute it for multiple atoms using a single PLUMED action and then compute the average value for the atoms in your system, the number of atoms that have an \(\tilde{k}_{\chi_0}\) value that is more that some target and so on.

The kernel can be generalized to crystal structures described as a lattice with a basis of more than one atom. In this case there is more than one type of environment. We consider the case of \(M\) environments \(X = \chi_1,\chi_2,...,\chi_M\) and we define the kernel through a best match strategy:

\[ \tilde{k}_X(\chi)= \frac{1}{\lambda} \log \left ( \sum\limits_{l=1}^{M}\exp \left (\lambda \: \tilde{k}_{\chi_l}(\chi) \right ) \right ). \]

For a large enough \(\lambda\) this expression will select the largest \(\tilde{k}_{\chi_l}(\chi)\) with \(\chi_l \in X\). This approach can be used, for instance, to target the hexagonal closed packed (HCP keyword) or the diamond structure (DIAMOND keyword).

The CRYSTAL_STRUCTURE keyword can take the values SC (simple cubic), BCC (body centered cubic), FCC (face centered cubic), HCP (hexagonal closed pack), DIAMOND (cubic diamond), and CUSTOM (user defined). All options follow the same conventions as in the lattice command of LAMMPS. If a CRYSTAL_STRUCTURE other than CUSTOM is used, then the lattice constants have to be specified using the keyword LATTICE_CONSTANTS. One value has to be specified for SC, BCC, FCC, and DIAMOND and two values have to be set for HCP (a and c lattice constants in that order).

If the CUSTOM option is used then the reference environments have to be specified by the user. The reference environments are specified in pdb files containing the distance vectors from the central atom to the neighbors. Make sure your PDB file is correctly formatted as explained in this page If only one reference environment is specified then the filename should be given as argument of the keyword REFERENCE. If instead several reference environments are given, then they have to be provided in separate pdb files and given as arguments of the keywords REFERENCE_1, REFERENCE_2, etc. If you have a reference crystal structure configuration you can use the Environment Finder app to determine the reference environments that you should use.

Examples

The following input calculates the ENVIRONMENTSIMILARITY kernel for 250 atoms in the system using the BCC atomic environment as target, and then calculates and prints the average value for this quantity.

Click on the labels of the actions for more information on what each action computes
tested on v2.7
es: ENVIRONMENTSIMILARITY 
SPECIES
this keyword is used for colvars such as coordination number.
=1-250
SIGMA
compulsory keyword ( default=0.1 ) Broadening parameter
=0.05
LATTICE_CONSTANTS
Lattice constants.
=0.423
CRYSTAL_STRUCTURE
compulsory keyword ( default=FCC ) Targeted crystal structure.
=BCC
MEAN
take the mean of these variables.
PRINT
ARG
the input for this action is the scalar output from one or more other actions.
=es.mean
FILE
the name of the file on which to output these quantities
=COLVAR

The next example compares the environments of the 96 selected atoms with a user specified reference environment. The reference environment is contained in the env1.pdb file. Once the kernel is computed the average and the number of atoms with a kernel larger than 0.5 are computed.

Click on the labels of the actions for more information on what each action computes
tested on v2.7
es: ENVIRONMENTSIMILARITY ...
   
SPECIES
this keyword is used for colvars such as coordination number.
=1-288:3
SIGMA
compulsory keyword ( default=0.1 ) Broadening parameter
=0.05
CRYSTAL_STRUCTURE
compulsory keyword ( default=FCC ) Targeted crystal structure.
=CUSTOM
REFERENCE
PDB file with relative distances from central atom.
=env1.pdb
MEAN
take the mean of these variables.
MORE_THAN
calculate the number of variables more than a certain target value.
={RATIONAL R_0=0.5 NN=12 MM=24} ... PRINT
ARG
the input for this action is the scalar output from one or more other actions.
=es.mean,es.morethan
FILE
the name of the file on which to output these quantities
=COLVAR

The next example is similar to the one above but in this case 4 reference environments are specified. Each reference environment is given in a separate pdb file.

Click on the labels of the actions for more information on what each action computes
tested on v2.7
es: ENVIRONMENTSIMILARITY ...
   
SPECIES
this keyword is used for colvars such as coordination number.
=1-288:3
SIGMA
compulsory keyword ( default=0.1 ) Broadening parameter
=0.05
CRYSTAL_STRUCTURE
compulsory keyword ( default=FCC ) Targeted crystal structure.
=CUSTOM
REFERENCE_1
PDB files with relative distances from central atom.
=env1.pdb
REFERENCE_2
PDB files with relative distances from central atom.
=env2.pdb
REFERENCE_3
PDB files with relative distances from central atom.
=env3.pdb
REFERENCE_4
PDB files with relative distances from central atom.
=env4.pdb
MEAN
take the mean of these variables.
MORE_THAN
calculate the number of variables more than a certain target value.
={RATIONAL R_0=0.5 NN=12 MM=24} ... PRINT
ARG
the input for this action is the scalar output from one or more other actions.
=es.mean,es.morethan
FILE
the name of the file on which to output these quantities
=COLVAR
Glossary of keywords and components
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 of 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 it so that the user can set a particular label for each of the components. 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 highest of the quantities 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 quantities 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 referred 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.
The atoms involved can be specified using
SPECIES this keyword is used for colvars such as coordination number. In that context it specifies that plumed should calculate one coordination number for each of the atoms specified. Each of these coordination numbers specifies how many of the other specified atoms are within a certain cutoff of the central atom. You can specify the atoms here as another multicolvar action or using a MultiColvarFilter or ActionVolume action. When you do so the quantity is calculated for those atoms specified in the previous multicolvar. This is useful if you would like to calculate the Steinhardt parameter for those atoms that have a coordination number more than four for example
Or alternatively by using
SPECIESA this keyword is used for colvars such as the coordination number. In that context it species that plumed should calculate one coordination number for each of the atoms specified in SPECIESA. Each of these coordination numbers specifies how many of the atoms specifies using SPECIESB is within the specified cutoff. As with the species keyword the input can also be specified using the label of another multicolvar
SPECIESB this keyword is used for colvars such as the coordination number. It must appear with SPECIESA. For a full explanation see the documentation for that keyword
Compulsory keywords
SIGMA ( default=0.1 ) Broadening parameter
CRYSTAL_STRUCTURE ( default=FCC ) Targeted crystal structure. Options are: SC: simple cubic, BCC: body center cubic, FCC: face centered cubic, HCP: hexagonal closed pack, DIAMOND: cubic diamond, CUSTOM: user defined
LAMBDA ( default=100 ) Lambda parameter
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 use MPI
LOWMEM ( default=off ) lower the memory requirements
TIMINGS

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

LATTICE_CONSTANTS Lattice constants. Two comma separated values for HCP, one value for all other CRYSTAL_STRUCTURES.
REFERENCE PDB file with relative distances from central atom. Use this keyword if you are targeting a single reference environment.
REFERENCE_ PDB files with relative distances from central atom. Each file corresponds to one template. Use these keywords if you are targeting more than one reference environment. You can use multiple instances of this keyword i.e. REFERENCE_1, REFERENCE_2, REFERENCE_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...
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...
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...
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...
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...
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 how many of the values fall in each of the bins of a histogram. This shortcut allows you to calculates NBIN quantities 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 mth 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\). You can use the COMPONENT keyword in this action but the syntax is slightly different. If you would like the second and third moments of the third component you would use MOMENTS={COMPONENT=3 MOMENTS=2-3}. The moments would then be referred to using the labels moment-3-2 and moment-3-3. This syntax is also required if you are using numbered MOMENT keywords i.e. MOMENTS1, MOMENTS2...
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