COLLECTIVE VARIABLES MODULE

Reference manual for NAMD


Code version: 2017-09-18

PIC Giacomo Fiorin, Jérôme Hénin

Contents

1 Introduction
2 A crash course
3 General parameters and input/output files
 3.1 NAMD parameters
 3.2 Configuration syntax for the Colvars module
 3.3 Input state file (optional)
 3.4 Output files
4 Defining collective variables and their properties
 4.1 General options for a collective variable
 4.2 Trajectory output
 4.3 Extended Lagrangian.
 4.4 Statistical analysis of collective variables
5 Selecting atoms for colvars: defining atom groups
 5.1 Selection keywords
 5.2 Moving frame of reference.
 5.3 Treatment of periodic boundary conditions.
 5.4 Performance a Colvars calculation based on group size.
6 Collective variable components (basis functions)
 6.1 List of available colvar components
  6.1.1 distance: center-of-mass distance between two groups.
  6.1.2 distanceZ: projection of a distance vector on an axis.
  6.1.3 distanceXY: modulus of the projection of a distance vector on a plane.
  6.1.4 distanceVec: distance vector between two groups.
  6.1.5 distanceDir: distance unit vector between two groups.
  6.1.6 distanceInv: mean distance between two groups of atoms.
  6.1.7 distancePairs: set of pairwise distances between two groups.
  6.1.8 cartesian: vector of atomic Cartesian coordinates.
  6.1.9 angle: angle between three groups.
  6.1.10 dipoleAngle: angle between two groups and dipole of a third group.
  6.1.11 dihedral: torsional angle between four groups.
  6.1.12 polarTheta: polar angle in spherical coordinates.
  6.1.13 polarPhi: azimuthal angle in spherical coordinates.
  6.1.14 coordNum: coordination number between two groups.
  6.1.15 selfCoordNum: coordination number between atoms within a group.
  6.1.16 hBond: hydrogen bond between two atoms.
  6.1.17 rmsd: root mean square displacement (RMSD) from reference positions.
  6.1.18 Advanced usage of the rmsd component.
  6.1.19 eigenvector: projection of the atomic coordinates on a vector.
  6.1.20 gyration: radius of gyration of a group of atoms.
  6.1.21 inertia: total moment of inertia of a group of atoms.
  6.1.22 inertiaZ: total moment of inertia of a group of atoms around a chosen axis.
  6.1.23 orientation: orientation from reference coordinates.
  6.1.24 orientationAngle: angle of rotation from reference coordinates.
  6.1.25 orientationProj: cosine of the angle of rotation from reference coordinates.
  6.1.26 spinAngle: angle of rotation around a given axis.
  6.1.27 tilt: cosine of the rotation orthogonal to a given axis.
  6.1.28 alpha: α-helix content of a protein segment.
  6.1.29 dihedralPC: protein dihedral pricipal component
 6.2 Configuration keywords shared by all components
 6.3 Advanced usage and special considerations
  6.3.1 Periodic components.
  6.3.2 Non-scalar components.
  6.3.3 Calculating total forces.
 6.4 Linear and polynomial combinations of components
 6.5 Colvars as custom functions of components
 6.6 Colvars as scripted functions of components
7 Biasing and analysis methods
 7.1 Adaptive Biasing Force
  7.1.1 ABF requirements on collective variables
  7.1.2 Parameters for ABF
  7.1.3 Multiple-replica ABF
  7.1.4 Output files
  7.1.5 Post-processing: reconstructing a multidimensional free energy surface
 7.2 Extended-system Adaptive Biasing Force (eABF)
  7.2.1 CZAR estimator of the free energy
  7.2.2 Zheng/Yang estimator of the free energy
  Usage for multiple–replica eABF.
 7.3 Metadynamics
  7.3.1 Output files
  7.3.2 Performance tuning
  7.3.3 Well-tempered metadynamics
  7.3.4 Multiple-replicas metadynamics
  7.3.5 Compatibility and post-processing
 7.4 Harmonic restraints
  7.4.1 Moving restraints: steered molecular dynamics
  7.4.2 Moving restraints: umbrella sampling
  7.4.3 Changing force constant
 7.5 Harmonic wall restraints
 7.6 Linear restraints
 7.7 Adaptive Linear Bias/Experiment Directed Simulation
 7.8 Multidimensional histograms
  7.8.1 Grid definition for multidimensional histograms
 7.9 Probability distribution-restraints
 7.10 Scripted biases
8 Colvars scripting
 8.1 Managing the colvars module
 8.2 Input and output
 8.3 Accessing collective variables
 8.4 Accessing biases

1 Introduction

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 define 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’ (shortened to colvar), which indicates any differentiable function of atomic Cartesian coordinates, xi, with i between 1 and N, the total number of atoms:

ξ(t)= ξ (xi(t),xj(t),xk(t),...),1≤ i,j,k...≤ N
(1)

This manual documents the collective variables module (Colvars), a portable software that interfaces multiple MD simulation programs, with a focus on flexibility, robustness and high performance. The module is designed to perform multiple tasks concurrently during or after a simulation, the most common of which are:

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.

