next up previous contents index
Next: Scripting interface (Tcl): list Up: Collective Variable-based Calculations (Colvars) Previous: Selecting atoms   Contents   Index

Subsections


Biasing and analysis methods

A biasing or analysis method can be applied to existing collective variables by using the following configuration:


$ <$ biastype$ >$ {
  name $ <$ name$ >$
  colvars $ <$ xi1$ >$ $ <$ xi2$ >$ ...
  $ <$ parameters$ >$
}

The keyword $ <$ biastype$ >$ indicates the method of choice. There can be multiple instances of the same method, e.g. using multiple harmonic blocks allows defining multiple restraints.

All biasing and analysis methods implemented recognize the following options:


Thermodynamic integration

The methods implemented here provide a variety of estimators of conformational free-energies. These are carried out at run-time, or with the use of post-processing tools over the generated output files. The specifics of each estimator are discussed in the documentation of each biasing or analysis method.

A special case is the traditional thermodynamic integration (TI) method, used for example to compute potentials of mean force (PMFs). Most types of restraints (9.5.5, 9.5.7, 9.5.8, ...) as well as metadynamics (9.5.4) can optionally use TI alongside their own estimator, based on the keywords documented below.

In adaptive biasing force (ABF) (9.5.2) the above keywords are not recognized, because their functionality is either included already (conventional ABF) or not available (extended-system ABF).


Adaptive Biasing Force

For a full description of the Adaptive Biasing Force method, see reference [28]. For details about this implementation, see references [46] and [47]. When publishing research that makes use of this functionality, please cite references [28] and [47].

An alternate usage of this feature is the application of custom tabulated biasing potentials to one or more colvars. See inputPrefix and updateBias below.

Combining ABF with the extended Lagrangian feature (9.3.20) of the variables produces the extended-system ABF variant of the method (9.5.3).

ABF is based on the thermodynamic integration (TI) scheme for computing free energy profiles. The free energy as a function of a set of collective variables $ {\mbox{\boldmath {$\xi$}}}=(\xi_{i})_{i\in[1,n]}$ is defined from the canonical distribution of $ {\mbox{\boldmath {$\xi$}}}$ , $ {\mathcal P}({\mbox{\boldmath {$\xi$}}})$ :

$\displaystyle A({\mbox{\boldmath {$\xi$}}}) = -\frac{1}{\beta} \ln {\mathcal P}({\mbox{\boldmath {$\xi$}}}) + A_0$ (56)

In the TI formalism, the free energy is obtained from its gradient, which is generally calculated in the form of the average of a force $ {\mbox{\boldmath {$F$}}}_\xi$ exerted on $ {\mbox{\boldmath {$\xi$}}}$ , taken over an iso- $ {\mbox{\boldmath {$\xi$}}}$ surface:

$\displaystyle {\mbox{\boldmath {$\nabla$}}}_\xi A({\mbox{\boldmath {$\xi$}}}) =...
...langle -{\mbox{\boldmath {$F$}}}_\xi \right\rangle_{{\mbox{\boldmath {$\xi$}}}}$ (57)

Several formulae that take the form of (58) have been proposed. This implementation relies partly on the classic formulation [18], and partly on a more versatile scheme originating in a work by Ruiz-Montero et al. [93], generalized by den Otter [29] and extended to multiple variables by Ciccotti et al. [23]. Consider a system subject to constraints of the form $ \sigma_{k}({\mbox{\boldmath {$x$}}}) = 0$ . Let $ ({\mbox{\boldmath {$v$}}}_{i})_{i\in[1,n]}$ be arbitrarily chosen vector fields ( $ \mathbb{R}^{3N}\rightarrow\mathbb{R}^{3N}$ ) verifying, for all $ i$ , $ j$ , and $ k$ :


$\displaystyle {\mbox{\boldmath {$v$}}}_{i} \cdot \mbox{\boldmath$\nabla_{\!\!x}\,$}\xi_{j}$ $\displaystyle =$ $\displaystyle \delta_{ij}$ (58)
$\displaystyle {\mbox{\boldmath {$v$}}}_{i} \cdot \mbox{\boldmath$\nabla_{\!\!x}\,$}\sigma_{k}$ $\displaystyle =$ 0 (59)

then the following holds [23]:

