$\phantom{\rule{0.3em}{0ex}}$

COLLECTIVE VARIABLES MODULE

Reference manual for NAMD

Code version: 2020-05-07

Alejandro Bernardin, Haochuan Chen, Jeﬀrey R. Comer, Giacomo Fiorin, Haohao Fu,
Jérôme Hénin, Axel Kohlmeyer, Fabrizio Marinelli, Joshua V. Vermaas, Andrew D.
White

1 Overview

2 Writing a Colvars conﬁguration: a crash course

3 Enabling and controlling the Colvars module in NAMD

3.1 Units in the Colvars module

3.2 NAMD parameters

3.3 Using the cv command to control the Colvars module

3.3.1 Setting up the Colvars module

3.3.2 Using the Colvars version in scripts

3.3.3 Loading and saving the Colvars state and other information

3.3.4 Managing collective variables

3.3.5 Applying and analyzing forces on collective variables

3.3.6 Managing collective variable biases

3.3.7 Loading and saving the state of individual biases

3.4 Conﬁguration syntax used by the Colvars module

3.5 Global keywords

3.6 Input state ﬁle

3.7 Output ﬁles

4 Deﬁning collective variables

4.1 Choosing a function

4.2 Distances

4.2.1 distance: center-of-mass distance between two groups.

4.2.2 distanceZ: projection of a distance vector on an axis.

4.2.3 distanceXY: modulus of the projection of a distance vector on a plane.

4.2.4 distanceVec: distance vector between two groups.

4.2.5 distanceDir: distance unit vector between two groups.

4.2.6 distanceInv: mean distance between two groups of atoms.

4.3 Angles

4.3.1 angle: angle between three groups.

4.3.2 dipoleAngle: angle between two groups and dipole of a third group.

4.3.3 dihedral: torsional angle between four groups.

4.3.4 polarTheta: polar angle in spherical coordinates.

4.3.5 polarPhi: azimuthal angle in spherical coordinates.

4.4 Contacts

4.4.1 coordNum: coordination number between two groups.

4.4.2 selfCoordNum: coordination number between atoms within a group.

4.4.3 hBond: hydrogen bond between two atoms.

4.5 Collective metrics

4.5.1 rmsd: root mean square displacement (RMSD) from reference positions.

4.5.2 Advanced usage of the rmsd component.

4.5.3 eigenvector: projection of the atomic coordinates on a vector.

4.5.4 gyration: radius of gyration of a group of atoms.

4.5.5 inertia: total moment of inertia of a group of atoms.

4.5.6 dipoleMagnitude: dipole magnitude of a group of atoms.

4.5.7 inertiaZ: total moment of inertia of a group of atoms around a chosen axis.

4.6 Rotations

4.6.1 orientation: orientation from reference coordinates.

4.6.2 orientationAngle: angle of rotation from reference coordinates.

4.6.3 orientationProj: cosine of the angle of rotation from reference coordinates.

4.6.4 spinAngle: angle of rotation around a given axis.

4.6.5 tilt: cosine of the rotation orthogonal to a given axis.

4.7 Protein structure descriptors

4.7.1 alpha: $\alpha $-helix content of a protein segment.

4.7.2 dihedralPC: protein dihedral principal component

4.8 Raw data: building blocks for custom functions

4.8.1 cartesian: vector of atomic Cartesian coordinates.

4.8.2 distancePairs: set of pairwise distances between two groups.

4.9 Geometric path collective variables

4.9.1 gspath: progress along a path deﬁned in atomic Cartesian coordinate space.

4.9.2 gzpath: distance from a path deﬁned in atomic Cartesian coordinate space.

4.9.3 linearCombination: Helper CV to deﬁne a linear combination of other CVs

4.9.4 gspathCV: progress along a path deﬁned in CV space.

4.9.5 gzpathCV: distance from a path deﬁned in CV space.

4.10 Arithmetic path collective variables

4.10.1 aspathCV: progress along a path deﬁned in CV space.

4.10.2 azpathCV: distance from a path deﬁned in CV space.

4.10.3 Path collective variables in Cartesian coordinates

4.11 Volumetric map-based variables

4.11.1 mapTotal: total value of a volumetric map

4.11.2 Multiple volumetric maps collective variables

4.12 Shared keywords for all components

4.13 Periodic components

4.14 Non-scalar components

4.14.1 Calculating total forces

4.15 Linear and polynomial combinations of components

4.16 Custom functions

4.17 Scripted functions

4.18 Deﬁning grid parameters

4.18.1 Grid ﬁles: multicolumn text format

4.19 Trajectory output

4.20 Extended Lagrangian

4.21 Multiple time-step variables

4.22 Backward-compatibility

4.23 Statistical analysis

5 Selecting atoms

5.1 Atom selection keywords

5.2 Moving frame of reference.

5.3 Treatment of periodic boundary conditions.

5.4 Performance of a Colvars calculation based on group size.

6 Biasing and analysis methods

6.1 Thermodynamic integration

6.2 Adaptive Biasing Force

6.2.1 ABF requirements on collective variables

6.2.2 Parameters for ABF

6.2.3 Multiple-replica ABF

6.2.4 Output ﬁles

6.2.5 Multidimensional free energy surfaces

6.3 Extended-system Adaptive Biasing Force (eABF)

6.3.1 CZAR estimator of the free energy

6.3.2 Zheng/Yang estimator of the free energy

6.4 Metadynamics

6.4.1 Treatment of the PMF boundaries

6.4.2 Basic conﬁguration keywords

6.4.3 Output ﬁles

6.4.4 Performance optimization

6.4.5 Ensemble-Biased Metadynamics

6.4.6 Well-tempered metadynamics

6.4.7 Multiple-walker metadynamics

6.5 Harmonic restraints

6.5.1 Moving restraints: steered molecular dynamics

6.5.2 Moving restraints: umbrella sampling

6.5.3 Changing force constant

6.6 Computing the work of a changing restraint

6.7 Harmonic wall restraints

6.8 Linear restraints

6.9 Adaptive Linear Bias/Experiment Directed Simulation

6.10 Multidimensional histograms

6.10.1 Grid deﬁnition for multidimensional histograms

6.11 Probability distribution-restraints

6.12 Deﬁning scripted biases

6.13 Performance of scripted biases

7 Scripting interface (Tcl): list of commands

7.1 Commands to manage the Colvars module

7.2 Commands to manage individual collective variables

7.3 Commands to manage individual biases

8 Syntax changes from older versions

9 Compilation notes

2 Writing a Colvars conﬁguration: a crash course

3 Enabling and controlling the Colvars module in NAMD

3.1 Units in the Colvars module

3.2 NAMD parameters

3.3 Using the cv command to control the Colvars module

3.3.1 Setting up the Colvars module

3.3.2 Using the Colvars version in scripts

3.3.3 Loading and saving the Colvars state and other information

3.3.4 Managing collective variables

3.3.5 Applying and analyzing forces on collective variables

3.3.6 Managing collective variable biases

3.3.7 Loading and saving the state of individual biases

3.4 Conﬁguration syntax used by the Colvars module

3.5 Global keywords

3.6 Input state ﬁle

3.7 Output ﬁles

4 Deﬁning collective variables

4.1 Choosing a function

4.2 Distances

4.2.1 distance: center-of-mass distance between two groups.

4.2.2 distanceZ: projection of a distance vector on an axis.

4.2.3 distanceXY: modulus of the projection of a distance vector on a plane.

4.2.4 distanceVec: distance vector between two groups.

4.2.5 distanceDir: distance unit vector between two groups.

4.2.6 distanceInv: mean distance between two groups of atoms.

4.3 Angles

4.3.1 angle: angle between three groups.

4.3.2 dipoleAngle: angle between two groups and dipole of a third group.

4.3.3 dihedral: torsional angle between four groups.

4.3.4 polarTheta: polar angle in spherical coordinates.

4.3.5 polarPhi: azimuthal angle in spherical coordinates.

4.4 Contacts

4.4.1 coordNum: coordination number between two groups.

4.4.2 selfCoordNum: coordination number between atoms within a group.

4.4.3 hBond: hydrogen bond between two atoms.

4.5 Collective metrics

4.5.1 rmsd: root mean square displacement (RMSD) from reference positions.

4.5.2 Advanced usage of the rmsd component.

4.5.3 eigenvector: projection of the atomic coordinates on a vector.

4.5.4 gyration: radius of gyration of a group of atoms.

4.5.5 inertia: total moment of inertia of a group of atoms.

4.5.6 dipoleMagnitude: dipole magnitude of a group of atoms.

4.5.7 inertiaZ: total moment of inertia of a group of atoms around a chosen axis.

4.6 Rotations

4.6.1 orientation: orientation from reference coordinates.

4.6.2 orientationAngle: angle of rotation from reference coordinates.

4.6.3 orientationProj: cosine of the angle of rotation from reference coordinates.

4.6.4 spinAngle: angle of rotation around a given axis.

4.6.5 tilt: cosine of the rotation orthogonal to a given axis.

4.7 Protein structure descriptors

4.7.1 alpha: $\alpha $-helix content of a protein segment.

4.7.2 dihedralPC: protein dihedral principal component

4.8 Raw data: building blocks for custom functions

4.8.1 cartesian: vector of atomic Cartesian coordinates.

4.8.2 distancePairs: set of pairwise distances between two groups.

4.9 Geometric path collective variables

4.9.1 gspath: progress along a path deﬁned in atomic Cartesian coordinate space.

4.9.2 gzpath: distance from a path deﬁned in atomic Cartesian coordinate space.

4.9.3 linearCombination: Helper CV to deﬁne a linear combination of other CVs

4.9.4 gspathCV: progress along a path deﬁned in CV space.

4.9.5 gzpathCV: distance from a path deﬁned in CV space.

4.10 Arithmetic path collective variables

4.10.1 aspathCV: progress along a path deﬁned in CV space.

4.10.2 azpathCV: distance from a path deﬁned in CV space.

4.10.3 Path collective variables in Cartesian coordinates

4.11 Volumetric map-based variables

4.11.1 mapTotal: total value of a volumetric map

4.11.2 Multiple volumetric maps collective variables

4.12 Shared keywords for all components

4.13 Periodic components

4.14 Non-scalar components

4.14.1 Calculating total forces

4.15 Linear and polynomial combinations of components

4.16 Custom functions

4.17 Scripted functions

4.18 Deﬁning grid parameters

4.18.1 Grid ﬁles: multicolumn text format

4.19 Trajectory output

4.20 Extended Lagrangian

4.21 Multiple time-step variables

4.22 Backward-compatibility

4.23 Statistical analysis

5 Selecting atoms

5.1 Atom selection keywords

5.2 Moving frame of reference.

5.3 Treatment of periodic boundary conditions.

5.4 Performance of a Colvars calculation based on group size.

6 Biasing and analysis methods

6.1 Thermodynamic integration

6.2 Adaptive Biasing Force

6.2.1 ABF requirements on collective variables

6.2.2 Parameters for ABF

6.2.3 Multiple-replica ABF

6.2.4 Output ﬁles

6.2.5 Multidimensional free energy surfaces

6.3 Extended-system Adaptive Biasing Force (eABF)

6.3.1 CZAR estimator of the free energy

6.3.2 Zheng/Yang estimator of the free energy

6.4 Metadynamics

6.4.1 Treatment of the PMF boundaries

6.4.2 Basic conﬁguration keywords

6.4.3 Output ﬁles

6.4.4 Performance optimization

6.4.5 Ensemble-Biased Metadynamics

6.4.6 Well-tempered metadynamics

6.4.7 Multiple-walker metadynamics

6.5 Harmonic restraints

6.5.1 Moving restraints: steered molecular dynamics

6.5.2 Moving restraints: umbrella sampling

6.5.3 Changing force constant

6.6 Computing the work of a changing restraint

6.7 Harmonic wall restraints

6.8 Linear restraints

6.9 Adaptive Linear Bias/Experiment Directed Simulation

6.10 Multidimensional histograms

6.10.1 Grid deﬁnition for multidimensional histograms

6.11 Probability distribution-restraints

6.12 Deﬁning scripted biases

6.13 Performance of scripted biases

7 Scripting interface (Tcl): list of commands

7.1 Commands to manage the Colvars module

7.2 Commands to manage individual collective variables

7.3 Commands to manage individual biases

8 Syntax changes from older versions

9 Compilation notes

In molecular dynamics simulations, it is often useful to reduce the large number of degrees of freedom of a physical system into few parameters whose statistical distributions can be analyzed individually, or used to deﬁne biasing potentials to alter the dynamics of the system in a controlled manner. These have been called ‘order parameters’, ‘collective variables’, ‘(surrogate) reaction coordinates’, and many other terms.

Here we use primarily the term ‘collective variable’, often shortened to colvar, to indicate any diﬀerentiable function of atomic Cartesian coordinates, ${\text{}x\text{}}_{i}$, with $i$ between $1$ and $N$, the total number of atoms:

This manual documents the collective variables module (Colvars), a software that provides an implementation for the functions $\xi \left(\text{}X\text{}\right)$ with a focus on ﬂexibility, robustness and high performance. The module is designed to perform multiple tasks concurrently during or after a simulation, the most common of which are:

- apply restraints or biasing potentials to multiple variables, tailored on the system by choosing from a wide set of basis functions, without limitations on their number or on the number of atoms involved; while this can in principle be done through a TclForces script, using the Colvars module is both easier and computationally more eﬃcient;
- calculate potentials of mean force (PMFs) along any set of variables, using diﬀerent enhanced sampling methods, such as Adaptive Biasing Force (ABF), metadynamics, steered MD and umbrella sampling; variants of these methods that make use of an ensemble of replicas are supported as well;
- calculate statistical properties of the variables, such as running averages and standard deviations, correlation functions of pairs of variables, and multidimensional histograms: this can be done either at run-time without the need to save very large trajectory ﬁles, or after a simulation has been completed using VMD and the cv command.

Detailed explanations of the design of the Colvars module are provided in reference [1]. Please cite this reference whenever publishing work that makes use of this module.

The Colvars conﬁguration is a plain text ﬁle or string that deﬁnes collective variables, biases, and general parameters of the Colvars module. It is passed to the module using back-end-speciﬁc commands documented in section 3.

Now let us look at a complete, non-trivial conﬁguration. Suppose that we want to run a steered MD experiment where a small molecule is pulled away from a protein binding site. In Colvars terms, this is done by applying a moving restraint to the distance between the two objects. The conﬁguration will contain two blocks, one deﬁning the distance variable (see section 4 and 4.2.1), and the other the moving harmonic restraint (6.5).

colvar {

name dist

distance {

group1 { atomNumbersRange 42-55 }

group2 {

psfSegID PR

atomNameResidueRange CA 15-30

}

}

}

harmonic {

colvars dist

forceConstant 20.0

centers 4.0 # initial distance

targetCenters 15.0 # final distance

targetNumSteps 500000

}

Reading this input in plain English: the variable here named dist consists in a distance function between the centers of two groups: the ligand (atoms 42 to 55) and the $\alpha $-carbon atoms of residues 15 to 30 in the protein (segment name PR). To the “dist” variable, we apply a harmonic potential of force constant 20 kcal/mol/Å${}^{2}$, initially centered around a value of 4 Å, which will increase to 15 Å over 500,000 simulation steps.

The atom selection keywords are detailed in section 5.

Here, we document the syntax of the commands and parameters used to set up and use the Colvars module in NAMD. One of these parameters is the conﬁguration ﬁle or the conﬁguration text for the module itself, whose syntax is described in 3.4 and in the following sections.

The “internal units” of the Colvars module are the units in which values are expected to be in the conﬁguration ﬁle, and in which collective variable values, energies, etc. are expressed in the output and colvars trajectory ﬁles. Generally the Colvars module uses internally the same units as its back-end MD engine, with the exception of VMD, where diﬀerent unit sets are supported to allow for easy setup, visualization and analysis of Colvars simulations performed with any simulation engine.

Note that angles are expressed in degrees, and derived quantites such as force constants are based on degrees as well. Atomic coordinates read from XYZ ﬁles (and PDB ﬁles where applicable) are expected to be expressed in Ångström, no matter what unit system is in use by the back-end or the Colvars Module.

To avoid errors due to reading conﬁguration ﬁles written in a diﬀerent unit system, it can be speciﬁed within the input:

- Keyword units$\u27e8\phantom{\rule{0.3em}{0ex}}$Unit
system to be used$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: string

Description: A string deﬁning the units to be used internally by Colvars. In NAMD the only allowed value is NAMD’s native units: real (Å, kcal/mol).

To enable a Colvars-based calculation, the colvars on command must be added to the NAMD script. Two optional commands, colvarsConfig and colvarsInput can be used to deﬁne the module’s conﬁguration or continue a previous simulation. Because these are static parameters, it is typically more convenient to use the cv command in the rest of the NAMD script.

- Keyword colvars$\u27e8\phantom{\rule{0.3em}{0ex}}$Enable
the Colvars module$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: NAMD conﬁguration ﬁle

Acceptable values: boolean

Default value: off

Description: If this ﬂag is on, the Colvars module within NAMD is enabled. - Keyword colvarsConfig$\u27e8\phantom{\rule{0.3em}{0ex}}$Conﬁguration
ﬁle for the collective variables$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: NAMD conﬁguration ﬁle

Acceptable values: UNIX ﬁlename

Description: Name of the Colvars conﬁguration ﬁle (3.4, 3.5 and following sections). This ﬁle can also be provided by the Tcl command cv configfile. Alternatively, the contents of the ﬁle (as opposed to the ﬁle itself) can be given as a string argument to the command cv config. - Keyword colvarsInput$\u27e8\phantom{\rule{0.3em}{0ex}}$Input
state ﬁle for the collective variables$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: NAMD conﬁguration ﬁle

Acceptable values: UNIX ﬁlename

Description: Keyword used to specify the input state ﬁle’s name (3.6). If the input ﬁle is meant to be loaded within a Tcl script section, the cv load command may be used instead.

At any moment after the ﬁrst initialization of the Colvars module, several options can be read or modiﬁed by the
Tcl command cv, with the following syntax:

cv $<$subcommand$>$
[args ...]

The most frequent uses of the cv command are discussed here. For a complete list of all sub-commands of cv, see
section 7.

If the NAMD conﬁguration parameter colvars is on, the cv command can be used anywhere in the NAMD script, and will be invoked as soon as NAMD begins processing Tcl commands.

To deﬁne collective variables and biases, conﬁguration can be loaded using either:

cv configfile colvars-file.in

to load conﬁguration from a ﬁle, or:

cv config "keyword { ... }"

to load conﬁguration as a string argument.

The latter version is particularly useful to dynamically deﬁne the Colvars conﬁguration. For example, when
running an ensemble of umbrella sampling simulations in NAMD, it may be convenient to use an identical NAMD
script, and let the queuing system assist in deﬁning the window. In this example, in a Slurm array job an
environment variable is used to deﬁne the window’s numeric index (starting at zero), and the umbrella
restraint center (starting at 2 for the ﬁrst window, and increasing in increments of 0.25 for all other
windows):

cv configfile colvars-definition.in

set window $env(SLURM_ARRAY_TASK_ID)

cv config "harmonic {

name us_${window}

colvars xi

centers [expr 2.0 + 0.25 * ${window}]

...

}"

The vast majority of the syntax in Colvars is backward-compatible, adding keywords when new features are
introduced. However, when using multiple versions simultaneously it may be useful to test within the script whether
the version is recent enough to support the desired feature. cv version can be used to get the Colvars version for
this use:

if { [cv version] >= "2020-02-25" } {

cv config "(use a recent feature)"

}

After a conﬁguration is fully deﬁned, cv load may be used to load a state ﬁle from a previous simulation that
contains e.g. data from history-dependent biases), to either continue that simulation or analyze its
results:

cv load $<$oldjob$>$.colvars.state

or more simply using the preﬁx of the state ﬁle itself:

cv load $<$oldjob$>$

The latter is much more convenient in combination with the NAMD reinitatoms command, for example:

reinitatoms $<$oldjob$>$

cv load $<$oldjob$>$

The step number contained by the loaded ﬁle will be used internally by Colvars to control time-dependent biases,
unless firstTimestep is issued, in which case that value will be used.

When the system’s topology is changed during simulation via the structure command (e.g. in constant-pH
simulations), it is generally best to reset and re-initalize the module from scratch before loading the corresponding
snapshot:

structure newsystem.psf

reinitatoms $<$snapshot$>$

cv reset

cv configfile ...

cv load $<$snapshot$>$

cv save, analogous to cv load, saves all restart information to a state ﬁle. This is normally not required during
a simulation if colvarsRestartFrequency is deﬁned (either directly or indirectly by the NAMD restart frequency),
but it is necessary in post-processing e.g. with VMD. Because not only a state ﬁle (used to continue simulations) but
also other data ﬁles (used to analyze the trajectory) are written, it is generally clearer to use cv save with a preﬁx
rather than a ﬁle name:

cv save $<$job$>$

See 7.1 for a complete list of scripting commands used to manage the Colvars module.

After one or more collective variables are deﬁned, they can be accessed via cv colvar [args ...]. For
example, to recompute the collective variable xi the following command can be used:

cv colvar xi update

This ordinarily is not needed during a simulation run, where all variables are recomputed at every step (along with
biasing forces acting on them). However, when analyzing an existing trajectory a call to update is generally
required.

While in all typical cases all conﬁguration of the variables is done with cv config
or cv configfile, a limited set of changes can be enacted at runtime using cv colvar
$<$name$>$
modifycvcs [args ...]. Each argument is a string passed to the function or functions that are used to compute the
variable, and are called colvar components, or CVCs (4.1). For example, a variable DeltaZ made of a
single distanceZ CVC can be made periodic with a period equal to the unit cell dimension along the
Z-axis:

cv colvar DeltaZ modifycvcs "period $Lz"

where $Lz is obtained outside Colvars.

This option is currently limited to changing the values of componentCoeff and componentExp (e.g. to update the
polynomial superposition parameters on the ﬂy), of period and wrapAround, and of the forceNoPBC option for all
components that support it.

If the variable is computed using more than one CVC, it is possible to selectively turn some of them on or
oﬀ:

cv colvar xi cvcflags $<$flags$>$

where $<$flags$>$
is a list of 0/1 values, one per component. This is useful for example when Tcl script-based path collective variables
in Cartesian coordinates (4.10.3) are used, to minimize computational cost by disabling the computation of terms
that are very close to zero.

Important: None of the changes enacted by modifycvcs or cvcflags will be saved to state ﬁles, and will be lost when restarting a simulation, deleting the corresponding collective variable, or resetting the module with cv reset.

As soon as a collective variable is up to date (during a MD run or after its update method has been called),
forces can be applied to it, e.g. as part of a custom restraint implemented by scriptedColvarForces:

cv colvar xi addforce $force

where $force is a scalar or a vector (depending on the type of variable xi) and is deﬁned by the user’s function. The
force will be physically applied to the corresponding atoms during the simulation after Colvars communicates all
forces to the rest of NAMD. Until then, the total force applied to xi from all biases can be retrieved
by:

cv colvar xi getappliedforce

(see also the use of the outputAppliedForce option).

To obtain the total force projected on the variable xi:

cv colvar xi gettotalforce

Note that not all types of variable support this option, and the value of the total force may not be available
immediately: see outputTotalForce for more details.

See 7.2 for a complete list of scripting commands used to manage collective variables.

Because biases depend only upon data internal to the Colvars module (i.e. they do not need atomic coordinates
from NAMD), it is generally easy to create them or update their conﬁguration at any time. For example, given the
most current value of the variable xi, an already-deﬁned restraint on it named harmonic_xi can be updated
as:

cv bias harmonic_xi update

Again, this is not generally needed during a running simulation, when an automat ic update of each bias is already
carried out.

Calling update for a bias is most useful for just-deﬁned biases or when changing their conﬁguration. When
update is called e.g. as part of the function invoked by scriptedColvarForces, it is executed before any biasing
forces are applied to the variables, thus allowing to modify them. This use of update is often used e.g. in the
deﬁnition of custom bias-exchange algorithms as part of the NAMD script. Because a bias is a relatively
light-weight object, the easiest way to change the conﬁguration of an existing bias is deleting it and re-creating
it:

# Delete the restraint "harmonic_xi"

cv bias harmonic_xi delete

# Re-define it, but using an updated restraint center

cv config "harmonic {

name harmonic_xi

centers ${new_center}]

...

}"

# Now update it (based on the current value of "xi")

cv bias harmonic_xi update

It is also possible to make the change subject to a condition on the energy of the new bias:

...

cv bias harmonic_xi update

if { [cv bias harmonic_xi energy] < ${E_accept} } {

...

}

Some types of bias are history-dependent, and the magnitude of their forces depends not only on the values of
their corresponding variables, but also on previous simulation history. It is thus useful to load information from a
state ﬁle that contains information speciﬁcally for one bias only, for example:

cv bias metadynamics1 load old.colvars.state

or alternatively, using the preﬁx of the ﬁle instead of its full name:

cv bias metadynamics1 load old

A corresponding save function is also available:

cv bias metadynamics1 save new

This pair of functions is also used internally by Colvars to implement e.g. multiple-walker metadynamics (6.4.7), but
they can be called from a scripted function to implement alternative coupling schemes.

See 7.3 for a complete list of scripting commands used to manage biases.

All the parameters deﬁning variables and their biasing or analysis algorithms are read from the ﬁle speciﬁed by the conﬁguration option colvarsConfig, or by the Tcl commands cv config and cv configfile. None of the keywords described in the remainder of this manual are recognized directly in the NAMD conﬁguration ﬁle, unless as arguments of cv config. Each conﬁguration line follows the format “keyword value”, where the keyword and its value are separated by any white space. The following rules apply:

- keywords are case-insensitive (upperBoundary is the same as upperboundary and UPPERBOUNDARY): their string values are however case-sensitive (e.g. ﬁle names);
- a long value, or a list of multiple values, can be distributed across multiple lines by using curly braces, “{” and “}”: the opening brace “{” must occur on the same line as the keyword, following a space character or other white space; the closing brace “}” can be at any position after that; any keywords following the closing brace on the same line are not valid (they should appear instead on a diﬀerent line);
- many keywords are nested, and are only meaningful within a speciﬁc context: for every keyword documented in the following, the “parent” keyword that deﬁnes such context is also indicated;
- the ‘=’ sign between a keyword and its value, deprecated in the NAMD main conﬁguration ﬁle, is not allowed;
- Tcl syntax is generally not available, but it is possible to use Tcl variables or bracket expansion of commands within a conﬁguration string, when this is passed via the command cv config …; this is particularly useful when combined with parameter introspection, e.g. cv config "colvarsTrajFrequency [DCDFreq]";
- if a keyword requiring a boolean value (yes|on|true or no|off|false) is provided without an explicit value, it defaults to ‘yes|on|true’; for example, ‘outputAppliedForce’ may be used as shorthand for ‘outputAppliedForce on’;
- the hash character # indicates a comment: all text in the same line following this character will be ignored.

The following keywords are available in the global context of the Colvars conﬁguration, i.e. they are not nested inside other keywords:

- Keyword colvarsTrajFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$Colvar
value trajectory frequency$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: positive integer

Default value: 100

Description: The values of each colvar (and of other related quantities, if requested) are written to the ﬁle outputName.colvars.traj every these many steps throughout the simulation. If the value is 0, such trajectory ﬁle is not written. For optimization the output is buﬀered, and synchronized with the disk only when the restart ﬁle is being written. - Keyword colvarsRestartFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$Colvar
module restart frequency$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: positive integer

Default value: NAMD parameter restartFreq

Description: The state ﬁle and any other output ﬁles produced by Colvars are written every these many steps (the trajectory ﬁle is still written every colvarsTrajFrequency steps). It is generally a good idea to leave this parameter at its default value, unless needed for special cases or to disable automatic writing of output ﬁles altogether. Writing can still be invoked at any time via the command cv save. - Keyword indexFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Index
ﬁle for atom selection (GROMACS “ndx” format)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: UNIX ﬁlename

Description: This option reads an index ﬁle (usually with a .ndx extension) as produced by the make_ndx tool of GROMACS. This keyword may be repeated to load multiple index ﬁles. A group with the same name may appear multiple times, as long as it contains the same indices in identical order each time: an error is raised otherwise. The names of index groups contained in this ﬁle can then be used to deﬁne atom groups with the indexGroup keyword. Other supported methods to select atoms are described in 5. - Keyword smp$\u27e8\phantom{\rule{0.3em}{0ex}}$Whether
SMP parallelism should be used$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: boolean

Default value: on

Description: If this ﬂag is enabled (default), SMP parallelism over threads will be used to compute variables and biases, provided that this is supported by the NAMD build in use.