2 A crash course

Suppose that we want to run a steered MD experiment where a small molecule is pulled away from a binding site. In Colvars terms, this is done by applying a moving restraint to the distance between the two objects. The configuration will contain two blocks, one defining the distance variable (see 4, 6), and the other the moving harmonic restraint (7.4).

colvar {
  name dist
  distance {
    group1 { atomNumbersRange 42-55 }
    group2 {
      psfSegID PR
      atomNameResidueRange CA 15-30 }
    }
  }
}

harmonic {
  colvars dist
  forceConstant 20.0
  centers 4.          # initial distance
  targetCenters 15.   # 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 (CA) of residues 15 to 30 in the protein (segment name PR). The atom selection syntax is detailed in 5.

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.

3 General parameters and input/output files

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 configuration file or the configuration text for the module itself, whose syntax is described in 3.2 and in the following sections.

3.1 NAMD parameters

To enable a Colvars-based calculation, two parameters must be added to the NAMD configuration file, colvars and colvarsConfig. An optional third parameter, colvarsInput, can be used to continue a previous simulation.

3.2 Configuration syntax for the Colvars module

All the parameters defining the colvars and their biasing or analysis algorithms are read from the file specified by the configuration option colvarsConfig, or by the Tcl commands cv config and cv configfile. Hence, none of the keywords described in this section and the following ones are available as keywords for the NAMD configuration file. The syntax of the Colvars configuration is “keyword value”, where the keyword and its value are separated by any white space. The following rules apply:

The following keywords are available in the global context of the colvars configuration, i.e. they are not nested inside other keywords:

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


PIC

Figure 1: Graphical representation of a Colvars configuration. The colvar called “d” is defined as the difference between two distances: the first distance (d1) is taken between the center of mass of atoms 1 and 2 and that of atoms 3 to 5, the second (d2) between atom 7 and the center of mass of atoms 8 to 10. The difference d = d1 d2 is obtained by multiplying the two by a coefficient C = +1 or C = 1, respectively. The colvar called “c” is the coordination number calculated between atoms 1 to 10 and atoms 11 to 20. A harmonic restraint is applied to both d and c: to allow using the same force constant K, both d and c are scaled by their respective fluctuation widths wd and wc. A third colvar “alpha” is defined as the α-helical content of residues 1 to 10. The values of “c” and “alpha” are also recorded throughout the simulation as a joint 2-dimensional histogram.

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 define a colvar and its behavior, regardless of its specific functional form. To define colvars that are appropriate to a specific physical system, Section 5 documents how to select atoms, and section 6 lists all of the available functional forms, which we call “colvar components”. Finally, section 7 lists the available methods and algorithms to perform biased simulations and multidimensional analysis of colvars.

3.3 Input state file (optional)

Aside from the colvars configuration, an optional input state file may be provided to load the relevant data from a previous simulation. The name of this file is provided as a value to the keyword colvarsInput.

3.4 Output files

During a simulation with collective variables defined, the following three output files are written:

Other output files may be written by specific methods applied to the colvars (e.g. by the ABF method, see 7.1, or the metadynamics method, see 7.3). Like the colvar trajectory file, they are needed only for analyzing, not continuing a simulation. All such files’ names also begin with the prefix outputName.

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

4 Defining collective variables and their properties

In the configuration file each colvar is defined by the keyword colvar, followed by its configuration options within curly braces: colvar { ... }. One of these options is the name of a colvar component: for example, including rmsd { ... } defines the colvar as a RMSD function. In most applications, only one component is used, and the component is equal to the colvar.

The full list of colvar components can be found in Section 6, with the syntax to select atoms in Section 5. The following section lists several options to control the behavior of a single colvar, regardless of its type.

4.1 General options for a collective variable

The following options are not required by default; however, the first four are very frequently used:

4.2 Trajectory output

4.3 Extended Lagrangian.

The following options enable extended-system dynamics, where a colvar is coupled to an additional degree of freedom (fictitious particle) by a harmonic spring. All biasing and confining forces are then applied to the extended degree of freedom. 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 (7.1) to perform eABF simulations (7.2).

4.4 Statistical analysis of collective variables

When the global keyword analysis is defined in the configuration file, run-time calculations of statistical properties for individual colvars can be performed. At the moment, several types of time correlation functions, running averages and running standard deviations are available.

5 Selecting atoms for colvars: defining atom groups

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

5.1 Selection keywords

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 different sets of atoms can be combined. However, atoms included by multiple keywords are only counted once. Below is an example configuration for an atom group with identifier “atoms”, which uses an unusually varied combination of selection keywords:

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 index group (requires a .ndx file to be provided globally)
  indexGroup Water

  # 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
}

The resulting selection includes atoms 1 and 3, those between 20 and 50, and those in the index group called “Water”; the indices of this group are read from the file provided by indexFile, in the global section of the configuration file.

The complete list of selection keywords available in NAMD is:

5.2 Moving frame of reference.

