Next: Scripting interface (Tcl): list
Up: Collective Variablebased 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:
 name
Identifier for the bias
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 the output, and to name some output files.
Tip: because the default name depends on the order of definition, but the outcome of the simulation does not, it may be convenient to assign consistent names for certain biases; for example, you may want to name a moving harmonic restraint smd, so that it can always be identified regardless of the presence of other restraints.
 colvars
Collective variables involved
Context: colvar bias
Acceptable Values: spaceseparated list of colvar names
Description: This option selects by name all the variables to which this bias or analysis will be applied.
 outputEnergy
Write the current bias energy to the trajectory file
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.
The total energy of all Colvars biases is also reported by NAMD, as part of the MISC title.
 outputFreq
Frequency (number of steps) at which output files are written
Context: colvar bias
Acceptable Values: positive integer
Default Value: colvarsRestartFrequency (see 9.2.5)
Description: If this bias produces aggregated data that needs to be written to disk (for example, a PMF), this number specifies the number of steps after which these data are written to files.
A value of zero disables writing files for this bias during the simulation (except for outputEnergy (see 9.5), which is controlled by colvarsTrajFrequency (see 9.2.5)).
All output files are also written at the end of a simulation run, regardless of the value of this number.
 bypassExtendedLagrangian
Apply bias to actual colvars, bypassing extended coordinates
Context: colvar bias
Acceptable Values: boolean
Default Value: off
Description: This option is implemented by the harmonicWalls (see 9.5.7) and
histogram (see 9.5.10) biases.
It is only relevant if the bias is applied to one or several extendedLagrangian colvars (9.3.20),
for example within an eABF (9.5.3) simulation.
Usually, biases use the value of the extended coordinate as a proxy for the actual colvar, and their biasing forces are applied to the extended coordinates as well.
If bypassExtendedLagrangian is enabled, the bias behaves as if there were no extended coordinates, and accesses the value of the underlying colvars, applying any biasing forces along the gradients of those variables.
 stepZeroData
Accumulate data starting at step 0 of a simulation run
Context: colvar bias
Acceptable Values: boolean
Default Value: off
Description: This option is meaningful for biases that record and accumulate data during a simulation, such as ABF (9.5.2), metadynamics (9.5.4), histograms (9.5.10) and in general any bias that accumulates freeenergy samples with thermodynamic integration, or TI (9.5.1).
When this option is disabled (default), data will only be recorded into the bias after the first coordinate update: this is generally the correct choice in simulation runs.
Biasing energy and forces will always be computed for all active biases, regardless of this option.
Note that in some cases the bias may require data from previous simulation steps: for example, TI requires total atomic forces (see outputTotalForce (see 9.3.19)) which are only available at the following step in NAMD; turning on this flag in those cases will raise an error.
Thermodynamic integration
The methods implemented here provide a variety of estimators of conformational freeenergies.
These are carried out at runtime, or with the use of postprocessing 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.
 writeTIPMF
Write the PMF computed by thermodynamic integration
Context: colvar bias
Acceptable Values: boolean
Default Value: off
Description: If the bias is applied to a variable that supports the calculation of total forces (see outputotalForce (see 9.3) and 9.3.14), this option allows calculating the corresponding PMF by thermodynamic integration, and writing it to the file outputName.
name
.ti.pmf, where
name
is the name of the bias and the contents of the file are in multicolumn text format (9.3.18).
The total force includes the forces applied to the variable by all bias, except those from this bias itself.
If any bias applies timedependent forces besides the one using this option, an error is raised.
 writeTISamples