To illustrate the ﬂexibility of the Colvars module, a non-trivial setup is represented in Figure 1. The
corresponding conﬁguration is given below. The options within the colvar blocks are described in 4, those
within the harmonic and histogram blocks in 6. Note: except colvar, none of the keywords shown is
mandatory.

colvar {

# difference of two distances

name d

width 0.2 # 0.2 Å of estimated fluctuation width

distance {

componentCoeff 1.0

group1 { atomNumbers 1 2 }

group2 { atomNumbers 3 4 5 }

}

distance {

componentCoeff -1.0

group1 { atomNumbers 7 }

group2 { atomNumbers 8 9 10 }

}

}

colvar {

name c

coordNum {

cutoff 6.0

group1 { atomNumbersRange 1-10 }

group2 { atomNumbersRange 11-20 }

}

}

colvar {

name alpha

alpha {

psfSegID PROT

residueRange 1-10

}

}

harmonic {

colvars d c

centers 3.0 4.0

forceConstant 5.0

}

histogram {

colvars c alpha

}

Section 4 explains how to deﬁne a colvar and its behavior, regardless of its speciﬁc functional form. To deﬁne colvars that are appropriate to a speciﬁc physical system, Section 5 documents how to select atoms, and section 4 lists all of the available functional forms, which we call “colvar components”. Finally, section 6 lists the available methods and algorithms to perform biased simulations and multidimensional analysis of colvars.

Because many of the methods implemented in Colvars are history-dependent, a state ﬁle is often needed to continue a long simulation over consecutive runs. Such state ﬁle is written automatically at the end of any simulation with Colvars, and contains data accumulated during that simulation along with the step number at the end of it. The step number read from the state ﬁle is then used to control such time-dependent biases: because of this essential role, the step number internal to Colvars may not always match the step number reported by the MD program that carried during the simulation (which may instead restart from zero each time). If a state ﬁle is not given, the NAMD command firstTimestep may be used to control the Colvars step number.

Depending on the conﬁguration, a state ﬁle may need to be loaded issued at the beginning of a new simulation when time-dependent biasing methods are applied (moving restraints, metadynamics, ABF, ...). When the Colvars module is initialized in NAMD, the colvarsInput keyword can be used to give the name of the state ﬁle. After initialization, a state ﬁle may be loaded at any time with the Tcl command cv load.

It is possible to load a state ﬁle even if the conﬁguration has changed: for example, new variables may be deﬁned or restraints be added in between consecutive runs. For each newly deﬁned variable or bias, no information will be read from the state ﬁle if this is unavailable: such new objects will remain uninitialized until the ﬁrst compute step. Conversely, any information that the state ﬁle has about variables or biases that are not deﬁned any longer is silently ignored. Because these checks are done by the names of variables or biases, it is the user’s responsibility to ensure that these are consistent between runs.

During a simulation with collective variables deﬁned, the following three output ﬁles are written:

- A state ﬁle, named outputName.colvars.state; this ﬁle is in ASCII (plain text) format, regardless of
the value of binaryOutput in the NAMD conﬁguration. This ﬁle is written at the end of the speciﬁed
run, but can also be written at any time with the command cv save (3.3.3).

This is the only Colvars output ﬁle needed to continue a simulation. - If the parameter colvarsRestartFrequency is larger than zero, a restart ﬁle is written every that many steps: this ﬁle is fully equivalent to the ﬁnal state ﬁle. The name of this ﬁle is restartName.colvars.state.
- If the parameter colvarsTrajFrequency is greater than 0 (default: 100), a trajectory ﬁle is written during the simulation: its name is outputName.colvars.traj; unlike the state ﬁle, it is not needed to restart a simulation, but can be used later for post-processing and analysis.

Other output ﬁles may also be written by speciﬁc methods, e.g. the ABF or metadynamics methods (6.2, 6.4). Like the trajectory ﬁle, they are needed only for analyzing, not continuing a simulation. All such ﬁles’ names also begin with the preﬁx outputName.

Lastly, the total energy of all biases or restraints applied to the colvars appears under the NAMD standard output, under the MISC column.

A collective variable is deﬁned by the keyword colvar followed by its conﬁguration options contained within curly braces:

colvar {

name xi

$<$other
options$>$

function_name {

$<$parameters$>$

$<$atom
selection$>$

}

}

There are multiple ways of deﬁning a variable:

- The simplest and most common way way is using one of the precompiled functions (here called “components”), which are listed in section 4.1. For example, using the keyword rmsd (section 4.5.1) deﬁnes the variable as the root mean squared deviation (RMSD) of the selected atoms.
- A new variable may also be constructed as a linear or polynomial combination of the components listed in section 4.1 (see 4.15 for details).
- A user-deﬁned mathematical function of the existing components (see list in section 4.1), or of the atomic coordinates directly (see the cartesian keyword in 4.8.1). The function is deﬁned through the keyword customFunction (see 4.16 for details).
- A user-deﬁned Tcl function of the existing components (see list in section 4.1), or of the atomic coordinates directly (see the cartesian keyword in 4.8.1). The function is provided by a separate Tcl script, and referenced through the keyword scriptedFunction (see 4.17 for details).

Choosing a component (function) is the only parameter strictly required to deﬁne a collective variable. It is also highly recommended to specify a name for the variable:

- Keyword name$\u27e8\phantom{\rule{0.3em}{0ex}}$Name
of this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Default value: “colvar” + numeric id

Description: The name is an unique case-sensitive string which allows the Colvars module to identify this colvar unambiguously; it is also used in the trajectory ﬁle to label to the columns corresponding to this colvar.

In this context, the function that computes a colvar is called a component. A component’s choice and deﬁnition consists of including in the variable’s conﬁguration a keyword indicating the type of function (e.g. rmsd), followed by a deﬁnition block specifying the atoms involved (see 5) and any additional parameters (cutoﬀs, “reference” values, …). At least one component must be chosen to deﬁne a variable: if none of the keywords listed below is found, an error is raised.

The following components implement functions with a scalar value (i.e. a real number):

- distance: distance between two groups;
- distanceZ: projection of a distance vector on an axis;
- distanceXY: projection of a distance vector on a plane;
- distanceInv: mean distance between two groups of atoms (e.g. NOE-based distance);
- angle: angle between three groups;
- dihedral: torsional (dihedral) angle between four groups;
- dipoleAngle: angle between two groups and dipole of a third group;
- dipoleMagnitude magnitude of the dipole of a group of atoms;
- polarTheta: polar angle of a group in spherical coordinates;
- polarPhi: azimuthal angle of a group in spherical coordinates;
- coordNum: coordination number between two groups;
- selfCoordNum: coordination number of atoms within a group;
- hBond: hydrogen bond between two atoms;
- rmsd: root mean square deviation (RMSD) from a set of reference coordinates;
- eigenvector: projection of the atomic coordinates on a vector;
- mapTotal: total value of a volumetric map;
- orientationAngle: angle of the best-ﬁt rotation from a set of reference coordinates;
- orientationProj: cosine of orientationProj;
- spinAngle: projection orthogonal to an axis of the best-ﬁt rotation from a set of reference coordinates;
- tilt: projection on an axis of the best-ﬁt rotation from a set of reference coordinates;
- gyration: radius of gyration of a group of atoms;
- inertia: moment of inertia of a group of atoms;
- inertiaZ: moment of inertia of a group of atoms around a chosen axis;
- alpha: $\alpha $-helix content of a protein segment.
- dihedralPC: projection of protein backbone dihedrals onto a dihedral principal component.

Some components do not return scalar, but vector values:

- distanceVec: distance vector between two groups (length: 3);
- distanceDir: unit vector parallel to distanceVec (length: 3);
- cartesian: vector of atomic Cartesian coordinates (length: $N$ times the number of Cartesian components requested, X, Y or Z);
- distancePairs: vector of mutual distances (length: ${N}_{\mathrm{1}}\times {N}_{\mathrm{2}}$);
- orientation: best-ﬁt rotation, expressed as a unit quaternion (length: 4).

The types of components used in a colvar (scalar or not) determine the properties of that colvar, and particularly which biasing or analysis methods can be applied.

What if “X” is not listed? If a function type is not available on this list, it may be possible to deﬁne it as a polynomial superposition of existing ones (see 4.15), a custom function (see 4.16), or a scripted function (see 4.17).

In the rest of this section, all available component types are listed, along with their physical units and the ranges of values, if limited. Such limiting values can be used to deﬁne lowerBoundary and upperBoundary in the parent colvar.

For each type of component, the available conﬁgurations keywords are listed: when two components share certain keywords, the second component references to the documentation of the ﬁrst one that uses that keyword. The very few keywords that are available for all types of components are listed in a separate section 4.12.

The distance {...} block deﬁnes a distance component between the two atom groups, group1 and group2.

List of keywords (see also 4.15 for additional options):

- Keyword group1$\u27e8\phantom{\rule{0.3em}{0ex}}$First
group of atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distance

Acceptable values: Block group1 {...}

Description: First group of atoms. - Keyword group2: analogous to group1
- Keyword forceNoPBC$\u27e8\phantom{\rule{0.3em}{0ex}}$Calculate
absolute rather than minimum-image distance?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distance

Acceptable values: boolean

Default value: no

Description: By default, in calculations with periodic boundary conditions, the distance component returns the distance according to the minimum-image convention. If this parameter is set to yes, PBC will be ignored and the distance between the coordinates as maintained internally will be used. This is only useful in a limited number of special cases, e.g. to describe the distance between remote points of a single macromolecule, which cannot be split across periodic cell boundaries, and for which the minimum-image distance might give the wrong result because of a relatively small periodic cell. - Keyword oneSiteTotalForce$\u27e8\phantom{\rule{0.3em}{0ex}}$Measure
total force on group 1 only?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: angle, dipoleAngle, dihedral

Acceptable values: boolean

Default value: no

Description: If this is set to yes, the total force is measured along a vector ﬁeld (see equation (27) in section 6.2) that only involves atoms of group1. This option is only useful for ABF, or custom biases that compute total forces. See section 6.2 for details.

The value returned is a positive number (in Å), ranging from $0$ to the largest possible interatomic distance within the chosen boundary conditions (with PBCs, the minimum image convention is used unless the forceNoPBC option is set).

The distanceZ {...} block deﬁnes a distance projection component, which can be seen as measuring the distance between two groups projected onto an axis, or the position of a group along such an axis. The axis can be deﬁned using either one reference group and a constant vector, or dynamically based on two reference groups. One of the groups can be set to a dummy atom to allow the use of an absolute Cartesian coordinate.

List of keywords (see also 4.15 for additional options):

- Keyword main$\u27e8\phantom{\rule{0.3em}{0ex}}$Main
group of atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ

Acceptable values: Block main {...}

Description: Group of atoms whose position $\text{}r\text{}$ is measured. - Keyword ref$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
group of atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ

Acceptable values: Block ref {...}

Description: Reference group of atoms. The position of its center of mass is noted ${\text{}r\text{}}_{1}$ below. - Keyword ref2$\u27e8\phantom{\rule{0.3em}{0ex}}$Secondary
reference group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ

Acceptable values: Block ref2 {...}

Default value: none

Description: Optional group of reference atoms, whose position ${\text{}r\text{}}_{2}$ can be used to deﬁne a dynamic projection axis: $\text{}e\text{}={\left(\parallel {\text{}r\text{}}_{2}-{\text{}r\text{}}_{1}\parallel \right)}^{-1}\times \left({\text{}r\text{}}_{2}-{\text{}r\text{}}_{1}\right)$. In this case, the origin is ${\text{}r\text{}}_{m}=1\u22152\left({\text{}r\text{}}_{1}+{\text{}r\text{}}_{2}\right)$, and the value of the component is $\text{}e\text{}\cdot \left(\text{}r\text{}-{\text{}r\text{}}_{m}\right)$. - Keyword axis$\u27e8\phantom{\rule{0.3em}{0ex}}$Projection
axis (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ

Acceptable values: (x, y, z) triplet

Default value: (0.0, 0.0, 1.0)

Description: The three components of this vector deﬁne a projection axis $\text{}e\text{}$ for the distance vector $\text{}r\text{}-{\text{}r\text{}}_{1}$ joining the centers of groups ref and main. The value of the component is then $\text{}e\text{}\cdot \left(\text{}r\text{}-{\text{}r\text{}}_{1}\right)$. The vector should be written as three components separated by commas and enclosed in parentheses. - Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

This component returns a number (in Å) whose range is determined by the chosen boundary conditions. For instance, if the $z$ axis is used in a simulation with periodic boundaries, the returned value ranges between $-{b}_{z}\u22152$ and ${b}_{z}\u22152$, where ${b}_{z}$ is the box length along $z$ (this behavior is disabled if forceNoPBC is set).

The distanceXY {...} block deﬁnes a distance projected on a plane, and accepts the same keywords as the component distanceZ, i.e. main, ref, either ref2 or axis, and oneSiteTotalForce. It returns the norm of the projection of the distance vector between main and ref onto the plane orthogonal to the axis. The axis is deﬁned using the axis parameter or as the vector joining ref and ref2 (see distanceZ above).

List of keywords (see also 4.15 for additional options):

- Keyword main: see deﬁnition of main in sec. 4.2.2 (distanceZ component)
- Keyword ref: see deﬁnition of ref in sec. 4.2.2 (distanceZ component)
- Keyword ref2: see deﬁnition of ref2 in sec. 4.2.2 (distanceZ component)
- Keyword axis: see deﬁnition of axis in sec. 4.2.2 (distanceZ component)
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The distanceVec {...} block deﬁnes a distance vector component, which accepts the same keywords as the component distance: group1, group2, and forceNoPBC. Its value is the 3-vector joining the centers of mass of group1 and group2.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The distanceDir {...} block deﬁnes a distance unit vector component, which accepts the same keywords as the component distance: group1, group2, and forceNoPBC. It returns a 3-dimensional unit vector $\mathbf{d}=\left({d}_{x},{d}_{y},{d}_{z}\right)$, with $\left|\mathbf{d}\right|=1$.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The distanceInv {...} block deﬁnes a generalized mean distance between two groups of atoms 1 and 2, weighted with exponent $1\u2215n$:

where $\parallel {\mathbf{d}}^{ij}\parallel $ is the distance between atoms $i$ and $j$ in groups 1 and 2 respectively, and $n$ is an even integer.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)
- Keyword exponent$\u27e8\phantom{\rule{0.3em}{0ex}}$Exponent
$n$
in equation 2$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceInv

Acceptable values: positive even integer

Default value: 6

Description: Deﬁnes the exponent to which the individual distances are elevated before averaging. The default value of 6 is useful for example to applying restraints based on NOE-measured distances.

This component returns a number in Å, ranging from $0$ to the largest possible distance within the chosen boundary conditions.

The angle {...} block deﬁnes an angle, and contains the three blocks group1, group2 and group3, deﬁning the three groups. It returns an angle (in degrees) within the interval $\left[0:180\right]$.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword group3: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The dipoleAngle {...} block deﬁnes an angle, and contains the three blocks group1, group2 and group3, deﬁning the three groups, being group1 the group where dipole is calculated. It returns an angle (in degrees) within the interval $\left[0:180\right]$.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword group3: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The dihedral {...} block deﬁnes a torsional angle, and contains the blocks group1, group2, group3 and group4, deﬁning the four groups. It returns an angle (in degrees) within the interval $\left[-180:180\right]$. The Colvars module calculates all the distances between two angles taking into account periodicity. For instance, reference values for restraints or range boundaries can be deﬁned by using any real number of choice.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword group3: analogous to group1
- Keyword group4: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)
- Keyword oneSiteTotalForce: see deﬁnition of oneSiteTotalForce in sec. 4.2.1 (distance component)

The polarTheta {...} block deﬁnes the polar angle in spherical coordinates, for the center of mass of a group of atoms described by the block atoms. It returns an angle (in degrees) within the interval $\left[0:180\right]$. To obtain spherical coordinates in a frame of reference tied to another group of atoms, use the fittingGroup (5.2) option within the atoms block. An example is provided in ﬁle examples/11_polar_angles.in of the Colvars public repository.

List of keywords (see also 4.15 for additional options):

- Keyword atoms$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: polarPhi

Acceptable values: atoms {...} block

Description: Deﬁnes the group of atoms for the COM of which the angle should be calculated.

The polarPhi {...} block deﬁnes the azimuthal angle in spherical coordinates, for the center of mass of a group of atoms described by the block atoms. It returns an angle (in degrees) within the interval $\left[-180:180\right]$. The Colvars module calculates all the distances between two angles taking into account periodicity. For instance, reference values for restraints or range boundaries can be deﬁned by using any real number of choice. To obtain spherical coordinates in a frame of reference tied to another group of atoms, use the fittingGroup (5.2) option within the atoms block. An example is provided in ﬁle examples/11_polar_angles.in of the Colvars public repository.

List of keywords (see also 4.15 for additional options):

- Keyword atoms$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: polarPhi

Acceptable values: atoms {...} block

Description: Deﬁnes the group of atoms for the COM of which the angle should be calculated.

The coordNum {...} block deﬁnes a coordination number (or number of contacts), which calculates the function $\left(1-{\left(d\u2215{d}_{0}\right)}^{n}\right)\u2215\left(1-{\left(d\u2215{d}_{0}\right)}^{m}\right)$, where ${d}_{0}$ is the “cutoﬀ” distance, and $n$ and $m$ are exponents that can control its long range behavior and stiﬀness [2]. This function is summed over all pairs of atoms in group1 and group2:

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword cutoff$\u27e8\phantom{\rule{0.3em}{0ex}}$“Interaction”
distance (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: positive decimal

Default value: 4.0

Description: This number deﬁnes the switching distance to deﬁne an interatomic contact: for $d\ll {d}_{0}$, the switching function $\left(1-{\left(d\u2215{d}_{0}\right)}^{n}\right)\u2215\left(1-{\left(d\u2215{d}_{0}\right)}^{m}\right)$ is close to 1, at $d={d}_{0}$ it has a value of $n\u2215m$ ($1\u22152$ with the default $n$ and $m$), and at $d\gg {d}_{0}$ it goes to zero approximately like ${d}^{m-n}$. Hence, for a proper behavior, $m$ must be larger than $n$. - Keyword cutoff3$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
distance vector (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: “(x, y, z)” triplet of positive decimals

Default value: (4.0, 4.0, 4.0)

Description: The three components of this vector deﬁne three diﬀerent cutoﬀs ${d}_{0}$ for each direction. This option is mutually exclusive with cutoff. - Keyword expNumer$\u27e8\phantom{\rule{0.3em}{0ex}}$Numerator
exponent$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: positive even integer

Default value: 6

Description: This number deﬁnes the $n$ exponent for the switching function. - Keyword expDenom$\u27e8\phantom{\rule{0.3em}{0ex}}$Denominator
exponent$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: positive even integer

Default value: 12

Description: This number deﬁnes the $m$ exponent for the switching function. - Keyword group2CenterOnly$\u27e8\phantom{\rule{0.3em}{0ex}}$Use
only group2’s center of mass$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: boolean

Default value: off

Description: If this option is on, only contacts between each atoms in group1 and the center of mass of group2 are calculated (by default, the sum extends over all pairs of atoms in group1 and group2). If group2 is a dummyAtom, this option is set to yes by default. - Keyword tolerance$\u27e8\phantom{\rule{0.3em}{0ex}}$Pairlist
control$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: decimal

Default value: 0.0

Description: This controls the pairlist feature, dictating the minimum value for each summation element in Eq. 3 such that the pair that contributed the summation element is included in subsequent simulation timesteps until the next pairlist recalculation. For most applications, this value should be small (eg. 0.001) to avoid missing important contributions to the overall sum. Higher values will improve performance by reducing the number of pairs that contribute to the sum. Values above 1 will exclude all possible pair interactions. Similarly, values below 0 will never exclude a pair from consideration. To ensure continuous forces, Eq. 3 is further modiﬁed by subtracting the tolerance and then rescaling so that each pair covers the range $\left[0,1\right]$. - Keyword pairListFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$Pairlist
regeneration frequency$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: coordNum

Acceptable values: positive integer

Default value: 100

Description: This controls the pairlist feature, dictating how many steps are taken between regenerating pairlists if the tolerance is greater than 0.

This component returns a dimensionless number, which ranges from approximately 0 (all interatomic distances are much larger than the cutoﬀ) to ${N}_{\mathtt{group1}}\times {N}_{\mathtt{group2}}$ (all distances are less than the cutoﬀ), or ${N}_{\mathtt{group1}}$ if group2CenterOnly is used. For performance reasons, at least one of group1 and group2 should be of limited size or group2CenterOnly should be used: the cost of the loop over all pairs grows as ${N}_{\mathtt{group1}}\times {N}_{\mathtt{group2}}$. Setting $\mathtt{tolerance}>0$ ameliorates this to some degree, although every pair is still checked to regenerate the pairlist.

The selfCoordNum {...} block deﬁnes a coordination number similarly to the component coordNum, but the function is summed over atom pairs within group1:

The keywords accepted by selfCoordNum are a subset of those accepted by coordNum, namely group1 (here deﬁning all of the atoms to be considered), cutoff, expNumer, and expDenom.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.4.1 (coordNum component)
- Keyword cutoff: see deﬁnition of cutoff in sec. 4.4.1 (coordNum component)
- Keyword cutoff3: see deﬁnition of cutoff3 in sec. 4.4.1 (coordNum component)
- Keyword expNumer: see deﬁnition of expNumer in sec. 4.4.1 (coordNum component)
- Keyword expDenom: see deﬁnition of expDenom in sec. 4.4.1 (coordNum component)
- Keyword tolerance: see deﬁnition of tolerance in sec. 4.4.1 (coordNum component)
- Keyword pairListFrequency: see deﬁnition of pairListFrequency in sec. 4.4.1 (coordNum component)

This component returns a dimensionless number, which ranges from approximately 0 (all interatomic distances much larger than the cutoﬀ) to ${N}_{\mathtt{group1}}\times \left({N}_{\mathtt{group1}}-1\right)\u22152$ (all distances within the cutoﬀ). For performance reasons, group1 should be of limited size, because the cost of the loop over all pairs grows as ${N}_{\mathtt{group1}}^{2}$.

The hBond {...} block deﬁnes a hydrogen bond, implemented as a coordination number (eq. 3) between the donor and the acceptor atoms. Therefore, it accepts the same options cutoff (with a diﬀerent default value of 3.3 Å), expNumer (with a default value of 6) and expDenom (with a default value of 8). Unlike coordNum, it requires two atom numbers, acceptor and donor, to be deﬁned. It returns an adimensional number, with values between 0 (acceptor and donor far outside the cutoﬀ distance) and 1 (acceptor and donor much closer than the cutoﬀ).

List of keywords (see also 4.15 for additional options):

- Keyword acceptor$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of the acceptor atom$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: hBond

Acceptable values: positive integer

Description: Number that uses the same convention as atomNumbers. - Keyword donor: analogous to acceptor
- Keyword cutoff: see deﬁnition of cutoff in sec. 4.4.1 (coordNum component)

Note: default value is 3.3 Å. - Keyword expNumer: see deﬁnition of expNumer in sec. 4.4.1 (coordNum component)

Note: default value is 6. - Keyword expDenom: see deﬁnition of expDenom in sec. 4.4.1 (coordNum component)

Note: default value is 8.

The block rmsd {...} deﬁnes the root mean square replacement (RMSD) of a group of atoms with respect to a reference structure. For each set of coordinates $\left\{{\mathbf{x}}_{1}\left(t\right),{\mathbf{x}}_{2}\left(t\right),\dots {\mathbf{x}}_{N}\left(t\right)\right\}$, the colvar component rmsd calculates the optimal rotation ${U}^{\left\{{\mathbf{x}}_{i}\left(t\right)\right\}\to \left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}}$ that best superimposes the coordinates $\left\{{\mathbf{x}}_{i}\left(t\right)\right\}$ onto a set of reference coordinates $\left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}$. Both the current and the reference coordinates are centered on their centers of geometry, ${\mathbf{x}}_{\mathrm{cog}}\left(t\right)$ and ${\mathbf{x}}_{\mathrm{cog}}^{\mathrm{(ref)}}$. The root mean square displacement is then deﬁned as:

The optimal rotation ${U}^{\left\{{\mathbf{x}}_{i}\left(t\right)\right\}\to \left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}}$ is calculated within the formalism developed in reference [3], which guarantees a continuous dependence of ${U}^{\left\{{\mathbf{x}}_{i}\left(t\right)\right\}\to \left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}}$ with respect to $\left\{{\mathbf{x}}_{i}\left(t\right)\right\}$.

List of keywords (see also 4.15 for additional options):

- Keyword atoms$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: atoms {...} block

Description: Deﬁnes the group of atoms of which the RMSD should be calculated. Optimal ﬁt options (such as refPositions and rotateReference) should typically NOT be set within this block. Exceptions to this rule are the special cases discussed in the Advanced usage paragraph below. - Keyword refPositions$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
coordinates$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: space-separated list of (x, y, z) triplets

Description: This option (mutually exclusive with refPositionsFile) sets the reference coordinates for RMSD calculation, and uses these to compute the roto-translational ﬁt. It is functionally equivalent to the option refPositions in the atom group deﬁnition, which also supports more advanced ﬁtting options. - Keyword refPositionsFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
coordinates ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: UNIX ﬁlename

Description: This option (mutually exclusive with refPositions) sets the reference coordinates for RMSD calculation, and uses these to compute the roto-translational ﬁt. It is functionally equivalent to the option refPositionsFile in the atom group deﬁnition, which also supports more advanced ﬁtting options. - Keyword refPositionsCol$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
column containing atom ﬂags$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: O, B, X, Y, or Z

Description: If refPositionsFile is a PDB ﬁle that contains all the atoms in the topology, this option may be provided to set which PDB ﬁeld is used to ﬂag the reference coordinates for atoms. - Keyword refPositionsColValue$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
selection ﬂag in the PDB column$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: positive decimal

Description: If deﬁned, this value identiﬁes in the PDB column refPositionsCol of the ﬁle refPositionsFile which atom positions are to be read. Otherwise, all positions with a non-zero value are read. - Keyword atomPermutation$\u27e8\phantom{\rule{0.3em}{0ex}}$Alternate
ordering of atoms for RMSD computation$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: rmsd

Acceptable values: List of atom numbers

Description: If deﬁned, this parameter deﬁnes a re-ordering (permutation) of the 1-based atom numbers that can be used to compute the RMSD, typically due to molecular symmetry. This parameter can be speciﬁed multiple times, each one deﬁning a new permutation: the returned RMSD value is the minimum over the set of permutations. For example, if the atoms making up the group are 6, 7, 8, 9, and atoms 7, 8, and 9 are invariant by circular permutation (as the hydrogens in a CH3 group), a symmetry-adapted RMSD would be obtained by adding:

atomPermutation 6 8 9 7

atomPermutation 6 9 7 8

Note that this does not aﬀect the least-squares roto-translational ﬁt, which is done using the topology ordering of atoms, and the reference positions in the order provided. Therefore, this feature is mostly useful when using custom ﬁtting parameters within the atom group, such as fittingGroup, or when ﬁtting is disabled altogether.

This component returns a positive real number (in Å).

In the standard usage as described above, the rmsd component calculates a minimum RMSD, that is, current coordinates are optimally ﬁtted onto the same reference coordinates that are used to compute the RMSD value. The ﬁt itself is handled by the atom group object, whose parameters are automatically set by the rmsd component. For very speciﬁc applications, however, it may be useful to control the ﬁtting process separately from the deﬁnition of the reference coordinates, to evaluate various types of non-minimal RMSD values. This can be achieved by setting the related options (refPositions, etc.) explicitly in the atom group block. This allows for the following non-standard cases:

- applying the optimal translation, but no rotation (rotateReference off), to bias or restrain the shape and orientation, but not the position of the atom group;
- applying the optimal rotation, but no translation (centerReference off), to bias or restrain the shape and position, but not the orientation of the atom group;
- disabling the application of optimal roto-translations, which lets the RMSD component describe the deviation of atoms from ﬁxed positions in the laboratory frame: this allows for custom positional restraints within the Colvars module;
- ﬁtting the atomic positions to diﬀerent reference coordinates than those used in the RMSD calculation itself (by specifying refPositions or refPositionsFile within the atom group as well as within the rmsd block);
- applying the optimal rotation and/or translation from a separate atom group, deﬁned through fittingGroup: the RMSD then reﬂects the deviation from reference coordinates in a separate, moving reference frame (see example in the section on fittingGroup).

The block eigenvector {...} deﬁnes the projection of the coordinates of a group of atoms (or more precisely, their deviations from the reference coordinates) onto a vector in ${\mathbb{R}}^{3n}$, where $n$ is the number of atoms in the group. The computed quantity is the total projection:

where, as in the rmsd component, $U$ is the optimal rotation matrix, ${\mathbf{x}}_{\mathrm{cog}}\left(t\right)$ and ${\mathbf{x}}_{\mathrm{cog}}^{\mathrm{(ref)}}$ are the centers of geometry of the current and reference positions respectively, and ${\mathbf{v}}_{i}$ are the components of the vector for each atom. Example choices for $\left({\mathbf{v}}_{i}\right)$ are an eigenvector of the covariance matrix (essential mode), or a normal mode of the system. It is assumed that ${\sum}_{i}{\mathbf{v}}_{i}=0$: otherwise, the Colvars module centers the ${\mathbf{v}}_{i}$ automatically when reading them from the conﬁguration.

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)
- Keyword vector$\u27e8\phantom{\rule{0.3em}{0ex}}$Vector
components$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: eigenvector

Acceptable values: space-separated list of (x, y, z) triplets

Description: This option (mutually exclusive with vectorFile) sets the values of the vector components. - Keyword vectorFile$\u27e8\phantom{\rule{0.3em}{0ex}}$ﬁle
containing vector components$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: eigenvector

Acceptable values: UNIX ﬁlename

Description: This option (mutually exclusive with vector) sets the name of a coordinate ﬁle containing the vector components; the ﬁle is read according to the same format used for refPositionsFile. For a PDB ﬁle speciﬁcally, the components are read from the X, Y and Z ﬁelds. Note: The PDB ﬁle has limited precision and ﬁxed-point numbers: in some cases, the vector components may not be accurately represented; a XYZ ﬁle should be used instead, containing ﬂoating-point numbers. - Keyword vectorCol$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
column used to ﬂag participating atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: eigenvector

Acceptable values: O or B

Description: Analogous to atomsCol. - Keyword vectorColValue$\u27e8\phantom{\rule{0.3em}{0ex}}$Value
used to ﬂag participating atoms in the PDB ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: eigenvector

Acceptable values: positive decimal

Description: Analogous to atomsColValue. - Keyword differenceVector$\u27e8\phantom{\rule{0.3em}{0ex}}$The
$3n$-dimensional
vector is the diﬀerence between vector and refPositions$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: eigenvector

Acceptable values: boolean

Default value: off

Description: If this option is on, the numbers provided by vector or vectorFile are interpreted as another set of positions, ${\mathbf{x}}_{i}^{\prime}$: the vector ${\mathbf{v}}_{i}$ is then deﬁned as ${\mathbf{v}}_{i}=\left({\mathbf{x}}_{i}^{\prime}-{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right)$. This allows to conveniently deﬁne a colvar $\xi $ as a projection on the linear transformation between two sets of positions, “A” and “B”. For convenience, the vector is also normalized so that $\xi =0$ when the atoms are at the set of positions “A” and $\xi =1$ at the set of positions “B”.

This component returns a number (in Å), whose value ranges between the smallest and largest absolute positions in the unit cell during the simulations (see also distanceZ). Due to the normalization in eq. 6, this range does not depend on the number of atoms involved.

The block gyration {...} deﬁnes the parameters for calculating the radius of gyration of a group of atomic positions $\left\{{\mathbf{x}}_{1}\left(t\right),{\mathbf{x}}_{2}\left(t\right),\dots {\mathbf{x}}_{N}\left(t\right)\right\}$ with respect to their center of geometry, ${\mathbf{x}}_{\mathrm{cog}}\left(t\right)$:

This component must contain one atoms {...} block to deﬁne the atom group, and returns a positive number, expressed in Å.

List of keywords (see also 4.15 for additional options):

The block inertia {...} deﬁnes the parameters for calculating the total moment of inertia of a group of atomic positions $\left\{{\mathbf{x}}_{1}\left(t\right),{\mathbf{x}}_{2}\left(t\right),\dots {\mathbf{x}}_{N}\left(t\right)\right\}$ with respect to their center of geometry, ${\mathbf{x}}_{\mathrm{cog}}\left(t\right)$:

$$I\phantom{\rule{3.04074pt}{0ex}}=\phantom{\rule{3.04074pt}{0ex}}\sum _{i=1}^{N}{\left|{\mathbf{x}}_{i}\left(t\right)-{\mathbf{x}}_{\mathrm{cog}}\left(t\right)\right|}^{2}$$ | (8) |

Note that all atomic masses are set to 1 for simplicity. This component must contain one atoms {...} block to deﬁne the atom group, and returns a positive number, expressed in Å${}^{2}$.

List of keywords (see also 4.15 for additional options):

The dipoleMagnitude {...} block deﬁnes the dipole magnitude of a group of atoms (norm of the dipole moment’s vector), being atoms the group where dipole magnitude is calculated. It returns the magnitude in elementary charge $e$ times Å.

List of keywords (see also 4.15 for additional options):

The block inertiaZ {...} deﬁnes the parameters for calculating the component along the axis $\mathbf{e}$ of the moment of inertia of a group of atomic positions $\left\{{\mathbf{x}}_{1}\left(t\right),{\mathbf{x}}_{2}\left(t\right),\dots {\mathbf{x}}_{N}\left(t\right)\right\}$ with respect to their center of geometry, ${\mathbf{x}}_{\mathrm{cog}}\left(t\right)$:

Note that all atomic masses are set to 1 for simplicity. This component must contain one atoms {...} block to deﬁne the atom group, and returns a positive number, expressed in Å${}^{2}$.

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword axis$\u27e8\phantom{\rule{0.3em}{0ex}}$Projection
axis (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: inertiaZ

Acceptable values: (x, y, z) triplet

Default value: (0.0, 0.0, 1.0)

Description: The three components of this vector deﬁne (when normalized) the projection axis $\mathbf{e}$.

The block orientation {...} returns the same optimal rotation used in the rmsd component to superimpose the coordinates $\left\{{\mathbf{x}}_{i}\left(t\right)\right\}$ onto a set of reference coordinates $\left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}$. Such component returns a four dimensional vector $\mathsf{q}=\left({q}_{0},{q}_{1},{q}_{2},{q}_{3}\right)$, with ${\sum}_{i}{q}_{i}^{2}=1$; this quaternion expresses the optimal rotation $\left\{{\mathbf{x}}_{i}\left(t\right)\right\}\to \left\{{\mathbf{x}}_{i}^{\mathrm{(ref)}}\right\}$ according to the formalism in reference [3]. The quaternion $\left({q}_{0},{q}_{1},{q}_{2},{q}_{3}\right)$ can also be written as $\left(cos\left(\mathit{\theta}\u22152\right),\phantom{\rule{0.3em}{0ex}}sin\left(\mathit{\theta}\u22152\right)\mathbf{u}\right)$, where $\mathit{\theta}$ is the angle and $\mathbf{u}$ the normalized axis of rotation; for example, a rotation of 90${}^{\circ}$ around the $z$ axis is expressed as “(0.707, 0.0, 0.0, 0.707)”. The script quaternion2rmatrix.tcl provides Tcl functions for converting to and from a $4\times 4$ rotation matrix in a format suitable for usage in VMD.

As for the component rmsd, the available options are atoms, refPositionsFile, refPositionsCol and refPositionsColValue, and refPositions.

Note: refPositionsand refPositionsFile deﬁne the set of positions from which the optimal rotation is calculated, but this rotation is not applied to the coordinates of the atoms involved: it is used instead to deﬁne the variable itself.

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)
- Keyword closestToQuaternion$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
rotation$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: orientation

Acceptable values: “(q0, q1, q2, q3)” quadruplet

Default value: (1.0, 0.0, 0.0, 0.0) (“null” rotation)

Description: Between the two equivalent quaternions $\left({q}_{0},{q}_{1},{q}_{2},{q}_{3}\right)$ and $\left(-{q}_{0},-{q}_{1},-{q}_{2},-{q}_{3}\right)$, the closer to (1.0, 0.0, 0.0, 0.0) is chosen. This simpliﬁes the visualization of the colvar trajectory when sampled values are a smaller subset of all possible rotations. Note: this only aﬀects the output, never the dynamics.

Tip: stopping the rotation of a protein. To stop the rotation of an elongated macromolecule in solution (and use an anisotropic box to save water molecules), it is possible to deﬁne a colvar with an orientation component, and restrain it through the harmonic bias around the identity rotation, (1.0, 0.0, 0.0, 0.0). Only the overall orientation of the macromolecule is aﬀected, and not its internal degrees of freedom. The user should also take care that the macromolecule is composed by a single chain, or disable wrapAll otherwise.

The block orientationAngle {...} accepts the same base options as the component orientation: atoms, refPositions, refPositionsFile, refPositionsCol and refPositionsColValue. The returned value is the angle of rotation $\mathit{\theta}$ between the current and the reference positions. This angle is expressed in degrees within the range [0${}^{\circ}$:180${}^{\circ}$].

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)

The block orientationProj {...} accepts the same base options as the component orientation: atoms, refPositions, refPositionsFile, refPositionsCol and refPositionsColValue. The returned value is the cosine of the angle of rotation $\mathit{\theta}$ between the current and the reference positions. The range of values is [-1:1].

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)

The complete rotation described by orientation can optionally be decomposed into two sub-rotations: one is a “spin” rotation around e, and the other a “tilt” rotation around an axis orthogonal to e. The component spinAngle measures the angle of the “spin” sub-rotation around e.

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)
- Keyword axis$\u27e8\phantom{\rule{0.3em}{0ex}}$Special
rotation axis (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: tilt

Acceptable values: (x, y, z) triplet

Default value: (0.0, 0.0, 1.0)

Description: The three components of this vector deﬁne (when normalized) the special rotation axis used to calculate the tilt and spinAngle components.

The component spinAngle returns an angle (in degrees) within the periodic interval $\left[-180:180\right]$.

Note: the value of spinAngle is a continuous function almost everywhere, with the exception of conﬁgurations with the corresponding “tilt” angle equal to 180${}^{\circ}$ (i.e. the tilt component is equal to $-1$): in those cases, spinAngle is undeﬁned. If such conﬁgurations are expected, consider deﬁning a tilt colvar using the same axis e, and restraining it with a lower wall away from $-1$.

The component tilt measures the cosine of the angle of the “tilt” sub-rotation, which combined with the “spin” sub-rotation provides the complete rotation of a group of atoms. The cosine of the tilt angle rather than the tilt angle itself is implemented, because the latter is unevenly distributed even for an isotropic system: consider as an analogy the angle $\mathit{\theta}$ in the spherical coordinate system. The component tilt relies on the same options as spinAngle, including the deﬁnition of the axis e. The values of tilt are real numbers in the interval $\left[-1:1\right]$: the value $1$ represents an orientation fully parallel to e (tilt angle = 0${}^{\circ}$), and the value $-1$ represents an anti-parallel orientation.

List of keywords (see also 4.15 for additional options):

- Keyword atoms: see deﬁnition of atoms in sec. 4.5.1 (rmsd component)
- Keyword refPositions: see deﬁnition of refPositions in sec. 4.5.1 (rmsd component)
- Keyword refPositionsFile: see deﬁnition of refPositionsFile in sec. 4.5.1 (rmsd component)
- Keyword refPositionsCol: see deﬁnition of refPositionsCol in sec. 4.5.1 (rmsd component)
- Keyword refPositionsColValue: see deﬁnition of refPositionsColValue in sec. 4.5.1 (rmsd component)
- Keyword axis: see deﬁnition of axis in sec. 4.6.4 (spinAngle component)

The block alpha {...} deﬁnes the parameters to calculate the helical content of a segment of protein residues. The $\alpha $-helical content across the $N+1$ residues ${N}_{0}$ to ${N}_{0}+N$ is calculated by the formula:

$$\begin{array}{rcll}\alpha \left({\mathrm{C}}_{\alpha}^{\left({N}_{0}\right)},{\mathrm{O}}^{\left({N}_{0}\right)},{\mathrm{C}}_{\alpha}^{\left({N}_{0}+1\right)},{\mathrm{O}}^{\left({N}_{0}+1\right)},\dots {\mathrm{N}}^{\left({N}_{0}+5\right)},{\mathrm{C}}_{\alpha}^{\left({N}_{0}+5\right)},{\mathrm{O}}^{\left({N}_{0}+5\right)},\dots {\mathrm{N}}^{\left({N}_{0}+N\right)},{\mathrm{C}}_{\alpha}^{\left({N}_{0}+N\right)}\right)\phantom{\rule{3.04074pt}{0ex}}=\phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}& & & \text{(10)}\text{}\text{}\\ \phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}\phantom{\rule{3.04074pt}{0ex}}\frac{1}{2\left(N-2\right)}\sum _{n={N}_{0}}^{{N}_{0}+N-2}\mathrm{angf}\left({\mathrm{C}}_{\alpha}^{\left(n\right)},{\mathrm{C}}_{\alpha}^{\left(n+1\right)},{\mathrm{C}}_{\alpha}^{\left(n+2\right)}\right)\phantom{\rule{3.04074pt}{0ex}}+\phantom{\rule{3.04074pt}{0ex}}\frac{1}{2\left(N-4\right)}\sum _{n={N}_{0}}^{{N}_{0}+N-4}\mathrm{hbf}\left({\mathrm{O}}^{\left(n\right)},{\mathrm{N}}^{\left(n+4\right)}\right)\mathrm{,}& & & \text{}\\ & & & \text{(11)}\text{}\text{}\end{array}$$

where the score function for the ${\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}$ angle is deﬁned as:

and the score function for the ${\mathrm{O}}^{\left(n\right)}\leftrightarrow {\mathrm{N}}^{\left(n+4\right)}$ hydrogen bond is deﬁned through a hBond colvar component on the same atoms.

List of keywords (see also 4.15 for additional options):

- Keyword residueRange$\u27e8\phantom{\rule{0.3em}{0ex}}$Potential
$\alpha $-helical
residues$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: “$<$Initial residue number$>$-$<$Final residue number$>$”

Description: This option speciﬁes the range of residues on which this component should be deﬁned. The Colvars module looks for the atoms within these residues named “CA”, “N” and “O”, and raises an error if any of those atoms is not found. - Keyword psfSegID$\u27e8\phantom{\rule{0.3em}{0ex}}$PSF
segment identiﬁer$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: string (max 4 characters)

Description: This option sets the PSF segment identiﬁer for the residues speciﬁed in residueRange. This option is only required when PSF topologies are used. - Keyword hBondCoeff$\u27e8\phantom{\rule{0.3em}{0ex}}$Coeﬃcient
for the hydrogen bond term$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive between 0 and 1

Default value: 0.5

Description: This number speciﬁes the contribution to the total value from the hydrogen bond terms. 0 disables the hydrogen bond terms, 1 disables the angle terms. - Keyword angleRef$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
${\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}$
angle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive decimal

Default value: 88${}^{\circ}$

Description: This option sets the reference angle used in the score function (12). - Keyword angleTol$\u27e8\phantom{\rule{0.3em}{0ex}}$Tolerance
in the ${\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}-{\mathrm{C}}_{\alpha}$
angle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive decimal

Default value: 15${}^{\circ}$

Description: This option sets the angle tolerance used in the score function (12). - Keyword hBondCutoff$\u27e8\phantom{\rule{0.3em}{0ex}}$Hydrogen
bond cutoﬀ$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive decimal

Default value: 3.3 Å

Description: Equivalent to the cutoff option in the hBond component. - Keyword hBondExpNumer$\u27e8\phantom{\rule{0.3em}{0ex}}$Hydrogen
bond numerator exponent$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive integer

Default value: 6

Description: Equivalent to the expNumer option in the hBond component. - Keyword hBondExpDenom$\u27e8\phantom{\rule{0.3em}{0ex}}$Hydrogen
bond denominator exponent$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alpha

Acceptable values: positive integer

Default value: 8

Description: Equivalent to the expDenom option in the hBond component.

This component returns positive values, always comprised between 0 (lowest $\alpha $-helical score) and 1 (highest $\alpha $-helical score).

The block dihedralPC {...} deﬁnes the parameters to calculate the projection of backbone dihedral angles within a protein segment onto a dihedral principal component, following the formalism of dihedral principal component analysis (dPCA) proposed by Mu et al.[4] and documented in detail by Altis et al.[5]. Given a peptide or protein segment of $N$ residues, each with Ramachandran angles ${\varphi}_{i}$ and ${\psi}_{i}$, dPCA rests on a variance/covariance analysis of the $4\left(N-1\right)$ variables $cos\left({\psi}_{1}\right),sin\left({\psi}_{1}\right),cos\left({\varphi}_{2}\right),sin\left({\varphi}_{2}\right)\cdots cos\left({\varphi}_{N}\right),sin\left({\varphi}_{N}\right)$. Note that angles ${\varphi}_{1}$ and ${\psi}_{N}$ have little impact on chain conformation, and are therefore discarded, following the implementation of dPCA in the analysis software Carma.[6]

For a given principal component (eigenvector) of coeﬃcients ${\left({k}_{i}\right)}_{1\le i\le 4\left(N-1\right)}$, the projection of the current backbone conformation is:

$$\xi =\sum _{n=1}^{N-1}{k}_{4n-3}cos\left({\psi}_{n}\right)+{k}_{4n-2}sin\left({\psi}_{n}\right)+{k}_{4n-1}cos\left({\varphi}_{n+1}\right)+{k}_{4n}sin\left({\varphi}_{n+1}\right)$$ | (13) |

dihedralPC expects the same parameters as the alpha component for deﬁning the relevant residues (residueRange and psfSegID) in addition to the following:

List of keywords (see also 4.15 for additional options):

- Keyword residueRange: see deﬁnition of residueRange in sec. 4.7.1 (alpha component)
- Keyword psfSegID: see deﬁnition of psfSegID in sec. 4.7.1 (alpha component)
- Keyword vectorFile$\u27e8\phantom{\rule{0.3em}{0ex}}$File
containing dihedral PCA eigenvector(s)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: dihedralPC

Acceptable values: ﬁle name

Description: A text ﬁle containing the coeﬃcients of dihedral PCA eigenvectors on the cosine and sine coordinates. The vectors should be arranged in columns, as in the ﬁles output by Carma.[6] - Keyword vectorNumber$\u27e8\phantom{\rule{0.3em}{0ex}}$File
containing dihedralPCA eigenvector(s)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: dihedralPC

Acceptable values: positive integer

Description: Number of the eigenvector to be used for this component.

The cartesian {...} block deﬁnes a component returning a ﬂat vector containing the Cartesian coordinates of all participating atoms, in the order $\left({x}_{1},{y}_{1},{z}_{1},\cdots \phantom{\rule{0.3em}{0ex}},{x}_{n},{y}_{n},{z}_{n}\right)$.

List of keywords (see also 4.15 for additional options):

- Keyword atoms$\u27e8\phantom{\rule{0.3em}{0ex}}$Group
of atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: cartesian

Acceptable values: Block atoms {...}

Description: Deﬁnes the atoms whose coordinates make up the value of the component. If rotateReference or centerReference are deﬁned, coordinates are evaluated within the moving frame of reference.

The distancePairs {...} block deﬁnes a ${N}_{\mathrm{1}}\times {N}_{\mathrm{2}}$-dimensional variable that includes all mutual distances between the atoms of two groups. This can be useful, for example, to develop a new variable deﬁned over two groups, by using the scriptedFunction feature.

List of keywords (see also 4.15 for additional options):

- Keyword group1: see deﬁnition of group1 in sec. 4.2.1 (distance component)
- Keyword group2: analogous to group1
- Keyword forceNoPBC: see deﬁnition of forceNoPBC in sec. 4.2.1 (distance component)

This component returns a ${N}_{\mathrm{1}}\times {N}_{\mathrm{2}}$-dimensional vector of numbers, each ranging from $0$ to the largest possible distance within the chosen boundary conditions.

The geometric path collective variables deﬁne the progress along a path, $s$, and the distance from the path, $z$. These CVs are proposed by Leines and Ensing[7] , which diﬀer from that[8] proposed by Branduardi et al., and utilize a set of geometric algorithms. The path is deﬁned as a series of frames in the atomic Cartesian coordinate space or the CV space. $s$ and $z$ are computed as

where ${\mathbf{v}}_{1}={\mathbf{s}}_{m}-\mathbf{z}$ is the vector connecting the current position to the closest frame, ${\mathbf{v}}_{2}=\mathbf{z}-{\mathbf{s}}_{m-1}$ is the vector connecting the second closest frame to the current position, ${\mathbf{v}}_{3}={\mathbf{s}}_{m+1}-{\mathbf{s}}_{m}$ is the vector connecting the closest frame to the third closest frame, and ${\mathbf{v}}_{4}={\mathbf{s}}_{m}-{\mathbf{s}}_{m-1}$ is the vector connecting the second closest frame to the closest frame. $m$ and $M$ are the current index of the closest frame and the total number of frames, respectively. If the current position is on the left of the closest reference frame, the $\pm $ in $s$ turns to the positive sign. Otherwise it turns to the negative sign.

The equations above assume: (i) the frames are equidistant and (ii) the second and the third closest frames are neighbouring to the closest frame. When these assumptions are not satisﬁed, this set of path CV should be used carefully.

In the gspath {...} and the gzpath {...} block all vectors, namely $\mathbf{z}$ and ${\mathbf{s}}_{k}$ are deﬁned in atomic Cartesian coordinate space. More speciﬁcally, $\mathbf{z}=\left[{\mathbf{r}}_{1},\cdots \phantom{\rule{0.3em}{0ex}},{\mathbf{r}}_{n}\right]$, where ${\mathbf{r}}_{i}$ is the $i$-th atom speciﬁed in the atoms block. ${\mathbf{s}}_{k}=\left[{\mathbf{r}}_{k,1},\cdots \phantom{\rule{0.3em}{0ex}},{\mathbf{r}}_{k,n}\right]$, where ${\mathbf{r}}_{k,i}$ means the $i$-th atom of the $k$-th reference frame.

List of keywords (see also 4.15 for additional options):

- Keyword atoms$\u27e8\phantom{\rule{0.3em}{0ex}}$Group
of atoms$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gzpath

Acceptable values: Block atoms {...}

Description: Deﬁnes the atoms whose coordinates make up the value of the component. - Keyword refPositionsCol$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
column containing atom ﬂags$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gzpath

Acceptable values: O, B, X, Y, or Z

Description: If refPositionsFileN is a PDB ﬁle that contains all the atoms in the topology, this option may be provided to set which PDB ﬁeld is used to ﬂag the reference coordinates for atoms. - Keyword refPositionsFileN$\u27e8\phantom{\rule{0.3em}{0ex}}$File
containing the reference positions for ﬁtting$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gzpath

Acceptable values: UNIX ﬁlename

Description: The path is deﬁned by multiple refPositionsFiles which are similiar to refPositionsFile in the rmsd CV. If your path consists of $10$ nodes, you can list the coordinate ﬁle (in PDB or XYZ format) from refPositionsFile1 to refPositionsFile10. - Keyword useSecondClosestFrame$\u27e8\phantom{\rule{0.3em}{0ex}}$Deﬁne
${\mathbf{s}}_{m-1}$
as the second closest frame?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gzpath

Acceptable values: boolean

Default value: on

Description: The deﬁnition assumes the second closest frame is neighbouring to the closest frame. This is not always true especially when the path is crooked. If this option is set to on (default), ${\mathbf{s}}_{m-1}$ is deﬁned as the second closest frame. If this option is set to off, ${\mathbf{s}}_{m-1}$ is deﬁned as the left or right neighbouring frame of the closest frame. - Keyword useThirdClosestFrame$\u27e8\phantom{\rule{0.3em}{0ex}}$Deﬁne
${\mathbf{s}}_{m+1}$
as the third closest frame?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gzpath

Acceptable values: boolean

Default value: off

Description: The deﬁnition assumes the third closest frame is neighbouring to the closest frame. This is not always true especially when the path is crooked. If this option is set to on, ${\mathbf{s}}_{m+1}$ is deﬁned as the third closest frame. If this option is set to off (default), ${\mathbf{s}}_{m+1}$ is deﬁned as the left or right neighbouring frame of the closest frame. - Keyword fittingAtoms$\u27e8\phantom{\rule{0.3em}{0ex}}$The
atoms that are used for alignment$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspath and gspath

Acceptable values: Group of atoms

Description: Before calculating ${\mathbf{v}}_{1}$, ${\mathbf{v}}_{2}$, ${\mathbf{v}}_{3}$ and ${\mathbf{v}}_{4}$, the current frame need to be aligned to the corresponding reference frames. This option speciﬁes which atoms are used to do alignment.

List of keywords (see also 4.15 for additional options):

- Keyword useZsquare$\u27e8\phantom{\rule{0.3em}{0ex}}$Compute
${z}^{2}$
instead of $z$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gzpath

Acceptable values: boolean

Default value: off

Description: $z$ is not diﬀerentiable when it is zero. This implementation workarounds it by setting the derivative of $z$ to zero when $z=0$. Another workaround is set this option to on, which computes ${z}^{2}$ instead of $z$, and then ${z}^{2}$ is diﬀerentiable when it is zero.

The usage of gzpath and gspath is illustrated below:

colvar {

# Progress along the path

name gs

# The path is defined by 5 reference frames (from string-00.pdb to string-04.pdb)

# Use atomic coordinate from atoms 1, 2 and 3 to compute the path

gspath {

atoms {atomnumbers { 1 2 3 }}

refPositionsFile1 string-00.pdb

refPositionsFile2 string-01.pdb

refPositionsFile3 string-02.pdb

refPositionsFile4 string-03.pdb

refPositionsFile5 string-04.pdb

}

}

colvar {

# Distance from the path

name gz

# The path is defined by 5 reference frames (from string-00.pdb to string-04.pdb)

# Use atomic coordinate from atoms 1, 2 and 3 to compute the path

gzpath {

atoms {atomnumbers { 1 2 3 }}

refPositionsFile1 string-00.pdb

refPositionsFile2 string-01.pdb

refPositionsFile3 string-02.pdb

refPositionsFile4 string-03.pdb

refPositionsFile5 string-04.pdb

}

}

This is a helper CV which can be deﬁned as a linear combination of other CVs. It maybe useful when you want to deﬁne the gspathCV {...} and the gzpathCV {...} as combinations of other CVs.

In the gspathCV {...} and the gzpathCV {...} block all vectors, namely $\mathbf{z}$ and ${\mathbf{s}}_{k}$ are deﬁned in CV space. More speciﬁcally, $\mathbf{z}=\left[{\xi}_{1},\cdots \phantom{\rule{0.3em}{0ex}},{\xi}_{n}\right]$, where ${\xi}_{i}$ is the $i$-th CV. ${\mathbf{s}}_{k}=\left[{\xi}_{k,1},\cdots \phantom{\rule{0.3em}{0ex}},{\xi}_{k,n}\right]$, where ${\xi}_{k,i}$ means the $i$-th CV of the $k$-th reference frame. It should be note that these two CVs requires the pathFile option, which speciﬁes a path ﬁle. Each line in the path ﬁle contains a set of space-seperated CV value of the reference frame. The sequence of reference frames matches the sequence of the lines.

List of keywords (see also 4.15 for additional options):

- Keyword useSecondClosestFrame$\u27e8\phantom{\rule{0.3em}{0ex}}$Deﬁne
${\mathbf{s}}_{m-1}$
as the second closest frame?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspathCV and gzpathCV

Acceptable values: boolean

Default value: on

Description: The deﬁnition assumes the second closest frame is neighbouring to the closest frame. This is not always true especially when the path is crooked. If this option is set to on (default), ${\mathbf{s}}_{m-1}$ is deﬁned as the second closest frame. If this option is set to off, ${\mathbf{s}}_{m-1}$ is deﬁned as the left or right neighbouring frame of the closest frame. - Keyword useThirdClosestFrame$\u27e8\phantom{\rule{0.3em}{0ex}}$Deﬁne
${\mathbf{s}}_{m+1}$
as the third closest frame?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspathCV and gzpathCV

Acceptable values: boolean

Default value: off

Description: The deﬁnition assumes the third closest frame is neighbouring to the closest frame. This is not always true especially when the path is crooked. If this option is set to on, ${\mathbf{s}}_{m+1}$ is deﬁned as the third closest frame. If this option is set to off (default), ${\mathbf{s}}_{m+1}$ is deﬁned as the left or right neighbouring frame of the closest frame. - Keyword pathFile$\u27e8\phantom{\rule{0.3em}{0ex}}$The
ﬁle name of the path ﬁle.$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gspathCV and gzpathCV

Acceptable values: UNIX ﬁlename

Description: Deﬁnes the nodes or images that constitutes the path in CV space. The CVs of an image are listed in a line of pathFile using space-seperated format. Lines from top to button in pathFile corresponds images from initial to last.

List of keywords (see also 4.15 for additional options):