$\displaystyle \frac{\partial A}{\partial \xi_{i}} = \left\langle {\mbox{\boldma...
...$}\cdot {\mbox{\boldmath {$v$}}}_{i} \right\rangle_{{\mbox{\boldmath {$\xi$}}}}$ (60)

where $ V$ is the potential energy function. $ {\mbox{\boldmath {$v$}}}_{i}$ can be interpreted as the direction along which the force acting on variable $ \xi_{i}$ is measured, whereas the second term in the average corresponds to the geometric entropy contribution that appears as a Jacobian correction in the classic formalism [18]. Condition (59) states that the direction along which the total force on $ \xi_{i}$ is measured is orthogonal to the gradient of $ \xi_{j}$ , which means that the force measured on $ \xi_{i}$ does not act on $ \xi_{j}$ .

Equation (60) implies that constraint forces are orthogonal to the directions along which the free energy gradient is measured, so that the measurement is effectively performed on unconstrained degrees of freedom. In NAMD, constraints are typically applied to the lengths of bonds involving hydrogen atoms, for example in TIP3P water molecules (parameter rigidBonds, section 5.6.1).

In the framework of ABF, $ {\bf F}_\xi$ is accumulated in bins of finite size $ \delta \xi$ , thereby providing an estimate of the free energy gradient according to equation (58). The biasing force applied along the collective variables to overcome free energy barriers is calculated as:

$\displaystyle {\bf F}^{\rm ABF} = \alpha(N_\xi) \times$   $\displaystyle \mbox{\boldmath$\nabla_{\!\!x}\,$}$$\displaystyle \widetilde A({\mbox{\boldmath {$\xi$}}})$ (61)

where $ \nabla_{\!\!x}\,$ $ \widetilde A$ denotes the current estimate of the free energy gradient at the current point $ {\mbox{\boldmath {$\xi$}}}$ in the collective variable subspace, and $ \alpha(N_\xi)$ is a scaling factor that is ramped from 0 to 1 as the local number of samples $ N_\xi$ increases to prevent nonequilibrium effects in the early phase of the simulation, when the gradient estimate has a large variance. See the fullSamples parameter below for details.

As sampling of the phase space proceeds, the estimate $ \nabla_{\!\!x}\,$ $ \widetilde A$ is progressively refined. The biasing force introduced in the equations of motion guarantees that in the bin centered around $ {\mbox{\boldmath {$\xi$}}}$ , the forces acting along the selected collective variables average to zero over time. Eventually, as the undelying free energy surface is canceled by the adaptive bias, evolution of the system along $ {\mbox{\boldmath {$\xi$}}}$ is governed mainly by diffusion. Although this implementation of ABF can in principle be used in arbitrary dimension, a higher-dimension collective variable space is likely to be difficult to sample and visualize. Most commonly, the number of variables is one or two, sometimes three.


ABF requirements on collective variables

The following conditions must be met for an ABF simulation to be possible and to produce an accurate estimate of the free energy profile. Note that these requirements do not apply when using the extended-system ABF method (9.5.3).

  1. Only linear combinations of colvar components can be used in ABF calculations.
  2. Availability of total forces is necessary. The following colvar components can be used in ABF calculations: distance, distance_xy, distance_z, angle, dihedral, gyration, rmsd and eigenvector. Atom groups may not be replaced by dummy atoms, unless they are excluded from the force measurement by specifying oneSiteTotalForce, if available.
  3. Mutual orthogonality of colvars. In a multidimensional ABF calculation, equation (59) must be satisfied for any two colvars $ \xi_{i}$ and $ \xi_{j}$ . Various cases fulfill this orthogonality condition:
  4. Mutual orthogonality of components: when several components are combined into a colvar, it is assumed that their vectors $ {\mbox{\boldmath {$v$}}}_{i}$ (equation (61)) are mutually orthogonal. The cases described for colvars in the previous paragraph apply.
  5. Orthogonality of colvars and constraints: equation 60 can be satisfied in two simple ways, if either no constrained atoms are involved in the force measurement (see point 3 above) or pairs of atoms joined by a constrained bond are part of an atom group which only intervenes through its center (center of mass or geometric center) in the force measurement. In the latter case, the contributions of the two atoms to the left-hand side of equation 60 cancel out. For example, all atoms of a rigid TIP3P water molecule can safely be included in an atom group used in a distance component.


Parameters for ABF

ABF depends on parameters from collective variables to define the grid on which free energy gradients are computed. In the direction of each colvar, the grid ranges from lowerBoundary to upperBoundary, and the bin width (grid spacing) is set by the width (see 9.3.18) parameter. The following specific parameters can be set in the ABF configuration block:


Multiple-replica ABF


Output files

The ABF bias produces the following files, all in multicolumn text format (9.3.18):

Also in the case of one-dimensional calculations, the ABF bias can report its current energy via outputEnergy; in higher dimensions, such computation is not implemented and the energy reported is zero.

If several ABF biases are defined concurrently, their name is inserted to produce unique filenames for output, as in outputName.abf1.grad. This should not be done routinely and could lead to meaningless results: only do it if you know what you are doing!

If the colvar space has been partitioned into sections (windows) in which independent ABF simulations have been run, the resulting data can be merged using the inputPrefix option described above (a run of 0 steps is enough).


Multidimensional free energy surfaces

If a one-dimensional calculation is performed, the estimated free energy gradient is integrated using a simple rectangle rule. In dimension 2 or 3, it is calculated as the solution of a Poisson equation:

$\displaystyle \Delta A(\xi) = - \nabla \cdot \langle F_\xi \rangle$ (62)

wehere $ \Delta A$ is the Laplacian of the free energy. The potential of mean force is written under the file name <outputName>.pmf, in a plain text format (see 9.3.18) that can be read by most data plotting and analysis programs (e.g. Gnuplot). This applies periodic boundary conditions to periodic coordinates, and Neumann boundary conditions otherwise (imposed free energy gradient at the boundary of the domain). Note that the grid used for free energy discretization is extended by one point along non-periodic coordinates, but not along periodic coordinates.

In dimension 4 or greater, integrating the discretized gradient becomes non-trivial. The standalone utility abf_integrate is provided to perform that task. Because 4D ABF calculations are uncommon, this tool is practically deprecated by the Poisson integration described above.

abf_integrate reads the gradient data and uses it to perform a Monte-Carlo (M-C) simulation in discretized collective variable space (specifically, on the same grid used by ABF to discretize the free energy gradient). By default, a history-dependent bias (similar in spirit to metadynamics) is used: at each M-C step, the bias at the current position is incremented by a preset amount (the hill height). Upon convergence, this bias counteracts optimally the underlying gradient; it is negated to obtain the estimate of the free energy surface.

abf_integrate is invoked using the command-line:
abf_integrate <gradient_file> [-n <nsteps>] [-t <temp>] [-m (0|1)] [-h <hill_height>] [-f <factor>]

The gradient file name is provided first, followed by other parameters in any order. They are described below, with their default value in square brackets:

Using the default values of all parameters should give reasonable results in most cases.


abf_integrate produces the following output files:

Note: Typically, the ``deviation'' vector field does not vanish as the integration converges. This happens because the numerical estimate of the gradient does not exactly derive from a potential, due to numerical approximations used to obtain it (finite sampling and discretization on a grid).


Extended-system Adaptive Biasing Force (eABF)

Extended-system ABF (eABF) is a variant of ABF (9.5.2) where the bias is not applied directly to the collective variable, but to an extended coordinate (``fictitious variable'') $ \lambda $ that evolves dynamically according to Newtonian or Langevin dynamics. Such an extended coordinate is enabled for a given colvar using the extendedLagrangian and associated keywords (9.3.20). The theory of eABF and the present implementation are documented in detail in reference [64].

Defining an ABF bias on a colvar wherein the extendedLagrangian option is active will perform eABF automatically; there is no dedicated option.

The extended variable $ \lambda $ is coupled to the colvar $ z=\xi(q)$ by the harmonic potential $ (k/2) (z - \lambda)^2$ . Under eABF dynamics, the adaptive bias on $ \lambda $ is the running estimate of the average spring force:

$\displaystyle F^{\mathrm{bias}}(\lambda^{*}) = \left\langle k(\lambda{} - z) \right\rangle_{\lambda^{*}}$ (63)

where the angle brackets indicate a canonical average conditioned by $ \lambda=\lambda^*$ . At long simulation times, eABF produces a flat histogram of the extended variable $ \lambda $ , and a flattened histogram of $ \xi$ , whose exact shape depends on the strength of the coupling as defined by extendedFluctuation in the colvar. Coupling should be somewhat loose for faster exploration and convergence, but strong enough that the bias does help overcome barriers along the colvar $ \xi$ .[64] Distribution of the colvar may be assessed by plotting its histogram, which is written to the outputName.zcount file in every eABF simulation. Note that a histogram bias (9.5.10) applied to an extended-Lagrangian colvar will access the extended degree of freedom $ \lambda $ , not the original colvar $ \xi$ ; however, the joint histogram may be explicitly requested by listing the name of the colvar twice in a row within the colvars parameter of the histogram block.

The eABF PMF is that of the coordinate $ \lambda $ , it is not exactly the free energy profile of $ \xi$ . That quantity can be calculated based on either the CZAR estimator or the Zheng/Yang estimator.


CZAR estimator of the free energy

The corrected z-averaged restraint (CZAR) estimator is described in detail in reference [64]. It is computed automatically in eABF simulations, regardless of the number of colvars involved. Note that ABF may also be applied on a combination of extended and non-extended colvars; in that case, CZAR still provides an unbiased estimate of the free energy gradient.

CZAR estimates the free energy gradient as:

$\displaystyle A'(z) = - \frac{1}{\beta} \frac{d\ln \tilde \rho (z)}{dz} + k (\langle\lambda\rangle_z - z).$ (64)

where $ z=\xi(q)$ is the colvar, $ \lambda $ is the extended variable harmonically coupled to $ z$ with a force constant $ k$ , and $ \tilde\rho (z)$ is the observed distribution (histogram) of $ z$ , affected by the eABF bias.

Parameters for the CZAR estimator are:

Similar to ABF, the CZAR estimator produces two output files in multicolumn text format (9.3.18):

The sampling histogram associated with the CZAR estimator is the $ z$ -histogram, which is written in the file outputName.zcount.


Zheng/Yang estimator of the free energy

This feature has been contributed to NAMD by the following authors:

Haohao Fu and Christophe Chipot

Laboratoire International Associé Centre National de la Recherche Scientifique et University of Illinois at Urbana-Champaign,
Unité Mixte de Recherche No. 7565, Université de Lorraine,
B.P. 70239, 54506 Vand\oeuvre-lès-Nancy cedex, France

© 2016, CENTRE NATIONAL DE LA RECHERCHE SCIENTIFIQUE


This implementation is fully documented in [36]. The Zheng and Yang estimator [121] is based on Umbrella Integration [53]. The free energy gradient is estimated as :

$\displaystyle A'(\xi^*) = \frac{\displaystyle \sum_{\lambda} N(\xi^*, \lambda) ...
...- k (\xi^* - \lambda) \right]} {\displaystyle \sum_{\lambda} N(\xi^*, \lambda)}$ (65)