Write the freeenergy gradient samples
Context: colvar bias
Acceptable Values: boolean
Default Value: off
Description: This option allows to compute total forces for use with thermodynamic integration as done by the keyword writeTIPMF (see 9.5).
The names of the files containing the variables' histogram and mean thermodynamic forces are outputName.
name
.ti.count and outputName.
name
.ti.force, respectively: these can be used by abf_integrate (see 9.5.2) or similar utility.
Note that because the .force file contains mean forces instead of freeenergy gradients, abf_integrate
filename
s 1.0 should be used.
This option is on by default when writeTIPMF is on, but can be enabled separately if the bias is applied to more than one variable, making not possible the direct integration of the PMF at runtime.
If any bias applies timedependent forces besides the one using this option, an error is raised.
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 (extendedsystem 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 extendedsystem 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
is defined from the canonical distribution of
,
:

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

(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 RuizMontero 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
. Let
be arbitrarily chosen vector fields
(
) verifying, for all
,
, and
:
then the following holds [23]:

(60) 
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 [18].
Condition (59) 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 (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,
is accumulated in bins of finite size
,
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:
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 higherdimension 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 extendedsystem
ABF method (9.5.3).
 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 (59) must be satisfied for any two colvars
and
.
Various cases fulfill this orthogonality condition:

and
are based on nonoverlapping 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 (61))
are mutually orthogonal. The cases described for colvars in the previous paragraph apply.
 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 lefthand 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:

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputEnergy: see definition of outputEnergy in sec. 9.5 (biasing and analysis methods)

outputFreq: see definition of outputFreq in sec. 9.5 (biasing and analysis methods)

stepZeroData: see definition of stepZeroData in sec. 9.5 (biasing and analysis methods)
 fullSamples
Number of samples in a bin prior
to application of the ABF
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 nonzero, 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:
.
 maxForce
Maximum magnitude of the ABF force
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 nonnegative value for each colvar. The unit of force
is kcal/mol divided by the colvar unit.
 hideJacobian
Remove geometric entropy term from calculated
free energy gradient?
Context: abf
Acceptable Values: boolean
Default Value: no
Description: In a few special cases, most notably distancebased 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 particleparticle 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.
 historyFreq
Frequency (in timesteps) at which ABF history files are
accumulated
Context: abf
Acceptable Values: positive integer
Default Value: 0
Description: If this number is nonzero, the free energy gradient estimate and sampling histogram
(and the PMF in onedimensional calculations) are written to files on disk at
the given time interval. History file names use the same prefix as output files, with
``.hist'' appended (outputName.hist.pmf).
historyFreq must be a multiple of outputFreq (see 9.5).
 inputPrefix
Filename prefix for reading ABF data
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).
 applyBias
Apply the ABF bias?
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.
 updateBias
Update the ABF bias?
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.
Multiplereplica ABF
Output files
The ABF bias produces the following files, all in multicolumn text format (9.3.18):
 outputName.grad: current estimate of the free energy gradient (grid),
in multicolumn;
 outputName.count: histogram of samples collected, on the same grid;
 outputName.pmf: integrated free energy profile or PMF (for dimensions 1, 2 or 3).
Also in the case of onedimensional 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 onedimensional 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:

(62) 
wehere
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
nonperiodic coordinates, but not along periodic coordinates.
In dimension 4 or greater, integrating the discretized gradient becomes nontrivial. 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 MonteCarlo (MC)
simulation in discretized collective variable space (specifically, on the same grid
used by ABF to discretize the free energy gradient).
By default, a historydependent bias (similar in spirit to metadynamics) is used:
at each MC 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 commandline:
abf_integrate <gradient_file> [n <nsteps>] [t <temp>] [m (01)] [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 MC 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 MC sampling (unrelated to the simulation temperature)
[500 K]
 s: scaling factor for the gradients; when using a histogram of total forces obtained from outputTotalForce (see 9.3.19) or the .force file written by writeTISamples (see 9.5.1), a scaling factor of 1 should be used [1.0]
 m: use metadynamicslike biased sampling? (0 = false) [1]
 h: increment for the historydependent bias (``hill height'') [0.01 kcal/mol]
 f: if nonzero, this factor is used to scale the increment stepwise in the
second half of the MC 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 MC sampling (not
usable in a straightforward way if the historydependent bias has been applied)
 <gradient_file>.est: estimated gradient of the calculated free energy surface
(from finite differences)
 <gradient_file>.dev: deviation between the userprovided 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).
Extendedsystem Adaptive Biasing Force (eABF)
Extendedsystem 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'')
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
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:

(63) 
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 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
.[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 extendedLagrangian colvar
will access the extended degree of freedom
, not the original colvar
;
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
, 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.
CZAR estimator of the free energy
The corrected zaveraged 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 nonextended
colvars; in that case, CZAR still provides an unbiased estimate of the free energy gradient.
CZAR estimates the free energy gradient as:

(64) 
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.
Parameters for the CZAR estimator are:
Similar to ABF, the CZAR estimator produces two output files in multicolumn text format (9.3.18):
 outputName.czar.grad: current estimate of the free energy gradient (grid),
in multicolumn;
 outputName.czar.pmf: only for onedimensional calculations, integrated
free energy profile or PMF.
The sampling histogram associated with the CZAR estimator is the
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 UrbanaChampaign,
Unité Mixte de Recherche No. 7565, Université de Lorraine,
B.P. 70239, 54506 VanduvrelèsNancy 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 :

(65) 
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
.
The estimator is enabled through the following option:
 UIestimator
Calculate UI estimator of the free energy?
Context: abf
Acceptable Values: boolean
Default Value: no
Description: This option is only available when ABF is performed on extendedLagrangian colvars.
When enabled, it triggers calculation of the free energy following the UI estimator.
The eABF algorithm can be associated with a multiplewalker strategy [77,25] (9.5.2).
To run a multiplereplica eABF simulation, start a multiplereplica
NAMD run (option +replicas) and set shared on in the Colvars config file to enable
the multiplewalker ABF algorithm.
It should be noted that in contrast with classical MWABF simulations,
the output files of an MWeABF 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 ABFbased calculation, breaking the reaction pathway
into several nonoverlapping windows, one can use
./eabf.tcl mergesplitwindow [merged_fileprefix] [eabf_output] [eabf_output2] ...
to merge the data accrued in these nonoverlapping 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 historydependent 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
is defined as:

(66) 
where
is the historydependent potential acting on the current values of the colvars
, and depends only parametrically on the previous values of the colvars.
is constructed as a sum of
dimensional repulsive Gaussian ``hills'', whose height is a chosen energy constant
, and whose centers are the previously explored configurations
.
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 estimator of the ``real'' potential of mean force
, save for an additive constant:

(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
, and of the userdefined parameters
,
and
[16].
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.
If the metadynamics parameters are chosen correctly, after an equilibration time,
, 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
[70,27]:

(68) 
where
is the time after which the bias potential grows (approximately) evenly during the simulation and
is the total simulation time. The free energy calculated according to eq. 69 can thus be obtained averaging on time mutiple timedependent 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
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
upperWall 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
parameter plus one.
It goes without saying that if the colvar r represents a distance between two freelymoving molecules, it will cross this ``threshold'' rather frequently.
In this example, where the value of hillWidth (
) amounts to 2 grid points, the threshold is 6+1 = 7 grid points away from upperBoundary.
In explicit units, the width of
is
0.2 Å, and the threshold is 15.0  7
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 =
= 13.6 Å is:
which results in a relative probability
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 freeenergy 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
, and the widths
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).

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputEnergy: see definition of outputEnergy in sec. 9.5 (biasing and analysis methods)

outputFreq: see definition of outputFreq in sec. 9.5 (biasing and analysis methods)

writeTIPMF: see definition of writeTIPMF in sec. 9.5 (biasing and analysis methods)

writeTISamples: see definition of writeTISamples in sec. 9.5 (biasing and analysis methods)

stepZeroData: see definition of stepZeroData in sec. 9.5 (biasing and analysis methods)
 hillWeight
Height of each hill (kcal/mol)
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.
 hillWidth
Width
of a Gaussian hill, measured in number of grid points
Context: metadynamics
Acceptable Values: positive decimal
Description: This keyword sets the Gaussian width
for all colvars, expressed in number of grid points, with the grid spacing along each colvar
determined by the respective value of width (see 9.3.18).
Values between 1 and 3 are recommended for this option: smaller numbers will fail to adequately interpolate each Gaussian function [33], while larger values may be unable to account for steep freeenergy gradients.
The values of each halfwidth
in the physical units of
are also printed by NAMD at initialization time; alternatively, they may be set explicitly via gaussianSigmas (see 9.5.4).
 gaussianSigmas
Halfwidths
of the Gaussian hill (one for each colvar)
Context: metadynamics
Acceptable Values: spaceseparated list of decimals
Description: This option sets the parameters
of the Gaussian hills along each colvar
, expressed in the same unit of
.
No restrictions are placed on each value, but a warning will be printed if useGrids (see 9.5.4) is on and the Gaussian width
is smaller than the corresponding grid spacing,
.
If not given, default values will be computed from the dimensionless number hillWidth (see 9.5.4).
 newHillFrequency
Frequency of hill creation
Context: metadynamics
Acceptable Values: positive integer
Default Value: 1000
Description: This option sets the number of steps after which a new Gaussian hill is added to the metadynamics potential.
The product of this number and the integration timestep defines the parameter
in eq. 67.
Higher values provide more accurate statistical sampling, at the price of longer simulation times to complete a PMF calculation.
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:
 writeFreeEnergyFile
Periodically write the PMF for visualization
Context: metadynamics
Acceptable Values: boolean
Default Value: on
Description: When useGrids and this option are on, the PMF is written every outputFreq (see 9.5) steps.
 keepFreeEnergyFiles
Keep all the PMF files
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.
 writeHillsTrajectory
Write a log of new hills
Context: metadynamics
Acceptable Values: boolean
Default Value: off
Description: If this option is on, a file containing the Gaussian hills written by the metadynamics bias, with the name:
``outputName.colvars.
name
.hills.traj'',
which can be useful to postprocess the time series of the Gassian hills.
Each line is written every newHillFrequency, regardless of the value of outputFreq (see 9.5).
When multipleReplicas is on, its name is changed to:
``outputName.colvars.
name
.
replicaID
.hills.traj''.
The columns of this file are the centers of the hills,
, followed by the halfwidths,
, and the weight,
.
Note: prior to version 20200224, the fullwidth
of the Gaussian was reported in lieu of
.
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.
EnsembleBiased Metadynamics
The ensemblebiased 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:

(69) 
where
is the target probability distribution and
its corresponding differential entropy.
The method is designed so that during the simulation the resulting distribution of the collective variable
converges to
.
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 electronelectron resonance (DEER) experiments [69].
The PMF along
can be estimated from the bias potential and the target ditribution [69]:

(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 timedependent free energy estimates (see keepFreeEnergyFiles).
The following additional options define the configuration for the ensemblebiased metadynamics approach:
 ebMeta
Perform ensemblebiased metadynamics
Context: metadynamics
Acceptable Values: boolean
Default Value: off
Description: If enabled, this flag activates the ensemblebiased metadynamics as
described by Marinelli et al.[69]. The target distribution file,
targetdistfile, is then required. The keywords lowerBoundary, upperBoundary
and width for the respective variables are also needed to set the binning (grid) of the target distribution file.
 targetDistFile
Target probability distribution file for ensemblebiased metadynamics
Context: metadynamics
Acceptable Values: multicolumn text file
Description: This file provides the target probability distribution,
, reported in eq. 70. The latter distribution must be a tabulated function provided in a multicolumn text format (see 9.3.18).
The provided distribution is then normalized.
 ebMetaEquilSteps
Number of equilibration steps for ensemblebiased metadynamics
Context: metadynamics
Acceptable Values: positive integer
Description: The EBMetaD approach may introduce large hills in regions with small values of the target probability distribution (eq. 70).
This happens, for example, if the probability distribution sampled by a conventional molecular dynamics simulation is significantly different from the target distribution.
This may lead to instabilities at the beginning of the simulation related to large biasing forces.
In this case, it is useful to introduce an equilibration stage in which the bias potential gradually switches from standard metadynamics (eq. 67) to EBmetaD (eq. 70) as
, where
and step is the current simulation step number.
 targetDistMinVal
Minimum value of the target distribution in reference to its maximum value
Context: metadynamics
Acceptable Values: positive decimal
Description: It is useful to set a minimum value of the target probability distribution to avoid values of the latter that are nearly zero, leading to very large hills.
This parameter sets the minimum value of the target probability distribution that is expressed as a fraction of its maximum value: minimum value =
maximum value X targetDistMinVal. This implies that 0 < targetDistMinVal < 1 and its default value is set to 1/1000000.
To avoid divisions by zero (see eq. 70), if targetDistMinVal is set as zero, values of
equal to zero are replaced by the
smallest positive value read in the same file.
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).
Welltempered metadynamics
The following options define the configuration for the ``welltempered'' metadynamics approach [4]:
Multiplewalker metadynamics
Metadynamics calculations can be performed concurrently by multiple replicas that share a common history.
This variant of the method is called multiplewalker 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 highperformance 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: Multiplewalker metadynamics with filebased communication.
metadynamics {
name mymtd
colvars x
hillWeight 0.001
newHillFrequency 1000
hillWidth 3.0
multipleReplicas on
replicasRegistry /sharedfolder/mymtdreplicas.txt
replicaUpdateFrequency 50000 # Best if larger than newHillFrequency
}
The following are the multiplewalkers related options:
 multipleReplicas
Enable multiplewalker metadynamics
Context: metadynamics
Acceptable Values: boolean
Default Value: off
Description: This option turns on multiplewalker communication between replicas.
 replicasRegistry
Multiple replicas database file
Context: metadynamics
Acceptable Values: UNIX filename
Description: If multipleReplicas is on, this option sets the path to the replicas' shared database file.
It is best to use an absolute path (especially when running individual replicas in separate folders).
 replicaUpdateFrequency
How often hills are shared between replicas
Context: metadynamics
Acceptable Values: positive integer
Description: If multipleReplicas is on, this option sets the number of steps after which each replica tries to read the other replicas' files.
On a networked file system, it is best to use a number of steps that corresponds to at least a minute of wall time.
 replicaID
Set the identifier for this replica
Context: metadynamics
Acceptable Values: string
Default Value: replica index (only if a shared communicator is used)
Description: If multipleReplicas is on, this option sets a unique identifier for this replicas.
When the replicas are launched in a single command (i.e. they share a parallel communicator and are tightly synchronized) this value is optional, and defaults to the replica's numeric index (starting at zero).
However, when the replicas are launched as independent runs this option is required.
 writePartialFreeEnergyFile
Periodically write the contribution to the
PMF from this replica
Context: metadynamics
Acceptable Values: boolean
Default Value: off
Description: If multipleReplicas is on, enabling this option produces an additional file outputName.partial.pmf, which can be useful to monitor the contribution of each replica to the total PMF (which is written to the file outputName.pmf).
Note: the name of this file is chosen for consistency and convenience, but its content is not a PMF and it is not expected to converge, even if the total PMF does.
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:

(71) 
There are two noteworthy aspects of this expression:
 Because the standard coefficient of
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 nonstandard definition of the force constant.
 The variable
is not only centered at
, but is also scaled by its characteristic length scale
(keyword width (see 9.3.18)).
The resulting dimensionless variable
is typically easier to treat numerically: for example, when the forces typically experienced by
are much smaller than
and
is chosen equal to
(thermal energy), the resulting probability distribution of
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 umbrellasampling ensemble runs: if the restraint centers are chosen in increments of
, the resulting distributions of
are most often optimally overlapped.
In regions where the underlying freeenergy landscape induces highly skewed distributions of
, additional windows may be added as needed, with spacings finer than
.
Beyond one dimension, the use of a scaled harmonic potential also allows a standard definition of a multidimensional restraint with a unified force constant:

(72) 
If onedimensional or homogeneous multidimensional restraints are defined, and there are no other uses for the parameter
, width can be left at its default value of
.
A harmonic restraint is defined by a harmonic {...} block, which may contain the following keywords:

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputEnergy: see definition of outputEnergy in sec. 9.5 (biasing and analysis methods)

writeTIPMF: see definition of writeTIPMF in sec. 9.5 (biasing and analysis methods)

writeTISamples: see definition of writeTISamples in sec. 9.5 (biasing and analysis methods)

stepZeroData: see definition of stepZeroData in sec. 9.5 (biasing and analysis methods)
 forceConstant
Scaled force constant (kcal/mol)
Context: harmonic
Acceptable Values: positive decimal
Default Value: 1.0
Description: This option defines a scaled force constant
for the harmonic potential (eq. 73).
To ensure consistency for multidimensional restraints, it is divided internally by the square of the specific width of each variable (which is 1 by default).
This makes all values effectively dimensionless and of commensurate size.
For instance, if this force constant is set to the thermal energy
(equal to
if molar units are used), then the amplitude of the thermal fluctuations of each variable
will be on the order of its width,
.
This can be used to estimate the optimal spacing of umbrellasampling windows (under the assumption that the force constant is larger than the curvature of the underlying free energy).
The values of the actual force constants
are always printed when the restraint is defined.
 centers
Initial harmonic restraint centers
Context: harmonic
Acceptable Values: spaceseparated 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.
 targetCenters
Steer the restraint centers towards these
targets
Context: harmonic
Acceptable Values: spaceseparated 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 outputAccumulatedWork and/or
outputAppliedForce within each of the colvars involved.
 targetNumSteps
Number of steps for steering
Context: harmonic
Acceptable Values: positive integer
Description: In singlestage (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 multistage transformations, this sets the
number of MD steps per stage.
 outputCenters
Write the current centers to the trajectory file
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.
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 onedimensional 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].
 targetForceConstant
Change the force constant towards this value
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 postprocessing
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.[31]
 targetForceExponent
Exponent in the timedependence of the force constant
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.
 targetEquilSteps
Number of steps discarded from TI estimate
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.
 lambdaSchedule
Schedule of lambdapoints for changing force constant
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.
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:
 outputAccumulatedWork
Write the accumulated work of the changing restraint to the Colvars trajectory file
Context: harmonic
Acceptable Values: boolean
Default Value: off
Description: If targetCenters or targetForceConstant are defined and this option is enabled, the accumulated work from the beginning of the simulation will be written to the trajectory file (colvarsTrajFrequency must be nonzero).
When the simulation is continued from a state file, the previously accumulated work is included in the integral.
This option allows to conveniently extract the estimated PMF of a steered MD calculation (when targetCenters is used), or of other simulation protocols.
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 halfharmonic potential;

(73) 
where
and
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 multidimensional).
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:

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputEnergy: see definition of outputEnergy in sec. 9.5 (biasing and analysis methods)

