next up previous contents index
Next: Biasing and analysis methods Up: Collective Variable-based Calculations (Colvars) Previous: Defining collective variables   Contents   Index


Selecting atoms

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:

Atom 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 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 file provided by the global keyword indexFile (see 9.2.5).

The complete list of selection keywords available in NAMD is:

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 $ \mathbf{x}_{i}$ , the colvar $ \xi$ can be defined on a set of roto-translated positions $ \mathbf{x}_{i}' = R(\mathbf{x}_{i} - \mathbf{x}^{\mathrm{C}}) + \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 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.

Warning on rotating frames of reference and periodic boundary conditions.

rotateReference affects 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 effectively 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 affect 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.

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

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 this condition may fail if the group spans different molecules. In that case, writing the NAMD output and restart files 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 affect the calculation of colvars if each atom group satisfies 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-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);
it has all of its atoms within the same molecular fragment.

Performance of 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. 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 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:

next up previous contents index
Next: Biasing and analysis methods Up: Collective Variable-based Calculations (Colvars) Previous: Defining collective variables   Contents   Index