- Adaptive Biasing Force
- ABF requirements on collective variables
- Parameters for ABF
- Multiple-replica ABF
- Output files
- Post-processing: reconstructing a multidimensional free energy surface

- Extended-system Adaptive Biasing Force (eABF)
- CZAR estimator of the free energy
- Zheng/Yang estimator of the free energy
- Usage for multiple-replica eABF.

- Metadynamics
- Output files
- Performance tuning
- Well-tempered metadynamics
- Multiple-replicas metadynamics
- Compatibility and post-processing

- Harmonic restraints
- Moving restraints: steered molecular dynamics
- Moving restraints: umbrella sampling
- Changing force constant

- Linear restraints
- Adaptive Linear Bias/Experiment Directed Simulation
- Multidimensional histograms

- Probability distribution-restraints
- Scripted biases

Biasing and analysis methods

All of the biasing and analysis methods implemented (`abf`,
`harmonic`, `histogram` and `metadynamics`)
recognize the following options:

Identifier for the bias`name`**Context:**colvar bias**Acceptable Values:**string**Default Value:**`type of bias bias index`**Description:**This string is used to identify the bias or analysis method in output messages and to name some output files.Collective variables involved`colvars`**Context:**colvar bias**Acceptable Values:**space-separated list of colvar names**Description:**This option selects by name all the colvars to which this bias or analysis will be applied.Write the current bias energy to the trajectory file`outputEnergy`**Context:**colvar bias**Acceptable Values:**boolean**Default Value:**`off`**Description:**If this option is chosen and`colvarsTrajFrequency`is not zero, the current value of the biasing energy will be written to the trajectory file during the simulation.

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

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 (10.2.4) of the variables produces the extended-system ABF variant of the method (10.5.2).

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 is defined from the canonical distribution of , :

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 exerted on , taken over an iso- surface:

Several formulae that take the form of (50) have been proposed. This implementation relies partly on the classic formulation [15], and partly on a more versatile scheme originating in a work by Ruiz-Montero et al. [66], generalized by den Otter [22] and extended to multiple variables by Ciccotti et al. [18]. Consider a system subject to constraints of the form . Let ( be arbitrarily chosen vector fields ( ) verifying, for all , , and :

then the following holds [18]:

where is the potential energy function. can be interpreted as the direction along which the force acting on variable 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 [15]. Condition (51) states that the direction along which the total force on is measured is orthogonal to the gradient of , which means that the force measured on does not act on .

Equation (52) 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, is accumulated in bins of finite size , thereby providing an estimate of the free energy gradient according to equation (50). The biasing force applied along the collective variables to overcome free energy barriers is calculated as:

where
denotes the current estimate of the
free energy gradient at the current point
in the collective
variable subspace, and
is a scaling factor that is ramped
from 0 to 1 as the local number of samples
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
**
**
is progressively refined. The biasing
force introduced in the equations of motion guarantees that in
the bin centered around
,
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
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 result in sampling difficulties.
Most commonly, the number of variables is one or two.

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 (10.5.2).

*Only linear combinations*of colvar components can be used in ABF calculations.*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.*Mutual orthogonality of colvars*. In a multidimensional ABF calculation, equation (51) must be satisfied for any two colvars and . Various cases fulfill this orthogonality condition:- and are based on non-overlapping sets of atoms.
- atoms involved in the force measurement on
do not participate in
the definition of
. This can be obtained using the option
`oneSiteTotalForce`of the`distance`,`angle`, and`dihedral`components (example: Ramachandran angles , ). -
and
are orthogonal by construction. Useful cases are the sum and
difference of two components, or
`distance_z`and`distance_xy`using the same axis.

*Mutual orthogonality of components*: when several components are combined into a colvar, it is assumed that their vectors (equation (53)) are mutually orthogonal. The cases described for colvars in the previous paragraph apply.*Orthogonality of colvars and constraints*: equation 52 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 52 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.

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` parameter (see 10.2.1).
The following specific parameters can be set in the ABF configuration block:

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)Number of samples in a bin prior to application of the ABF`fullSamples`**Context:**`abf`**Acceptable Values:**positive integer**Default Value:**200**Description:**To avoid nonequilibrium effects due to large fluctuations of the force exerted along the colvars, it is recommended to apply a biasing force only after a the estimate has started converging. If`fullSamples`is non-zero, the applied biasing force is scaled by a factor between 0 and 1. If the number of samples in the current bin is higher than`fullSamples`, the factor is one. If it is less than half of`fullSamples`, the factor is zero and no bias is applied. Between those two thresholds, the factor follows a linear ramp from 0 to 1: .Maximum magnitude of the ABF force`maxForce`**Context:**`abf`**Acceptable Values:**positive decimals (one per colvar)**Default Value:**disabled**Description:**This option enforces a cap on the magnitude of the biasing force effectively applied by this ABF bias on each colvar. This can be useful in the presence of singularities in the PMF such as hard walls, where the discretization of the average force becomes very inaccurate, causing the colvar's diffusion to get ``stuck'' at the singularity. To enable this cap, provide one non-negative value for each colvar. The unit of force is kcal/mol divided by the colvar unit.Remove geometric entropy term from calculated free energy gradient?`hideJacobian`**Context:**`abf`**Acceptable Values:**boolean**Default Value:**`no`**Description:**In a few special cases, most notably distance-based variables, an alternate definition of the potential of mean force is traditionally used, which excludes the Jacobian term describing the effect of geometric entropy on the distribution of the variable. This results, for example, in particle-particle potentials of mean force being flat at large separations. Setting this parameter to`yes`causes the output data to follow that convention, by removing this contribution from the output gradients while applying internally the corresponding correction to ensure uniform sampling. It is not allowed for colvars with multiple components.Frequency (in timesteps) at which ABF data files are refreshed`outputFreq`**Context:**`abf`**Acceptable Values:**positive integer**Default Value:**Colvars module restart frequency**Description:**The files containing the free energy gradient estimate and sampling histogram (and the PMF in one-dimensional calculations) are written on disk at the given time interval.Frequency (in timesteps) at which ABF history files are accumulated`historyFreq`**Context:**`abf`**Acceptable Values:**positive integer**Default Value:**0**Description:**If this number is non-zero, the free energy gradient estimate and sampling histogram (and the PMF in one-dimensional calculations) are appended to files on disk at the given time interval. History file names use the same prefix as output files, with ```.hist`'' appended.Filename prefix for reading ABF data`inputPrefix`**Context:**`abf`**Acceptable Values:**list of strings**Description:**If this parameter is set, for each item in the list, ABF tries to read a gradient and a sampling files named`inputPrefix .grad`and`inputPrefix .count`. This is done at startup and sets the initial state of the ABF algorithm. The data from all provided files is combined appropriately. Also, the grid definition (min and max values, width) need not be the same that for the current run. This command is useful to piece together data from simulations in different regions of collective variable space, or change the colvar boundary values and widths. Note that it is not recommended to use it to switch to a smaller width, as that will leave some bins empty in the finer data grid. This option is NOT compatible with reading the data from a restart file (`colvarsInput`option of the NAMD config file).Apply the ABF bias?`applyBias`**Context:**`abf`**Acceptable Values:**boolean**Default Value:**`yes`**Description:**If this is set to no, the calculation proceeds normally but the adaptive biasing force is not applied. Data is still collected to compute the free energy gradient. This is mostly intended for testing purposes, and should not be used in routine simulations.Update the ABF bias?`updateBias`**Context:**`abf`**Acceptable Values:**boolean**Default Value:**`yes`**Description:**If this is set to no, the initial biasing force (e.g. read from a restart file or through`inputPrefix`) is not updated during the simulation. As a result, a constant bias is applied. This can be used to apply a custom, tabulated biasing potential to any combination of colvars. To that effect, one should prepare a gradient file containing the gradient of the potential to be applied (negative of the bias force), and a count file containing only values greater than`fullSamples`. These files must match the grid parameters of the colvars.

Multiple-replica ABF

Apply multiple-replica ABF, sharing force samples among the replicas?`shared`**Context:**`abf`**Acceptable Values:**boolean**Default Value:**`no`**Description:**This is command requires that NAMD be compiled and executed with multiple-replica support. If`shared`is set to yes, the total force samples will be synchronized among all replicas at intervals defined by`sharedFreq`. This implements the multiple-walker ABF scheme described in [56]; this implementation is documented in [19]. Thus, it is as if total force samples among all replicas are gathered in a single shared buffer, which why the algorithm is referred to as shared ABF. Shared ABF allows all replicas to benefit from the sampling done by other replicas and can lead to faster convergence of the biasing force.Frequency (in timesteps) at which force samples are synchronized among the replicas`sharedFreq`**Context:**`abf`**Acceptable Values:**positive integer**Default Value:**`outputFreq`**Description:**In the current implementation of shared ABF, each replica maintains a separate buffer of total force samples that determine the biasing force. Every`sharedFreq`steps, the replicas communicate the samples that have been gathered since the last synchronization time, ensuring all replicas apply a similar biasing force.

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

*outputName*`.grad`: current estimate of the free energy gradient (grid), in multicolumn;*outputName*`.count`: histogram of samples collected, on the same grid;*outputName*`.pmf`: only for one-dimensional calculations, integrated free energy profile or PMF.

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

If a one-dimensional calculation is performed, the estimated free energy
gradient is automatically integrated and a potential of mean force is written
under the file name `<outputName>.pmf`, in a plain text format that
can be read by most data plotting and analysis programs (e.g. gnuplot).

In dimension 2 or greater, integrating the discretized gradient becomes non-trivial. The
standalone utility `abf_integrate` is provided to perform that task.
`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:

`-n`: number of M-C steps to be performed; by default, a minimal number of steps is chosen based on the size of the grid, and the integration runs until a convergence criterion is satisfied (based on the RMSD between the target gradient and the real PMF gradient)`-t`: temperature for M-C sampling (unrelated to the simulation temperature) [500 K]`-m`: use metadynamics-like biased sampling? (0 = false) [1]`-h`: increment for the history-dependent bias (``hill height'') [0.01 kcal/mol]`-f`: if non-zero, this factor is used to scale the increment stepwise in the second half of the M-C sampling to refine the free energy estimate [0.5]

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

`abf_integrate` produces the following output files:

`<gradient_file>.pmf`: computed free energy surface`<gradient_file>.histo`: histogram of M-C sampling (not usable in a straightforward way if the history-dependent bias has been applied)`<gradient_file>.est`: estimated gradient of the calculated free energy surface (from finite differences)`<gradient_file>.dev`: deviation between the user-provided numerical gradient and the actual gradient of the calculated free energy surface. The RMS norm of this vector field is used as a convergence criteria and displayed periodically during the integration.

**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 (10.5.1)
where the bias is not applied
directly to the collective variable, but to an extended coordinate (``fictitious variable'')
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 (10.2.4).
The theory of eABF and the present implementation are documented in detail
in reference [49].

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

The extended variable is coupled to the colvar by the harmonic potential . Under eABF dynamics, the adaptive bias on is the running estimate of the average spring force:

(54) |

where the angle brackets indicate a canonical average conditioned by . At long simulation times, eABF produces a flat histogram of the extended variable , and a flattened histogram of , whose exact shape depends on the strength of the coupling as defined by

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

The *corrected z-averaged restraint* (CZAR) estimator
is described in detail in reference [49].
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:

where is the colvar, is the extended variable harmonically coupled to with a force constant , and is the observed distribution (histogram) of , affected by the eABF bias.

There is only one optional parameter to the CZAR estimator:

Write internal data from CZAR to a separate file?`writeCZARwindowFile`**Context:**`abf`**Acceptable Values:**boolean**Default Value:**`no`**Description:**When this option is enabled, eABF simulations will write a file containing the -averaged restraint force under the name*outputName*`.zgrad`. The same information is always included in the colvars state file, which is sufficient for restarting an eABF simulation. These separate file is only useful when joining adjacent windows from a stratified eABF simulation, either to continue the simulation in a broader window or to compute a CZAR estimate of the PMF over the full range of the coordinate(s).

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

*outputName*`.czar.grad`: current estimate of the free energy gradient (grid), in multicolumn;*outputName*`.czar.pmf`: only for one-dimensional calculations, integrated free energy profile or PMF.

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 Vanduvre-lès-Nancy cedex, France

© 2016, CENTRE NATIONAL DE LA RECHERCHE SCIENTIFIQUE

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

where is the colvar, is the extended variable harmonically coupled to with a force constant , is the number of samples collected in a bin, which is assumed to be a Gaussian function of with mean and standard deviation . At the present stage, equation 57 is implemented through the scripted Colvars interface (10.6) for one- and two-dimensional free-energy calculations.

To evaluate the Zheng/Yang estimator in an eABF simulation, one needs to set
`scriptedColvarForces on`
and source the eabf.tcl file found in the lib/eabf directory.
Here, an example of a configuration file is supplied
for an eABF simulation:

`source eabf.tcl # Enables eABF
set eabf_inputname 0 # Prefix for restart files. '0' is used for new run
set eabf_outputname output.eabf # Prefix for output files
set eabf_temperature 300 # Temperature used in the calculation
set eabf_outputfreq 20000 # Frequency at which eABF data files are updated
`

set eabf_inputname 0

set eabf_outputname output.eabf.[myReplica]

set eabf_temperature 300

set eabf_outputfreq 20000

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

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.eabf window1.eabf window2.eabf window3.eabf` or
`./eabf.tcl -mergesplitwindow merge abf0 abf1 abf2 abf3`.

Metadynamics

The metadynamics method uses a history-dependent potential [46] that generalizes to any type of colvars the conformational flooding [30] and local elevation [38] 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 is defined as:

where is the history-dependent potential acting on the

During the simulation, the system evolves towards the nearest minimum of the ``effective'' potential of mean force , which is the sum of the ``real'' underlying potential of mean force and the the metadynamics potential, . Therefore, at any given time the probability of observing the configuration is proportional to : 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 is constant, and is an accurate estimator of the ``real'' potential of mean force , save for an additive constant:

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 , and of the user-defined parameters , and [14]. In typical applications, a good rule of thumb can be to choose the ratio much smaller than , where is the longest among 's correlation times: then dictates the resolution of the calculated PMF.

To enable a metadynamics calculation, a `metadynamics` block must be defined in the colvars configuration file.
Its mandatory keywords are `colvars`, which lists all the variables involved, and `hillWeight`, which specifies the weight parameter
.
The parameters
and
specified by the optional keywords `newHillFrequency` and `hillWidth`:

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)see definition of`outputEnergy:``outputEnergy`(biasing and analysis methods)Height of each hill (kcal/mol)`hillWeight`**Context:**`metadynamics`**Acceptable Values:**positive decimal**Description:**This option sets the height of the Gaussian hills that are added during this run. Lower values provide more accurate sampling of the system's degrees of freedom at the price of longer simulation times to complete a PMF calculation based on metadynamics.Frequency of hill creation`newHillFrequency`**Context:**`metadynamics`**Acceptable Values:**positive integer**Default Value:**`1000`**Description:**This option sets the number of integration steps after which a new hill is added to the metadynamics potential. Its value determines the parameter in eq. 58. Higher values provide more accurate sampling at the price of longer simulation times to complete a PMF calculation.Relative width of a Gaussian hill with respect to the colvar's width`hillWidth`**Context:**`metadynamics`**Acceptable Values:**positive decimal**Default Value:****Description:**The Gaussian width along each colvar, , is set as the product between this number and the colvar's parameter given by`width`(see 10.2.1); such product is printed in the standard output of NAMD. The default value of this number gives a Gaussian hill function whose volume is equal to the product of , the volume of one`histogram`bin (see 10.5.7), and .**Tip:***use this property to estimate the fraction of colvar space covered by the Gaussian bias within a given simulation time.*When`useGrids`is on, the default value also gives acceptable discretization errors [24]: for smoother visualization, this parameter may be increased and the`width`decreased in the same proportion.**Note:***values smaller than 1 are not recommended*.

Output files

Periodically write the PMF for visualization`writeFreeEnergyFile`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`on`**Description:**When`useGrids`and this option are`on`, the PMF is written every`colvarsRestartFrequency`steps.Keep all the PMF files`keepFreeEnergyFiles`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**When`writeFreeEnergyFile`and this option are`on`, the step number is included in the file name, thus generating a series of PMF files. Activating this option can be useful to follow more closely the convergence of the simulation, by comparing PMFs separated by short times.

**Note:** when Gaussian hills are deposited near `lowerBoundary` or `upperBoundary` (see 10.2.1) and interpolating grids are used (default behavior), their truncation can give rise to accumulating errors.
In these cases, as a measure of fault-tolerance all Gaussian hills near the boundaries are included in the output state file, and are recalculated analytically whenever the colvar falls outside the grid's boundaries.
(Such measure protects the accuracy of the calculation, and can only be disabled by `hardLowerBoundary` or `hardUpperBoundary`.)
To avoid gradual loss of performance and growth of the state file, either one of the following solutions is recommended:

- enabling the option
`expandBoundaries`, so that the grid's boundaries are automatically recalculated whenever necessary; the resulting`.pmf`will have its abscissas expanded accordingly; - setting
`lowerWall`and`upperWall`well within the interval delimited by`lowerBoundary`and`upperBoundary`.

Performance tuning

Interpolate the hills with grids`useGrids`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`on`**Description:**This option discretizes all hills for improved performance, accumulating their energy and their gradients on two separate grids of equal spacing. Grids are defined by the values of`lowerBoundary`,`upperBoundary`and`width`for each colvar. Currently, this option is implemented for all types of variables except the non-scalar types (`distanceDir`or`orientation`). If`expandBoundaries`is defined in one of the colvars, grids are automatically expanded along the direction of that colvar.Recompute the grids when reading a state file`rebinGrids`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**When restarting from a state file, the grid's parameters (boundaries and widths) saved in the state file override those in the configuration file. Enabling this option forces the grids to match those in the current configuration file.

Well-tempered metadynamics

Perform well-tempered metadynamics`wellTempered`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**If enabled, this flag causes well-tempered metadynamics as described by Barducci et al.[4] to be performed, rather than standard metadynamics. The parameter`biasTemperature`is then required.This feature was contributed by Li Li (Luthey-Schulten group, Departement of Chemistry, UIUC).Temperature bias for well-tempered metadynamics`biasTemperature`**Context:**`metadynamics`**Acceptable Values:**positive decimal**Description:**When running metadynamics in the long time limit, collective variable space is sampled to a modified temperature . In conventional metadynamics, the temperature ``boost'' would constantly increases with time. Instead, in well-tempered metadynamics must be defined by the user via`biasTemperature`. The written PMF includes the scaling factor [4]. A careful choice of determines the sampling and convergence rate, and is hence crucial to the success of a well-tempered metadynamics simulation.

Multiple-replicas metadynamics

Multiple replicas metadynamics`multipleReplicas`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**If this option is`on`, multiple (independent) replica of the same system can be run at the same time, and their hills will be combined to obtain a single PMF [64]. Replicas are identified by the value of`replicaID`. Communication is done by files: each replica must be able to read the files created by the others, whose paths are communicated through the file`replicasRegistry`. This file, and the files listed in it, are read every`replicaUpdateFrequency`steps. Every time the colvars state file is written (`colvarsRestartFrequency`), the file:

``*outputName*`.colvars.`*name*`.`*replicaID*`.state`'' is also written, containing the state of the metadynamics bias for`replicaID`. In the time steps between`colvarsRestartFrequency`, new hills are temporarily written to the file:

``*outputName*`.colvars.`*name*`.`*replicaID*`.hills`'', which serves as communication buffer. These files are only required for communication, and may be deleted after a new MD run is started with a different`outputName`.Set the identifier for this replica`replicaID`**Context:**`metadynamics`**Acceptable Values:**string**Description:**If`multipleReplicas`is`on`, this option sets a unique identifier for this replica. All replicas should use identical collective variable configurations, except for the value of this option.Multiple replicas database file`replicasRegistry`**Context:**`metadynamics`**Acceptable Values:**UNIX filename**Default Value:**``*name*`.replica_files.txt`''**Description:**If`multipleReplicas`is`on`, this option sets the path to the replicas' database file.How often hills are communicated between replicas`replicaUpdateFrequency`**Context:**`metadynamics`**Acceptable Values:**positive integer**Default Value:**`newHillFrequency`**Description:**If`multipleReplicas`is`on`, this option sets the number of steps after which each replica (re)reads the other replicas' files. The lowest meaningful value of this number is`newHillFrequency`. If access to the file system is significantly affecting the simulation performance, this number can be increased, at the price of reduced synchronization between replicas. Values higher than`colvarsRestartFrequency`may not improve performance significantly.Periodically write the contribution to the PMF from this replica`dumpPartialFreeEnergyFile`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`on`**Description:**When`multipleReplicas`is`on`, the file*outputName*`.pmf`contains the combined PMF from all replicas, provided that`useGrids`is`on`(default). Enabling this option produces an additional file*outputName*`.partial.pmf`, which can be useful to quickly monitor the contribution of each replica to the PMF.

Name of this metadynamics instance`name`**Context:**`metadynamics`**Acceptable Values:**string**Default Value:**```meta`'' + rank number**Description:**This option sets the name for this metadynamics instance. While it is not advisable to use more than one metadynamics instance within the same simulation, this allows to distinguish each instance from the others. If there is more than one metadynamics instance, the name of this bias is included in the metadynamics output file names, such as e.g. the`.pmf`file.Write each individual hill to the state file`keepHills`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**When`useGrids`and this option are`on`, all hills are saved to the state file in their analytic form, alongside their grids. This makes it possible to later use exact analytic Gaussians for`rebinGrids`. To only keep track of the history of the added hills,`writeHillsTrajectory`is preferable.Write a log of new hills`writeHillsTrajectory`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`on`**Description:**If this option is`on`, a logfile is written by the`metadynamics`bias, with the name ``*outputName*`.colvars. name .hills.traj`'', which can be useful to follow the time series of the hills. When`multipleReplicas`is`on`, its name changes to

``*outputName*`.colvars. name . replicaID .hills.traj`''. This file can be used to quickly visualize the positions of all added hills, in case`newHillFrequency`does not coincide with`colvarsRestartFrequency`.

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:

Note that this differs from harmonic bond and angle potentials in common force fields, where the factor of one half is typically omitted, resulting in a non-standard definition of the force constant.

The formula above includes the characteristic length scale
of the colvar
(keyword `width`, see 10.2.1) to allow the definition of a multi-dimensional restraint with a unified force constant:

If one-dimensional or homogeneous multi-dimensional restraints are defined, and there are no other uses for the parameter
, *the parameter* `width` *can be left at its default value of
*.

The restraint energy is reported by NAMD under the MISC title.
A harmonic restraint is set up by a `harmonic {...}`
block, which may contain (in addition to the standard option
`colvars`) the following keywords:

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)see definition of`outputEnergy:``outputEnergy`(biasing and analysis methods)Scaled force constant (kcal/mol)`forceConstant`**Context:**`harmonic`**Acceptable Values:**positive decimal**Default Value:**`1.0`**Description:**This defines a scaled force constant for the harmonic potential (eq. 61). To ensure consistency for multidimensional restraints, it is divided internally by the square of the specific`width`for each colvar involved (which is 1 by default), so that all colvars are effectively dimensionless and of commensurate size. For instance, setting a scaled force constant of 10 kcal/mol acting on two colvars, an angle with a`width`of 5 degrees and a distance with a width of 0.5 Å, will apply actual force constants of 0.4 kcal/mol degree for the angle and 40 kcal/mol/Å for the distance.Initial harmonic restraint centers`centers`**Context:**`harmonic`**Acceptable Values:**space-separated list of colvar values**Description:**The centers (equilibrium values) of the restraint, , are entered here. The number of values must be the number of requested colvars. Each value is a decimal number if the corresponding colvar returns a scalar, a ```(x, y, z)`'' triplet if it returns a unit vector or a vector, and a ```(q0, q1, q2, q3)`'' quadruplet if it returns a rotational quaternion. If a colvar has periodicities or symmetries, its closest image to the restraint center is considered when calculating the harmonic potential.

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

Steer the restraint centers towards these targets`targetCenters`**Context:**`harmonic`**Acceptable Values:**space-separated list of colvar values**Description:**When defined, the current`centers`will be moved towards these values during the simulation. By default, the centers are moved over a total of`targetNumSteps`steps by a linear interpolation, in the spirit of Steered MD. If`targetNumStages`is set to a nonzero value, the change is performed in discrete stages, lasting`targetNumSteps`steps*each*. This second mode may be used to sample successive windows in the context of an Umbrella Sampling simulation. When continuing a simulation run, the`centers`specified in the configuration file`colvarsConfig`are overridden by those saved in the restart file`colvarsInput`. To perform Steered MD in an arbitrary space of colvars, it is sufficient to use this option and enable`outputAppliedForce`within each of the colvars involved.Number of steps for steering`targetNumSteps`**Context:**`harmonic`**Acceptable Values:**positive integer**Description:**In single-stage (continuous) transformations, defines the number of MD steps required to move the restraint centers (or force constant) towards the values specified with`targetCenters`or`targetForceConstant`. After the target values have been reached, the centers (resp. force constant) are kept fixed. In multi-stage transformations, this sets the number of MD steps*per stage*.Write the current centers to the trajectory file`outputCenters`**Context:**`harmonic`**Acceptable Values:**boolean**Default Value:**`off`**Description:**If this option is chosen and`colvarsTrajFrequency`is not zero, the positions of the restraint centers will be written to the trajectory file during the simulation. This option allows to conveniently extract the PMF from the colvars trajectory files in a steered MD calculation.Write the accumulated work of the moving restraint to the trajectory file`outputAccumulatedWork`**Context:**`harmonic`**Acceptable Values:**boolean**Default Value:**`off`**Description:**If this option is chosen,`targetCenters`is defined, and`colvarsTrajFrequency`is not zero, the accumulated work from the beginning of the simulation will be written to the trajectory file. If the simulation has been continued from a previous state file, the previously accumulated work is included in the integral. This option allows to conveniently extract the PMF from the colvars trajectory files in a steered MD calculation.

**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 10.5.7).

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

Number of stages for steering`targetNumStages`**Context:**`harmonic`**Acceptable Values:**non-negative integer**Default Value:**`0`**Description:**If non-zero, sets the number of stages in which the restraint centers or force constant are changed to their target values. If zero, the change is continuous. Each stage lasts`targetNumSteps`MD steps. To sample both ends of the transformation, the simulation should be run for`targetNumSteps`(`targetNumStages`+ 1).

Changing force constant

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

Change the force constant towards this value`targetForceConstant`**Context:**`harmonic`**Acceptable Values:**positive decimal**Description:**When defined, the current`forceConstant`will be moved towards this value during the simulation. Time evolution of the force constant is dictated by the`targetForceExponent`parameter (see below). By default, the force constant is changed smoothly over a total of`targetNumSteps`steps. This is useful to introduce or remove restraints in a progressive manner. If`targetNumStages`is set to a nonzero value, the change is performed in discrete stages, lasting`targetNumSteps`steps*each*. This second mode may be used to compute the conformational free energy change associated with the restraint, within the FEP or TI formalisms. For convenience, the code provides an estimate of the free energy derivative for use in TI. A more complete free energy calculation (particularly with regard to convergence analysis), while not handled by the Colvars module, can be performed by post-processing the colvars trajectory, if`colvarsTrajFrequency`is set to a suitably small value. It should be noted, however, that restraint free energy calculations may be handled more efficiently by an indirect route, through the determination of a PMF for the restrained coordinate.[23]Exponent in the time-dependence of the force constant`targetForceExponent`**Context:**`harmonic`**Acceptable Values:**decimal equal to or greater than 1.0**Default Value:**`1.0`**Description:**Sets the exponent, , in the function used to vary the force constant as a function of time. The force is varied according to a coupling parameter , raised to the power : , where , , and are the initial, current, and final values of the force constant. The parameter evolves linearly from 0 to 1, either smoothly, or in`targetNumStages`equally spaced discrete stages, or according to an arbitrary schedule set with`lambdaSchedule`. When the initial value of the force constant is zero, an exponent greater than 1.0 distributes the effects of introducing the restraint more smoothly over time than a linear dependence, and ensures that there is no singularity in the derivative of the restraint free energy with respect to lambda. A value of 4 has been found to give good results in some tests.Number of steps discarded from TI estimate`targetEquilSteps`**Context:**`harmonic`**Acceptable Values:**positive integer**Description:**Defines the number of steps within each stage that are considered equilibration and discarded from the restraint free energy derivative estimate reported reported in the output.Schedule of lambda-points for changing force constant`lambdaSchedule`**Context:**`harmonic`**Acceptable Values:**list of real numbers between 0 and 1**Description:**If specified together with targetForceConstant, sets the sequence of discrete values that will be used for different stages.

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 10.5.6. Please cite Pitera and Chodera when using [63].

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)Scaled force constant (kcal/mol)`forceConstant`**Context:**`linear`**Acceptable Values:**positive decimal**Default Value:**`1.0`**Description:**This defines a scaled force constant for the linear bias. To ensure consistency for multidimensional restraints, it is divided internally by the specific`width`for each colvar involved (which is 1 by default), so that all colvars are effectively dimensionless and of commensurate size.Initial linear restraint centers`centers`**Context:**`linear`**Acceptable Values:**space-separated list of colvar values**Description:**The centers (equilibrium values) of the restraint are entered here. The number of values must be the number of requested colvars. Each value is a decimal number if the corresponding colvar returns a scalar, a ```(x, y, z)`'' triplet if it returns a unit vector or a vector, and a ```q0, q1, q2, q3)`'' quadruplet if it returns a rotational quaternion. If a colvar has periodicities or symmetries, its closest image to the restraint center is considered when calculating the linear potential.

Adaptive Linear Bias/Experiment Directed Simulation

Experiment directed simulation applies a linear bias with a changing
force constant. Please cite White and Voth [82] 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 10.5.5
and 10.5.4 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**.

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)Collective variable centers`centers`**Context:**`alb`**Acceptable Values:**space-separated list of colvar values**Description:**The desired center (equilibrium values) which will be sought during the adaptive linear biasing. The number of values must be the number of requested colvars. Each value is a decimal number if the corresponding colvar returns a scalar, a ```(x, y, z)`'' triplet if it returns a unit vector or a vector, and a ```q0, q1, q2, q3)`'' quadruplet if it returns a rotational quaternion. If a colvar has periodicities or symmetries, its closest image to the restraint center is considered when calculating the linear potential.The duration of updates`updateFrequency`**Context:**`alb`**Acceptable Values:**An integer**Description:**This is, , the number of simulation steps to use for each update to the bias. This determines how long the system requires to equilibrate after a change in force constant ( ), how long statistics are collected for an iteration ( ), and how quickly energy is added to the system (at most, , where is the`forceRange`). Until the force constant has converged, the method as described is an optimization procedure and not an integration of a particular statistical ensemble. It is important that each step should be uncorrelated from the last so that iterations are independent. Therefore, should be at least twice the autocorrelation time of the collective variable. The system should also be able to dissipate energy as fast as , which can be done by adjusting thermostat parameters. Practically, has been tested successfully at significantly shorter than the autocorrelation time of the collective variables being biased and still converge correctly.The expected range of the force constant in units of energy`forceRange`**Context:**`alb`**Acceptable Values:**A space-separated list of decimal numbers**Default Value:**3**Description:**This is largest magnitude of the force constant which one expects. If this parameter is too low, the simulation will not converge. If it is too high the simulation will waste time exploring values that are too large. A value of 3 has worked well in the systems presented as a first choice. This parameter is dynamically adjusted over the course of a simulation. The benefit is that a bad guess for the forceRange can be corrected. However, this can lead to large amounts of energy being added over time to the system. To prevent this dynamic update, add`hardForceRange yes`as a parameterThe maximum rate of change of force constant`rateMax`**Context:**`alb`**Acceptable Values:**A list of space-separated real numbers**Description:**This optional parameter controls how much energy is added to the system from this bias. Tuning this separately from the`updateFrequency`and`forceRange`can allow for large bias changes but with a low`rateMax`prevents large energy changes that can lead to instability in the simulation.

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.
It functions as a ``collective variable bias'', and is invoked by adding a
`histogram` block to the Colvars configuration file.

As with any other biasing and analysis method, when a histogram is applied to
an extended-system colvar (10.2.4), it accesses the value
of the fictitious coordinate rather than that of the ``true'' colvar.
A joint histogram of the ``true'' colvar and the fictitious coordinate
may be obtained by specifying the colvar name twice in a row
in the `colvars` parameter: the first instance will be understood as the
``true'' colvar, and the second, as the fictitious coordinate.

In addition to the common parameters `name` and `colvars`
described above, a `histogram` block may define the following parameter:

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)Frequency (in timesteps) at which the histogram files are refreshed`outputFreq`**Context:**`histogram`**Acceptable Values:**positive integer**Default Value:**`colvarsRestartFrequency`**Description:**The histogram data are written to files at the given time interval. A value of 0 disables the creation of these files (**note:**all data to continue a simulation are still included in the state file).Write the histogram to a file`outputFile`**Context:**`histogram`**Acceptable Values:**UNIX filename**Default Value:***outputName*`. name .dat`**Description:**Name of the file containing histogram data (multicolumn format), which is written every`outputFreq`steps. For the special case of 2 variables, Gnuplot may be used to visualize this file.Write the histogram to a file`outputFileDX`**Context:**`histogram`**Acceptable Values:**UNIX filename**Default Value:***outputName*`. name .dat`**Description:**Name of the file containing histogram data (OpenDX format), which is written every`outputFreq`steps. For the special case of 3 variables, VMD may be used to visualize this file.Treat vector variables as multiple observations of a scalar variable?`gatherVectorColvars`**Context:**`histogram`**Acceptable Values:**UNIX filename**Default Value:**`off`**Description:**When this is set to`on`, the components of a multi-dimensional colvar (e.g. one based on`cartesian`,`distancePairs`, or a vector of scalar numbers given by`scriptedFunction`) are treated as multiple observations of a scalar variable. This results in the histogram being accumulated multiple times for each simulation step). When multiple vector variables are included in`histogram`, these must have the same length because their components are accumulated together. For example, if , and are three variables of dimensions 5, 5 and 1, respectively, for each iteration 5 triplets ( ) are accumulated into a 3-dimensional histogram.Treat vector variables as multiple observations of a scalar variable?`weights`**Context:**`histogram`**Acceptable Values:**list of space-separated decimals**Default Value:**all weights equal to 1**Description:**When`gatherVectorColvars`is`on`, the components of each multi-dimensional colvar are accumulated with a different weight. For example, if and are two distinct`cartesian`variables defined on the same group of atoms, the corresponding 2D histogram can be weighted on a per-atom basis in the definition of`histogram`.

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:

Lower boundaries of the grid`lowerBoundaries`**Context:**`histogramGrid`**Acceptable Values:**list of space-separated decimals**Description:**This option defines the lower boundaries of the grid, overriding any values defined by the`lowerBoundary`keyword of each colvar. Note that when`gatherVectorColvars`is`on`, each vector variable is automatically treated as a scalar, and a single value should be provided for it.analogous to`upperBoundaries:``lowerBoundaries`analogous to`widths:``lowerBoundaries`

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
variables
are interpreted as multiple observations of a random variable
with unknown probability distribution.
The potential is minimized when the histogram
, estimated as a sum of Gaussian functions centered at
, is equal to the reference histogram
:

When used in combination with a

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:

see definition of`name:``name`(biasing and analysis methods)see definition of`colvars:``colvars`(biasing and analysis methods)see definition of`outputEnergy:``outputEnergy`(biasing and analysis methods)Lower boundary of the colvar grid`lowerBoundary`**Context:**`histogramRestraint`**Acceptable Values:**decimal**Description:**Defines the lowest end of the interval where the reference distribution is defined. Exactly one value must be provided, because only one-dimensional histograms are supported by the current version.analogous to`upperBoundary:``lowerBoundary`Width of the colvar grid`width`**Context:**`histogramRestraint`**Acceptable Values:**positive decimal**Description:**Defines the spacing of the grid where the reference distribution is defined.Standard deviation of the approximating Gaussian`gaussianSigma`**Context:**`histogramRestraint`**Acceptable Values:**positive decimal**Default Value:**2`width`**Description:**Defines the parameter in eq. 63.Force constant (kcal/mol)`forceConstant`**Context:**`histogramRestraint`**Acceptable Values:**positive decimal**Default Value:**`1.0`**Description:**Defines the parameter in eq. 62.Reference histogram`refHistogram`**Context:**`histogramRestraint`**Acceptable Values:**space-separated list of positive decimals**Description:**Provides the values of consecutively. The mid-point convention is used, i.e. the first point that should be included is for =`lowerBoundary`+`width`/2. If the integral of is not normalized to 1, is rescaled automatically before use.Reference histogram`refHistogramFile`**Context:**`histogramRestraint`**Acceptable Values:**UNIX file name**Description:**Provides the values of as contents of the corresponding file (mutually exclusive with`refHistogram`). The format is that of a text file, with each line containing the space-separated values of and . The same numerical conventions as`refHistogram`are used.Periodically write the instantaneous histogram`writeHistogram`**Context:**`metadynamics`**Acceptable Values:**boolean**Default Value:**`off`**Description:**If`on`, the histogram is written every`colvarsRestartFrequency`steps to a file with the name*outputName*`. name .hist.dat`This is useful to diagnose the convergence of against .

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

Enable custom, scripted forces on colvars`scriptedColvarForces`**Context:**global**Acceptable Values:**boolean**Default Value:**`off`**Description:**If this flag is enabled, a Tcl procedure named`calc_colvar_forces`accepting one parameter should be defined by the user. It is executed at each timestep, with the current step number as parameter, between the calculation of colvars and the application of bias forces. This procedure may use the scripting interface (see 10.6) to access the values of colvars and apply forces on them, effectively defining custom collective variable biases.