writeTIPMF: see definition of writeTIPMF in sec. 9.5 (biasing and analysis methods)

writeTISamples: see definition of writeTISamples in sec. 9.5 (biasing and analysis methods)

stepZeroData: see definition of stepZeroData in sec. 9.5 (biasing and analysis methods)
 lowerWalls
Position of the lower wall
Context: colvar
Acceptable Values: Spaceseparated list of decimals
Description: Defines the values
below which a confining restraint on the colvar is applied to each colvar
.
 upperWalls
Position of the lower wall
Context: colvar
Acceptable Values: Spaceseparated list of decimals
Description: Defines the values
above which a confining restraint on the colvar is applied to each colvar
.

forceConstant: see definition of forceConstant in sec. 9.5.5 (Harmonic restraints)
 lowerWallConstant
Force constant for the lower wall
Context: harmonicWalls
Acceptable Values: positive decimal
Default Value: forceConstant
Description: When both sets of walls are defined (lower and upper), this keyword allows setting different force constants for them.
As with forceConstant, the specified constant is divided internally by the square of the specific width of each variable (see also the equivalent keyword for the harmonic restraint, forceConstant (see 9.5.5)).
The force constant reported in the output as ``
'', and used in the change of force constant scheme, is the geometric mean of upperWallConstant and upperWallConstant.