The following options define 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 effectively remove from certain colvars the effects of molecular tumbling and of diffusion. Given the set of atomic positions xi, the colvar ξ can be defined on a set of roto-translated positions xi= R(xi xC)+ xref. xC is the geometric center of the xi, R is the optimal rotation matrix to the reference positions and xref is the geometric center of the reference positions.

Components that are defined based on pairwise distances are naturally invariant under global roto-translations. Other components are instead affected 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 defined 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.

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

5.3 Treatment of periodic boundary conditions.

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 the condition may fail if the group spans different molecules: in that case, writing the NAMD output files 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 affect the calculation of colvars if each atom group satisfies one or more of the following:

  1. it is composed by only one atom;
  2. 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);
  3. it is used by a colvar component that ignores the ill-defined Cartesian components of its center of mass (such as the x and y components of a membrane’s center of mass modeled with distanceZ);
  4. it has all of its atoms within the same molecular fragment.

5.4 Performance a Colvars calculation based on group size.

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. Atomic coordinates are typically collected on one 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 significant 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:

6 Collective variable components (basis functions)

Each colvar is defined by one or more components (typically only one). Each component consists of a keyword identifying a functional form, and a definition block following that keyword, specifying the atoms involved and any additional parameters (cutoffs, “reference” values, …).

The types of the components used in a colvar determine the properties of that colvar, and which biasing or analysis methods can be applied. In most cases, the colvar returns a real number, which is computed by one or more instances of the following components:

Some components do not return scalar, but vector values. They can only be combined with vector values of the same type, except within a scripted collective variable.

In the following, all the available component types are listed, along with their physical units and the limiting values, if any. Such limiting values can be used to define lowerBoundary and upperBoundary in the parent colvar.

For each type of component, the available configurations keywords are listed: when two components share certain keywords, the second component simply references to the documentation of the first regarding that keyword. The keywords that are available for all types of components are listed at the end (see  

6.1 List of available colvar components

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

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

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

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

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

The distanceZ {...} block defines 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 defined using either one reference group and a constant vector, or dynamically based on two reference groups.

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

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 bz2 and bz2, where bz is the box length along z (this behavior is disabled if forceNoPBC is set).

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

The distanceXY {...} block defines 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 defined using the axis parameter or as the vector joining ref and ref2 (see distanceZ above).

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

6.1.4 distanceVec: distance vector between two groups.

The distanceVec {...} block defines 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 6.4 for additional options):

6.1.5 distanceDir: distance unit vector between two groups.

The distanceDir {...} block defines 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 d = (dx,dy,dz), with |d| = 1.

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

6.1.6 distanceInv: mean distance between two groups of atoms.

The distanceInv {...} block defines a generalized mean distance between two groups of atoms 1 and 2, weighted with exponent 1∕n:

      (        (     )n )− 1∕n
 [n]     -1---    -1---
d1,2 =   N1N2 ∑i,j ∥dij∥
(2)

where dijis the distance between atoms i and j in groups 1 and 2 respectively, and n is an even integer.

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

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

6.1.7 distancePairs: set of pairwise distances between two groups.

The distancePairs {...} block defines a N1 ×N2-dimensional variable that includes all mutual distances between the atoms of two groups. This can be useful, for example, to develop a new variable defined over two groups, by using the scriptedFunction feature.

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

This component returns a N1 ×N2-dimensional vector of numbers, each ranging from 0 to the largest possible distance within the chosen boundary conditions.

6.1.8 cartesian: vector of atomic Cartesian coordinates.

The cartesian {...} block defines a component returning a flat vector containing the Cartesian coordinates of all participating atoms, in the order (x1,y1,z1,⋅⋅⋅,xn,yn,zn).

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

6.1.9 angle: angle between three groups.

The angle {...} block defines an angle, and contains the three blocks group1, group2 and group3, defining the three groups. It returns an angle (in degrees) within the interval [0 : 180].

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

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

The dipoleAngle {...} block defines an angle, and contains the three blocks group1, group2 and group3, defining the three groups, being group1 the group where dipole is calculated. It returns an angle (in degrees) within the interval [0 : 180].

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

6.1.11 dihedral: torsional angle between four groups.

The dihedral {...} block defines a torsional angle, and contains the blocks group1, group2, group3 and group4, defining the four groups. It returns an angle (in degrees) within the interval [180 : 180]. 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 defined by using any real number of choice.

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

6.1.12 polarTheta: polar angle in spherical coordinates.

The polarTheta {...} block defines 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 [0 : 180]. To obtain spherical coordinates in a frame of reference tied to another group of atoms, use the fittingGroup5.2 option within the atoms block.

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

6.1.13 polarPhi: azimuthal angle in spherical coordinates.

The polarPhi {...} block defines 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 [180 : 180]. 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 defined by using any real number of choice.

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

6.1.14 coordNum: coordination number between two groups.

The coordNum {...} block defines a coordination number (or number of contacts), which calculates the function (1(d∕d0)n)(1(d∕d0)m), where d0 is the “cutoff” distance, and n and m are exponents that can control its long range behavior and stiffness [2]. This function is summed over all pairs of atoms in group1 and group2:

                                                n