- Keyword useZsquare$\u27e8\phantom{\rule{0.3em}{0ex}}$Compute
${z}^{2}$
instead of $z$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: gzpathCV

Acceptable values: boolean

Default value: off

Description: $z$ is not diﬀerentiable when it is zero. This implementation workarounds it by setting the derivative of $z$ to zero when $z=0$. Another workaround is set this option to on, which computes ${z}^{2}$ instead of $z$, and then ${z}^{2}$ is diﬀerentiable when it is zero.

The usage of gzpathCV and gspathCV is illustrated below:

colvar {

# Progress along the path

name gs

# Path defined by the CV space of two dihedral angles

gspathCV {

pathFile ./path.txt

dihedral {

name 001

group1 {atomNumbers {5}}

group2 {atomNumbers {7}}

group3 {atomNumbers {9}}

group4 {atomNumbers {15}}

}

dihedral {

name 002

group1 {atomNumbers {7}}

group2 {atomNumbers {9}}

group3 {atomNumbers {15}}

group4 {atomNumbers {17}}

}

}

}

colvar {

# Distance from the path

name gz

gzpathCV {

pathFile ./path.txt

dihedral {

name 001

group1 {atomNumbers {5}}

group2 {atomNumbers {7}}

group3 {atomNumbers {9}}

group4 {atomNumbers {15}}

}

dihedral {

name 002

group1 {atomNumbers {7}}

group2 {atomNumbers {9}}

group3 {atomNumbers {15}}

group4 {atomNumbers {17}}

}

}

}

The arithmetic path collective variable in CV space uses the same formula as the one proposed by Branduardi[8] et al., except that it computes $s$ and $z$ in CV space instead of RMSDs in Cartesian space. Moreover, this implementation allows diﬀerent coeﬃcients for each CV components as described in [9]. Assuming a path is composed of $N$ reference frames and deﬁned in an $M$-dimensional CV space, then the equations of $s$ and $z$ of the path are

$$z=-\frac{1}{\lambda}ln\left(\sum _{i=1}^{N}exp\left(-\lambda \sum _{j=1}^{M}{c}_{j}^{2}\left({x}_{j}-{x}_{i,j}\right)\right)\right)$$ | (17) |

where ${c}_{j}$ is the coeﬃcient(weight) of the $j$-th CV, ${x}_{i,j}$ is the value of $j$-th CV of $i$-th reference frame and ${x}_{j}$ is the value of $j$-th CV of current frame. $\lambda $ is a parameter to smooth the variation of $s$ and $z$.

This colvar component computes the $s$ variable.

List of keywords (see also 4.15 for additional options):

- Keyword weights$\u27e8\phantom{\rule{0.3em}{0ex}}$Coeﬃcients
of the collective variables$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: aspathCV and azpathCV

Acceptable values: space-separated numbers in a {...} block

Default value: {1.0 ...}

Description: Deﬁne the coeﬃcients. The $j$-th value in the {...} block corresponds the ${c}_{j}$ in the equations. - Keyword lambda$\u27e8\phantom{\rule{0.3em}{0ex}}$Smoothness
of the variation of $s$
and $z$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: aspathCV and azpathCV

Acceptable values: decimal

Default value: inverse of the mean square displacements of successive reference frames

Description: The value of $\lambda $ in the equations. - Keyword pathFile$\u27e8\phantom{\rule{0.3em}{0ex}}$The
ﬁle name of the path ﬁle.$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: aspathCV and azpathCV

Acceptable values: UNIX ﬁlename

Description: Deﬁnes the nodes or images that constitutes the path in CV space. The CVs of an image are listed in a line of pathFile using space-seperated format. Lines from top to button in pathFile corresponds images from initial to last.

This colvar component computes the $z$ variable. Options are the same as in 4.10.1.

The usage of azpathCV and aspathCV is illustrated below:

colvar {

# Progress along the path

name as

# Path defined by the CV space of two dihedral angles

aspathCV {

pathFile ./path.txt

weights {1.0 1.0}

lambda 0.005

dihedral {

name 001

group1 {atomNumbers {5}}

group2 {atomNumbers {7}}

group3 {atomNumbers {9}}

group4 {atomNumbers {15}}

}

dihedral {

name 002

group1 {atomNumbers {7}}

group2 {atomNumbers {9}}

group3 {atomNumbers {15}}

group4 {atomNumbers {17}}

}

}

}

colvar {

# Distance from the path

name az

azpathCV {

pathFile ./path.txt

weights {1.0 1.0}

lambda 0.005

dihedral {

name 001

group1 {atomNumbers {5}}

group2 {atomNumbers {7}}

group3 {atomNumbers {9}}

group4 {atomNumbers {15}}

}

dihedral {

name 002

group1 {atomNumbers {7}}

group2 {atomNumbers {9}}

group3 {atomNumbers {15}}

group4 {atomNumbers {17}}

}

}

}

The path collective variables deﬁned by Branduardi et al. [8] are based on RMSDs in Cartesian coordinates. Noting ${d}_{i}$ the RMSD between the current set of Cartesian coordinates and those of image number $i$ of the path:

$$s=\frac{1}{N-1}\frac{\sum _{i=1}^{N}\left(i-1\right)exp\left(-\lambda {d}_{i}^{2}\right)}{\sum _{i=1}^{N}exp\left(-\lambda {d}_{i}^{2}\right)}$$ | (18) |

$$z=-\frac{1}{\lambda}ln\left(\sum _{i=1}^{N}exp\left(-\lambda {d}_{i}^{2}\right)\right)$$ | (19) |

where $\lambda $ is the smoothing parameter.

These coordinates are implemented as Tcl-scripted combinations of rmsd components. The implementation is available as ﬁle colvartools/pathCV.tcl, and an example is provided in ﬁle examples/10_pathCV.namd of the Colvars public repository. It implements an optimization procedure, whereby the distance to a given image is only calculated if its contribution to the sum is larger than a user-deﬁned tolerance parameter. All distances are calculated every freq timesteps to update the list of nearby images.

Volumetric maps of the Cartesian coordinates, typically deﬁned as mesh grid along the three Cartesian axes, may be used to deﬁne collective variables. This feature is currently available in NAMD, implemented as an interface between Colvars and GridForces. Please cite [10] when using this implementation of collective variables based on volumetric maps.

Given a function of the Cartesian coordinates $\varphi \left(\mathbf{x}\right)=\varphi \left(x,y,z\right)$, a mapTotal collective variable component $\Phi \left(\mathbf{X}\right)$ is deﬁned as the sum of the values of the function $\varphi \left(\mathbf{x}\right)$ evaluated at the coordinates of each atom, ${\mathbf{x}}_{i}$:

$$\Phi \left(\mathbf{X}\right)=\sum _{i=1}^{N}\varphi \left({\mathbf{x}}_{i}\right)$$ | (20) |

This formulation allows, for example, to “count” the number of atoms within a region of space by using a positive-valued
function $\varphi \left(\mathbf{x}\right)$,
such as for example the number of water molecules in a hydrophobic cavity [10].

Because the volumetric map itself and the atoms aﬀected by it are deﬁned externally to Colvars, this component has a very limited number of keywords. List of keywords (see also 4.15 for additional options):

- Keyword mapName$\u27e8\phantom{\rule{0.3em}{0ex}}$Specify
the name of the volumetric map to use as a colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: mapTotal

Acceptable values: string

Description: The value of this option speciﬁes the label of the volumetric map to use for this collective variable component. This label must identify a map already loaded in NAMD via mGridForcePotFile, and its value of mGridForceScale needs to be set to (0, 0, 0), so that its collective force can be computed dynamically.

Example: biasing the number of molecules inside a cavity using a volumetric map.

Firstly, a volumetric map that has a value of 1 inside the cavity and 0 outside should be prepared. A reasonable
starting point may be obtained, for example, with VMD: using an existing trajectory where the cavity is occupied by
solvent and a spatial selection that identiﬁes all the molecules within the cavity, volmap occupancy -allframes
-combine max computes the occupancy map as a step function (values 1 or 0), and volutil -smooth … makes it a
continuous map, suitable for use as a MD simulation bias. A PDB ﬁle deﬁning the selection (for example, where all
water oxygens and ions have an occupancy of 1 and other atoms 0) is also prepared using VMD. Both the
map ﬁle and the atom selection ﬁle are then loaded via the mGridForcePotFile and related NAMD
commands:

mGridForce yes

mGridForcePotFile Cavity cavity.dx # OpenDX map file

mGridForceFile Cavity water-sel.pdb # PDB file used for atom selection

mGridForceCol Cavity O # Use the occupancy column of the PDB file

mGridForceChargeCol Cavity O # Use occ. again (default: electrostatic charge)

mGridForceScale Cavity 0.0 0.0 0.0 # Do not use GridForces for this map

The value of mGridForceScale is particularly important, because it determines the GridForces force constant
for the “Cavity” map. A non-zero value enables a conventional GridForces calculation, where the force constant
remains ﬁxed within each run command and the forces on the atoms depend only on their positions in space.
However, setting mGridForceScale to zero signals to NAMD that the force acting through the volumetric map may
be computed dynamically, as part of a collective-variable biasing scheme. To do so, the map labeled “Cavity” needs
to be referred to in the Colvars conﬁguration:

cv config "

colvar {

name n_waters

mapTotal {

mapName Cavity # Same label as the GridForce map

}

}"

The variable “n_waters” may then be used with any of the enhanced sampling methods available (6): new forces applied to it at each simulation step will be transmitted to the corresponding atoms within the same step.

To study processes that involve changes in shape of a macromolecular aggregate (for example, deformations of lipid membranes) it is useful to deﬁne collective variables based on more than one volumetric map at a time, measuring the relative similarity with each map while still achieving correct thermodynamic sampling of each state.

This is achieved by combining multiple mapTotal components, each based on a diﬀerently-shaped volumetric map, into a single collective variable $\xi $. To track transitions between states, the contribution of each map to $\xi $ should be discriminated from the others, for example by assigning to it a diﬀerent weight. The “Multi-Map” progress variable [10] uses a weight sum of these components, using linearly-increasing weights:

$$\xi \left(\mathbf{X}\right)=\sum _{k=1}^{K}{\Phi}_{k}\left(\mathbf{X}\right)=\sum _{k=1}^{K}k\sum _{i=1}^{N}{\varphi}_{k}\left({\mathbf{x}}_{i}\right)$$ | (21) |

where $K$ is the number of
maps employed and each ${\Phi}_{k}$
is a mapTotal component.

Example: transitions between macromolecular shapes using volumetric maps.

A series of map ﬁles, each representing a diﬀerent shape, is loaded into NAMD:

mGridForce yes

for { set k 1 } { $k <= $K } { incr k } {

mGridForcePotFile Shape_$k map_$k.dx # Density map of the k-th state

…

}

and these are then used to deﬁne a multiple-map collective variable:

# Collect the definition of all components into one string

set components ""

for { set k 1 } { $k <= $K } { incr k } {

set components "${components}

mapTotal {

mapName Shape_$k

componentCoeff $k

}

"

}

# Use this string to define the variable

cv config "

colvar {

name shapes

${components}

}"

The above example illustrates a use case where a weighted sum (i.e. a linear combination) is used to deﬁne a single variable from multiple components. Depending on the problem under study, non-linear functions may be more appropriate. These may be deﬁned a custom functions if implemented (see 4.16), or scripted functions (see 4.17).

The following options can be used for any of the above colvar components in order to obtain a polynomial combination or any user-supplied function provided by scriptedFunction.

- Keyword name$\u27e8\phantom{\rule{0.3em}{0ex}}$Name
of this component$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: any component

Acceptable values: string

Default value: type of component + numeric id

Description: The name is an unique case-sensitive string which allows the Colvars module to identify this component. This is useful, for example, when combining multiple components via a scriptedFunction. It also deﬁnes the variable name representing the component’s value in a customFunction expression. - Keyword scalable$\u27e8\phantom{\rule{0.3em}{0ex}}$Attempt
to calculate this component in parallel?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: any component

Acceptable values: boolean

Default value: on, if available

Description: If set to on (default), the Colvars module will attempt to calculate this component in parallel to reduce overhead. Whether this option is available depends on the type of component: currently supported are distance, distanceZ, distanceXY, distanceVec, distanceDir, angle and dihedral. This ﬂag inﬂuences computational cost, but does not aﬀect numerical results: therefore, it should only be turned oﬀ for debugging or testing purposes.

The following components returns real numbers that lie in a periodic interval:

- dihedral: torsional angle between four groups;
- spinAngle: angle of rotation around a predeﬁned axis in the best-ﬁt from a set of reference coordinates.

In certain conditions, distanceZ can also be periodic, namely when periodic boundary conditions (PBCs) are deﬁned in the simulation and distanceZ’s axis is parallel to a unit cell vector.

In addition, a custom or scripted scalar colvar may be periodic depending on its user-deﬁned expression. It will only be treated as such by the Colvars module if the period is speciﬁed using the period keyword, while wrapAround is optional.

The following keywords can be used within periodic components, or within custom variables (4.16), or wthin scripted variables 4.17).

- Keyword period$\u27e8\phantom{\rule{0.3em}{0ex}}$Period
of the component$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ, custom colvars

Acceptable values: positive decimal

Default value: 0.0

Description: Setting this number enables the treatment of distanceZ as a periodic component: by default, distanceZ is not considered periodic. The keyword is supported, but irrelevant within dihedral or spinAngle, because their period is always 360 degrees. - Keyword wrapAround$\u27e8\phantom{\rule{0.3em}{0ex}}$Center
of the wrapping interval for periodic variables$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: distanceZ, dihedral, spinAngle, custom colvars

Acceptable values: decimal

Default value: 0.0

Description: By default, values of the periodic components are centered around zero, ranging from $-P\u22152$ to $P\u22152$, where $P$ is the period. Setting this number centers the interval around this value. This can be useful for convenience of output, or to set the walls for a harmonicWalls in an order that would not otherwise be allowed.

Internally, all diﬀerences between two values of a periodic colvar follow the minimum image convention: they are calculated based on the two periodic images that are closest to each other.

Note: linear or polynomial combinations of periodic components (see 4.15) may become meaningless when components cross the periodic boundary. Use such combinations carefully: estimate the range of possible values of each component in a given simulation, and make use of wrapAround to limit this problem whenever possible.

When one of the following components are used, the deﬁned colvar returns a value that is not a scalar number:

- distanceVec: 3-dimensional vector of the distance between two groups;
- distanceDir: 3-dimensional unit vector of the distance between two groups;
- orientation: 4-dimensional unit quaternion representing the best-ﬁt rotation from a set of reference coordinates.

The distance between two 3-dimensional unit vectors is computed as the angle between them. The distance between two quaternions is computed as the angle between the two 4-dimensional unit vectors: because the orientation represented by $\mathsf{q}$ is the same as the one represented by $-\mathsf{q}$, distances between two quaternions are computed considering the closest of the two symmetric images.

Non-scalar components carry the following restrictions:

- Calculation of total forces (outputTotalForce option) is currently not implemented.
- Each colvar can only contain one non-scalar component.
- Binning on a grid (abf, histogram and metadynamics with useGrids enabled) is currently not implemented for colvars based on such components.

Note: while these restrictions apply to individual colvars based on non-scalar components, no limit is set to the number of scalar colvars. To compute multi-dimensional histograms and PMFs, use sets of scalar colvars of arbitrary size.

In addition to the restrictions due to the type of value computed (scalar or non-scalar), a ﬁnal restriction can arise when calculating total force (outputTotalForce option or application of a abf bias). total forces are available currently only for the following components: distance, distanceZ, distanceXY, angle, dihedral, rmsd, eigenvector and gyration.

To extend the set of possible deﬁnitions of colvars $\xi \left(\mathbf{r}\right)$, multiple components ${q}_{i}\left(\mathbf{r}\right)$ can be summed with the formula:

$$\xi \left(\mathbf{r}\right)=\sum _{i}{c}_{i}{\left[{q}_{i}\left(\mathbf{r}\right)\right]}^{{n}_{i}}$$ | (22) |

where each component appears with a unique coeﬃcient ${c}_{i}$ (1.0 by default) the positive integer exponent ${n}_{i}$ (1 by default).

Any set of components can be combined within a colvar, provided that they return the same type of values (scalar, unit vector, vector, or quaternion). By default, the colvar is the sum of its components. Linear or polynomial combinations (following equation (22)) can be obtained by setting the following parameters, which are common to all components:

- Keyword componentCoeff$\u27e8\phantom{\rule{0.3em}{0ex}}$Coeﬃcient
of this component in the colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: any component

Acceptable values: decimal

Default value: 1.0

Description: Deﬁnes the coeﬃcient by which this component is multiplied (after being raised to componentExp) before being added to the sum. - Keyword componentExp$\u27e8\phantom{\rule{0.3em}{0ex}}$Exponent
of this component in the colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: any component

Acceptable values: integer

Default value: 1

Description: Deﬁnes the power at which the value of this component is raised before being added to the sum. When this exponent is diﬀerent than 1 (non-linear sum), total forces and the Jacobian force are not available, making the colvar unsuitable for ABF calculations.

Example: To deﬁne the average of a colvar across diﬀerent parts of the system, simply deﬁne within the same colvar block a series of components of the same type (applied to diﬀerent atom groups), and assign to each component a componentCoeff of $1\u2215N$.