upperWallConstant: analogous to lowerWallConstant

targetForceConstant: see definition of targetForceConstant in sec. 9.5.5 (harmonic restraints)
 targetForceConstant
Change the force constant(s) towards this value
Context: harmonicWalls
Acceptable Values: positive decimal
Description: This keyword allows changing either one or both of the wall force constants over time.
In the case that lowerWallConstant and upperWallConstant have the same value, the behavior of this keyword is identical to the corresponding keyword in the harmonic restraint; otherwise, the change schedule is applied to the geometric mean of the two constant.
When only one set of walls is defined (lowerWall or upperWalls), only the respective force constant is changed.
Note: if only one of the two force constants is meant to change over time, it is possible to use two instances of harmonicWalls, and apply the changing schedule only to one of them.

targetNumSteps: see definition of targetNumSteps in sec. 9.5.5 (harmonic restraints)

targetForceExponent: see definition of targetForceExponent in sec. 9.5.5 (harmonic restraints)

targetEquilSteps: see definition of targetEquilSteps in sec. 9.5.5 (harmonic restraints)

targetNumStages: see definition of targetNumStages in sec. 9.5.5 (harmonic restraints)

lambdaSchedule: see definition of lambdaSchedule in sec. 9.5.5 (harmonic restraints)

outputAccumulatedWork: see definition of outputAccumulatedWork in sec. 9.5.5 (harmonic restraints)
 bypassExtendedLagrangian