C(group1,group2 )=    ∑     ∑    1-−-(|xi−-xj|∕d0)-
                    i∈group1j∈group21− (|xi− xj|∕d0)m
(3)

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

This component returns a dimensionless number, which ranges from approximately 0 (all interatomic distances are much larger than the cutoff) to Ngroup1×Ngroup2 (all distances are less than the cutoff), or Ngroup1 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 Ngroup1×Ngroup2.

6.1.15 selfCoordNum: coordination number between atoms within a group.

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

                     1-−-(|xi−-xj|∕d0)n
C(group1) =   ∑    ∑ 1 − (|xi− xj|∕d0)m
            i∈group1j>i
(4)

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

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

This component returns a dimensionless number, which ranges from approximately 0 (all interatomic distances much larger than the cutoff) to Ngroup1×(Ngroup11)2 (all distances within the cutoff). For performance reasons, group1 should be of limited size, because the cost of the loop over all pairs grows as Ngroup12.

6.1.16 hBond: hydrogen bond between two atoms.

The hBond {...} block defines 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 different 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 defined. It returns an adimensional number, with values between 0 (acceptor and donor far outside the cutoff distance) and 1 (acceptor and donor much closer than the cutoff).

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

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

The block rmsd {...} defines the root mean square replacement (RMSD) of a group of atoms with respect to a reference structure. For each set of coordinates {x1(t),x2(t),xN(t)}, the colvar component rmsd calculates the optimal rotation U{xi(t)}→{xi(ref)} that best superimposes the coordinates {xi(t)} onto a set of reference coordinates {xi(ref)}. Both the current and the reference coordinates are centered on their centers of geometry, xcog(t) and xcog(ref). The root mean square displacement is then defined as:

                       ∘ ---N-|-----------------(-----------)|-
RMSD  ({xi(t)},{x(ref)})=    1-  ||U (xi(t)− xcog(t)) −  x(ref)− x(creogf) ||2
                i         N ∑i=1                     i
(5)

The optimal rotation U{xi(t)}→{xi(ref)} is calculated within the formalism developed in reference [3], which guarantees a continuous dependence of U{xi(t)}→{xi(ref)} with respect to {xi(t)}.

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

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

6.1.18 Advanced usage of the rmsd component.

In the standard usage as described above, the rmsd component calculates a minimum RMSD, that is, current coordinates are optimally fitted onto the same reference coordinates that are used to compute the RMSD value. The fit itself is handled by the atom group object, whose parameters are automatically set by the rmsd component. For very specific applications, however, it may be useful to control the fitting process separately from the definition 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:

  1. 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;
  2. applying the optimal rotation, but no translation (translateReference off), to bias or restrain the shape and position, but not the orientation of the atom group;
  3. disabling the application of optimal roto-translations, which lets the RMSD component decribe the deviation of atoms from fixed positions in the laboratory frame: this allows for custom positional restraints within the Colvars module;
  4. fitting the atomic positions to different reference coordinates than those used in the RMSD calculation itself;
  5. applying the optimal rotation and/or translation from a separate atom group, defined through fittingGroup: the RMSD then reflects the deviation from reference coordinates in a separate, moving reference frame.

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

The block eigenvector {...} defines the projection of the coordinates of a group of atoms (or more precisely, their deviations from the reference coordinates) onto a vector in 3n, where n is the number of atoms in the group. The computed quantity is the total projection:

          (ref)     n   (                   (ref)   (ref))
p({xi(t)},{xi  }) = ∑ vi⋅ U (xi(t)− xcog(t)) − (xi  − xcog ) ,
                  i=1
(6)

where, as in the rmsd component, U is the optimal rotation matrix, xcog(t) and xcog(ref) are the centers of geometry of the current and reference positions respectively, and vi are the components of the vector for each atom. Example choices for (vi) are an eigenvector of the covariance matrix (essential mode), or a normal mode of the system. It is assumed that ivi = 0: otherwise, the Colvars module centers the vi automatically when reading them from the configuration.

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

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.

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

The block gyration {...} defines the parameters for calculating the radius of gyration of a group of atomic positions {x1(t),x2(t),xN(t)} with respect to their center of geometry, xcog(t):

      ∘ -------------------
        -1 N ||           ||2
Rgyr =  N ∑   xi(t)− xcog(t)
          i=1
(7)

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

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

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

The block inertia {...} defines the parameters for calculating the total moment of inertia of a group of atomic positions {x1(t),x2(t),xN(t)} with respect to their center of geometry, xcog(t):

     N
I =    ||xi(t)− xcog(t)||2
    ∑i=1
(8)

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

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

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

The block inertiaZ {...} defines the parameters for calculating the component along the axis e of the moment of inertia of a group of atomic positions {x1(t),x2(t),xN(t)} with respect to their center of geometry, xcog(t):

     N
I =    ((x (t)− x  (t))⋅e)2
e   ∑i=1    i     cog
(9)

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

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

6.1.23 orientation: orientation from reference coordinates.

