next up previous contents index
Next: Collective variable components (basis Up: Collective Variable-based Calculations1 Previous: Defining collective variables and   Contents   Index


Selecting atoms for colvars: defining atom groups

Selection keywords

To define collective variables, atoms are usually selected by group. Each group is identified by a name that is unique in the context of the specific colvar component (e.g. for a distance component, the names of the two groups are group1 and group2). The name is followed by a brace-delimited block of selection keywords: these 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 named ``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:

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.

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 colvar 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:

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.

Computational cost of colvars based on group size.

In parallel MD simulations, the calculation of most interaction terms are spread over many computational nodes, but the calculation of colvars is not parallelized. Therefore, additional calculations are executed by the node calculating the colvars, and most importantly, additional communication is added between the first node and the other nodes. The latency-tolerant design and dynamic load balancing of NAMD alleviate both factors: however, under some circumstances, a noticeable performance impact may be observed. To mitigate that, atom groups should be kept relatively small (up to a few thousands, depending on the computational cost to simulate the system by itself).

next up previous contents index
Next: Collective variable components (basis Up: Collective Variable-based Calculations1 Previous: Defining collective variables and   Contents   Index