Apply bias to actual colvars, bypassing extended coordinates
Context: harmonicWalls
Acceptable Values: boolean
Default Value: on
Description: This option behaves as bypassExtendedLagrangian (see 9.5) for other biases,
but it defaults to on, unlike in the general case.
Thus, by default, the harmonicWalls bias applies to the actual colvars, so that the distribution of the colvar between the walls is unaffected by the bias, which then applies a flatbottom potential as a function of the colvar value. This bias will affect the extended coordinate distribution near the walls.
If bypassExtendedLagrangian is disabled, harmonicWalls applies a flatbottom potential as a function of the extended coordinate. Conversely, this bias will then modify the distribution of the actual colvar value near the walls.
Example 1: harmonic walls for one variable with two different force constants.
harmonicWalls {
name mywalls
colvars dist
lowerWall 22.0
upperWall 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
lowerWall 180.0 0.0
upperWall 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].

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputEnergy: see definition of outputEnergy in sec. 9.5 (biasing and analysis methods)
 forceConstant
Scaled force constant (kcal/mol)
Context: linear
Acceptable Values: positive decimal
Default Value: 1.0
Description: This option defines a scaled force constant for the linear bias.
To ensure consistency for multidimensional restraints, it is divided internally by the specific width of each variable (which is 1 by default), so that all variables are effectively dimensionless and of commensurate size.
See also the equivalent keyword for the harmonic restraint, forceConstant (see 9.5.5).
The values of the actual force constants
are always printed when the restraint is defined.
 centers