Collective variables may be deﬁned by specifying a custom function as an analytical expression. The expression is parsed by Lepton, the lightweight expression parser written by Peter Eastman (https://simtk.org/projects/lepton). Lepton produces eﬃcient evaluation routines for the function and its derivatives.

- Keyword customFunction$\u27e8\phantom{\rule{0.3em}{0ex}}$Compute
colvar as a custom function of its components$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Description: Mathematical expression to deﬁne the colvar as a closed-form function of its colvar components. See below for the detailed syntax of Lepton expressions. Multiple mentions of this keyword can be used to deﬁne a vector variable (as in the example below). - Keyword customFunctionType$\u27e8\phantom{\rule{0.3em}{0ex}}$Type
of value returned by the scripted colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Default value: scalar

Description: With this ﬂag, the user may specify whether the colvar is a scalar or one of the following vector types: vector3 (a 3D vector), unit_vector3 (a normalized 3D vector), or unit_quaternion (a normalized quaternion), or vector. Note that the scalar and vector cases are not necessary, as they are detected automatically.

The expression may use the collective variable components as variables, referred to by their user-deﬁned name. Scalar elements of vector components may be accessed by appending a 1-based index to their name, as in the example below. When implementing generic functions of Cartesian coordinates rather than functions of existing components, the cartesian component may be particularly useful. A scalar-valued custom variable may be manually deﬁned as periodic by providing the keyword period, and the optional keyword wrapAround, with the same meaning as in periodic components (see 4.13 for details). A vector variable may be deﬁned by specifying the customFunction parameter several times: each expression deﬁnes one scalar element of the vector colvar, as in this example:

colvar {

name custom

# A 2-dimensional vector function of a scalar x and a 3-vector r

customFunction cos(x) * (r1 + r2 + r3)

customFunction sqrt(r1 * r2)

distance {

name x

group1 { atomNumbers 1 }

group2 { atomNumbers 50 }

}

distanceVec {

name r

group1 { atomNumbers 10 11 12 }

group2 { atomNumbers 20 21 22 }

}

}

Numeric constants may be given in either decimal or exponential form (e.g. 3.12e-2). An expression may be
followed by deﬁnitions for intermediate values that appear in the expression, separated by semicolons. For example,
the expression:

a^2 + a*b + b^2; a = a1 + a2; b = b1 + b2

is exactly equivalent to:

(a1 + a2)^2 + (a1 + a2) * (b1 + b2) + (b1 + b2)^2.

The deﬁnition of an intermediate value may itself involve other intermediate values. All uses of a value must appear
before that value’s deﬁnition.

Lepton supports the usual arithmetic operators +, -, *, /, and ̂ (power), as well as the following functions:

sqrt | Square root |

exp | Exponential |

log | Natural logarithm |

erf | Error function |

erfc | Complementary error function |

sin | Sine (angle in radians) |

cos | Cosine (angle in radians) |

sec | Secant (angle in radians) |

csc | Cosecant (angle in radians) |

tan | Tangent (angle in radians) |

cot | Cotangent (angle in radians) |

asin | Inverse sine (in radians) |

acos | Inverse cosine (in radians) |

atan | Inverse tangent (in radians) |

atan2 | Two-argument inverse tangent (in radians) |

sinh | Hyperbolic sine |

cosh | Hyperbolic cosine |

tanh | Hyperbolic tangent |

abs | Absolute value |

ﬂoor | Floor |

ceil | Ceiling |

min | Minimum of two values |

max | Maximum of two values |

delta | $\mathrm{delta}\left(x\right)=1$ if $x=0$, 0 otherwise |

step | $\mathrm{step}\left(x\right)=0$ if $x<0$, 1 if $x>=0$ |

select | $\mathrm{select}\left(x,y,z\right)=z$ if $x=0$, $y$ otherwise |

When scripting is supported (default in NAMD), a colvar may be deﬁned as a scripted function of its components, rather than a linear or polynomial combination. When implementing generic functions of Cartesian coordinates rather than functions of existing components, the cartesian component may be particularly useful. A scalar-valued scripted variable may be manually deﬁned as periodic by providing the keyword period, and the optional keyword wrapAround, with the same meaning as in periodic components (see 4.13 for details).

An example of elaborate scripted colvar is given in example 10, in the form of path-based collective variables as deﬁned by Branduardi et al[8] (Section 4.10.3).

- Keyword scriptedFunction$\u27e8\phantom{\rule{0.3em}{0ex}}$Compute
colvar as a scripted function of its components$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Description: If this option is speciﬁed, the colvar will be computed as a scripted function of the values of its components. To that eﬀect, the user should deﬁne two Tcl procedures: calc_$<$scriptedFunction$>$ and calc_$<$scriptedFunction$>$_gradient, both accepting as many parameters as the colvar has components. Values of the components will be passed to those procedures in the order deﬁned by their sorted name strings. Note that if all components are of the same type, their default names are sorted in the order in which they are deﬁned, so that names need only be speciﬁed for combinations of components of diﬀerent types. calc_$<$scriptedFunction$>$ should return one value of type $<$scriptedFunctionType$>$, corresponding to the colvar value. calc_$<$scriptedFunction$>$_gradient should return a Tcl list containing the derivatives of the function with respect to each component. If both the function and some of the components are vectors, the gradient is really a Jacobian matrix that should be passed as a linear vector in row-major order, i.e. for a function ${f}_{i}\left({x}_{j}\right)$: ${\nabla}_{x}{f}_{1}{\nabla}_{x}{f}_{2}\cdots \phantom{\rule{0.3em}{0ex}}$. - Keyword scriptedFunctionType$\u27e8\phantom{\rule{0.3em}{0ex}}$Type
of value returned by the scripted colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Default value: scalar

Description: If a colvar is deﬁned as a scripted function, its type is not constrained by the types of its components. With this ﬂag, the user may specify whether the colvar is a scalar or one of the following vector types: vector3 (a 3D vector), unit_vector3 (a normalized 3D vector), or unit_quaternion (a normalized quaternion), or vector (a vector whose size is speciﬁed by scriptedFunctionVectorSize). Non-scalar values should be passed as space-separated lists. - Keyword scriptedFunctionVectorSize$\u27e8\phantom{\rule{0.3em}{0ex}}$Dimension
of the vector value of a scripted colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Description: This parameter is only valid when scriptedFunctionType is set to vector. It deﬁnes the vector length of the colvar value returned by the function.

Many algorithms require the deﬁnition of boundaries and/or characteristic spacings that can be used to deﬁne discrete “states” in the collective variable, or to combine variables with very diﬀerent units. The parameters described below oﬀer a way to specify these parameters only once for each variable, while using them multiple times in restraints, time-dependent biases or analysis methods.

- Keyword width$\u27e8\phantom{\rule{0.3em}{0ex}}$Unit
of the variable, or grid spacing$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive decimal

Default value: 1.0

Description: This number deﬁnes the eﬀective unit of measurement for the collective variable, and is used by the biasing methods for the following purposes. Harmonic (6.5), harmonic walls (6.7) and linear restraints (6.8) use it to set the physical unit of the force constant, which is useful for multidimensional restraints involving multiple variables with very diﬀerent units (for examples, $\AA $ or degrees ${}^{\circ}$) with a single, scaled force constant. The values of the scaled force constant in the units of each variable are printed at initialization time. Histograms (6.10), ABF (6.2) and metadynamics (6.4) all use this number as the initial choice for the grid spacing along this variable: for this reason, width should generally be no larger than the standard deviation of the colvar in an unbiased simulation. Unless it is required to control the spacing, it is usually simplest to keep the default value of 1, so that restraint force constants are provided with their full physical unit. - Keyword lowerBoundary$\u27e8\phantom{\rule{0.3em}{0ex}}$Lower
boundary of the colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: decimal

Default value: natural boundary of the function

Description: Deﬁnes the lowest end of the interval of “relevant” values for the variable. This number can be, for example, a true physical boundary imposed by the choice of function (e.g. the distance function is always larger than zero): if this is the case, and only one function is used to deﬁne the variable, the default value of this number is set to the lowest end of the range of values of that function, if available (see Section 4.1). Alternatively, this value may be provided by the user, to represent for example the left-most point of a PMF calculation along this variable. In the latter case, it is the user’s responsibility to either (a) ensure the variable does not go signiﬁcantly beyond the boundary (for example by adding a harmonicWalls restraint, 6.7), or (b) instruct the code that this is a true physical boundary by setting hardLowerBoundary. - Keyword upperBoundary$\u27e8\phantom{\rule{0.3em}{0ex}}$Upper
boundary of the colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: decimal

Default value: natural boundary of the function

Description: Similarly to lowerBoundary, deﬁnes the highest of the “relevant” values of the variable. - Keyword hardLowerBoundary$\u27e8\phantom{\rule{0.3em}{0ex}}$Whether
the lower boundary is the physical lower limit$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: provided by the component

Description: When the colvar has a “natural” boundary (for example, a distance colvar cannot go below 0) this ﬂag is automatically enabled. For more complex variable deﬁnitions, or when lowerBoundary is provided directly by the user, it may be useful to set this ﬂag explicitly. This option does not aﬀect simulation results, but enables some internal optimizations by letting the code know that the variable is unable to cross the lower boundary, regardless of whether restraints are applied to it. - Keyword hardUpperBoundary$\u27e8\phantom{\rule{0.3em}{0ex}}$Whether
the upper boundary is the physical upper limit of the colvar’s values$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: provided by the component

Description: Analogous to hardLowerBoundary. - Keyword expandBoundaries$\u27e8\phantom{\rule{0.3em}{0ex}}$Allow
to expand the two boundaries if needed$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: If deﬁned, lowerBoundary and upperBoundary may be automatically expanded to accommodate colvar values that do not ﬁt in the initial range. Currently, this option is used by the metadynamics bias (6.4) to keep all of its hills fully within the grid. This option cannot be used when the initial boundaries already span the full period of a periodic colvar.

Many simulation methods and analysis tools write ﬁles that contain functions of the collective variables tabulated on a grid (e.g. potentials of mean force or multidimentional histograms) for the purpose of analyzing results. Such ﬁles are produced by ABF (6.2), metadynamics (6.4), multidimensional histograms (6.10), as well as any restraint with optional thermodynamic integration support (6.1).

In some cases, these ﬁles may also be read as input of a new simulation. Suitable input ﬁles for this purpose are
typically generated as output ﬁles of previous simulations, or directly by the user in the speciﬁc case of ensemble-biased
metadynamics (6.4.5). This section explains the “multicolumn” format used by these ﬁles. For a multidimensional
function $f({\xi}_{1}$,
${\xi}_{2}$,
…$)$ the
multicolumn grid format is deﬁned as follows:

# | ${N}_{\mathrm{cv}}$ | |||||

# | $\mathtt{min}\left({\xi}_{1}\right)$ | $\mathtt{width}\left({\xi}_{1}\right)$ | $\mathtt{npoints}\left({\xi}_{1}\right)$ | $\mathtt{periodic}\left({\xi}_{1}\right)$ | ||

# | $\mathtt{min}\left({\xi}_{2}\right)$ | $\mathtt{width}\left({\xi}_{2}\right)$ | $\mathtt{npoints}\left({\xi}_{2}\right)$ | $\mathtt{periodic}\left({\xi}_{2}\right)$ | ||

# | … | … | … | … | ||

# | $\mathtt{min}\left({\xi}_{{N}_{\mathrm{cv}}}\right)$ | $\mathtt{width}\left({\xi}_{{N}_{\mathrm{cv}}}\right)$ | $\mathtt{npoints}\left({\xi}_{{N}_{\mathrm{cv}}}\right)$ | $\mathtt{periodic}\left({\xi}_{{N}_{\mathrm{cv}}}\right)$ | ||

${\xi}_{1}^{1}$ | ${\xi}_{2}^{1}$ | … | ${\xi}_{{N}_{\mathrm{cv}}}^{1}$ | f(${\xi}_{1}^{1}$, ${\xi}_{2}^{1}$, …, ${\xi}_{{N}_{\mathrm{cv}}}^{1}$) | ||

${\xi}_{1}^{1}$ | ${\xi}_{2}^{1}$ | … | ${\xi}_{{N}_{\mathrm{cv}}}^{2}$ | f(${\xi}_{1}^{1}$, ${\xi}_{2}^{1}$, …, ${\xi}_{{N}_{\mathrm{cv}}}^{2}$) | ||

… | … | … | … | … | ||

Lines beginning with the character “#” are the header of the ﬁle. ${N}_{\mathrm{cv}}$ is the number of collective variables sampled by the grid. For each variable ${\xi}_{i}$, $\mathtt{min}\left({\xi}_{i}\right)$ is the lowest value sampled by the grid (i.e. the left-most boundary of the grid along ${\xi}_{i}$), $\mathtt{width}\left({\xi}_{i}\right)$ is the width of each grid step along ${\xi}_{i}$, $\mathtt{npoints}\left({\xi}_{i}\right)$ is the number of points and $\mathtt{periodic}\left({\xi}_{i}\right)$ is a ﬂag whose value is 1 or 0 depending on whether the grid is periodic along ${\xi}_{i}$. In most situations:

- $\mathtt{min}\left({\xi}_{i}\right)$ is given by the lowerBoundary keyword of the variable ${\xi}_{i}$;
- $\mathtt{width}\left({\xi}_{i}\right)$ is given by the width keyword;
- $\mathtt{npoints}\left({\xi}_{i}\right)$ is calculated from the two above numbers and the upperBoundary keyword;
- $\mathtt{periodic}\left({\xi}_{i}\right)$ is set to 1 if and only if ${\xi}_{i}$ is periodic and the grids’ boundaries cover its period.

Exception: there is a slightly diﬀerent header in PMF ﬁles computed by ABF (6.2) or by other biases with an optional thermodynamic integration (TI) estimator (6.1). In this case, free-energy gradients are accumulated on an (npoints)-long grid along each variable $\xi $: after these gradients are integrated, the resulting PMF is discretized on a grid with (npoints+1) points along $\xi $. Therefore, the edges of the PMF’s grid extend $\mathtt{width}\u22152$ above and below the original boundaries (unless these are periodic). The format of the ﬁle’s header is otherwise unchanged.

After the header, the rest of the ﬁle contains values of the tabulated function
$f({\xi}_{1}$,
${\xi}_{2}$,
…${\xi}_{{N}_{\mathrm{cv}}})$, one for each line.
The ﬁrst ${N}_{\mathrm{cv}}$ columns
contain values of ${\xi}_{1}$,
${\xi}_{2}$,
…${\xi}_{{N}_{\mathrm{cv}}}$ and the last column contains
the value of the function $f$.
Points are sorted in ascending order with the fastest-changing values at the right (“C-style” order). Each sweep of the right-most
variable ${\xi}_{{N}_{\mathrm{cv}}}$
is terminated by an empty line. For two dimensional grid ﬁles, this allows quick visualization by programs such as
GNUplot.

Example 1: multicolumn text ﬁle for a one-dimensional histogram with lowerBoundary = 15, upperBoundary = 48 and width = 0.1.

# | 1 | ||||

# | 15 | 0.1 | 330 | 0 | |

15.05 | 6.14012e-07 | ||||

15.15 | 7.47644e-07 | ||||

… | … | ||||

47.85 | 1.65944e-06 | ||||

47.95 | 1.46712e-06 | ||||

Example 2: multicolumn text ﬁle for a two-dimensional histogram of two dihedral angles (periodic interval with 6${}^{\circ}$ bins):

# | 2 | ||||

# | -180.0 | 6.0 | 30 | 1 | |

# | -180.0 | 6.0 | 30 | 1 | |

-177.0 | -177.0 | 8.97117e-06 | |||

-177.0 | -171.0 | 1.53525e-06 | |||

… | … | … | |||

-177.0 | 177.0 | 2.442956-06 | |||

-171.0 | -177.0 | 2.04702e-05 | |||

… | … | … | |||

- Keyword outputValue$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
a trajectory for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: on

Description: If colvarsTrajFrequency is non-zero, the value of this colvar is written to the trajectory ﬁle every colvarsTrajFrequency steps in the column labeled “$<$name$>$”. - Keyword outputVelocity$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
a velocity trajectory for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: If colvarsTrajFrequency is deﬁned, the ﬁnite-diﬀerence calculated velocity of this colvar are written to the trajectory ﬁle under the label “v_$<$name$>$”. - Keyword outputEnergy$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
an energy trajectory for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: This option applies only to extended Lagrangian colvars. If colvarsTrajFrequency is deﬁned, the kinetic energy of the extended degree and freedom and the potential energy of the restraining spring are are written to the trajectory ﬁle under the labels “Ek_$<$name$>$” and “Ep_$<$name$>$”. - Keyword outputTotalForce$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
a total force trajectory for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: If colvarsTrajFrequency is deﬁned, the total force on this colvar (i.e. the projection of all atomic total forces onto this colvar — see equation (27) in section 6.2) are written to the trajectory ﬁle under the label “fs_$<$name$>$”. For extended Lagrangian colvars, the “total force” felt by the extended degree of freedom is simply the force from the harmonic spring. Due to design constraints, the total force reported by NAMD to Colvars was computed at the previous simulation step. Note: not all components support this option. The physical unit for this force is kcal/mol, divided by the colvar unit U. - Keyword outputAppliedForce$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
an applied force trajectory for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: If colvarsTrajFrequency is deﬁned, the total force applied on this colvar by Colvars biases are written to the trajectory under the label “fa_$<$name$>$”. For extended Lagrangian colvars, this force is actually applied to the extended degree of freedom rather than the geometric colvar itself. The physical unit for this force is kcal/mol divided by the colvar unit.

The following options enable extended-system dynamics, where a colvar is coupled to an additional degree of freedom (ﬁctitious particle) by a harmonic spring. This extended coordinate masks the colvar and replaces it transparently from the perspective of biasing and analysis methods. Biasing forces are then applied to the extended degree of freedom, and the actual geometric colvar (function of Cartesian coordinates) only feels the force from the harmonic spring. This is particularly useful when combined with an abf bias to perform eABF simulations (6.3).

Note that for some biases (harmonicWalls, histogram), this masking behavior is controlled by the keyword bypassExtendedLagrangian. Speciﬁcally for harmonicWalls, the default behavior is to bypass extended Lagrangian coordinates and act directly on the actual colvars.

- Keyword extendedLagrangian$\u27e8\phantom{\rule{0.3em}{0ex}}$Add
extended degree of freedom$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: Adds a ﬁctitious particle to be coupled to the colvar by a harmonic spring. The ﬁctitious mass and the force constant of the coupling potential are derived from the parameters extendedTimeConstant and extendedFluctuation, described below. Biasing forces on the colvar are applied to this ﬁctitious particle, rather than to the atoms directly. This implements the extended Lagrangian formalism used in some metadynamics simulations [2]. The energy associated with the extended degree of freedom is reported along with bias energies under the MISC title in NAMD’s energy output. - Keyword extendedFluctuation$\u27e8\phantom{\rule{0.3em}{0ex}}$Standard
deviation between the colvar and the ﬁctitious particle (colvar unit)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive decimal

Description: Deﬁnes the spring stiﬀness for the extendedLagrangian mode, by setting the typical deviation between the colvar and the extended degree of freedom due to thermal ﬂuctuation. The spring force constant is calculated internally as ${k}_{B}T\u2215{\sigma}^{2}$, where $\sigma $ is the value of extendedFluctuation. - Keyword extendedTimeConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Oscillation
period of the ﬁctitious particle (fs)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive decimal

Default value: 200

Description: Deﬁnes the inertial mass of the ﬁctitious particle, by setting the oscillation period of the harmonic oscillator formed by the ﬁctitious particle and the spring. The period should be much larger than the MD time step to ensure accurate integration of the extended particle’s equation of motion. The ﬁctitious mass is calculated internally as ${k}_{B}T{\left(\tau \u22152\pi \sigma \right)}^{2}$, where $\tau $ is the period and $\sigma $ is the typical ﬂuctuation (see above). - Keyword extendedTemp$\u27e8\phantom{\rule{0.3em}{0ex}}$Temperature
for the extended degree of freedom (K)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive decimal

Default value: thermostat temperature

Description: Temperature used for calculating the coupling force constant of the extended variable (see extendedFluctuation) and, if needed, as a target temperature for extended Langevin dynamics (see extendedLangevinDamping). This should normally be left at its default value. - Keyword extendedLangevinDamping$\u27e8\phantom{\rule{0.3em}{0ex}}$Damping
factor for extended Langevin dynamics (ps${}^{-1}$)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive decimal

Default value: 1.0

Description: If this is non-zero, the extended degree of freedom undergoes Langevin dynamics at temperature extendedTemp. The friction force is minus extendedLangevinDamping times the velocity. This is useful because the extended dynamics coordinate may heat up in the transient non-equilibrium regime of ABF. Use moderate damping values, to limit viscous friction (potentially slowing down diﬀusive sampling) and stochastic noise (increasing the variance of statistical measurements). In doubt, use the default value.

- Keyword timeStepFactor$\u27e8\phantom{\rule{0.3em}{0ex}}$Compute
this colvar once in a certain number of timesteps$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 1

Description: Instructs this colvar to activate at a time interval equal to the base (MD) timestep times timeStepFactor.[11] At other time steps, the value of the variable is not updated, and no biasing forces are applied. Any forces exerted by biases are accumulated over the given time interval, then applied as an impulse at the next update.

- Keyword subtractAppliedForce$\u27e8\phantom{\rule{0.3em}{0ex}}$Do
not include biasing forces in the total force for this colvar$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: If the colvar supports total force calculation (see 4.14.1), all forces applied to this colvar by biases will be removed from the total force. This keyword allows to recover some of the “system force” calculation available in the Colvars module before version 2016-08-10. Please note that removal of all other external forces (including biasing forces applied to a diﬀerent colvar) is no longer supported, due to changes in the underlying simulation engines (primarily NAMD). This option may be useful when continuing a previous simulation where the removal of external/applied forces is essential. For all new simulations, the use of this option is not recommended.

Run-time calculations of statistical properties that depend explicitly on time can be performed for individual collective variables. Currently, several types of time correlation functions, running averages and running standard deviations are implemented. For run-time computation of histograms, please see the histogram bias (6.10).

- Keyword corrFunc$\u27e8\phantom{\rule{0.3em}{0ex}}$Calculate
a time correlation function?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: Whether or not a time correlaction function should be calculated for this colvar. - Keyword corrFuncWithColvar$\u27e8\phantom{\rule{0.3em}{0ex}}$Colvar
name for the correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: string

Description: By default, the auto-correlation function (ACF) of this colvar, ${\xi}_{i}$, is calculated. When this option is speciﬁed, the correlation function is calculated instead with another colvar, ${\xi}_{j}$, which must be of the same type (scalar, vector, or quaternion) as ${\xi}_{i}$. - Keyword corrFuncType$\u27e8\phantom{\rule{0.3em}{0ex}}$Type
of the correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: velocity, coordinate or coordinate_p2

Default value: velocity

Description: With coordinate or velocity, the correlation function ${C}_{i,j}\left(t\right)$ = $\u27e8\Pi \left({\xi}_{i}\left({t}_{0}\right),{\xi}_{j}\left({t}_{0}+t\right)\right)\u27e9$ is calculated between the variables ${\xi}_{i}$ and ${\xi}_{j}$, or their velocities. $\Pi \left({\xi}_{i},{\xi}_{j}\right)$ is the scalar product when calculated between scalar or vector values, whereas for quaternions it is the cosine between the two corresponding rotation axes. With coordinate_p2, the second order Legendre polynomial, $\left(3cos{\left(\mathit{\theta}\right)}^{2}-1\right)\u22152$, is used instead of the cosine. - Keyword corrFuncNormalize$\u27e8\phantom{\rule{0.3em}{0ex}}$Normalize
the time correlation function?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: on

Description: If enabled, the value of the correlation function at $t$ = 0 is normalized to 1; otherwise, it equals to $\u27e8O\left({\xi}_{i},{\xi}_{j}\right)\u27e9$. - Keyword corrFuncLength$\u27e8\phantom{\rule{0.3em}{0ex}}$Length
of the time correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 1000

Description: Length (in number of points) of the time correlation function. - Keyword corrFuncStride$\u27e8\phantom{\rule{0.3em}{0ex}}$Stride
of the time correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 1

Description: Number of steps between two values of the time correlation function. - Keyword corrFuncOffset$\u27e8\phantom{\rule{0.3em}{0ex}}$Oﬀset
of the time correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 0

Description: The starting time (in number of steps) of the time correlation function (default: $t$ = 0). Note: the value at $t$ = 0 is always used for the normalization. - Keyword corrFuncOutputFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
ﬁle for the time correlation function$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: UNIX ﬁlename

Default value: outputName.$<$name$>$.corrfunc.dat

Description: The time correlation function is saved in this ﬁle. - Keyword runAve$\u27e8\phantom{\rule{0.3em}{0ex}}$Calculate
the running average and standard deviation$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: boolean

Default value: off

Description: Whether or not the running average and standard deviation should be calculated for this colvar. - Keyword runAveLength$\u27e8\phantom{\rule{0.3em}{0ex}}$Length
of the running average window$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 1000

Description: Length (in number of points) of the running average window. - Keyword runAveStride$\u27e8\phantom{\rule{0.3em}{0ex}}$Stride
of the running average window values$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: positive integer

Default value: 1

Description: Number of steps between two values within the running average window. - Keyword runAveOutputFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Output
ﬁle for the running average and standard deviation$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: UNIX ﬁlename

Default value: outputName.$<$name$>$.runave.traj

Description: The running average and standard deviation are saved in this ﬁle.

To deﬁne collective variables, atoms are usually selected as groups. Each group is deﬁned using an identiﬁer that is unique in the context of the speciﬁc colvar component (e.g. for a distance component, the two groups are group1 and group2). The identiﬁer is followed by a brace-delimited block containing selection keywords and other parameters, including an optional name:

- Keyword name$\u27e8\phantom{\rule{0.3em}{0ex}}$Unique
name for the atom group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: string

Description: This parameter deﬁnes a unique name for this atom group, which can be referred to in the deﬁnition of other atom groups (including in other colvars) by invoking atomsOfGroup as a selection keyword.

Selection keywords may be used individually or in combination with each other, and each can be repeated any
number of times. Selection is incremental: each keyword adds the corresponding atoms to the selection, so that
diﬀerent sets of atoms can be combined. However, atoms included by multiple keywords are only counted once.
Below is an example conﬁguration for an atom group called “atoms”. Note: this is an unusually varied combination
of selection keywords, demonstrating how they can be combined together: most simulations only use one of
them.

atoms {

# add atoms 1 and 3 to this group (note: the first atom in the system is 1)

atomNumbers {

1 3

}

# add atoms starting from 20 up to and including 50

atomNumbersRange 20-50

# add all the atoms with occupancy 2 in the file atoms.pdb

atomsFile atoms.pdb

atomsCol O

atomsColValue 2.0

# add all the C-alphas within residues 11 to 20 of segments "PR1" and "PR2"

psfSegID PR1 PR2

atomNameResidueRange CA 11-20

atomNameResidueRange CA 11-20

# add index group (requires a .ndx file to be provided globally)

indexGroup Water

}

The resulting selection includes atoms 1 and 3, those between 20 and 50, the ${\mathrm{C}}_{\alpha}$ atoms between residues 11 and 20 of the two segments PR1 and PR2, and those in the index group called “Water”. The indices of this group are read from the ﬁle provided by the global keyword indexFile.

The complete list of selection keywords available in NAMD is:

- Keyword atomNumbers$\u27e8\phantom{\rule{0.3em}{0ex}}$List
of atom numbers$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: space-separated list of positive integers

Description: This option adds to the group all the atoms whose numbers are in the list. The number of the ﬁrst atom in the system is 1: to convert from a VMD selection, use “atomselect get serial”. - Keyword indexGroup$\u27e8\phantom{\rule{0.3em}{0ex}}$Name
of index group to be used (GROMACS format)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: string

Description: If the name of an index ﬁle has been provided by indexFile, this option allows to select one index group from that ﬁle: the atoms from that index group will be used to deﬁne the current group. - Keyword atomsOfGroup$\u27e8\phantom{\rule{0.3em}{0ex}}$Name
of group deﬁned previously$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: string

Description: Refers to a group deﬁned previously using its user-deﬁned name. This adds all atoms of that named group to the current group. - Keyword atomNumbersRange$\u27e8\phantom{\rule{0.3em}{0ex}}$Atoms
within a number range$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: $<$Starting number$>$-$<$Ending number$>$

Description: This option includes in the group all atoms whose numbers are within the range speciﬁed. The number of the ﬁrst atom in the system is 1. - Keyword atomNameResidueRange$\u27e8\phantom{\rule{0.3em}{0ex}}$Named
atoms within a range of residue numbers$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: $<$Atom name$>$ $<$Starting residue$>$-$<$Ending residue$>$

Description: This option adds to the group all the atoms with the provided name, within residues in the given range. - Keyword psfSegID$\u27e8\phantom{\rule{0.3em}{0ex}}$PSF
segment identiﬁer$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: space-separated list of strings (max 4 characters)

Description: This option sets the PSF segment identiﬁer for atomNameResidueRange. Multiple values may be provided, which correspond to multiple instances of atomNameResidueRange, in order of their occurrence. This option is only necessary if a PSF topology ﬁle is used. - Keyword atomsFile$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
ﬁle name for atom selection$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: UNIX ﬁlename

Description: This option selects atoms from the PDB ﬁle provided and adds them to the group according to numerical ﬂags in the column atomsCol. Note: the sequence of atoms in the PDB ﬁle provided must match that in the system’s topology. - Keyword atomsCol$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
column to use for atom selection ﬂags$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: O, B, X, Y, or Z

Description: This option speciﬁes which PDB column in atomsFile is used to determine which atoms are to be included in the group. - Keyword atomsColValue$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
selection ﬂag in the PDB column$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: positive decimal

Description: If deﬁned, this value in atomsCol identiﬁes atoms in atomsFile that are included in the group. If undeﬁned, all atoms with a non-zero value in atomsCol are included. - Keyword dummyAtom$\u27e8\phantom{\rule{0.3em}{0ex}}$Dummy
atom position (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: (x, y, z) triplet

Description: Instead of selecting any atom, this option makes the group a virtual particle at a ﬁxed position in space. This is useful e.g. to replace a group’s center of geometry with a user-deﬁned position.

The following options deﬁne an automatic calculation of an optimal translation (centerReference) or optimal rotation (rotateReference), that superimposes the positions of this group to a provided set of reference coordinates. This can allow, for example, to eﬀectively remove from certain colvars the eﬀects of molecular tumbling and of diﬀusion. Given the set of atomic positions ${\mathbf{x}}_{i}$, the colvar $\xi $ can be deﬁned on a set of roto-translated positions ${\mathbf{x}}_{i}^{\prime}=R\left({\mathbf{x}}_{i}-{\mathbf{x}}^{\mathrm{C}}\right)+{\mathbf{x}}^{\mathrm{ref}}$. ${\mathbf{x}}^{\mathrm{C}}$ is the geometric center of the ${\mathbf{x}}_{i}$, $R$ is the optimal rotation matrix to the reference positions and ${\mathbf{x}}^{\mathrm{ref}}$ is the geometric center of the reference positions.

Components that are deﬁned based on pairwise distances are naturally invariant under global roto-translations. Other components are instead aﬀected by global rotations or translations: however, they can be made invariant if they are expressed in the frame of reference of a chosen group of atoms, using the centerReference and rotateReference options. Finally, a few components are deﬁned by convention using a roto-translated frame (e.g. the minimal RMSD): for these components, centerReference and rotateReference are enabled by default. In typical applications, the default settings result in the expected behavior.

Warning on rotating frames of reference and periodic boundary conditions. rotateReference aﬀects coordinates that depend on minimum-image distances in periodic boundary conditions (PBC). After rotation of the coordinates, the periodic cell vectors become irrelevant: the rotated system is eﬀectively non-periodic. A safe way to handle this is to ensure that the relevant inter-group distance vectors remain smaller than the half-size of the periodic cell. If this is not desirable, one should avoid the rotating frame of reference, and apply orientational restraints to the reference group instead, in order to keep the orientation of the reference group consistent with the orientation of the periodic cell.

Warning on rotating frames of reference and ABF. Note that centerReference and rotateReference may aﬀect the Jacobian derivative of colvar components in a way that is not taken into account by default. Be careful when using these options in ABF simulations or when using total force values.

- Keyword centerReference$\u27e8\phantom{\rule{0.3em}{0ex}}$Implicitly
remove translations for this group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: boolean

Default value: off

Description: If this option is on, the center of geometry of the group will be aligned with that of the reference positions provided by either refPositions or refPositionsFile. Colvar components will only have access to the aligned positions. Note: unless otherwise speciﬁed, rmsd and eigenvector set this option to on by default. - Keyword rotateReference$\u27e8\phantom{\rule{0.3em}{0ex}}$Implicitly
remove rotations for this group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: boolean

Default value: off

Description: If this option is on, the coordinates of this group will be optimally superimposed to the reference positions provided by either refPositions or refPositionsFile. The rotation will be performed around the center of geometry if centerReference is on, or around the origin otherwise. The algorithm used is the same employed by the orientation colvar component [3]. Forces applied to the atoms of this group will also be implicitly rotated back to the original frame. Note: unless otherwise speciﬁed, rmsd and eigenvector set this option to on by default. - Keyword refPositions$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
positions for ﬁtting (Å)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: space-separated list of (x, y, z) triplets

Description: This option provides a list of reference coordinates for centerReference and/or rotateReference, and is mutually exclusive with refPositionsFile. If only centerReference is on, the list may contain a single (x, y, z) triplet; if also rotateReference is on, the list should be as long as the atom group, and its order must match the order in which atoms were deﬁned. - Keyword refPositionsFile$\u27e8\phantom{\rule{0.3em}{0ex}}$File
containing the reference positions for ﬁtting$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: UNIX ﬁlename

Description: This option provides a list of reference coordinates for centerReference and/or rotateReference, and is mutually exclusive with refPositions. The acceptable ﬁle format is XYZ, which is read in double precision, or PDB; the latter is discouraged if the precision of the reference coordinates is a concern. Atomic positions are read diﬀerently depending on the following scenarios: (i) the ﬁle contains exactly as many records as the atoms in the group: all positions are read in sequence; (ii) (most common case) the ﬁle contains coordinates for the entire system: only the positions corresponding to the numeric indices of the atom group are read; (iii) if the ﬁle is a PDB ﬁle and refPositionsCol is speciﬁed, positions are read according to the value of the column refPositionsCol (which may be the same as atomsCol). In each case, atoms are read from the ﬁle in order of increasing number. - Keyword refPositionsCol$\u27e8\phantom{\rule{0.3em}{0ex}}$PDB
column containing atom ﬂags$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: O, B, X, Y, or Z

Description: Like atomsCol for atomsFile, indicates which column to use to identify the atoms in refPositionsFile (if this is a PDB ﬁle). - Keyword refPositionsColValue$\u27e8\phantom{\rule{0.3em}{0ex}}$Atom
selection ﬂag in the PDB column$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: positive decimal

Description: Analogous to atomsColValue, but applied to refPositionsCol. - Keyword fittingGroup$\u27e8\phantom{\rule{0.3em}{0ex}}$Use
an alternate set of atoms to deﬁne the roto-translation$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: Block fittingGroup { ... }

Default value: This atom group itself

Description: If either centerReference or rotateReference is deﬁned, this keyword deﬁnes an alternate atom group to calculate the optimal roto-translation. Use this option to deﬁne a continuous rotation if the structure of the group involved changes signiﬁcantly (a typical symptom would be the message “Warning: discontinuous rotation!”).The following example illustrates the use of fittingGroup as part of a Distance to Bound Conﬁguration (DBC) coordinate for use in ligand restraints for binding aﬃnity calculations.[12] The group called “atoms” describes coordinates of a ligand’s atoms, expressed in a moving frame of reference tied to a binding site (here within a protein). An optimal roto-translation is calculated automatically by ﬁtting the C${}_{\alpha}$ trace of the rest of the protein onto the coordinates provided by a PDB ﬁle. To deﬁne a DBC coordinate, this atom group would be used within an rmsd function.

# Example: defining a group "atoms" (the ligand) whose coordinates are expressed

# in a roto-translated frame of reference defined by a second group (the receptor)

atoms {

atomNumbers 1 2 3 4 5 6 7 # atoms of the ligand (1-based)

centerReference yes

rotateReference yes

fittingGroup {

# define the frame by fitting alpha carbon atoms

# in 2 protein segments close to the site

psfSegID PROT PROT

atomNameResidueRange CA 1-40

atomNameResidueRange CA 59-100

}

refPositionsFile all.pdb # can be the entire system

}

The following two options have default values appropriate for the vast majority of applications, and are only provided to support rare, special cases.

- Keyword enableFitGradients$\u27e8\phantom{\rule{0.3em}{0ex}}$Include
the roto-translational contribution to colvar gradients$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: boolean

Default value: on

Description: When either centerReference or rotateReference is on, the gradients of some colvars include terms proportional to $\partial R\u2215\partial {\mathbf{x}}_{i}$ (rotational gradients) and $\partial {\mathbf{x}}^{\mathrm{C}}\u2215\partial {\mathbf{x}}_{i}$ (translational gradients). By default, these terms are calculated and included in the total gradients; if this option is set to off, they are neglected. In the case of a minimum RMSD component, this ﬂag is automatically disabled because the contributions of those derivatives to the gradients cancel out. - Keyword enableForces$\u27e8\phantom{\rule{0.3em}{0ex}}$Apply
forces from this colvar to this group$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: atom group

Acceptable values: boolean

Default value: on

Description: If this option is off, no forces are applied the atoms in the group. Other forces are not aﬀected (i.e. those from the MD engine, from other colvars, and other external forces). For dummy atoms, this option is off by default.

In simulations with periodic boundary conditions, NAMD maintains the coordinates of all the atoms within a molecule contiguous to each other (i.e. there are no spurious “jumps” in the molecular bonds). The Colvars module relies on this when calculating a group’s center of geometry, but this condition may fail if the group spans diﬀerent molecules. In that case, writing the NAMD output and restart ﬁles using wrapAll or wrapWater could produce wrong results when a simulation run is continued from a previous one. The user should then determine, according to which type of colvars are being calculated, whether wrapAll or wrapWater can be enabled.

In general, internal coordinate wrapping by NAMD does not aﬀect the calculation of colvars if each atom group satisﬁes one or more of the following:

- it is composed by only one atom;
- it is used by a colvar component which does not make use of its center of geometry, but only of pairwise distances (distanceInv, coordNum, hBond, alpha, dihedralPC);
- it is used by a colvar component that ignores the ill-deﬁned Cartesian components of its center of mass (such as the $x$ and $y$ components of a membrane’s center of mass modeled with distanceZ);
- it has all of its atoms within the same molecular fragment.

In simulations performed with message-passing programs (such as NAMD or LAMMPS), the calculation of energy and forces is distributed (i.e., parallelized) across multiple nodes, as well as over the processor cores of each node. When Colvars is enabled, certain atomic coordinates are collected on a single node, where the calculation of collective variables and of their biases is executed. This means that for simulations over large numbers of nodes, a Colvars calculation may produce a signiﬁcant overhead, coming from the costs of transmitting atomic coordinates to one node and of processing them. The latency-tolerant design and dynamic load balancing of NAMD may alleviate both factors, but a noticeable performance impact may be observed.

Performance can be improved in multiple ways:

- The calculation of variables, components and biases can be distributed over the processor cores of the node where the Colvars module is executed. Currently, an equal weight is assigned to each colvar, or to each component of those colvars that include more than one component. The performance of simulations that use many colvars or components is improved automatically. For simulations that use a single large colvar, it may be advisable to partition it in multiple components, which will be then distributed across the available cores. In NAMD, this feature is enabled in all binaries compiled using SMP builds of Charm++ with the CkLoop extension. If printed, the message “SMP parallelism is available.” indicates the availability of the option. If available, the option is turned on by default, but may be disabled using the keyword smp if required for debugging.
- NAMD also oﬀers a parallelized calculation of the centers of mass of groups of atoms. This option is on by default for all components that are simple functions of centers of mass, and is controlled by the keyword scalable. When supported, the message “Will enable scalable calculation for group …” is printed for each group.
- As a general rule, the size of atom groups should be kept relatively small (up to a few thousands of atoms, depending on the size of the entire system in comparison). To gain an estimate of the computational cost of a large colvar, one can use a test calculation of the same colvar in VMD (hint: use the time Tcl command to measure the cost of running cv update).

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

$<$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 deﬁning multiple restraints.

All biasing and analysis methods implemented recognize the following options:

- Keyword name$\u27e8\phantom{\rule{0.3em}{0ex}}$Identiﬁer
for the bias$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 ﬁles. Tip: because the default name depends on the order of deﬁnition, 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 identiﬁed regardless of the presence of other restraints. - Keyword colvars$\u27e8\phantom{\rule{0.3em}{0ex}}$Collective
variables involved$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar bias

Acceptable values: space-separated list of colvar names

Description: This option selects by name all the variables to which this bias or analysis will be applied. - Keyword outputEnergy$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the current bias energy to the trajectory ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 ﬁle during the simulation. The total energy of all Colvars biases is also reported by NAMD, as part of the MISC title. - Keyword outputFreq$\u27e8\phantom{\rule{0.3em}{0ex}}$Frequency
(number of steps) at which output ﬁles are written$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar bias

Acceptable values: positive integer

Default value: colvarsRestartFrequency

Description: If this bias produces aggregated data that needs to be written to disk (for example, a PMF), this number speciﬁes the number of steps after which these data are written to ﬁles. A value of zero disables writing ﬁles for this bias during the simulation (except for outputEnergy, which is controlled by colvarsTrajFrequency). All output ﬁles are also written at the end of a simulation run, regardless of the value of this number. - Keyword bypassExtendedLagrangian$\u27e8\phantom{\rule{0.3em}{0ex}}$Apply
bias to actual colvars, bypassing extended coordinates$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar bias

Acceptable values: boolean

Default value: off

Description: This option is implemented by the harmonicWalls and histogram biases. It is only relevant if the bias is applied to one or several extended-Lagrangian colvars (4.20), for example within an eABF (6.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. - Keyword stepZeroData$\u27e8\phantom{\rule{0.3em}{0ex}}$Accumulate
data starting at step 0 of a simulation run$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 (6.2), metadynamics (6.4), histograms (6.10) and in general any bias that accumulates free-energy samples with thermodynamic integration, or TI (6.1). When this option is disabled (default), data will only be recorded into the bias after the ﬁrst 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) which are only available at the following step in NAMD; turning on this ﬂag in those cases will raise an error.

The methods implemented here provide a variety of estimators of conformational free-energies. These are carried out at run-time, or with the use of post-processing tools over the generated output ﬁles. The speciﬁcs 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 (6.5, 6.7, 6.8, ...) as well as metadynamics (6.4) can optionally use TI alongside their own estimator, based on the keywords documented below.

- Keyword writeTIPMF$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the PMF computed by thermodynamic integration$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 and 4.14.1), this option allows calculating the corresponding PMF by thermodynamic integration, and writing it to the ﬁle outputName.$<$name$>$.ti.pmf, where $<$name$>$ is the name of the bias and the contents of the ﬁle are in multicolumn text format (4.18.1). The total force includes the forces applied to the variable by all bias, except those from this bias itself. If any bias applies time-dependent forces besides the one using this option, an error is raised. - Keyword writeTISamples$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the free-energy gradient samples$\phantom{\rule{0.3em}{0ex}}\u27e9$

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. The names of the ﬁles 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 6.2.5) or similar utility. Note that because the .force ﬁle contains mean forces instead of free-energy 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 time-dependent forces besides the one using this option, an error is raised.

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

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

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