where $ \xi$ is the colvar, $ \lambda $ is the extended variable harmonically coupled to $ \xi$ with a force constant $ k$ , $ N(\xi, \lambda)$ is the number of samples collected in a $ (\xi, \lambda)$ bin, which is assumed to be a Gaussian function of $ \xi$ with mean $ \langle\xi\rangle_{\lambda}$ and standard deviation $ \sigma_{\lambda}$ .

The estimator is enabled through the following option:

Usage for multiple-replica eABF.

The eABF algorithm can be associated with a multiple-walker strategy [77,25] (9.5.2). To run a multiple-replica eABF simulation, start a multiple-replica NAMD run (option +replicas) and set shared on in the Colvars config file to enable the multiple-walker ABF algorithm. It should be noted that in contrast with classical MW-ABF simulations, the output files of an MW-eABF simulation only show the free energy estimate of the corresponding replica.

One can merge the results, using ./eabf.tcl -mergemwabf [merged_filename] [eabf_output1] [eabf_output2] ..., e.g., ./eabf.tcl -mergemwabf merge.eabf eabf.0.UI eabf.1.UI eabf.2.UI eabf.3.UI.

If one runs an ABF-based calculation, breaking the reaction pathway into several non-overlapping windows, one can use ./eabf.tcl -mergesplitwindow [merged_fileprefix] [eabf_output] [eabf_output2] ... to merge the data accrued in these non-overlapping windows. This option can be utilized in both eABF and classical ABF simulations, e.g., ./eabf.tcl -mergesplitwindow merge window0.czar window1.czar window2.czar window3.czar, ./eabf.tcl -mergesplitwindow merge window0.UI window1.UI window2.UI window3.UI or ./eabf.tcl -mergesplitwindow merge abf0 abf1 abf2 abf3.