Initial linear restraint centers
Context: linear
Acceptable Values: spaceseparated list of colvar values
Description: These are analogous to the centers (see 9.5.5) keyword of the harmonic restraint.
Although they do not affect dynamics, they are here necessary to ensure a welldefined energy for the linear bias.

writeTIPMF: see definition of writeTIPMF in sec. 9.5 (biasing and analysis methods)

writeTISamples: see definition of writeTISamples in sec. 9.5 (biasing and analysis methods)

targetForceConstant: see definition of targetForceConstant in sec. 9.5.5 (Harmonic restraints)

targetNumSteps: see definition of targetNumSteps in sec. 9.5.5 (Harmonic restraints)

targetForceExponent: see definition of targetForceExponent in sec. 9.5.5 (Harmonic restraints)

targetEquilSteps: see definition of targetEquilSteps in sec. 9.5.5 (Harmonic restraints)

targetNumStages: see definition of targetNumStages in sec. 9.5.5 (Harmonic restraints)

lambdaSchedule: see definition of lambdaSchedule in sec. 9.5.5 (Harmonic restraints)

outputAccumulatedWork: see definition of outputAccumulatedWork in sec. 9.5.5 (Harmonic restraints)
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.

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)
 centers
Collective variable centers
Context: alb
Acceptable Values: spaceseparated 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.
 updateFrequency