ABF is based on the thermodynamic integration (TI) scheme for computing free energy proﬁles. The free energy as a function of a set of collective variables $\text{}\xi \text{}={\left({\xi}_{i}\right)}_{i\in \left[1,n\right]}$ is deﬁned from the canonical distribution of $\text{}\xi \text{}$, $\mathcal{\mathcal{P}}\left(\text{}\xi \text{}\right)$:

$$A\left(\text{}\xi \text{}\right)=-\frac{1}{\beta}ln\mathcal{\mathcal{P}}\left(\text{}\xi \text{}\right)+{A}_{0}$$ | (23) |

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 ${\text{}F\text{}}_{\xi}$ exerted on $\text{}\xi \text{}$, taken over an iso-$\text{}\xi \text{}$ surface:

$${\text{}\nabla \text{}}_{\xi}A\left(\text{}\xi \text{}\right)={\u27e8-{\text{}F\text{}}_{\xi}\u27e9}_{\text{}\xi \text{}}$$ | (24) |

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

$$\begin{array}{rcll}{\text{}v\text{}}_{i}\cdot \text{}{\nabla}_{\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}x}\phantom{\rule{0.3em}{0ex}}\text{}{\xi}_{j}& =& {\delta}_{ij}& \text{(25)}\text{}\text{}\\ {\text{}v\text{}}_{i}\cdot \text{}{\nabla}_{\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}x}\phantom{\rule{0.3em}{0ex}}\text{}{\sigma}_{k}& =& 0& \text{(26)}\text{}\text{}\end{array}$$

then the following holds [19]:

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

Equation (26) implies that constraint forces are orthogonal to the directions along which the free energy gradient is measured, so that the measurement is eﬀectively 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).

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

where $\text{}{\nabla}_{\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}x}\phantom{\rule{0.3em}{0ex}}\text{}\stackrel{\u0303}{A}$ denotes the current estimate of the free energy gradient at the current point $\text{}\xi \text{}$ in the collective variable subspace, and $\alpha \left({N}_{\xi}\right)$ is a scaling factor that is ramped from 0 to 1 as the local number of samples ${N}_{\xi}$ increases to prevent nonequilibrium eﬀects 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 $\text{}{\nabla}_{\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}x}\phantom{\rule{0.3em}{0ex}}\text{}\stackrel{\u0303}{A}$ is progressively reﬁned. The biasing force introduced in the equations of motion guarantees that in the bin centered around $\text{}\xi \text{}$, 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 $\text{}\xi \text{}$ is governed mainly by diﬀusion. Although this implementation of ABF can in principle be used in arbitrary dimension, a higher-dimension collective variable space is likely to be diﬃcult to sample and visualize. Most commonly, the number of variables is one or two, sometimes three.

The following conditions must be met for an ABF simulation to be possible and to produce an accurate estimate of the free energy proﬁle. Note that these requirements do not apply when using the extended-system ABF method (6.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 (25) must be satisﬁed for any two
colvars ${\xi}_{i}$
and ${\xi}_{j}$.
Various cases fulﬁll this orthogonality condition:
- ${\xi}_{i}$ and ${\xi}_{j}$ are based on non-overlapping sets of atoms.
- atoms involved in the force measurement on ${\xi}_{i}$ do not participate in the deﬁnition of ${\xi}_{j}$. This can be obtained using the option oneSiteTotalForce of the distance, angle, and dihedral components (example: Ramachandran angles $\varphi $, $\psi $).
- ${\xi}_{i}$ and ${\xi}_{j}$ are orthogonal by construction. Useful cases are the sum and diﬀerence 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 ${\text{}v\text{}}_{i}$ (equation (27)) are mutually orthogonal. The cases described for colvars in the previous paragraph apply.
- Orthogonality of colvars and constraints: equation 26 can be satisﬁed 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 26 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 deﬁne 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. The following speciﬁc parameters can be set in the ABF conﬁguration block:

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword outputFreq: see deﬁnition of outputFreq in sec. 6 (biasing and analysis methods)
- Keyword stepZeroData: see deﬁnition of stepZeroData in sec. 6 (biasing and analysis methods)
- Keyword fullSamples$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of samples in a bin prior to application of the ABF$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: positive integer

Default value: 200

Description: To avoid nonequilibrium eﬀects due to large ﬂuctuations 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 $\alpha \left({N}_{\xi}\right)$ between 0 and 1. If the number of samples ${N}_{\xi}$ 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: $\alpha \left({N}_{\xi}\right)=\left(2{N}_{\xi}\u2215\mathrm{fullSamples}\right)-1$ . - Keyword maxForce$\u27e8\phantom{\rule{0.3em}{0ex}}$Maximum
magnitude of the ABF force$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 eﬀectively 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 diﬀusion 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. - Keyword hideJacobian$\u27e8\phantom{\rule{0.3em}{0ex}}$Remove
geometric entropy term from calculated free energy gradient?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: boolean

Default value: no

Description: In a few special cases, most notably distance-based variables, an alternate deﬁnition of the potential of mean force is traditionally used, which excludes the Jacobian term describing the eﬀect of geometric entropy on the distribution of the variable. This results, for example, in particle-particle potentials of mean force being ﬂat 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. - Keyword historyFreq$\u27e8\phantom{\rule{0.3em}{0ex}}$Frequency
(in timesteps) at which ABF history ﬁles are accumulated$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 written to ﬁles on disk at the given time interval. History ﬁle names use the same preﬁx as output ﬁles, with “.hist” appended (outputName.hist.pmf). historyFreq must be a multiple of outputFreq. - Keyword inputPrefix$\u27e8\phantom{\rule{0.3em}{0ex}}$Filename
preﬁx for reading ABF data$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 ﬁles 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 ﬁles is combined appropriately. Also, the grid deﬁnition (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 diﬀerent 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 ﬁner data grid. This option is NOT compatible with reading the data from a restart ﬁle (colvarsInput option of the NAMD conﬁg ﬁle). - Keyword applyBias$\u27e8\phantom{\rule{0.3em}{0ex}}$Apply
the ABF bias?$\phantom{\rule{0.3em}{0ex}}\u27e9$

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. - Keyword updateBias$\u27e8\phantom{\rule{0.3em}{0ex}}$Update
the ABF bias?$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 ﬁle 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 eﬀect, one should prepare a gradient ﬁle containing the gradient of the potential to be applied (negative of the bias force), and a count ﬁle containing only values greater than fullSamples. These ﬁles must match the grid parameters of the colvars.

- Keyword shared$\u27e8\phantom{\rule{0.3em}{0ex}}$Apply
multiple-replica ABF, sharing force samples among the replicas?$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 deﬁned by sharedFreq. This implements the multiple-walker ABF scheme described in [20]; this implementation is documented in [21]. Thus, it is as if total force samples among all replicas are gathered in a single shared buﬀer, which why the algorithm is referred to as shared ABF. Shared ABF allows all replicas to beneﬁt from the sampling done by other replicas and can lead to faster convergence of the biasing force. - Keyword sharedFreq$\u27e8\phantom{\rule{0.3em}{0ex}}$Frequency
(in timesteps) at which force samples are synchronized among the replicas$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: positive integer

Default value: outputFreq

Description: In the current implementation of shared ABF, each replica maintains a separate buﬀer 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 ﬁles, all in multicolumn text format (4.18.1):

- 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 proﬁle or PMF (for dimensions 1, 2 or 3).

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

If several ABF biases are deﬁned concurrently, their name is inserted to produce unique ﬁlenames 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 integrated using a simple rectangle rule. In dimension 2 or 3, it is calculated as the solution of a Poisson equation:

$$\Delta A\left(\xi \right)=-\nabla \cdot \u27e8{F}_{\xi}\u27e9$$ | (29) |

wehere $\Delta A$
is the Laplacian of the free energy. The potential of mean force is written under the ﬁle name

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

abf_integrate reads the gradient data and uses it to perform a Monte-Carlo (M-C) simulation in discretized collective variable space (speciﬁcally, 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

The gradient ﬁle name is provided ﬁrst, 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 satisﬁed (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]
- -s: scaling factor for the gradients; when using a histogram of total forces obtained from outputTotalForce or the .force ﬁle written by writeTISamples, a scaling factor of -1 should be used [1.0]
- -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 reﬁne 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 ﬁles:

_file>.pmf: computed free energy surface _file>.histo: histogram of M-C sampling (not usable in a straightforward way if the history-dependent bias has been applied) _file>.est: estimated gradient of the calculated free energy surface (from ﬁnite diﬀerences) _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 ﬁeld is used as a convergence criteria and displayed periodically during the integration.

Note: Typically, the “deviation” vector ﬁeld 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 (ﬁnite sampling and discretization on a grid).

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

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

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

$${F}^{\mathrm{bias}}\left({\lambda}^{\ast}\right)={\u27e8k\left(\lambda -z\right)\u27e9}_{{\lambda}^{\ast}}$$ | (30) |

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

The eABF PMF is that of the coordinate $\lambda $, it is not exactly the free energy proﬁle of $\xi $. 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 [22]. 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:

$${A}^{\prime}\left(z\right)=-\frac{1}{\beta}\frac{dln\stackrel{\u0303}{\rho}\left(z\right)}{dz}+k\left({\u27e8\lambda \u27e9}_{z}-z\right).$$ | (31) |

where $z=\xi \left(q\right)$ is the colvar, $\lambda $ is the extended variable harmonically coupled to $z$ with a force constant $k$, and $\stackrel{\u0303}{\rho}\left(z\right)$ is the observed distribution (histogram) of $z$, aﬀected by the eABF bias.

Parameters for the CZAR estimator are:

- Keyword CZARestimator$\u27e8\phantom{\rule{0.3em}{0ex}}$Calculate
CZAR estimator of the free energy?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: boolean

Default value: yes

Description: This option is only available when ABF is performed on extended-Lagrangian colvars. When enabled, it triggers calculation of the free energy following the CZAR estimator. - Keyword writeCZARwindowFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
internal data from CZAR to a separate ﬁle?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: boolean

Default value: no

Description: When this option is enabled, eABF simulations will write a ﬁle containing the $z$-averaged restraint force under the name outputName.zgrad. The same information is always included in the colvars state ﬁle, which is suﬃcient for restarting an eABF simulation. These separate ﬁle is only useful when joining adjacent windows from a stratiﬁed 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). Important warning. Unbiased free-energy estimators from eABF dynamics rely on some form of sampling histogram. When running stratiﬁed (windowed) calculations this histogram becomes discontinuous, and as a result the free energy gradient estimated by CZAR is inaccurate at the window boundary, resulting in visible ”blips” in the PMF. As a workaround, we recommend manually replacing the two free energy gradient values at the boundary, either with the ABF values from .grad ﬁles (accurate in the limit of tight coupling), or with values interpolated for the neighboring values of the CZAR gradient.

Similar to ABF, the CZAR estimator produces two output ﬁles in multicolumn text format (4.18.1):

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

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

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

Haohao Fu and Christophe Chipot

Laboratoire International Associé Centre National de la Recherche Scientiﬁque et University
of Illinois at Urbana–Champaign,

Unité Mixte de Recherche No. 7565, Université de Lorraine,

B.P. 70239, 54506 Vandœuvre-lès-Nancy cedex, France

© 2016, Centre National de la Recherche Scientiﬁque

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

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

The estimator is enabled through the following option:

- Keyword UIestimator$\u27e8\phantom{\rule{0.3em}{0ex}}$Calculate
UI estimator of the free energy?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: abf

Acceptable values: boolean

Default value: no

Description: This option is only available when ABF is performed on extended-Lagrangian colvars. When enabled, it triggers calculation of the free energy following the UI estimator.

Usage for multiple–replica eABF. The eABF algorithm can be associated with a multiple–walker strategy [20, 21] (6.2.3). To run a multiple–replica eABF simulation, start a multiple-replica NAMD run (option +replicas) and set shared on in the Colvars conﬁg ﬁle to enable the multiple–walker ABF algorithm. It should be noted that in contrast with classical MW–ABF simulations, the output ﬁles of an MW–eABF simulation only show the free energy estimate of the corresponding replica.

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

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

The metadynamics method uses a history-dependent potential [26] that generalizes to any type of colvars the conformational ﬂooding [27] and local elevation [28] 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 $\text{}\xi \text{}=\left({\xi}_{1},{\xi}_{2},\dots ,{\xi}_{{N}_{\mathrm{cv}}}\right)$ is deﬁned as:

where ${V}_{\mathrm{meta}}$ is the history-dependent potential acting on the current values of the colvars $\text{}\xi \text{}$, and depends only parametrically on the previous values of the colvars. ${V}_{\mathrm{meta}}$ is constructed as a sum of ${N}_{\mathrm{cv}}$-dimensional repulsive Gaussian “hills”, whose height is a chosen energy constant $W$, and whose centers are the previously explored conﬁgurations $\left(\text{}\xi \text{}\left(\delta t\right),\text{}\xi \text{}\left(2\delta t\right),\dots \right)$.

During the simulation, the system evolves towards the nearest minimum of the “eﬀective” potential of mean force $\xc3\left(\text{}\xi \text{}\right)$, which is the sum of the “real” underlying potential of mean force $A\left(\text{}\xi \text{}\right)$ and the the metadynamics potential, ${V}_{\mathrm{meta}}\left(\text{}\xi \text{}\right)$. Therefore, at any given time the probability of observing the conﬁguration $\text{}{\xi}^{\ast}\text{}$ is proportional to $exp\left(-\xc3\left(\text{}{\xi}^{\ast}\text{}\right)\u2215{\kappa}_{\mathrm{B}}T\right)$: this is also the probability that a new Gaussian “hill” is added at that conﬁguration. If the simulation is run for a suﬃciently long time, each local minimum is canceled out by the sum of the Gaussian “hills”. At that stage the “eﬀective” potential of mean force $\xc3\left(\text{}\xi \text{}\right)$ is constant, and $-{V}_{\mathrm{meta}}\left(\text{}\xi \text{}\right)$ is an estimator of the “real” potential of mean force $A\left(\text{}\xi \text{}\right)$, save for an additive constant:

$$A\left(\text{}\xi \text{}\right)\phantom{\rule{3.04074pt}{0ex}}\simeq \phantom{\rule{3.04074pt}{0ex}}-{V}_{\mathrm{meta}}\left(\text{}\xi \text{}\right)+K$$ | (34) |

Such estimate of the free energy can be provided by enabling writeFreeEnergyFile. Assuming that the set of collective variables includes all relevant degrees of freedom, the predicted error of the estimate is a simple function of the correlation times of the colvars ${\tau}_{{\xi}_{i}}$, and of the user-deﬁned parameters $W$, ${\sigma}_{{\xi}_{i}}$ and $\delta t$ [29]. In typical applications, a good rule of thumb can be to choose the ratio $W\u2215\delta t$ much smaller than ${\kappa}_{\mathrm{B}}T\u2215{\tau}_{\text{}\xi \text{}}$, where ${\tau}_{\text{}\xi \text{}}$ is the longest among $\text{}\xi \text{}$’s correlation times: ${\sigma}_{{\xi}_{i}}$ then dictates the resolution of the calculated PMF.

If the metadynamics parameters are chosen correctly, after an equilibration time, ${t}_{e}$, the estimator provided by eq. 34 oscillates on time around the “real” free energy, thereby a better estimate of the latter can be obtained as the time average of the bias potential after ${t}_{e}$ [30, 31]:

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

In typical scenarios the Gaussian hills of a metadynamics potential are interpolated and summed together onto a grid, which is much more eﬃcient than computing each hill independently at every step (the keyword useGrids is on by default). This numerical approximation typically yields neglibile errors in the resulting PMF [1]. However, due to the ﬁnite 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 $\left[0:180\right]$ interval of an angle colvar) or when the ﬂags hardLowerBoundary and hardUpperBoundary are explicitly set by the user. Unfortunately, processing explicit hills alongside the potential and force grids could easily become ineﬃcient, slowing down the simulation and increasing the state ﬁle’s size.

In general, it is a good idea to deﬁne a repulsive potential to avoid hills from coming too close to the grid’s
boundaries, for example as a harmonicWalls restraint (see 6.7).

Example: Using harmonic walls to protect the grid’s boundaries.

colvar {

name r

distance { ... }

upperBoundary 15.0

width 0.2

}

metadynamics {

name meta_r

colvars r

hillWeight 0.001

hillWidth 2.0

}

harmonicWalls {

name wall_r

colvars r

upperWalls 13.0

upperWallConstant 2.0

}

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

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

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

$${E}^{\ast}=\frac{1}{2}k{\left(\frac{r-{r}_{\mathrm{upper}}}{{w}_{r}}\right)}^{2}=\frac{1}{2}2.0{\left(-3\right)}^{2}=9\phantom{\rule{1em}{0ex}}\mathrm{kcal\u2215mol}$$ |

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

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

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

To enable a metadynamics calculation, a metadynamics {...} block must be deﬁned in the Colvars conﬁguration ﬁle. Its mandatory keywords are colvars, the variables involved, hillWeight, the weight parameter $W$, and the widths $2\sigma $ of the Gaussian hills in each dimension given by the single dimensionless parameter hillWidth, or more explicitly by the gaussianSigmas.

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword outputFreq: see deﬁnition of outputFreq in sec. 6 (biasing and analysis methods)
- Keyword writeTIPMF: see deﬁnition of writeTIPMF in sec. 6 (biasing and analysis methods)
- Keyword writeTISamples: see deﬁnition of writeTISamples in sec. 6 (biasing and analysis methods)
- Keyword stepZeroData: see deﬁnition of stepZeroData in sec. 6 (biasing and analysis methods)
- Keyword hillWeight$\u27e8\phantom{\rule{0.3em}{0ex}}$Height
of each hill (kcal/mol)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: positive decimal

Description: This option sets the height $W$ 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. - Keyword hillWidth$\u27e8\phantom{\rule{0.3em}{0ex}}$Width
$2\sigma $
of a Gaussian hill, measured in number of grid points$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: positive decimal

Description: This keyword sets the Gaussian width $2{\sigma}_{{\xi}_{i}}$ for all colvars, expressed in number of grid points, with the grid spacing along each colvar $\xi $ determined by the respective value of width. Values between 1 and 3 are recommended for this option: smaller numbers will fail to adequately interpolate each Gaussian function [1], while larger values may be unable to account for steep free-energy gradients. The values of each half-width ${\sigma}_{{\xi}_{i}}$ in the physical units of ${\xi}_{i}$ are also printed by NAMD at initialization time; alternatively, they may be set explicitly via gaussianSigmas. - Keyword gaussianSigmas$\u27e8\phantom{\rule{0.3em}{0ex}}$Half-widths
$\sigma $
of the Gaussian hill (one for each colvar)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: space-separated list of decimals

Description: This option sets the parameters ${\sigma}_{{\xi}_{i}}$ of the Gaussian hills along each colvar ${\xi}_{i}$, expressed in the same unit of ${\xi}_{i}$. No restrictions are placed on each value, but a warning will be printed if useGrids is on and the Gaussian width $2{\sigma}_{{\xi}_{i}}$ is smaller than the corresponding grid spacing, $\mathtt{width}\left({\xi}_{i}\right)$. If not given, default values will be computed from the dimensionless number hillWidth. - Keyword newHillFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$Frequency
of hill creation$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 time-step deﬁnes the parameter $\delta t$ in eq. 33. Higher values provide more accurate statistical sampling, at the price of longer simulation times to complete a PMF calculation.

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

- Keyword writeFreeEnergyFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Periodically
write the PMF for visualization$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: on

Description: When useGrids and this option are on, the PMF is written every outputFreq steps. - Keyword keepFreeEnergyFiles$\u27e8\phantom{\rule{0.3em}{0ex}}$Keep
all the PMF ﬁles$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: When writeFreeEnergyFile and this option are on, the step number is included in the ﬁle name, thus generating a series of PMF ﬁles. Activating this option can be useful to follow more closely the convergence of the simulation, by comparing PMFs separated by short times. - Keyword writeHillsTrajectory$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
a log of new hills$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: If this option is on, a ﬁle containing the Gaussian hills written by the metadynamics bias, with the name:

“outputName.colvars.$<$name$>$.hills.traj”,

which can be useful to post-process the time series of the Gassian hills. Each line is written every newHillFrequency, regardless of the value of outputFreq. When multipleReplicas is on, its name is changed to:

“outputName.colvars.$<$name$>$.$<$replicaID$>$.hills.traj”.

The columns of this ﬁle are the centers of the hills, ${\xi}_{i}\left({t}^{\prime}\right)$, followed by the half-widths, ${\sigma}_{{\xi}_{i}}$, and the weight, $W$. Note: prior to version 2020-02-24, the full-width $2\sigma $ of the Gaussian was reported in lieu of $\sigma $.

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

- Keyword useGrids$\u27e8\phantom{\rule{0.3em}{0ex}}$Interpolate
the hills with grids$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 deﬁned 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 deﬁned in one of the colvars, grids are automatically expanded along the direction of that colvar. - Keyword rebinGrids$\u27e8\phantom{\rule{0.3em}{0ex}}$Recompute
the grids when reading a state ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: When restarting from a state ﬁle, the grid’s parameters (boundaries and widths) saved in the state ﬁle override those in the conﬁguration ﬁle. Enabling this option forces the grids to match those in the current conﬁguration ﬁle. - Keyword keepHills$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
each individual hill to the state ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: When useGrids and this option are on, all hills are saved to the state ﬁle 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.

The ensemble-biased metadynamics (EBMetaD) approach [32] 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 ﬂat distribution as target. This is achieved by weighing the Gaussian functions used in the metadynamics approach by the inverse of the target probability distribution:

where ${\rho}_{exp}\left(\text{}\xi \text{}\right)$ is the target probability distribution and ${S}_{\rho}=-\int {\rho}_{exp}\left(\text{}\xi \text{}\right)log{\rho}_{exp}\left(\text{}\xi \text{}\right)\phantom{\rule{0.3em}{0ex}}\mathrm{d}\text{}\xi \text{}$ its corresponding diﬀerential entropy. The method is designed so that during the simulation the resulting distribution of the collective variable $\text{}\xi \text{}$ converges to ${\rho}_{exp}\left(\text{}\xi \text{}\right)$. A practical application of EBMetaD is to reproduce an “experimental” probability distribution, for example the distance distribution between spectroscopic labels inferred from Förster resonance energy transfer (FRET) or double electron-electron resonance (DEER) experiments [32].

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

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

The following additional options deﬁne the conﬁguration for the ensemble-biased metadynamics approach:

- Keyword ebMeta$\u27e8\phantom{\rule{0.3em}{0ex}}$Perform
ensemble-biased metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: If enabled, this ﬂag activates the ensemble-biased metadynamics as described by Marinelli et al.[32]. The target distribution ﬁle, 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 ﬁle. - Keyword targetDistFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Target
probability distribution ﬁle for ensemble-biased metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: multicolumn text ﬁle

Description: This ﬁle provides the target probability distribution, ${\rho}_{exp}\left(\text{}\xi \text{}\right)$, reported in eq. 36. The latter distribution must be a tabulated function provided in a multicolumn text format (see 4.18.1). The provided distribution is then normalized. - Keyword ebMetaEquilSteps$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of equilibration steps for ensemble-biased metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

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. 36). This happens, for example, if the probability distribution sampled by a conventional molecular dynamics simulation is signiﬁcantly diﬀerent 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. 33) to EBmetaD (eq. 36) as $\lambda {V}_{\mathrm{meta}}\left(\text{}\xi \text{}\right)+\left(1-\lambda \right){V}_{\mathrm{EBmetaD}}\left(\text{}\xi \text{}\right)$, where $\lambda =\left(\mathtt{ebMetaEquilSteps}-\mathtt{step}\right)\u2215\mathtt{ebMetaEquilSteps}$ and step is the current simulation step number. - Keyword targetDistMinVal$\u27e8\phantom{\rule{0.3em}{0ex}}$Minimum
value of the target distribution in reference to its maximum value$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 01 and its default value is set to 1/1000000. To avoid divisions by zero (see eq. 36), if targetDistMinVal is set as zero, values of ${\rho}_{exp}$ equal to zero are replaced by the smallest positive value read in the same ﬁle.

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

Example: EBmetaD conﬁguration 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 ﬁle in “multicolumn” format (4.18.1) 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 (6.7).

The following options deﬁne the conﬁguration for the “well-tempered” metadynamics approach [33]:

- Keyword wellTempered$\u27e8\phantom{\rule{0.3em}{0ex}}$Perform
well-tempered metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: If enabled, this ﬂag causes well-tempered metadynamics as described by Barducci et al.[33] to be performed, rather than standard metadynamics. The parameter biasTemperature is then required. This feature was contributed by Li Li (Luthey-Schulten group, Department of Chemistry, UIUC). - Keyword biasTemperature$\u27e8\phantom{\rule{0.3em}{0ex}}$Temperature
bias for well-tempered metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: positive decimal