The block orientation {...} returns the same optimal rotation used in the rmsd component to superimpose the coordinates {xi(t)} onto a set of reference coordinates {xi(ref)}. Such component returns a four dimensional vector q = (q0,q1,q2,q3), with iqi2 = 1; this quaternion expresses the optimal rotation {xi(t)}→{xi(ref)} according to the formalism in reference [3]. The quaternion (q0,q1,q2,q3) can also be written as (cos(𝜃∕2),sin(𝜃 ∕2)u), where 𝜃 is the angle and u the normalized axis of rotation; for example, a rotation of 90 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×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 define 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 define the variable itself.

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

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 define a colvar with an orientation component, and restrain it throuh the harmonic bias around the identity rotation, (1.0, 0.0, 0.0, 0.0). Only the overall orientation of the macromolecule is affected, 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.

6.1.24 orientationAngle: angle of rotation from reference coordinates.

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 𝜃 between the current and the reference positions. This angle is expressed in degrees within the range [0:180].

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

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

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 𝜃 between the current and the reference positions. The range of values is [-1:1].

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

6.1.26 spinAngle: angle of rotation around a given axis.

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 6.4 for additional options):

The component spinAngle returns an angle (in degrees) within the periodic interval [180 : 180].

Note: the value of spinAngle is a continuous function almost everywhere, with the exception of configurations with the corresponding “tilt” angle equal to 180 (i.e. the tilt component is equal to 1): in those cases, spinAngle is undefined. If such configurations are expected, consider defining a tilt colvar using the same axis e, and restraining it with a lower wall away from 1.

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

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 𝜃 in the spherical coordinate system. The component tilt relies on the same options as spinAngle, including the definition of the axis e. The values of tilt are real numbers in the interval [1 : 1]: the value 1 represents an orientation fully parallel to e (tilt angle = 0), and the value 1 represents an anti-parallel orientation.

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

6.1.28 alpha: α-helix content of a protein segment.

The block alpha {...} defines the parameters to calculate the helical content of a segment of protein residues. The α-helical content across the N +1 residues N0 to N0 +N is calculated by the formula:

 (  (N)       (N +1)                  (N +5)                   (N +N))
α  Cα 0,O(N0),Cα 0  ,O (N0+1),...N(N0+5),Cα 0  ,O(N0+5),...N(N0+N ),Cα 0    =         (1 0)
           N+N −2    (                )          N +N−4   (          )
   ---1---- 0    angf C(n),C (n+1),C (n+2) + ----1--- 0    hbf  O(n),N(n+4) ,
   2(N− 2)  ∑n=N0        α    α     α      2(N − 4) n∑=N0

                                                                               (1 1)
where the score function for the CαCαCα angle is defined as:
                            (                       )
    (                )   1−  𝜃 (C (n),C(n+1),C(n+2))− 𝜃  2 ∕(Δ𝜃  )2
angf C(αn),C (nα+1),C (nα+2)  = ---(----α---α-----α-------0)------tol--,
                         1−  𝜃 (C (n),C(n+1),C(n+2))− 𝜃  4 ∕(Δ𝜃  )4
                                 α   α     α       0       tol
(12)

and the score function for the O(n) N(n+4) hydrogen bond is defined through a hBond colvar component on the same atoms.

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

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

6.1.29 dihedralPC: protein dihedral pricipal component

The block dihedralPC {...} defines 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 ϕi and ψi, dPCA rests on a variance/covariance analysis of the 4(N 1) variables cos(ψ1),sin(ψ1),cos(ϕ2),sin(ϕ2)⋅⋅⋅cos(ϕN),sin(ϕN). Note that angles ϕ1 and ψ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 coefficients (ki)1i4(N1), the projection of the current backbone conformation is:

   N− 1
ξ =    k   cos(ψ )+ k    sin(ψ  )+ k   cos(ϕ   )+ k  sin(ϕ   )
    ∑n=1  4n−3     n    4n−2     n   4n−1     n+1    4n     n+1
(13)

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

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

6.2 Configuration keywords shared by all components

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.

6.3 Advanced usage and special considerations

6.3.1 Periodic components.

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

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

The following keywords can be used within periodic components (and are illegal elsewhere):

Internally, all differences 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 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.

6.3.2 Non-scalar components.

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

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 q is the same as the one represented by q, distances between two quaternions are computed considering the closest of the two symmetric images.

Non-scalar components carry the following restrictions:

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.

6.3.3 Calculating total forces.

In addition to the restrictions due to the type of value computed (scalar or non-scalar), a final 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.

6.4 Linear and polynomial combinations of components

To extend the set of possible definitions of colvars ξ(r), multiple components qi(r) can be summed with the formula:

                n
ξ(r)=  ∑ ci[qi(r)]i
       i
(14)

where each component appears with a unique coefficient ci (1.0 by default) the positive integer exponent ni (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 (14)) can be obtained by setting the following parameters, which are common to all components:

Example: To define the average of a colvar across different parts of the system, simply define within the same colvar block a series of components of the same type (applied to different atom groups), and assign to each component a componentCoeff of 1∕N.