The duration of updates
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.
 forceRange
The expected range of the force constant in units of energy
Context: alb
Acceptable Values: A spaceseparated 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 parameter
 rateMax
The maximum rate of change of force constant
Context: alb
Acceptable Values: A list of spaceseparated 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 Ndimensional histogram. A histogram block may define the following parameters:

name: see definition of name in sec. 9.5 (biasing and analysis methods)

colvars: see definition of colvars in sec. 9.5 (biasing and analysis methods)

outputFreq: see definition of outputFreq in sec. 9.5 (biasing and analysis methods)

stepZeroData: see definition of stepZeroData in sec. 9.5 (biasing and analysis methods)
 outputFile
Write the histogram to a file
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 (see 9.5) steps.
For the special case of 2 variables, Gnuplot may be used to visualize this file.
If outputFile is set to none, the file is not written.
 outputFileDX
Write the histogram to a file
Context: histogram
Acceptable Values: UNIX filename
Default Value: outputName.
name
.dx
Description: Name of the file containing histogram data (OpenDX format), which is written every outputFreq (see 9.5) steps.
For the special case of 3 variables, VMD may be used to visualize this file.
This file is written by default if the dimension is 3 or more.
If outputFileDX is set to none, the file is not written.
 gatherVectorColvars
Treat vector variables as multiple observations of a scalar variable?
Context: histogram
Acceptable Values: UNIX filename
Default Value: off
Description: When this is set to on, the components of a multidimensional 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 3dimensional histogram.
 weights
Treat vector variables as multiple observations of a scalar variable?
Context: histogram
Acceptable Values: list of spaceseparated decimals
Default Value: all weights equal to 1
Description: When gatherVectorColvars is on, the components of each multidimensional 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 peratom basis in the definition of histogram.
As with any other biasing and analysis method, when a histogram is applied to
an extendedsystem 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.

bypassExtendedLagrangian: see definition of bypassExtendedLagrangian in sec. 9.5 (biasing and analysis methods)
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:
 lowerBoundaries
Lower boundaries of the grid
Context: histogramGrid
Acceptable Values: list of spaceseparated 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.

upperBoundaries: analogous to lowerBoundaries

widths: analogous to lowerBoundaries
Probability distributionrestraints
The histogramRestraint bias implements a continuous potential of many variables (or of a single highdimensional variable) aimed at reproducing a onedimensional 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
:

(74) 

(75) 
When used in combination with a distancePairs multidimensional 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 onedimensional histogram.
Future versions will include support for multidimensional 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.
 scriptedColvarForces
Enable custom, scripted forces on colvars
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 cv command to access the values of colvars (e.g. cv colvar xi value), apply forces on them (cv colvar xi addforce $F) or add energy to the simulation system (cv addenergy $E), effectively defining custom collective variable biases.
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:
 distribute the computation of all components across available threads;
 on a single thread, collect the results of multicomponent variables using polynomial combinations (see 9.3.15), or custom functions (see 9.3.16), or scripted functions (see 9.3.17);
 distribute the computation of all biases across available threads;
 compute on a single thread any scripted biases implemented via the keyword scriptedColvarForces (see 9.5.12).
 communicate on a single thread forces to NAMD.
The following options allow to finetune this schedule:
 scriptingAfterBiases
Scripted colvar forces need updated biases?
Context: global
Acceptable Values: boolean
Default Value: on
Description: This flag specifies that the calc_colvar_forces procedure (last step in the list above) is executed only after all biases have been updated (nexttolast step)
For example, this allows using the energy of a restraint bias, or the force applied on a colvar,
to calculate additional scripted forces, such as boundary constraints.
When this flag is set to off, it is assumed that only the values of the variables
(but not the energy of the biases or applied forces) will be used by calc_colvar_forces:
this can be used to schedule the calculation of scripted forces and biases concurrently
to increase performance.
Next: Scripting interface (Tcl): list
Up: Collective Variablebased Calculations (Colvars)
Previous: Selecting atoms
Contents
Index
http://www.ks.uiuc.edu/Research/namd/