Description: When running metadynamics in the long time limit, collective variable space is sampled to a modiﬁed temperature $T+\Delta T$. In conventional metadynamics, the temperature “boost” $\Delta T$ would constantly increases with time. Instead, in well-tempered metadynamics $\Delta T$ must be deﬁned by the user via biasTemperature. The written PMF includes the scaling factor $\left(T+\Delta T\right)\u2215\Delta T$ [33]. A careful choice of $\Delta T$ determines the sampling and convergence rate, and is hence crucial to the success of a well-tempered metadynamics simulation.

Metadynamics calculations can be performed concurrently by multiple replicas that share a common history. This variant of the method is called multiple-walker metadynamics [34]: 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 [1], replicas communicate through ﬁles. 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 conﬁguration can be used for all replicas (otherwise, replicaID needs to be manually set to a diﬀerent string for each replica). However, the use case (2) is less demanding in terms of high-performance computing resources: a typical scenario would be a computer cluster (including virtual servers from a cloud provider) where not all nodes are connected to each other at high speed, and thus each replica runs on a small group of nodes or a single node.

Whichever way the replicas are started (coupled or not), a shared ﬁlesystem is needed so that each replica can
read the ﬁles created by the others: paths to these ﬁles are stored in the shared ﬁle replicasRegistry. This ﬁle, and
those listed in it, are read every replicaUpdateFrequency steps. Each time the Colvars state ﬁle is written (for
example, colvarsRestartFrequency steps), the ﬁle named:

outputName.colvars.name.replicaID.state

is written as well; this ﬁle contains only the state of the metadynamics bias, which the other replicas will read in
turn. In between the times when this ﬁle is modiﬁed/replaced, new hills are also temporarily written to the ﬁle
named:

outputName.colvars.name.replicaID.hills

Both ﬁles are only used for communication, and may be deleted after the replica begins writing ﬁles with a new
outputName.

Example: Multiple-walker metadynamics with ﬁle-based communication.

metadynamics {

name mymtd

colvars x

hillWeight 0.001

newHillFrequency 1000

hillWidth 3.0

multipleReplicas on

replicasRegistry /shared-folder/mymtd-replicas.txt

replicaUpdateFrequency 50000 # Best if larger than newHillFrequency

}

The following are the multiple-walkers related options:

- Keyword multipleReplicas$\u27e8\phantom{\rule{0.3em}{0ex}}$Enable
multiple-walker metadynamics$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: This option turns on multiple-walker communication between replicas. - Keyword replicasRegistry$\u27e8\phantom{\rule{0.3em}{0ex}}$Multiple
replicas database ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: UNIX ﬁlename

Description: If multipleReplicas is on, this option sets the path to the replicas’ shared database ﬁle. It is best to use an absolute path (especially when running individual replicas in separate folders). - Keyword replicaUpdateFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$How
often hills are shared between replicas$\phantom{\rule{0.3em}{0ex}}\u27e9$

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’ ﬁles. On a networked ﬁle system, it is best to use a number of steps that corresponds to at least a minute of wall time. - Keyword replicaID$\u27e8\phantom{\rule{0.3em}{0ex}}$Set
the identiﬁer for this replica$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 identiﬁer 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. - Keyword writePartialFreeEnergyFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Periodically
write the contribution to the PMF from this replica$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: If multipleReplicas is on, enabling this option produces an additional ﬁle outputName.partial.pmf, which can be useful to monitor the contribution of each replica to the total PMF (which is written to the ﬁle outputName.pmf). Note: the name of this ﬁle 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.

The harmonic biasing method may be used to enforce ﬁxed 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 deﬁnition:

$$V\left(\xi \right)=\frac{1}{2}k{\left(\frac{\xi -{\xi}_{0}}{{w}_{\xi}}\right)}^{2}$$ | (38) |

There are two noteworthy aspects of this expression:

- Because the standard coeﬃcient of $1\u22152$ of the harmonic potential is included, this expression diﬀers from harmonic bond and angle potentials historically used in common force ﬁelds, where the factor was typically omitted resulting in a non-standard deﬁnition of the force constant.
- The variable $\xi $
is not only centered at ${\xi}_{0}$,
but is also scaled by its characteristic length scale ${w}_{\xi}$
(keyword width). The resulting dimensionless variable $z=\left(\xi -{\xi}_{0}\right)\u2215{w}_{\xi}$
is typically easier to treat numerically: for example, when the forces typically experienced by $\xi $
are much smaller than $k\u2215{w}_{\xi}$
and $k$
is chosen equal to ${\kappa}_{\mathrm{B}}T$
(thermal energy), the resulting probability distribution of $z$
is approximately a Gaussian with mean equal to 0 and standard deviation equal to 1.
This property can be used for setting the force constant in umbrella-sampling ensemble runs: if the restraint centers are chosen in increments of ${w}_{\xi}$, the resulting distributions of $\xi $ are most often optimally overlapped. In regions where the underlying free-energy landscape induces highly skewed distributions of $\xi $, additional windows may be added as needed, with spacings ﬁner than ${w}_{\xi}$.

Beyond one dimension, the use of a scaled harmonic potential also allows a standard deﬁnition of a multi-dimensional restraint with a uniﬁed force constant:

$$V\left({\xi}_{1},\dots ,{\xi}_{M}\right)=\frac{1}{2}k\sum _{i=1}^{M}{\left(\frac{{\xi}_{i}-{\xi}_{0}}{{w}_{\xi}}\right)}^{2}$$ | (39) |

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

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

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword writeTIPMF: see deﬁnition of writeTIPMF in sec. 6 (biasing and analysis methods)
- Keyword writeTISamples: see deﬁnition of writeTISamples in sec. 6 (biasing and analysis methods)
- Keyword stepZeroData: see deﬁnition of stepZeroData in sec. 6 (biasing and analysis methods)
- Keyword forceConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Scaled
force constant (kcal/mol)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: positive decimal

Default value: 1.0

Description: This option deﬁnes a scaled force constant $k$ for the harmonic potential (eq. 39). To ensure consistency for multidimensional restraints, it is divided internally by the square of the speciﬁc width of each variable (which is 1 by default). This makes all values eﬀectively dimensionless and of commensurate size. For instance, if this force constant is set to the thermal energy ${\kappa}_{\mathrm{B}}T$ (equal to $RT$ if molar units are used), then the amplitude of the thermal ﬂuctuations of each variable $\xi $ will be on the order of its width, ${w}_{\xi}$. This can be used to estimate the optimal spacing of umbrella-sampling 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 $k\u2215{w}_{\xi}^{2}$ are always printed when the restraint is deﬁned. - Keyword centers$\u27e8\phantom{\rule{0.3em}{0ex}}$Initial
harmonic restraint centers$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: space-separated list of colvar values

Description: The centers (equilibrium values) of the restraint, ${\xi}_{0}$, 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 deﬁning several colvars, and applying one or more harmonic restraints to diﬀerent groups of colvars. In some cases, dozens of colvars can be deﬁned, but their value may not be relevant: to limit the size of the colvars trajectory ﬁle, it may be wise to disable outputValue for such “ancillary” variables, and leave it enabled only for “relevant” ones.

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.

- Keyword targetCenters$\u27e8\phantom{\rule{0.3em}{0ex}}$Steer
the restraint centers towards these targets$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: space-separated list of colvar values

Description: When deﬁned, 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 speciﬁed in the conﬁguration ﬁle $<$colvarsConfig$>$ are overridden by those saved in the restart ﬁle $<$colvarsInput$>$. To perform Steered MD in an arbitrary space of colvars, it is suﬃcient to use this option and enable outputAccumulatedWork and/or outputAppliedForce within each of the colvars involved. - Keyword targetNumSteps$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of steps for steering$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: positive integer

Description: In single-stage (continuous) transformations, deﬁnes the number of MD steps required to move the restraint centers (or force constant) towards the values speciﬁed with targetCenters or targetForceConstant. After the target values have been reached, the centers (resp. force constant) are kept ﬁxed. In multi-stage transformations, this sets the number of MD steps per stage. - Keyword outputCenters$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the current centers to the trajectory ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 ﬁle during the simulation. This option allows to conveniently extract the PMF from the colvars trajectory ﬁles 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 ﬁle (state ﬁle). Thus, such simulations can be run in several chunks, and restarted directly using the same colvars conﬁguration ﬁle. In case of a restart, the values of parameters such as targetCenters, targetNumSteps, etc. should not be changed manually.

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 ﬁle 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 predeﬁned grid can be automatically obtained by using the histogram bias (see 6.10).

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

- Keyword targetNumStages$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of stages for steering$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 $\times $ (targetNumStages + 1).

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

- Keyword targetForceConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Change
the force constant towards this value$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: positive decimal

Description: When deﬁned, 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 eﬃciently by an indirect route, through the determination of a PMF for the restrained coordinate.[35] - Keyword targetForceExponent$\u27e8\phantom{\rule{0.3em}{0ex}}$Exponent
in the time-dependence of the force constant$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: decimal equal to or greater than 1.0

Default value: 1.0

Description: Sets the exponent, $\alpha $, in the function used to vary the force constant as a function of time. The force is varied according to a coupling parameter $\lambda $, raised to the power $\alpha $: ${k}_{\lambda}={k}_{0}+{\lambda}^{\alpha}\left({k}_{1}-{k}_{0}\right)$, where ${k}_{0}$, ${k}_{\lambda}$, and ${k}_{1}$ are the initial, current, and ﬁnal values of the force constant. The parameter $\lambda $ 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 eﬀects 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. - Keyword targetEquilSteps$\u27e8\phantom{\rule{0.3em}{0ex}}$Number
of steps discarded from TI estimate$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: positive integer

Description: Deﬁnes 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. - Keyword lambdaSchedule$\u27e8\phantom{\rule{0.3em}{0ex}}$Schedule
of lambda-points for changing force constant$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: list of real numbers between 0 and 1

Description: If speciﬁed together with targetForceConstant, sets the sequence of discrete $\lambda $ values that will be used for diﬀerent stages.

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

- Keyword outputAccumulatedWork$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the accumulated work of the changing restraint to the Colvars trajectory ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonic

Acceptable values: boolean

Default value: off

Description: If targetCenters or targetForceConstant are deﬁned and this option is enabled, the accumulated work from the beginning of the simulation will be written to the trajectory ﬁle (colvarsTrajFrequency must be non-zero). When the simulation is continued from a state ﬁle, 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.

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

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

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

The harmonicWalls bias implements the following options:

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword writeTIPMF: see deﬁnition of writeTIPMF in sec. 6 (biasing and analysis methods)
- Keyword writeTISamples: see deﬁnition of writeTISamples in sec. 6 (biasing and analysis methods)
- Keyword stepZeroData: see deﬁnition of stepZeroData in sec. 6 (biasing and analysis methods)
- Keyword lowerWalls$\u27e8\phantom{\rule{0.3em}{0ex}}$Position
of the lower wall$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: Space-separated list of decimals

Description: Deﬁnes the values ${\xi}_{\mathrm{lower}}$ below which a conﬁning restraint on the colvar is applied to each colvar $\xi $. - Keyword upperWalls$\u27e8\phantom{\rule{0.3em}{0ex}}$Position
of the lower wall$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: colvar

Acceptable values: Space-separated list of decimals

Description: Deﬁnes the values ${\xi}_{\mathrm{upper}}$ above which a conﬁning restraint on the colvar is applied to each colvar $\xi $. - Keyword forceConstant: see deﬁnition of forceConstant in sec. 6.5 (Harmonic restraints)
- Keyword lowerWallConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Force
constant for the lower wall$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonicWalls

Acceptable values: positive decimal

Default value: forceConstant