Metadynamics

The metadynamics method uses a history-dependent potential [60] that generalizes to any type of colvars the conformational flooding [40] and local elevation [48] methods, originally formulated to use as colvars the principal components of a covariance matrix or a set of dihedral angles, respectively. The metadynamics potential on the colvars $ {\mbox{\boldmath {$\xi$}}} = (\xi_{1}, \xi_{2}, \ldots, \xi_{N_{\mathrm{cv}}})$ is defined as:

$\displaystyle V_{\mathrm{meta}}({\mbox{\boldmath {$\xi$}}}(t)) \; = \; { \sum_{...
...\frac{(\xi_{i}(t)-\xi_{i}(t'))^{2}}{2\sigma_{\xi_{i}}^{2}}\right) } }\mathrm{,}$ (66)

where $ V_{\mathrm{meta}}$ is the history-dependent potential acting on the current values of the colvars $ {\mbox{\boldmath {$\xi$}}}$ , and depends only parametrically on the previous values of the colvars. $ V_{\mathrm{meta}}$ is constructed as a sum of $ N_{\mathrm{cv}}$ -dimensional repulsive Gaussian ``hills'', whose height is a chosen energy constant $ W$ , and whose centers are the previously explored configurations $ \left({\mbox{\boldmath {$\xi$}}}(\delta{}t), {\mbox{\boldmath {$\xi$}}}(2\delta{}t), \ldots\right)$ .

During the simulation, the system evolves towards the nearest minimum of the ``effective'' potential of mean force $ \tilde{A}({\mbox{\boldmath {$\xi$}}})$ , which is the sum of the ``real'' underlying potential of mean force $ A({\mbox{\boldmath {$\xi$}}})$ and the the metadynamics potential, $ V_{\mathrm{meta}}({\mbox{\boldmath {$\xi$}}})$ . Therefore, at any given time the probability of observing the configuration $ {\mbox{\boldmath {$\xi^{*}$}}}$ is proportional to $ \exp\left(-\tilde{A}({\mbox{\boldmath {$\xi^{*}$}}})/\kappa_{\mathrm{B}}T\right)$ : this is also the probability that a new Gaussian ``hill'' is added at that configuration. If the simulation is run for a sufficiently long time, each local minimum is canceled out by the sum of the Gaussian ``hills''. At that stage the ``effective'' potential of mean force $ \tilde{A}({\mbox{\boldmath {$\xi$}}})$ is constant, and $ -V_{\mathrm{meta}}({\mbox{\boldmath {$\xi$}}})$ is an estimator of the ``real'' potential of mean force $ A({\mbox{\boldmath {$\xi$}}})$ , save for an additive constant:

$\displaystyle A({\mbox{\boldmath {$\xi$}}}) \; \simeq \; { -V_{\mathrm{meta}}({\mbox{\boldmath {$\xi$}}}) + K }$ (67)

Such estimate of the free energy can be provided by enabling writeFreeEnergyFile. Assuming that the set of collective variables includes all relevant degrees of freedom, the predicted error of the estimate is a simple function of the correlation times of the colvars $ \tau_{\xi_{i}}$ , and of the user-defined parameters $ W$ , $ \sigma_{\xi_{i}}$ and $ \delta{}t$ [16]. In typical applications, a good rule of thumb can be to choose the ratio $ W/\delta{}t$ much smaller than $ \kappa_{\mathrm{B}}T/\tau_{{\mbox{\boldmath {$\xi$}}}}$ , where $ \tau_{{\mbox{\boldmath {$\xi$}}}}$ is the longest among $ {\mbox{\boldmath {$\xi$}}}$ 's correlation times: $ \sigma_{\xi_{i}}$ then dictates the resolution of the calculated PMF.

If the metadynamics parameters are chosen correctly, after an equilibration time, $ t_{e}$ , the estimator provided by eq. 68 oscillates on time around the ``real'' free energy, thereby a better estimate of the latter can be obtained as the time average of the bias potential after $ t_{e}$ [70,27]:

$\displaystyle A({\mbox{\boldmath {$\xi$}}}) \; = \; {-\frac{1}{t_{tot}-t_{e}} \int_{t_{e}}^{t_{tot}} { V_{\mathrm{meta}}({\mbox{\boldmath {$\xi$}}},t)dt} }$ (68)

where $ t_{e}$ is the time after which the bias potential grows (approximately) evenly during the simulation and $ t_{tot}$ is the total simulation time. The free energy calculated according to eq. 69 can thus be obtained averaging on time mutiple time-dependent free energy estimates, that can be printed out through the keyword keepFreeEnergyFiles. An alternative is to obtain the free energy profiles by summing the hills added during the simulation; the hills trajectory can be printed out by enabling the option writeHillsTrajectory.


Treatment of the PMF boundaries

In typical scenarios the Gaussian hills of a metadynamics potential are interpolated and summed together onto a grid, which is much more efficient than computing each hill independently at every step (the keyword useGrids (see 9.5.4) is on by default). This numerical approximation typically yields neglibile errors in the resulting PMF [33]. However, due to the finite thickness of the Gaussian function, the metadynamics potential would suddenly vanish each time a variable exceeds its grid boundaries.

To avoid such discontinuity the Colvars metadynamics code will keep an explicit copy of each hill that straddles a grid's boundary, and will use it to compute metadynamics forces outside the grid. This measure is taken to protect the accuracy and stability of a metadynamics simulation, except in cases of ``natural'' boundaries (for example, the $ [0:180]$ interval of an angle colvar) or when the flags hardLowerBoundary (see 9.3.18) and hardUpperBoundary (see 9.3.18) are explicitly set by the user. Unfortunately, processing explicit hills alongside the potential and force grids could easily become inefficient, slowing down the simulation and increasing the state file's size.

In general, it is a good idea to define a repulsive potential to avoid hills from coming too close to the grid's boundaries, for example as a harmonicWalls restraint (see 9.5.7).

Example: Using harmonic walls to protect the grid's boundaries.
colvar {
  name r
  distance { ... }
  upperBoundary 15.0
  width 0.2
}

metadynamics {
  name meta_r
  colvars r
  hillWeight 0.001
  hillWidth 2.0
}

harmonicWalls {
  name wall_r
  colvars r
  upperWalls 13.0
  upperWallConstant 2.0
}

In the colvar r, the distance function used has a lowerBoundary automatically set to 0 Å by default, thus the keyword lowerBoundary itself is not mandatory and hardLowerBoundary is set to yes internally. However, upperBoundary does not have such a ``natural'' choice of value. The metadynamics potential meta_r will individually process any hill whose center is too close to the upperBoundary, more precisely within fewer grid points than 6 times the Gaussian $ \sigma$ parameter plus one. It goes without saying that if the colvar r represents a distance between two freely-moving molecules, it will cross this ``threshold'' rather frequently.

In this example, where the value of hillWidth ($ 2\sigma$ ) amounts to 2 grid points, the threshold is 6+1 = 7 grid points away from upperBoundary. In explicit units, the width of $ r$ is $ w_r =$ 0.2 Å, and the threshold is 15.0 - 7$ \times$ 0.2 = 13.6 Å.

The wall_r restraint included in the example prevents this: the position of its upperWall is 13 Å, i.e. 3 grid points below the buffer's threshold (13.6 Å). For the chosen value of upperWallConstant, the energy of the wall_r bias at r = $ r_{\mathrm{upper}}$ = 13.6 Å is:

$\displaystyle E^* = \frac{1}{2} \- k \left(\frac{r - r_{\mathrm{upper}}}{w_r}\right)^2 = \frac{1}{2} \- 2.0 \left(-3\right)^2 = 9~\mathrm{kcal/mol}$    

which results in a relative probability $ \exp(-E^*/\kappa_{\mathrm{B}}T) \simeq$ $ 3\times{}10^{-7}$ that r crosses the threshold. The probability that r exceeds upperBoundary, which is further away, has also become vanishingly small. At that point, you may want to set hardUpperBoundary to yes for r, and let meta_r know that no special treatment near the grid's boundaries will be needed.

What is the impact of the wall restraint onto the PMF? Not a very complicated one: the PMF reconstructed by metadynamics will simply show a sharp increase in free-energy where the wall potential kicks in (r $ >$ 13 Å). You may then choose between using the PMF only up until that point and discard the rest, or subtracting the energy of the harmonicWalls restraint from the PMF itself. Keep in mind, however, that the statistical convergence of metadynamics may be less accurate where the wall potential is strong.

In summary, although it would be simpler to set the wall's position upperWall and the grid's boundary upperBoundary to the same number, the finite width of the Gaussian hills calls for setting the former strictly within the latter.


Basic configuration keywords

To enable a metadynamics calculation, a metadynamics {...} block must be defined in the Colvars configuration file. Its mandatory keywords are colvars (see 9.5), the variables involved, hillWeight (see 9.5.4), the weight parameter $ W$ , and the widths $ 2\sigma$ of the Gaussian hills in each dimension given by the single dimensionless parameter hillWidth (see 9.5.4), or more explicitly by the gaussianSigmas (see 9.5.4).


Output files

When interpolating grids are enabled (default behavior), the PMF is written by default every colvarsRestartFrequency steps to the file outputName.pmf in multicolumn text format (9.3.18). The following two options allow to disable or control this behavior and to track statistical convergence:


Performance optimization

The following options control the computational cost of metadynamics calculations, but do not affect results. Default values are chosen to minimize such cost with no loss of accuracy.


Ensemble-Biased Metadynamics

The ensemble-biased metadynamics (EBMetaD) approach [69] is designed to reproduce a target probability distribution along selected collective variables. Standard metadynamics can be seen as a special case of EBMetaD with a flat distribution as target. This is achieved by weighing the Gaussian functions used in the metadynamics approach by the inverse of the target probability distribution:

$\displaystyle V_{\mathrm{EBmetaD}}({\mbox{\boldmath {$\xi$}}}(t)) \; = \; { \su...
...\frac{(\xi_{i}(t)-\xi_{i}(t'))^{2}}{2\sigma_{\xi_{i}}^{2}}\right) } }\mathrm{,}$ (69)

where $ \rho_{exp}({\mbox{\boldmath {$\xi$}}})$ is the target probability distribution and $ S_{\rho} = - \int \rho_{exp}({\mbox{\boldmath {$\xi$}}}) \log \rho_{exp}({\mbox{\boldmath {$\xi$}}}) \, \mathrm{d}{\mbox{\boldmath {$\xi$}}}$ its corresponding differential entropy. The method is designed so that during the simulation the resulting distribution of the collective variable $ {\mbox{\boldmath {$\xi$}}}$ converges to $ \rho_{exp}({\mbox{\boldmath {$\xi$}}})$ . A practical application of EBMetaD is to reproduce an ``experimental'' probability distribution, for example the distance distribution between spectroscopic labels inferred from Förster resonance energy transfer (FRET) or double electron-electron resonance (DEER) experiments [69].

The PMF along $ \xi$ can be estimated from the bias potential and the target ditribution [69]:

$\displaystyle A({\mbox{\boldmath {$\xi$}}}) \; \simeq \; { -V_{\mathrm{EBmetaD}...
...{$\xi$}}}) - \kappa_{\mathrm{B}}T \log \rho_{exp}({\mbox{\boldmath {$\xi$}}}) }$ (70)

and obtained by enabling writeFreeEnergyFile. Similarly to eq. 69, a more accurate estimate of the free energy can be obtained by averaging (after an equilibration time) multiple time-dependent free energy estimates (see keepFreeEnergyFiles).

The following additional options define the configuration for the ensemble-biased metadynamics approach:

As with standard metadynamics, multidimensional probability distributions can be targeted using a single metadynamics block using multiple colvars and a multidimensional target distribution file (see 9.3.18). Instead, multiple probability distributions on different variables can be targeted separately in the same simulation by introducing multiple metadynamics blocks with the ebMeta option.

Example: EBmetaD configuration for a single variable.
colvar {
  name r
  distance {
    group1 { atomNumbers 991 992 }
    group2 { atomNumbers 1762 1763 }
  }
  upperBoundary 100.0
  width 0.1
}

metadynamics {
  name ebmeta
  colvars r
  hillWeight 0.01
  hillWidth 3.0
  ebMeta on
  targetDistFile targetdist1.dat
  ebMetaEquilSteps 500000
}

where targetdist1.dat is a text file in ``multicolumn'' format (9.3.18) with the same width as the variable r (0.1 in this case):
# 1        
# 0.0 0.1 1000 0  
           
  0.05 0.0012      
  0.15 0.0014      
  ... ...      
  99.95 0.0010      
           

Tip: Besides setting a meaninful value for targetDistMinVal, the exploration of unphysically low values of the target distribution (which would lead to very large hills and possibly numerical instabilities) can be also prevented by restricting sampling to a given interval, using e.g. harmonicWalls restraint (9.5.7).


Well-tempered metadynamics

The following options define the configuration for the ``well-tempered'' metadynamics approach [4]:


Multiple-walker metadynamics

Metadynamics calculations can be performed concurrently by multiple replicas that share a common history. This variant of the method is called multiple-walker metadynamics [90]: the Gaussian hills of all replicas are periodically combined into a single biasing potential, intended to converge to a single PMF.

In the implementation here described [33], replicas communicate through files. This arrangement allows launching the replicas either (1) as a bundle (i.e. a single job in a cluster's queueing system) or (2) as fully independent runs (i.e. as separate jobs for the queueing system). One advantage of the use case (1) is that an identical Colvars configuration can be used for all replicas (otherwise, replicaID needs to be manually set to a different string for each replica). However, the use case (2) is less demanding in terms of high-performance computing resources: a typical scenario would be a computer cluster (including virtual servers from a cloud provider) where not all nodes are connected to each other at high speed, and thus each replica runs on a small group of nodes or a single node.

Whichever way the replicas are started (coupled or not), a shared filesystem is needed so that each replica can read the files created by the others: paths to these files are stored in the shared file replicasRegistry. This file, and those listed in it, are read every replicaUpdateFrequency steps. Each time the Colvars state file is written (for example, colvarsRestartFrequency steps), the file named:
outputName.colvars.name.replicaID.state
is written as well; this file contains only the state of the metadynamics bias, which the other replicas will read in turn. In between the times when this file is modified/replaced, new hills are also temporarily written to the file named:
outputName.colvars.name.replicaID.hills
Both files are only used for communication, and may be deleted after the replica begins writing files with a new outputName.

Example: Multiple-walker metadynamics with file-based communication.
metadynamics {
  name mymtd
  colvars x
  hillWeight 0.001
  newHillFrequency 1000
  hillWidth 3.0
  
  multipleReplicas on
  replicasRegistry /shared-folder/mymtd-replicas.txt
  replicaUpdateFrequency 50000 # Best if larger than newHillFrequency
}

The following are the multiple-walkers related options:


Harmonic restraints

The harmonic biasing method may be used to enforce fixed or moving restraints, including variants of Steered and Targeted MD. Within energy minimization runs, it allows for restrained minimization, e.g. to calculate relaxed potential energy surfaces. In the context of the Colvars module, harmonic potentials are meant according to their textbook definition:

$\displaystyle V(\xi) = \frac{1}{2} k \left(\frac{\xi - \xi_0}{w_{\xi}}\right)^2$ (71)

There are two noteworthy aspects of this expression:
  1. Because the standard coefficient of $ 1/2$ of the harmonic potential is included, this expression differs from harmonic bond and angle potentials historically used in common force fields, where the factor was typically omitted resulting in a non-standard definition of the force constant.
  2. The variable $ \xi$ is not only centered at $ \xi_0$ , but is also scaled by its characteristic length scale $ w_{\xi}$ (keyword width (see 9.3.18)). The resulting dimensionless variable $ z = (\xi - \xi_0)/w_{\xi}$ is typically easier to treat numerically: for example, when the forces typically experienced by $ \xi$ are much smaller than $ k/w_{\xi}$ and $ k$ is chosen equal to $ \kappa_{\mathrm{B}}T$ (thermal energy), the resulting probability distribution of $ z$ is approximately a Gaussian with mean equal to 0 and standard deviation equal to 1.

    This property can be used for setting the force constant in umbrella-sampling ensemble runs: if the restraint centers are chosen in increments of $ w_{\xi}$ , the resulting distributions of $ \xi$ are most often optimally overlapped. In regions where the underlying free-energy landscape induces highly skewed distributions of $ \xi$ , additional windows may be added as needed, with spacings finer than $ w_{\xi}$ .

Beyond one dimension, the use of a scaled harmonic potential also allows a standard definition of a multi-dimensional restraint with a unified force constant:

$\displaystyle V(\xi_{1}, \ldots, \xi_{M}) = \frac{1}{2} k \sum_{i=1}^{M} \left(\frac{\xi_{i} - \xi_0}{w_{\xi}}\right)^2$ (72)

If one-dimensional or homogeneous multi-dimensional restraints are defined, and there are no other uses for the parameter $ w_{\xi}$ , width can be left at its default value of $ 1$ .

A harmonic restraint is defined by a harmonic {...} block, which may contain the following keywords:

Tip: A complex set of restraints can be applied to a system, by defining several colvars, and applying one or more harmonic restraints to different groups of colvars. In some cases, dozens of colvars can be defined, but their value may not be relevant: to limit the size of the colvars trajectory file, it may be wise to disable outputValue for such ``ancillary'' variables, and leave it enabled only for ``relevant'' ones.


Moving restraints: steered molecular dynamics

The following options allow to change gradually the centers of the harmonic restraints during a simulations. When the centers are changed continuously, a steered MD in a collective variable space is carried out.

Note on restarting moving restraint simulations: Information about the current step and stage of a simulation with moving restraints is stored in the restart file (state file). Thus, such simulations can be run in several chunks, and restarted directly using the same colvars configuration file. In case of a restart, the values of parameters such as targetCenters, targetNumSteps, etc. should not be changed manually.


Moving restraints: umbrella sampling

The centers of the harmonic restraints can also be changed in discrete stages: in this cases a one-dimensional umbrella sampling simulation is performed. The sampling windows in simulation are calculated in sequence. The colvars trajectory file may then be used both to evaluate the correlation times between consecutive windows, and to calculate the frequency distribution of the colvar of interest in each window. Furthermore, frequency distributions on a predefined grid can be automatically obtained by using the histogram bias (see 9.5.10).

To activate an umbrella sampling simulation, the same keywords as in the previous section can be used, with the addition of the following:


Changing force constant

The force constant of the harmonic restraint may also be changed to equilibrate [31].


Computing the work of a changing restraint

If the restraint centers or force constant are changed continuosly (targetNumStages undefined) it is possible to record the net work performed by the changing restraint:


Harmonic wall restraints

The harmonicWalls {...} bias is closely related to the harmonic bias (see 9.5.5), with the following two differences: (i) instead of a center a lower wall and/or an upper wall are defined, outside of which the bias implements a half-harmonic potential;

$\displaystyle V(\xi) = \left\{ \begin{array}{l l} \frac{1}{2} k \left(\frac{\xi...
..._{\xi}}\right)^2 & \mathrm{if }\ \xi < \xi_{\mathrm{lower}} \end{array} \right.$ (73)

where $ \xi_{\mathrm{lower}}$ and $ \xi_{\mathrm{upper}}$ are the lower and upper wall thresholds, respectively; (ii) because an interval between two walls is defined, only scalar variables can be used (but any number of variables can be defined, and the wall bias is intrinsically multi-dimensional).

Note: this bias replaces the keywords lowerWall, lowerWallConstant, upperWall and upperWallConstant defined in the colvar context. Those keywords are deprecated.

The harmonicWalls bias implements the following options:

Example 1: harmonic walls for one variable with two different force constants.
harmonicWalls {
  name mywalls
  colvars dist
  lowerWalls 22.0
  upperWalls 38.0
  lowerWallConstant 2.0
  upperWallConstant 10.0
}

Example 2: harmonic walls for two variables with a single force constant.
harmonicWalls {
  name mywalls
  colvars phi psi
  lowerWalls -180.0 0.0
  upperWalls 0.0 180.0
  forceConstant 5.0
}


Linear restraints

The linear restraint biasing method is used to minimally bias a simulation. There is generally a unique strength of bias for each CV center, which means you must know the bias force constant specifically for the center of the CV. This force constant may be found by using experiment directed simulation described in section 9.5.9. Please cite Pitera and Chodera when using [87].


Adaptive Linear Bias/Experiment Directed Simulation

Experiment directed simulation applies a linear bias with a changing force constant. Please cite White and Voth [117] when using this feature. As opposed to that reference, the force constant here is scaled by the width corresponding to the biased colvar. In White and Voth, each force constant is scaled by the colvars set center. The bias converges to a linear bias, after which it will be the minimal possible bias. You may also stop the simulation, take the median of the force constants (ForceConst) found in the colvars trajectory file, and then apply a linear bias with that constant. All the notes about units described in sections 9.5.8 and 9.5.5 apply here as well. This is not a valid simulation of any particular statistical ensemble and is only an optimization algorithm until the bias has converged.


Multidimensional histograms

The histogram feature is used to record the distribution of a set of collective variables in the form of a N-dimensional histogram. A histogram block may define the following parameters:

As with any other biasing and analysis method, when a histogram is applied to an extended-system colvar (9.3.20), it accesses the value of the extended coordinate rather than that of the actual colvar. This can be overridden by enabling the bypassExtendedLagrangian (see 9.5) option. A joint histogram of the actual colvar and the extended coordinate may be collected by specifying the colvar name twice in a row in the colvars parameter (e.g. colvars myColvar myColvar): the first instance will be understood as the actual colvar, and the second, as the extended coordinate.


Grid definition for multidimensional histograms

Like the ABF and metadynamics biases, histogram uses the parameters lowerBoundary, upperBoundary, and width to define its grid. These values can be overridden if a configuration block histogramGrid { ...} is provided inside the configuration of histogram. The options supported inside this configuration block are:


Probability distribution-restraints

The histogramRestraint bias implements a continuous potential of many variables (or of a single high-dimensional variable) aimed at reproducing a one-dimensional statistical distribution that is provided by the user. The $ M$ variables $ (\xi_{1}, \ldots, \xi_{M})$ are interpreted as multiple observations of a random variable $ \xi$ with unknown probability distribution. The potential is minimized when the histogram $ h(\xi)$ , estimated as a sum of Gaussian functions centered at $ (\xi_{1}, \ldots, \xi_{M})$ , is equal to the reference histogram $ h_{0}(\xi)$ :

$\displaystyle V(\xi_{1}, \ldots, \xi_{M}) = \frac{1}{2} k \int\left(h(\xi)-h_{0}(\xi)\right)^2 \mathrm{d}\xi$ (74)

$\displaystyle h(\xi) = \frac{1}{M\sqrt{2\pi\sigma^2}} \sum_{i=1}^{M} \exp\left(-\frac{(\xi-\xi_{i})^2}{2\sigma^2}\right)$ (75)

When used in combination with a distancePairs multi-dimensional variable, this bias implements the refinement algorithm against ESR/DEER experiments published by Shen et al [98].

This bias behaves similarly to the histogram bias with the gatherVectorColvars option, with the important difference that all variables are gathered, resulting in a one-dimensional histogram. Future versions will include support for multi-dimensional histograms.

The list of options is as follows:


Defining scripted biases

Rather than using the biasing methods described above, it is possible to apply biases provided at run time as a Tcl script, in the spirit of TclForces.


Performance of scripted biases

If concurrent computation over multiple threads is available (this is indicated by the message ``SMP parallelism is available.'' printed at initialization time), it is useful to take advantage of the scripting interface to combine many components, all computed in parallel, into a single variable.

The default SMP schedule is the following:

  1. distribute the computation of all components across available threads;
  2. on a single thread, collect the results of multi-component variables using polynomial combinations (see 9.3.15), or custom functions (see 9.3.16), or scripted functions (see 9.3.17);
  3. distribute the computation of all biases across available threads;
  4. compute on a single thread any scripted biases implemented via the keyword scriptedColvarForces (see 9.5.12).
  5. communicate on a single thread forces to NAMD.

The following options allow to fine-tune this schedule:


next up previous contents index
Next: Scripting interface (Tcl): list Up: Collective Variable-based Calculations (Colvars) Previous: Selecting atoms   Contents   Index
http://www.ks.uiuc.edu/Research/namd/