6.5 Colvars as custom functions of components

Collective variables may be defined by specifying a custom function as an analytical expression such as cos(x) + y^2. The expression is parsed by the Lepton expression parser (written by Peter Eastman), which produces efficient evaluation routines for the function itself as well as its derivatives. The expression may use the collective variable components as variables, refered to as their name string. Scalar elements of vector components may be accessed by appending a 1-based index to their name. When implementing generic functions of Cartesian coordinates rather than functions of existing components, the cartesian component may be particularly useful. A vector variable may be defined by specifying the customFunction parameter several times: each expression defines one scalar element of the vector colvar. This is illustrated in the example below.

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 }
  }
}

6.6 Colvars as scripted functions of components

When scripting is supported (default in NAMD), a colvar may be defined 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.

An example of elaborate scripted colvar is given in example 10, in the form of path-based collective variables as defined by Branduardi et al[7]. The required Tcl procedures are provided in the colvartools directory.

7 Biasing and analysis methods

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

In addition, restraint biases (7.4, 7.5, 7.6, ...) and metadynamics biases (7.3) offer the following optional keywords, which allow the use of thermodynamic integration (TI) to compute potentials of mean force (PMFs). In adaptive biasing force (ABF) biases (7.1) the same keywords are not recognized because their functionality is always included.

7.1 Adaptive Biasing Force

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

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

ABF is based on the thermodynamic integration (TI) scheme for computing free energy profiles. The free energy as a function of a set of collective variables ξ = (ξi)i[1,n] is defined from the canonical distribution of ξ , 𝒫(ξ):

        1
A(ξ)= − --ln𝒫 (ξ)+ A0
        β
(15)

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

∇  A(ξ)= ⟨− F ⟩
  ξ          ξ ξ
(16)

Several formulae that take the form of (16) have been proposed. This implementation relies partly on the classic formulation [11], and partly on a more versatile scheme originating in a work by Ruiz-Montero et al. [12], generalized by den Otter [13] and extended to multiple variables by Ciccotti et al. [14]. Consider a system subject to constraints of the form σk(x) = 0. Let (vi)i[1,n] be arbitrarily chosen vector fields (3N 3N) verifying, for all i, j, and k:

vi⋅∇xξj  =   δij                                  (1 7)
vi⋅∇xσk  =   0                                   (1 8)

then the following holds [14]:

∂A
---= ⟨vi⋅∇xV − kBT∇x ⋅vi⟩ξ
∂ξi
(19)

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

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

In the framework of ABF, Fξ is accumulated in bins of finite size δξ , thereby providing an estimate of the free energy gradient according to equation (16). The biasing force applied along the collective variables to overcome free energy barriers is calculated as:

 ABF             ^
F    = α(N ξ)× ∇xA(ξ)
(20)

where xA^ denotes the current estimate of the free energy gradient at the current point ξ in the collective variable subspace, and α(Nξ) is a scaling factor that is ramped from 0 to 1 as the local number of samples Nξ increases to prevent nonequilibrium effects in the early phase of the simulation, when the gradient estimate has a large variance. See the fullSamples parameter below for details.

As sampling of the phase space proceeds, the estimate x^
A is progressively refined. The biasing force introduced in the equations of motion guarantees that in the bin centered around ξ , the forces acting along the selected collective variables average to zero over time. Eventually, as the undelying free energy surface is canceled by the adaptive bias, evolution of the system along ξ is governed mainly by diffusion. Although this implementation of ABF can in principle be used in arbitrary dimension, a higher-dimension collective variable space is likely to result in sampling difficulties. Most commonly, the number of variables is one or two.

7.1.1 ABF requirements on collective variables

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

  1. Only linear combinations of colvar components can be used in ABF calculations.
  2. Availability of total forces is necessary. The following colvar components can be used in ABF calculations: distance, distance_xy, distance_z, angle, dihedral, gyration, rmsd and eigenvector. Atom groups may not be replaced by dummy atoms, unless they are excluded from the force measurement by specifying oneSiteTotalForce, if available.
  3. Mutual orthogonality of colvars. In a multidimensional ABF calculation, equation (17) must be satisfied for any two colvars ξi and ξj. Various cases fulfill this orthogonality condition:
  4. Mutual orthogonality of components: when several components are combined into a colvar, it is assumed that their vectors vi (equation (19)) are mutually orthogonal. The cases described for colvars in the previous paragraph apply.
  5. Orthogonality of colvars and constraints: equation 18 can be satisfied in two simple ways, if either no constrained atoms are involved in the force measurement (see point 3 above) or pairs of atoms joined by a constrained bond are part of an atom group which only intervenes through its center (center of mass or geometric center) in the force measurement. In the latter case, the contributions of the two atoms to the left-hand side of equation 18 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.

7.1.2 Parameters for ABF

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

7.1.3 Multiple-replica ABF

7.1.4 Output files

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

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

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

7.1.5 Post-processing: reconstructing a multidimensional free energy surface

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

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

abf_integrate is invoked using the command-line:
abf_integrate _file> [-n ] [-t ] [-m (0|1)] [-h _height>] [-f ]

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

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