Description: When both sets of walls are deﬁned (lower and upper), this keyword allows setting diﬀerent force constants for them. As with forceConstant, the speciﬁed constant is divided internally by the square of the speciﬁc width of each variable (see also the equivalent keyword for the harmonic restraint, forceConstant). The force constant reported in the output as “$k$”, and used in the change of force constant scheme, is the geometric mean of upperWallConstant and upperWallConstant. - Keyword upperWallConstant: analogous to lowerWallConstant
- Keyword targetForceConstant: see deﬁnition of targetForceConstant in sec. 6.5 (harmonic restraints)
- Keyword targetForceConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Change
the force constant(s) towards this value$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 deﬁned (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. - Keyword targetNumSteps: see deﬁnition of targetNumSteps in sec. 6.5 (harmonic restraints)
- Keyword targetForceExponent: see deﬁnition of targetForceExponent in sec. 6.5 (harmonic restraints)
- Keyword targetEquilSteps: see deﬁnition of targetEquilSteps in sec. 6.5 (harmonic restraints)
- Keyword targetNumStages: see deﬁnition of targetNumStages in sec. 6.5 (harmonic restraints)
- Keyword lambdaSchedule: see deﬁnition of lambdaSchedule in sec. 6.5 (harmonic restraints)
- Keyword outputAccumulatedWork: see deﬁnition of outputAccumulatedWork in sec. 6.5 (harmonic restraints)
- Keyword bypassExtendedLagrangian$\u27e8\phantom{\rule{0.3em}{0ex}}$Apply
bias to actual colvars, bypassing extended coordinates$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: harmonicWalls

Acceptable values: boolean

Default value: on

Description: This option behaves as bypassExtendedLagrangian 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 unaﬀected by the bias, which then applies a ﬂat-bottom potential as a function of the colvar value. This bias will aﬀect the extended coordinate distribution near the walls. If bypassExtendedLagrangian is disabled, harmonicWalls applies a ﬂat-bottom 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 diﬀerent force constants.

harmonicWalls {

name mywalls

colvars dist

lowerWalls 22.0

upperWalls 38.0

lowerWallConstant 2.0

upperWallConstant 10.0

}

Example 2: harmonic walls for two variables with a single force constant.

harmonicWalls {

name mywalls

colvars phi psi

lowerWalls -180.0 0.0

upperWalls 0.0 180.0

forceConstant 5.0

}

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 speciﬁcally for the center of the CV. This force constant may be found by using experiment directed simulation described in section 6.9. Please cite Pitera and Chodera when using [36].

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword forceConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Scaled
force constant (kcal/mol)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: linear

Acceptable values: positive decimal

Default value: 1.0

Description: This option deﬁnes a scaled force constant for the linear bias. To ensure consistency for multidimensional restraints, it is divided internally by the speciﬁc width of each variable (which is 1 by default), so that all variables are eﬀectively dimensionless and of commensurate size. See also the equivalent keyword for the harmonic restraint, forceConstant. The values of the actual force constants $k\u2215{w}_{\xi}$ are always printed when the restraint is deﬁned. - Keyword centers$\u27e8\phantom{\rule{0.3em}{0ex}}$Initial
linear restraint centers$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: linear

Acceptable values: space-separated list of colvar values

Description: These are analogous to the centers keyword of the harmonic restraint. Although they do not aﬀect dynamics, they are here necessary to ensure a well-deﬁned energy for the linear bias. - Keyword writeTIPMF: see deﬁnition of writeTIPMF in sec. 6 (biasing and analysis methods)
- Keyword writeTISamples: see deﬁnition of writeTISamples in sec. 6 (biasing and analysis methods)
- Keyword targetForceConstant: see deﬁnition of targetForceConstant in sec. 6.5 (Harmonic restraints)
- Keyword targetNumSteps: see deﬁnition of targetNumSteps in sec. 6.5 (Harmonic restraints)
- Keyword targetForceExponent: see deﬁnition of targetForceExponent in sec. 6.5 (Harmonic restraints)
- Keyword targetEquilSteps: see deﬁnition of targetEquilSteps in sec. 6.5 (Harmonic restraints)
- Keyword targetNumStages: see deﬁnition of targetNumStages in sec. 6.5 (Harmonic restraints)
- Keyword lambdaSchedule: see deﬁnition of lambdaSchedule in sec. 6.5 (Harmonic restraints)
- Keyword outputAccumulatedWork: see deﬁnition of outputAccumulatedWork in sec. 6.5 (Harmonic restraints)

Experiment directed simulation applies a linear bias with a changing force constant. Please cite White and Voth [37] 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 ﬁle, and then apply a linear bias with that constant. All the notes about units described in sections 6.8 and 6.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.

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword centers$\u27e8\phantom{\rule{0.3em}{0ex}}$Collective
variable centers$\phantom{\rule{0.3em}{0ex}}\u27e9$

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. - Keyword updateFrequency$\u27e8\phantom{\rule{0.3em}{0ex}}$The
duration of updates$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alb

Acceptable values: An integer

Description: This is, $N$, 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 ($N\u22152$), how long statistics are collected for an iteration ($N\u22152$), and how quickly energy is added to the system (at most, $A\u22152N$, where $A$ 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, $N$ should be at least twice the autocorrelation time of the collective variable. The system should also be able to dissipate energy as fast as $N\u22152$, which can be done by adjusting thermostat parameters. Practically, $N$ has been tested successfully at signiﬁcantly shorter than the autocorrelation time of the collective variables being biased and still converge correctly. - Keyword forceRange$\u27e8\phantom{\rule{0.3em}{0ex}}$The
expected range of the force constant in units of energy$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: alb

Acceptable values: A space-separated list of decimal numbers

Default value: 3 ${k}_{b}T$

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 ${k}_{b}T$ has worked well in the systems presented as a ﬁrst choice. This parameter is dynamically adjusted over the course of a simulation. The beneﬁt 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 - Keyword rateMax$\u27e8\phantom{\rule{0.3em}{0ex}}$The
maximum rate of change of force constant$\phantom{\rule{0.3em}{0ex}}\u27e9$

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.

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

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputFreq: see deﬁnition of outputFreq in sec. 6 (biasing and analysis methods)
- Keyword stepZeroData: see deﬁnition of stepZeroData in sec. 6 (biasing and analysis methods)
- Keyword outputFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the histogram to a ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogram

Acceptable values: UNIX ﬁlename

Default value: outputName.$<$name$>$.dat

Description: Name of the ﬁle 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 ﬁle. If outputFile is set to none, the ﬁle is not written. - Keyword outputFileDX$\u27e8\phantom{\rule{0.3em}{0ex}}$Write
the histogram to a ﬁle$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogram

Acceptable values: UNIX ﬁlename

Default value: outputName.$<$name$>$.dx

Description: Name of the ﬁle 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 ﬁle. This ﬁle is written by default if the dimension is 3 or more. If outputFileDX is set to none, the ﬁle is not written. - Keyword gatherVectorColvars$\u27e8\phantom{\rule{0.3em}{0ex}}$Treat
vector variables as multiple observations of a scalar variable?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogram

Acceptable values: UNIX ﬁlename

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 $\xi $, $\lambda $ and $\tau $ are three variables of dimensions 5, 5 and 1, respectively, for each iteration 5 triplets $\left({\xi}_{i},{\lambda}_{i},\tau \right)$ ($i=1,\dots 5$) are accumulated into a 3-dimensional histogram. - Keyword weights$\u27e8\phantom{\rule{0.3em}{0ex}}$Treat
vector variables as multiple observations of a scalar variable?$\phantom{\rule{0.3em}{0ex}}\u27e9$

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 diﬀerent weight. For example, if $x$ and $y$ are two distinct cartesian variables deﬁned on the same group of atoms, the corresponding 2D histogram can be weighted on a per-atom basis in the deﬁnition of histogram.

As with any other biasing and analysis method, when a histogram is applied to an extended-system colvar (4.20), it accesses the value of the extended coordinate rather than that of the actual colvar. This can be overridden by enabling the bypassExtendedLagrangian 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 ﬁrst instance will be understood as the actual colvar, and the second, as the extended coordinate.

- Keyword bypassExtendedLagrangian: see deﬁnition of bypassExtendedLagrangian in sec. 6 (biasing and analysis methods)

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

- Keyword lowerBoundaries$\u27e8\phantom{\rule{0.3em}{0ex}}$Lower
boundaries of the grid$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramGrid

Acceptable values: list of space-separated decimals

Description: This option deﬁnes the lower boundaries of the grid, overriding any values deﬁned 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. - Keyword upperBoundaries: analogous to lowerBoundaries
- Keyword widths: analogous to lowerBoundaries

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

$$V\left({\xi}_{1},\dots ,{\xi}_{M}\right)=\frac{1}{2}k\int {\left(h\left(\xi \right)-{h}_{0}\left(\xi \right)\right)}^{2}\mathrm{d}\xi $$ | (41) |

$$h\left(\xi \right)=\frac{1}{M\sqrt{2\pi {\sigma}^{2}}}\sum _{i=1}^{M}exp\left(-\frac{{\left(\xi -{\xi}_{i}\right)}^{2}}{2{\sigma}^{2}}\right)$$ | (42) |

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

This bias behaves similarly to the histogram bias with the gatherVectorColvars option, with the important diﬀerence 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:

- Keyword name: see deﬁnition of name in sec. 6 (biasing and analysis methods)
- Keyword colvars: see deﬁnition of colvars in sec. 6 (biasing and analysis methods)
- Keyword outputEnergy: see deﬁnition of outputEnergy in sec. 6 (biasing and analysis methods)
- Keyword lowerBoundary$\u27e8\phantom{\rule{0.3em}{0ex}}$Lower
boundary of the colvar grid$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: decimal

Description: Deﬁnes the lowest end of the interval where the reference distribution ${h}_{0}\left(\xi \right)$ is deﬁned. Exactly one value must be provided, because only one-dimensional histograms are supported by the current version. - Keyword upperBoundary: analogous to lowerBoundary
- Keyword width$\u27e8\phantom{\rule{0.3em}{0ex}}$Width
of the colvar grid$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: positive decimal

Description: Deﬁnes the spacing of the grid where the reference distribution ${h}_{0}\left(\xi \right)$ is deﬁned. - Keyword gaussianSigma$\u27e8\phantom{\rule{0.3em}{0ex}}$Standard
deviation of the approximating Gaussian$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: positive decimal

Default value: 2 $\times $ width

Description: Deﬁnes the parameter $\sigma $ in eq. 42. - Keyword forceConstant$\u27e8\phantom{\rule{0.3em}{0ex}}$Force
constant (kcal/mol)$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: positive decimal

Default value: 1.0

Description: Deﬁnes the parameter $k$ in eq. 41. - Keyword refHistogram$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
histogram ${h}_{0}\left(\xi \right)$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: space-separated list of $M$ positive decimals

Description: Provides the values of ${h}_{0}\left(\xi \right)$ consecutively. The mid-point convention is used, i.e. the ﬁrst point that should be included is for $\xi $ = lowerBoundary+width/2. If the integral of ${h}_{0}\left(\xi \right)$ is not normalized to 1, ${h}_{0}\left(\xi \right)$ is rescaled automatically before use. - Keyword refHistogramFile$\u27e8\phantom{\rule{0.3em}{0ex}}$Reference
histogram ${h}_{0}\left(\xi \right)$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: histogramRestraint

Acceptable values: UNIX ﬁle name

Description: Provides the values of ${h}_{0}\left(\xi \right)$ as contents of the corresponding ﬁle (mutually exclusive with refHistogram). The format is that of a text ﬁle, with each line containing the space-separated values of $\xi $ and ${h}_{0}\left(\xi \right)$. The same numerical conventions as refHistogram are used. - Keyword writeHistogram$\u27e8\phantom{\rule{0.3em}{0ex}}$Periodically
write the instantaneous histogram $h\left(\xi \right)$$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: metadynamics

Acceptable values: boolean

Default value: off

Description: If on, the histogram $h\left(\xi \right)$ is written every colvarsRestartFrequency steps to a ﬁle with the name outputName.$<$name$>$.hist.dat This is useful to diagnose the convergence of $h\left(\xi \right)$ against ${h}_{0}\left(\xi \right)$.

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.

- Keyword scriptedColvarForces$\u27e8\phantom{\rule{0.3em}{0ex}}$Enable
custom, scripted forces on colvars $\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: boolean

Default value: off

Description: If this ﬂag is enabled, a Tcl procedure named calc_colvar_forces accepting one parameter should be deﬁned 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), eﬀectively deﬁning custom collective variable 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 multi-component variables using polynomial combinations (see 4.15), or custom functions (see 4.16), or scripted functions (see 4.17);
- distribute the computation of all biases across available threads;
- compute on a single thread any scripted biases implemented via the keyword scriptedColvarForces.
- communicate on a single thread forces to NAMD.

The following options allow to ﬁne-tune this schedule:

- Keyword scriptingAfterBiases$\u27e8\phantom{\rule{0.3em}{0ex}}$Scripted
colvar forces need updated biases?$\phantom{\rule{0.3em}{0ex}}\u27e9$

Context: global

Acceptable values: boolean

Default value: on

Description: This ﬂag speciﬁes that the calc_colvar_forces procedure (last step in the list above) is executed only after all biases have been updated (next-to-last 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 ﬂag 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.

This section lists all the commands used in NAMD to control the behavior of the Colvars module from within a run script.

- cv addenergy

Add an energy to the MD engine (no effect in VMD)

Parameters

E : float - Amount of energy to add - cv config

Read configuration from the given string

Parameters

conf : string - Configuration string - cv configfile
_file>

Read configuration from a file

Parameters

conf_file : string - Path to configuration file - cv delete

Delete this Colvars module instance (VMD only) - cv frame [frame]

Get or set current frame number (VMD only)

Parameters

frame : integer - Frame number (optional) - cv getconfig

Get the module's configuration string read so far - cv getenergy

Get the current Colvars energy - cv help [command]

Get the help string of the Colvars scripting interface

Parameters

command : string - Get the help string of this specific command (optional) - cv list [param]

Return a list of all variables or biases

Parameters

param : string - "colvars" or "biases"; default is "colvars" (optional) - cv listcommands

Get the list of script functions, prefixed with "cv_", "colvar_" or "bias_" - cv load

Load data from a state file into all matching colvars and biases

Parameters

prefix : string - Path to existing state file or input prefix - cv loadfromstring

Load state data from a string into all matching colvars and biases

Parameters

buffer : string - String buffer containing the state information - cv molid [molid]

Get or set the molecule ID on which Colvars is defined (VMD only)

Parameters

molid : integer - Molecule ID; -1 means undefined (optional) - cv printframe

Return the values that would be written to colvars.traj - cv printframelabels

Return the labels that would be written to colvars.traj - cv reset

Delete all internal configuration - cv resetindexgroups

Clear the index groups loaded so far, allowing to replace them - cv save

Change the prefix of all output files and save them

Parameters

prefix : string - Output prefix with trailing ".colvars.state" gets removed) - cv savetostring

Write the Colvars state to a string and return it - cv units [units]

Get or set the current Colvars unit system

Parameters

units : string - The new unit system (optional) - cv update

Recalculate colvars and biases - cv version

Get the Colvars Module version number

- cv colvar name addforce

Apply the given force onto this colvar and return the same

Parameters

force : float or array - Applied force; must match colvar dimensionality - cv colvar name cvcflags

Enable or disable individual components by setting their active flags

Parameters

flags : integer array - Zero/nonzero value disables/enables the CVC - cv colvar name delete

Delete this colvar, along with all biases that depend on it - cv colvar name get

Get the value of the given feature for this colvar

Parameters

feature : string - Name of the feature - cv colvar name getappliedforce

Return the total of the forces applied to this colvar - cv colvar name getatomgroups

Return the atom indices used by this colvar as a list of lists - cv colvar name getatomids

Return the list of atom indices used by this colvar - cv colvar name getconfig

Return the configuration string of this colvar - cv colvar name getgradients

Return the atomic gradients of this colvar - cv colvar name gettotalforce

Return the sum of internal and external forces to this colvar - cv colvar name help [command]

Get a help summary or the help string of one colvar subcommand

Parameters

command : string - Get the help string of this specific command (optional) - cv colvar name modifycvcs

Modify configuration of individual components by passing string arguments

Parameters

confs : sequence of strings - New configurations; empty strings are skipped - cv colvar name run_ave

Get the current running average of the value of this colvar - cv colvar name set

Set the given feature of this colvar to a new value

Parameters

feature : string - Name of the feature

value : string - String representation of the new feature value - cv colvar name state

Print a string representation of the feature state of this colvar - cv colvar name type

Get the type description of this colvar - cv colvar name update

Recompute this colvar and return its up-to-date value - cv colvar name value

Get the current value of this colvar - cv colvar name width

Get the width of this colvar

- cv bias name bin

Get the current grid bin index (1D ABF only for now) - cv bias name bincount [index]

Get the number of samples at the given grid bin (1D ABF only for now)

Parameters

index : integer - Grid index; defaults to current bin (optional) - cv bias name binnum

Get the total number of grid points of this bias (1D ABF only for now) - cv bias name delete

Delete this bias - cv bias name energy

Get the current energy of this bias - cv bias name get

Get the value of the given feature for this bias

Parameters

feature : string - Name of the feature - cv bias name getconfig

Return the configuration string of this bias - cv bias name help [command]

Get a help summary or the help string of one bias subcommand

Parameters

command : string - Get the help string of this specific command (optional) - cv bias name load

Load data into this bias

Parameters

prefix : string - Read from a file with this name or prefix - cv bias name loadfromstring

Load state data into this bias from a string

Parameters

buffer : string - String buffer containing the state information - cv bias name save

Save data from this bias into a file with the given prefix

Parameters

prefix : string - Prefix for the state file of this bias - cv bias name savetostring

Save data from this bias into a string and return it - cv bias name set

Set the given feature of this bias to a new value

Parameters

feature : string - Name of the feature

value : string - String representation of the new feature value - cv bias name share

Share bias information with other replicas (multiple-walker scheme) - cv bias name state

Print a string representation of the feature state of this bias - cv bias name update

Recompute this bias and return its up-to-date energy

The following is a list of syntax changes in Colvars since its ﬁrst release. Many of the older keywords are still recognized by the current code, thanks to speciﬁc compatibility code. This is not a list of new features: its primary purpose is to make you aware of those improvements that aﬀect the use of old conﬁguration ﬁles with new versions of the code.

Note: if you are using any of the NAMD and VMD tutorials:

https://www.ks.uiuc.edu/Training/Tutorials/

please be aware that several of these tutorials are not actively maintained: for those cases, this list will help you
reconcile any inconsistencies.

- Colvars version 2016-06-09 or later (NAMD version 2.12b1 or later).

The legacy keyword refPositionsGroup has been renamed fittingGroup for clarity (the legacy version is still supported). - Colvars version 2016-08-10 or later (NAMD version 2.12b1 or later).

“System forces” have been replaced by “total forces” (see for example outputTotalForce). See the following page for more information:

https://colvars.github.io/README-totalforce.html - Colvars version 2017-01-09 or later (NAMD version 2.13b1 or later).

A new type of restraint, harmonicWalls (see 6.7), replaces and improves upon the legacy keywords lowerWall and upperWall: these are still supported as short-hands. - Colvars version 2018-11-15 or later (NAMD version 2.14b1 or later).

The global analysis keyword has been discontinued: speciﬁc analysis tasks are controlled directly by the keywords corrFunc and runAve, which continue to remain off by default. - Colvars version 2020-02-25 or later (NAMD version 2.14b1 or later).

The parameter hillWidth, expressing the Gaussian width $2\sigma $ in relative units (number of grid points), does not have a default value any more. A new alternative parameter gaussianSigmas allows setting the $\sigma $ parameters explicitly for each variable if needed.

Furthermore, to facilitate the use of other analysis tools such as for example sum_hills:

https://www.plumed.org/doc-v2.6/user-doc/html/sum hills.html_

the format of the ﬁle written by writeHillsTrajectory has also been changed to use $\sigma $ instead of $2\sigma $. This change does not aﬀect how the biasing potential is written in the state ﬁle, or the simulated trajectory. - Colvars version 2020-02-25 or later (NAMD version 2.14b1 or later).

The legacy keywords lowerWall and upperWall of a colvar deﬁnition block do not have default values any longer, and need to be set explicitly, preferably as part of the harmonicWalls restraint. When using an ABF bias, it is recommended to set the two walls equal to lowerBoundary and upperBoundary, respectively. When using a metadynamics bias, it is recommended to set the two walls strictly within lowerBoundary and upperBoundary; see 6.4.1 for details.

Up-to-date documentation can always be accessed at:

https://colvars.github.io/colvars-refman-namd/colvars-refman-namd.html

The Colvars module is typically built using the recipes of each supported software package: for this reason, no installation instructions are needed, and the vast majority of the features described in this manual are supported in the most common builds of each package. This section lists the few cases where the choice of compilation settings aﬀects features in the Colvars module.

- Scripting commands using the Tcl language (https://www.tcl.tk) are supported in VMD and NAMD. All precompiled builds of each code include Tcl, and it is highly recommended to enable Tcl support in any custom build, using precompiled Tcl libraries from the UIUC website.
- The Lepton library (https://simtk.org/projects/lepton) used to implement the customFunction feature is currently included only in NAMD (always on) and in LAMMPS (on by default).
- Some features require compilation using the C++11 language standard. Although it is becoming
commonplace, this standard is not yet available on all scientiﬁc computing systems. Deailed
information can be found at:

https://colvars.github.io/README-c++11.html

abf

CZARestimator, 73

UIestimator, 74

applyBias, 69

colvars, 68

fullSamples, 68

hideJacobian, 69

historyFreq, 69

inputPrefix, 69

maxForce, 68

name, 68

outputEnergy, 68

outputFreq, 68

sharedFreq, 70

shared, 70

stepZeroData, 68

updateBias, 69

writeCZARwindowFile, 73

alb

centers, 91

colvars, 91

forceRange, 92

name, 91

rateMax, 92

updateFrequency, 92

alpha

angleRef, 32

angleTol, 32

hBondCoeff, 31

hBondCutoff, 32

hBondExpDenom, 32

hBondExpNumer, 32

psfSegID, 31

residueRange, 31

angle

forceNoPBC, 19

group1, 19

group2, 19

group3, 19

oneSiteTotalForce, 19

angle, dipoleAngle, dihedral

oneSiteTotalForce, 16

aspathCV and azpathCV

lambda, 39

pathFile, 39

weights, 38

cartesian

atoms, 33

colvar

corrFuncLength, 55

corrFuncNormalize, 55

corrFuncOffset, 55

corrFuncOutputFile, 55

corrFuncStride, 55

corrFuncType, 54

corrFuncWithColvar, 54

corrFunc, 54

customFunctionType, 46

customFunction, 46

expandBoundaries, 49

extendedFluctuation, 53

extendedLagrangian, 52

extendedLangevinDamping, 53

extendedTemp, 53

extendedTimeConstant, 53

hardLowerBoundary, 49

hardUpperBoundary, 49

lowerBoundary, 49

lowerWalls, 88

name, 13

outputAppliedForce, 52

outputEnergy, 51

outputTotalForce, 52

outputValue, 51

outputVelocity, 51

runAveLength, 55

runAveOutputFile, 56

runAveStride, 55

runAve, 55

scriptedFunctionType, 48

scriptedFunctionVectorSize, 48

scriptedFunction, 48

subtractAppliedForce, 54

timeStepFactor, 53

upperBoundary, 49

upperWalls, 88

width, 48

coordNum

cutoff3, 21

cutoff, 21

expDenom, 21

expNumer, 21

group1, 21

group2CenterOnly, 21

group2, 21

pairListFrequency, 22

tolerance, 21

dihedralPC

psfSegID, 33

residueRange, 33

vectorFile, 33

vectorNumber, 33

dihedral

forceNoPBC, 20

group1, 19

group2, 19

group3, 19

group4, 19

oneSiteTotalForce, 20

dipoleAngle

forceNoPBC, 19

group1, 19

group2, 19

group3, 19

oneSiteTotalForce, 19

dipoleMagnitude

atoms, 27

distanceDir

forceNoPBC, 18

group1, 18

group2, 18

oneSiteTotalForce, 18

distanceInv

exponent, 18

group1, 18

group2, 18

oneSiteTotalForce, 18

distancePairs

forceNoPBC, 33

group1, 33

group2, 33

distanceVec

forceNoPBC, 17

group1, 17

group2, 17

oneSiteTotalForce, 17

distanceXY

axis, 17

forceNoPBC, 17

main, 17

ref2, 17

ref, 17

distanceZ

axis, 16

forceNoPBC, 16

main, 16

oneSiteTotalForce, 17

ref2, 16

ref, 16

distanceZ, dihedral, spinAngle, custom colvars

wrapAround, 44

distanceZ, custom colvars

period, 44

distance

forceNoPBC, 15

group1, 15

group2, 15

eigenvector

atoms, 26

differenceVector, 26

refPositionsColValue, 26

refPositionsCol, 26

refPositionsFile, 26

refPositions, 26

vectorColValue, 26

vectorCol, 26

vectorFile, 26

vector, 26

gspathCV and gzpathCV

pathFile, 37

useSecondClosestFrame, 36

useThirdClosestFrame, 36

gspath and gspath

fittingAtoms, 35

gspath and gzpath

atoms, 34

refPositionsCol, 34

refPositionsFileN, 34

useSecondClosestFrame, 35

useThirdClosestFrame, 35

gyration

atoms, 27

gzpathCV

useZsquare, 37

gzpath

useZsquare, 35

hBond

acceptor, 23

cutoff, 23

donor, 23

expDenom, 23

expNumer, 23

harmonicWalls

bypassExtendedLagrangian, 89

colvars, 88

forceConstant, 88

lambdaSchedule, 89

lowerWallConstant, 89

name, 88

outputAccumulatedWork, 89

outputEnergy, 88

stepZeroData, 88

targetEquilSteps, 89

targetForceConstant, 89

targetForceExponent, 89

targetNumStages, 89

targetNumSteps, 89

upperWallConstant, 89

writeTIPMF, 88

writeTISamples, 88

harmonic

centers, 85

colvars, 84

forceConstant, 84

lambdaSchedule, 87

name, 84

outputAccumulatedWork, 87

outputCenters, 86

outputEnergy, 84

stepZeroData, 84

targetCenters, 85

targetEquilSteps, 87

targetForceConstant, 86

targetForceExponent, 87

targetNumStages, 86

targetNumSteps, 85

writeTIPMF, 84

writeTISamples, 84

histogramGrid

lowerBoundaries, 94

upperBoundaries, 94

widths, 94

histogramRestraint

colvars, 94

forceConstant, 95

gaussianSigma, 95

lowerBoundary, 94

name, 94

outputEnergy, 94

refHistogramFile, 95

refHistogram, 95

upperBoundary, 95

width, 95

histogram

bypassExtendedLagrangian, 93

colvars, 92

gatherVectorColvars, 93

name, 92

outputFileDX, 93

outputFile, 92

outputFreq, 92

stepZeroData, 92

weights, 93

inertiaZ

atoms, 28

axis, 28

inertia

atoms, 27

linear

centers, 90

colvars, 90

forceConstant, 90

lambdaSchedule, 91

name, 90

outputAccumulatedWork, 91

outputEnergy, 90

targetEquilSteps, 91

targetForceConstant, 91

targetForceExponent, 91

targetNumStages, 91

targetNumSteps, 91

writeTIPMF, 91

writeTISamples, 91

mapTotal

mapName, 41

metadynamics

biasTemperature, 82

colvars, 77

ebMetaEquilSteps, 80

ebMeta, 80

gaussianSigmas, 77

hillWeight, 77

hillWidth, 77

keepFreeEnergyFiles, 78

keepHills, 79

multipleReplicas, 83

name, 77

newHillFrequency, 78

outputEnergy, 77

outputFreq, 77

rebinGrids, 79

replicaID, 83

replicaUpdateFrequency, 83

replicasRegistry, 83

stepZeroData, 77

targetDistFile, 80

targetDistMinVal, 80

useGrids, 79

wellTempered, 81

writeFreeEnergyFile, 78

writeHillsTrajectory, 78

writeHistogram, 95

writePartialFreeEnergyFile, 83

writeTIPMF, 77

writeTISamples, 77

orientationAngle

atoms, 29

refPositionsColValue, 29

refPositionsCol, 29

refPositionsFile, 29

refPositions, 29

orientationProj

atoms, 29

refPositionsColValue, 29

refPositionsCol, 29

refPositionsFile, 29

refPositions, 29

orientation

atoms, 28

closestToQuaternion, 28

refPositionsColValue, 28

refPositionsCol, 28

refPositionsFile, 28

refPositions, 28

polarPhi

atoms, 20

rmsd

atomPermutation, 24

atoms, 24

refPositionsColValue, 24

refPositionsCol, 24

refPositionsFile, 24

refPositions, 24

selfCoordNum

cutoff3, 22

cutoff, 22

expDenom, 22

expNumer, 22

group1, 22

pairListFrequency, 22

tolerance, 22

spinAngle

atoms, 30

refPositionsColValue, 30

refPositionsCol, 30

refPositionsFile, 30

refPositions, 30

tilt

atoms, 30

axis, 30, 31

refPositionsColValue, 30

refPositionsCol, 30

refPositionsFile, 30

refPositions, 30

CZARestimator, 73

UIestimator, 74

applyBias, 69

colvars, 68

fullSamples, 68

hideJacobian, 69

historyFreq, 69

inputPrefix, 69

maxForce, 68

name, 68

outputEnergy, 68

outputFreq, 68

sharedFreq, 70

shared, 70

stepZeroData, 68

updateBias, 69

writeCZARwindowFile, 73

alb

centers, 91

colvars, 91

forceRange, 92

name, 91

rateMax, 92

updateFrequency, 92

alpha

angleRef, 32

angleTol, 32

hBondCoeff, 31

hBondCutoff, 32

hBondExpDenom, 32

hBondExpNumer, 32

psfSegID, 31

residueRange, 31

angle

forceNoPBC, 19

group1, 19

group2, 19

group3, 19

oneSiteTotalForce, 19

angle, dipoleAngle, dihedral

oneSiteTotalForce, 16

aspathCV and azpathCV

lambda, 39

pathFile, 39

weights, 38

cartesian

atoms, 33

colvar

corrFuncLength, 55

corrFuncNormalize, 55

corrFuncOffset, 55

corrFuncOutputFile, 55

corrFuncStride, 55

corrFuncType, 54

corrFuncWithColvar, 54

corrFunc, 54

customFunctionType, 46

customFunction, 46

expandBoundaries, 49

extendedFluctuation, 53

extendedLagrangian, 52

extendedLangevinDamping, 53

extendedTemp, 53

extendedTimeConstant, 53

hardLowerBoundary, 49

hardUpperBoundary, 49

lowerBoundary, 49

lowerWalls, 88

name, 13

outputAppliedForce, 52

outputEnergy, 51

outputTotalForce, 52

outputValue, 51

outputVelocity, 51

runAveLength, 55

runAveOutputFile, 56

runAveStride, 55

runAve, 55

scriptedFunctionType, 48

scriptedFunctionVectorSize, 48

scriptedFunction, 48

subtractAppliedForce, 54

timeStepFactor, 53

upperBoundary, 49

upperWalls, 88

width, 48

coordNum

cutoff3, 21

cutoff, 21

expDenom, 21

expNumer, 21

group1, 21

group2CenterOnly, 21

group2, 21

pairListFrequency, 22

tolerance, 21

dihedralPC

psfSegID, 33

residueRange, 33

vectorFile, 33

vectorNumber, 33

dihedral

forceNoPBC, 20

group1, 19

group2, 19

group3, 19

group4, 19

oneSiteTotalForce, 20

dipoleAngle

forceNoPBC, 19

group1, 19

group2, 19

group3, 19

oneSiteTotalForce, 19

dipoleMagnitude

atoms, 27

distanceDir

forceNoPBC, 18

group1, 18

group2, 18

oneSiteTotalForce, 18

distanceInv

exponent, 18

group1, 18

group2, 18

oneSiteTotalForce, 18

distancePairs

forceNoPBC, 33

group1, 33

group2, 33

distanceVec

forceNoPBC, 17

group1, 17

group2, 17

oneSiteTotalForce, 17

distanceXY

axis, 17

forceNoPBC, 17

main, 17

ref2, 17

ref, 17

distanceZ

axis, 16

forceNoPBC, 16

main, 16

oneSiteTotalForce, 17

ref2, 16

ref, 16

distanceZ, dihedral, spinAngle, custom colvars

wrapAround, 44

distanceZ, custom colvars

period, 44

distance

forceNoPBC, 15

group1, 15

group2, 15

eigenvector

atoms, 26

differenceVector, 26

refPositionsColValue, 26

refPositionsCol, 26

refPositionsFile, 26

refPositions, 26

vectorColValue, 26

vectorCol, 26

vectorFile, 26

vector, 26

gspathCV and gzpathCV

pathFile, 37

useSecondClosestFrame, 36

useThirdClosestFrame, 36

gspath and gspath

fittingAtoms, 35

gspath and gzpath

atoms, 34

refPositionsCol, 34

refPositionsFileN, 34

useSecondClosestFrame, 35

useThirdClosestFrame, 35

gyration

atoms, 27

gzpathCV

useZsquare, 37

gzpath

useZsquare, 35

hBond

acceptor, 23

cutoff, 23

donor, 23

expDenom, 23

expNumer, 23

harmonicWalls

bypassExtendedLagrangian, 89

colvars, 88

forceConstant, 88

lambdaSchedule, 89

lowerWallConstant, 89

name, 88

outputAccumulatedWork, 89

outputEnergy, 88

stepZeroData, 88

targetEquilSteps, 89

targetForceConstant, 89

targetForceExponent, 89

targetNumStages, 89

targetNumSteps, 89

upperWallConstant, 89

writeTIPMF, 88

writeTISamples, 88

harmonic

centers, 85

colvars, 84

forceConstant, 84

lambdaSchedule, 87

name, 84

outputAccumulatedWork, 87

outputCenters, 86

outputEnergy, 84

stepZeroData, 84

targetCenters, 85

targetEquilSteps, 87

targetForceConstant, 86

targetForceExponent, 87

targetNumStages, 86

targetNumSteps, 85

writeTIPMF, 84

writeTISamples, 84

histogramGrid

lowerBoundaries, 94

upperBoundaries, 94

widths, 94

histogramRestraint

colvars, 94

forceConstant, 95

gaussianSigma, 95

lowerBoundary, 94

name, 94

outputEnergy, 94

refHistogramFile, 95

refHistogram, 95

upperBoundary, 95

width, 95

histogram

bypassExtendedLagrangian, 93

colvars, 92

gatherVectorColvars, 93

name, 92

outputFileDX, 93

outputFile, 92

outputFreq, 92

stepZeroData, 92

weights, 93

inertiaZ

atoms, 28

axis, 28

inertia

atoms, 27

linear

centers, 90

colvars, 90

forceConstant, 90

lambdaSchedule, 91

name, 90

outputAccumulatedWork, 91

outputEnergy, 90

targetEquilSteps, 91

targetForceConstant, 91

targetForceExponent, 91

targetNumStages, 91

targetNumSteps, 91

writeTIPMF, 91

writeTISamples, 91

mapTotal

mapName, 41

metadynamics

biasTemperature, 82

colvars, 77

ebMetaEquilSteps, 80

ebMeta, 80

gaussianSigmas, 77

hillWeight, 77

hillWidth, 77

keepFreeEnergyFiles, 78

keepHills, 79

multipleReplicas, 83

name, 77

newHillFrequency, 78

outputEnergy, 77

outputFreq, 77

rebinGrids, 79

replicaID, 83

replicaUpdateFrequency, 83

replicasRegistry, 83

stepZeroData, 77

targetDistFile, 80

targetDistMinVal, 80

useGrids, 79

wellTempered, 81

writeFreeEnergyFile, 78

writeHillsTrajectory, 78

writeHistogram, 95

writePartialFreeEnergyFile, 83

writeTIPMF, 77

writeTISamples, 77

orientationAngle

atoms, 29

refPositionsColValue, 29

refPositionsCol, 29

refPositionsFile, 29

refPositions, 29

orientationProj

atoms, 29

refPositionsColValue, 29

refPositionsCol, 29

refPositionsFile, 29

refPositions, 29

orientation

atoms, 28

closestToQuaternion, 28

refPositionsColValue, 28

refPositionsCol, 28

refPositionsFile, 28

refPositions, 28

polarPhi

atoms, 20

rmsd

atomPermutation, 24

atoms, 24

refPositionsColValue, 24

refPositionsCol, 24

refPositionsFile, 24

refPositions, 24

selfCoordNum

cutoff3, 22

cutoff, 22

expDenom, 22

expNumer, 22

group1, 22

pairListFrequency, 22

tolerance, 22

spinAngle

atoms, 30

refPositionsColValue, 30

refPositionsCol, 30

refPositionsFile, 30

refPositions, 30

tilt

atoms, 30

axis, 30, 31

refPositionsColValue, 30

refPositionsCol, 30

refPositionsFile, 30

refPositions, 30

any component

componentCoeff, 45

componentExp, 45

name, 43

scalable, 43

atom group

atomNameResidueRange, 58

atomNumbersRange, 58

atomNumbers, 58

atomsColValue, 59

atomsCol, 59

atomsFile, 58

atomsOfGroup, 58

centerReference, 60

dummyAtom, 59

enableFitGradients, 61

enableForces, 62

fittingGroup, 61

indexGroup, 58

name, 57

psfSegID, 58

refPositionsColValue, 61

refPositionsCol, 60

refPositionsFile, 60

refPositions, 60

rotateReference, 60

colvar bias

bypassExtendedLagrangian, 65

colvars, 64

name, 64

outputEnergy, 64

outputFreq, 64

stepZeroData, 65

writeTIPMF, 65

writeTISamples, 65

global

colvarsRestartFrequency, 9

colvarsTrajFrequency, 9

indexFile, 10

scriptedColvarForces, 95

scriptingAfterBiases, 96

smp, 10

units, 4

NAMD conﬁguration ﬁle

colvarsConfig, 4

colvarsInput, 5

colvars, 4

[1] G. Fiorin, M. L. Klein, and J. Hénin. Using collective variables to drive molecular dynamics simulations. Mol. Phys., 111(22-23):3345–3362, 2013.

[2] M. Iannuzzi, A. Laio, and M. Parrinello. Eﬃcient exploration of reactive potential energy surfaces using car-parrinello molecular dynamics. Phys. Rev. Lett., 90(23):238302, 2003.

[3] E A Coutsias, C Seok, and K A Dill. Using quaternions to calculate RMSD. J. Comput. Chem., 25(15):1849–1857, 2004.

[4] Yuguang Mu, Phuong H. Nguyen, and Gerhard Stock. Energy landscape of a small peptide revealed by dihedral angle principal component analysis. Proteins, 58(1):45–52, 2005.

[5] Alexandros Altis, Phuong H. Nguyen, Rainer Hegger, and Gerhard Stock. Dihedral angle principal component analysis of molecular dynamics simulations. J. Chem. Phys., 126(24):244111, 2007.

[6] Nicholas M Glykos. Carma: a molecular dynamics analysis program. J. Comput. Chem., 27(14):1765–1768, 2006.

[7] G. D. Leines and B. Ensing. Path ﬁnding on high-dimensional free energy landscapes. Phys. Rev. Lett., 109:020601, 2012.

[8] Davide Branduardi, Francesco Luigi Gervasio, and Michele Parrinello. From a to b in free energy space. J Chem Phys, 126(5):054103, 2007.

[9] F. Comitani L. Hovan and F. L. Gervasio. Deﬁning an optimal metric for the path collective variables. J. Chem. Theory Comput., 15:25–32, 2019.

[10] Giacomo Fiorin, Fabrizio Marinelli, and José D. Faraldo-Gómez. Direct derivation of free energies of membrane deformation and other solvent density variations from enhanced sampling molecular dynamics. J. Comp. Chem., 41(5):449–459, 2020.

[11] Marco Jacopo Ferrarotti, Sandro Bottaro, Andrea Pérez-Villa, and Giovanni Bussi. Accurate multiple time step in biased molecular simulations. Journal of chemical theory and computation, 11:139–146, 2015.

[12] Reza Salari, Thomas Joseph, Ruchi Lohia, Jérôme Hénin, and Grace Brannigan. A streamlined, general approach for computing ligand binding free energies and its application to GPCR-bound cholesterol. Journal of Chemical Theory and Computation, 14(12):6560–6573, 2018.

[13] Eric Darve, David Rodríguez-Gómez, and Andrew Pohorille. Adaptive biasing force method for scalar and vector free energy calculations. J. Chem. Phys., 128(14):144120, 2008.

[14] J. Hénin and C. Chipot. Overcoming free energy barriers using unconstrained molecular dynamics simulations. J. Chem. Phys., 121:2904–2914, 2004.

[15] J. Hénin, G. Fiorin, C. Chipot, and M. L. Klein. Exploring multidimensional free energy landscapes using time-dependent biases on collective variables. J. Chem. Theory Comput., 6(1):35–47, 2010.

[16] A. Carter, E, G. Ciccotti, J. T. Hynes, and R. Kapral. Constrained reaction coordinate dynamics for the simulation of rare events. Chem. Phys. Lett., 156:472–477, 1989.

[17] M. J. Ruiz-Montero, D. Frenkel, and J. J. Brey. Eﬃcient schemes to compute diﬀusive barrier crossing rates. Mol. Phys., 90:925–941, 1997.

[18] W. K. den Otter. Thermodynamic integration of the free energy along a reaction coordinate in cartesian coordinates. J. Chem. Phys., 112:7283–7292, 2000.

[19] Giovanni Ciccotti, Raymond Kapral, and Eric Vanden-Eijnden. Blue moon sampling, vectorial reaction coordinates, and unbiased constrained dynamics. ChemPhysChem, 6(9):1809–1814, 2005.

[20] K. Minoukadeh, C. Chipot, and T. Lelièvre. Potential of mean force calculations: A multiple-walker adaptive biasing force approach. J. Chem. Theor. Comput., 6:1008–1017, 2010.

[21] J. Comer, J. Phillips, K. Schulten, and C. Chipot. Multiple-walker strategies for free-energy calculations in namd: Shared adaptive biasing force and walker selection rules. J. Chem. Theor. Comput., 10:5276–5285, 2014.

[22] Adrien Lesage, Tony Lelièvre, Gabriel Stoltz, and Jérôme Hénin. Smoothed biasing forces yield unbiased free energies with the extended-system adaptive biasing force method. J. Phys. Chem. B, 121(15):3676–3685, 2017.

[23] H. Fu, X. Shao, C. Chipot, and W. Cai. Extended adaptive biasing force algorithm. an on–the–ﬂy implementation for accurate free–energy calculations. J. Chem. Theory Comput., 2016.

[24] L. Zheng and W. Yang. Practically eﬃcient and robust free energy calculations: Double-integration orthogonal space tempering. J. Chem. Theor. Compt., 8:810–823, 2012.

[25] J. Kastner and W. Thiel. Bridging the gap between thermodynamic integration and umbrella sampling provides a novel analysis method: “umbrella integration”. J. Chem. Phys., 123(14):144104, 2005.

[26] A. Laio and M. Parrinello. Escaping free-energy minima. Proc. Natl. Acad. Sci. USA, 99(20):12562–12566, 2002.

[27] Helmut Grubmüller. Predicting slow structural transitions in macromolecular systems: Conformational ﬂooding. Phys. Rev. E, 52(3):2893–2906, Sep 1995.

[28] T. Huber, A. E. Torda, and W.F. van Gunsteren. Local elevation - A method for improving the searching properties of molecular-dynamics simulation. Journal of Computer-Aided Molecular Design, 8(6):695–708, DEC 1994.

[29] G. Bussi, A. Laio, and M. Parrinello. Equilibrium free energies from nonequilibrium metadynamics. Phys. Rev. Lett., 96(9):090601, 2006.

[30] Fabrizio Marinelli, Fabio Pietrucci, Alessandro Laio, and Stefano Piana. A kinetic model of trp-cage folding from multiple biased molecular dynamics simulations. PLOS Computational Biology, 5(8):1–18, 2009.

[31] Yanier Crespo, Fabrizio Marinelli, Fabio Pietrucci, and Alessandro Laio. Metadynamics convergence law in a multidimensional system. Phys. Rev. E, 81:055701, May 2010.

[32] Fabrizio Marinelli and José D. Faraldo-Gómez. Ensemble-biased metadynamics: A molecular simulation method to sample experimental distributions. Biophysical Journal, 108(12):2779 – 2782, 2015.

[33] Alessandro Barducci, Giovanni Bussi, and Michele Parrinello. Well-tempered metadynamics: A smoothly converging and tunable free-energy method. Phys. Rev. Lett., 100:020603, 2008.

[34] P. Raiteri, A. Laio, F. L. Gervasio, C. Micheletti, and M. Parrinello. Eﬃcient reconstruction of complex free energy landscapes by multiple walkers metadynamics. J. Phys. Chem. B, 110(8):3533–9, 2006.

[35] Yuqing Deng and Benoît Roux. Computations of standard binding free energies with molecular dynamics simulations. J. Phys. Chem. B, 113(8):2234–2246, 2009.

[36] Jed W. Pitera and John D. Chodera. On the use of experimental observations to bias simulated ensembles. J. Chem. Theory Comput., 8:3445–3451, 2012.

[37] A. D. White and G. A. Voth. Eﬃcient and minimal method to bias molecular simulations with experimental data. J. Chem. Theory Comput., ASAP, 2014.

[38] Rong Shen, Wei Han, Giacomo Fiorin, Shahidul M Islam, Klaus Schulten, and Benoît Roux. Structural reﬁnement of proteins by restrained molecular dynamics simulations with non-interacting molecular fragments. PLoS Comput. Biol., 11(10):e1004368, 2015.