abf_integrate produces the following output files:

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

7.2 Extended-system Adaptive Biasing Force (eABF)

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

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

The extended variable λ is coupled to the colvar z = ξ(q) by the harmonic potential (k∕2)(zλ)2. Under eABF dynamics, the adaptive bias on λ is the running estimate of the average spring force:

Fbias(λ∗)= ⟨k(λ − z)⟩λ∗
(21)

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

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

7.2.1 CZAR estimator of the free energy

The corrected z-averaged restraint (CZAR) estimator is described in detail in reference [17]. 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′(z)= − 1-dlnρ~(z) + k(⟨λ⟩ − z).
        β    dz         z
(22)

where z = ξ(q) is the colvar, λ is the extended variable harmonically coupled to z with a force constant k, and ρ~(z) is the observed distribution (histogram) of z, affected by the eABF bias.

Parameters for the CZAR estimator are:

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

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

7.2.2 Zheng/Yang estimator of the free energy

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

Haohao Fu and Christophe Chipot
Laboratoire International Associé Centre National de la Recherche Scientifique et University of Illinois at Urbana–Champaign,
Unité Mixte de Recherche No. 7565, Université de Lorraine,
B.P. 70239, 54506 Vandœuvre-ls-Nancy cedex, France

© 2016, Centre National de la Recherche Scientique

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

                   [  ∗                  ]
         ∑ N (ξ∗,λ ) (ξ--−-⟨ξ2-⟩λ-)− k(ξ∗− λ)
  ′ ∗    λ-------------β-σλ----------------
A (ξ )=                N (ξ ∗,λ )
                     ∑λ
(23)

where ξ is the colvar, λ is the extended variable harmonically coupled to ξ with a force constant k, N(ξ,λ) is the number of samples collected in a (ξ,λ) bin, which is assumed to be a Gaussian function of ξ with mean ξλ and standard deviation σλ.

The estimator is enabled through the following option:

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

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

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

7.3 Metadynamics

The metadynamics method uses a history-dependent potential [21] that generalizes to any type of colvars the conformational flooding [22] and local elevation [23] 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 ξ = (ξ12,Ncv) is defined as:

               t′<t    Ncv   (            ′ 2 )
Vmeta(ξ(t))=    ∑    W ∏  exp  − (ξi(t)−-ξi(t)) ,
            t′=δt,2δt,... i=1           2σξ2i
(24)

where Vmeta is the history-dependent potential acting on the current values of the colvars ξ , and depends only parametrically on the previous values of the colvars. Vmeta is constructed as a sum of Ncv-dimensional repulsive Gaussian “hills”, whose height is a chosen energy constant W , and whose centers are the previously explored configurations (ξ(δt),ξ (2δt),...).

During the simulation, the system evolves towards the nearest minimum of the “effective” potential of mean force Ã(ξ), which is the sum of the “real” underlying potential of mean force A(ξ) and the the metadynamics potential, Vmeta(ξ). Therefore, at any given time the probability of observing the configuration ξ is proportional to exp(−A~(ξ ∗)∕κ  T)
         B: this is also the probability that a new Gaussian “hill” is added at that configuration. If the simulation is run for a sufficiently long time, each local minimum is canceled out by the sum of the Gaussian “hills”. At that stage the “effective” potential of mean force Ã(ξ) is constant, and Vmeta(ξ) is an accurate estimator of the “real” potential of mean force A(ξ), save for an additive constant:

A(ξ) ≃ − Vmeta(ξ )+ K
(25)

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 τξi, and of the user-defined parameters W , σξi and δt [24]. In typical applications, a good rule of thumb can be to choose the ratio W∕δt much smaller than κBT ∕τξ, where τξ is the longest among ξ ’s correlation times: σξi then dictates the resolution of the calculated PMF.

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

7.3.1 Output files

When interpolating grids are enabled (default behavior), the PMF is written every colvarsRestartFrequency steps to the file outputName.pmf. The following two options allow to control this behavior and to visually track statistical convergence:

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

7.3.2 Performance tuning

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

7.3.3 Well-tempered metadynamics

The following options define the configuration for the “well-tempered” metadynamics approach [25]:

7.3.4 Multiple-replicas metadynamics

The following options define metadynamics calculations with more than one replica:

7.3.5 Compatibility and post-processing

The following options may be useful only for applications that go beyond the calculation of a PMF by metadynamics:

7.4 Harmonic restraints

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

         (       )
       1-  ξ-−-ξ0 2
V(ξ) = 2k    wξ
(26)

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

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

                 M (       )2
V(ξ ,...,ξ ) = 1k     ξi−-ξ0
   1     M    2 i∑=1   w ξ
(27)

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

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

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

7.4.1 Moving restraints: steered molecular dynamics

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

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

7.4.2 Moving restraints: umbrella sampling

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

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

7.4.3 Changing force constant

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

7.5 Harmonic wall restraints

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

       (     (      )2
       ||  1k  ξ−ξupper    if ξ > ξupper
       {  2     wξ
V (ξ)= ||  0  (      )2  if ξlower ≤ ξ ≥ ξupper
       (  12k  ξ−ξwlower    if ξ < ξlower
                 ξ
(28)

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

Note: this bias replaces the keywords lowerWall, lowerWallConstant, upperWall and upperWallConstant defined in the colvar context (see 4). These keywords are still supported, but will be deprecated in the future.

The harmonicWalls bias implements the following options:

7.6 Linear restraints

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

7.7 Adaptive Linear Bias/Experiment Directed Simulation

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

7.8 Multidimensional histograms

The histogram feature is used to record the distribution of a set of collective variables in the form of a N-dimensional histogram. It functions as a “collective variable bias”, and is invoked by adding a histogram block to the Colvars configuration file.

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

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

7.8.1 Grid definition for multidimensional histograms

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

7.9 Probability distribution-restraints

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

              1  ∫
V (ξ1,...,ξM )= --k  (h(ξ)− h0(ξ))2 dξ
              2
(29)

                M     (          )
h(ξ )= --√-1----  exp  − (ξ −-ξi)2
       M   2πσ 2∑i=1         2σ 2
(30)

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

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

The list of options is as follows:

7.10 Scripted biases

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

8 Colvars scripting

This interface is particularly useful to implement custom biases as scripted colvar forces. See the scriptedColvarForces option in 7.10. Note that scripting commands may not be used directly in the NAMD configuration file before the first run or minimize statement. They may be used either within the callback procedures (e.g. calc_colvar_forces) or in the NAMD config file after a run or minimize statement.

Collective variables and biases can be added, queried and deleted through the scripting command cv, with the following syntax: cv <subcommand> [args...]. For example, to query the value of a collective variable named myVar, use the following syntax: set value [cv colvar myVar value]. All subcommands of cv are documented below.

8.1 Managing the colvars module

8.2 Input and output

8.3 Accessing collective variables

8.4 Accessing biases

The following configuration options can modify the behavior of the scripting interface for optimization purposes:

References

[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. Efficient 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]   Davide Branduardi, Francesco Luigi Gervasio, and Michele Parrinello. From a to b in free energy space. J Chem Phys, 126(5):054103, 2007.

[8]   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.

[9]   J. Hénin and C. Chipot. Overcoming free energy barriers using unconstrained molecular dynamics simulations. J. Chem. Phys., 121:2904–2914, 2004.

[10]   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.

[11]   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.

[12]   M. J. Ruiz-Montero, D. Frenkel, and J. J. Brey. Efficient schemes to compute diffusive barrier crossing rates. Mol. Phys., 90:925–941, 1997.

[13]   W. K. den Otter. Thermodynamic integration of the free energy along a reaction coordinate in cartesian coordinates. J. Chem. Phys., 112:7283–7292, 2000.

[14]   Giovanni Ciccotti, Raymond Kapral, and Eric Vanden-Eijnden. Blue moon sampling, vectorial reaction coordinates, and unbiased constrained dynamics. ChemPhysChem, 6(9):1809–1814, 2005.

[15]   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.

[16]   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.

[17]   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.

[18]   H. Fu, X. Shao, C. Chipot, and W. Cai. Extended adaptive biasing force algorithm. an on–the–fly implementation for accurate free–energy calculations. J. Chem. Theory Comput., 2016.

[19]   L. Zheng and W. Yang. Practically efficient and robust free energy calculations: Double-integration orthogonal space tempering. J. Chem. Theor. Compt., 8:810–823, 2012.

[20]   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.

[21]   A. Laio and M. Parrinello. Escaping free-energy minima. Proc. Natl. Acad. Sci. USA, 99(20):12562–12566, 2002.

[22]   Helmut Grubmüller. Predicting slow structural transitions in macromolecular systems: Conformational flooding. Phys. Rev. E, 52(3):2893–2906, Sep 1995.

[23]   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.

[24]   G. Bussi, A. Laio, and M. Parrinello. Equilibrium free energies from nonequilibrium metadynamics. Phys. Rev. Lett., 96(9):090601, 2006.

[25]   Alessandro Barducci, Giovanni Bussi, and Michele Parrinello. Well-tempered metadynamics: A smoothly converging and tunable free-energy method. Phys. Rev. Lett., 100:020603, 2008.

[26]   P. Raiteri, A. Laio, F. L. Gervasio, C. Micheletti, and M. Parrinello. Efficient reconstruction of complex free energy landscapes by multiple walkers metadynamics. J. Phys. Chem. B, 110(8):3533–9, 2005.

[27]   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.

[28]   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.

[29]   A. D. White and G. A. Voth. Efficient and minimal method to bias molecular simulations with experimental data. J. Chem. Theory Comput., ASAP, 2014.

[30]   Rong Shen, Wei Han, Giacomo Fiorin, Shahidul M Islam, Klaus Schulten, and Benoît Roux. Structural refinement of proteins by restrained molecular dynamics simulations with non-interacting molecular fragments. PLoS Comput. Biol., 11(10):e1004368, 2015.