next up previous contents index
Next: Translation between NAMD and Up: Performance Tuning Previous: NAMD performance tuning concepts

Non-bonded interaction distance-testing

The last critical parameter for non-bonded interaction calculations is the parameter pairlistdist. To reduce the cost of performing the non-bonded interactions, NAMD uses a non-bonded pair list which contained all pairs of atoms for which non-bonded interactions should be calculated. Performing the search for pairs of atoms that should have their interactions calculated is an expensive operation. Thus, the pair list is only calculated periodically, at least once per cycle. Unfortunately, pairs of atoms move relative to each other during the steps between preparation of the pair list. Because of this, if the pair list were built to include only those pairs of atoms that are within the cutoff distance when the list is generated, it would be possible for atoms to drift closer together than the cutoff distance during subsequent timesteps and yet not have their non-bonded interactions calculated.

Let us consider a concrete example to better understand this. Assume that the pairlist is built once every ten timesteps and that the cutoff distance is 8.0 Å. Consider a pair of atoms A and B that are 8.1 Å apart when the pairlist is built. If the pair list includes only those atoms within the cutoff distance, this pair would not be included in the list. Now assume that after five timesteps, atoms A and B have moved to only 7.9 Å apart. A and B are now within the cutoff distance of each other, and should have their non-bonded interactions calculated. However, because the non-bonded interactions are based solely on the pair list and the pair list will not be rebuilt for another five timesteps, this pair will be ignored for five timesteps causing energy not to be conserved within the system.

To avoid this problem, the parameter pairlistdist allows the user to specify a distance greater than the cutoff distance for pairs to be included in the pair list, as shown in Figure 19. Pairs that are included in the pair list but are outside the cutoff distance are simply ignored. So in the above example, if the pairlistdist were set to $ 10.0$ Å, then the atom pair A and B would be included in the pair list, even though the pair would initially be ignored because they are further apart than the cutoff distance. As the pair moved closer and entered the cutoff distance, because the pair was already in the pair list, the non-bonded interactions would immediately be calculated and energy conservation would be preserved. The value of pairlistdist should be chosen such that no atom pair moves more than pairlistdist$ -$cutoff in one cycle. This will insure energy conservation and efficiency.

Figure 19: Depiction of the difference between the cutoff distance and the pair list distance. The pair list distance specifies a sphere that is slightly larger than that of the cutoff so that pairs are allowed to move in and out of the cutoff distance without causing energy conservation to be disturbed.
\includegraphics{figures/pairlistdist}

The pairlistdist parameter is also used to determine the minimum patch size. Unless the splitPatch parameter is explicitly set to position, hydrogen atoms will be placed on the same patch as the ``mother atom'' to which they are bonded. These hydrogen groups are then distance tested against each other using only a cutoff increased by the the value of the hgroupCutoff parameter. The size of the patches is also increased by this amount. NAMD functions correctly even if a hydrogen atom and its mother atom are separated by more than half of hgroupCutoff by breaking that group into its individual atoms for distance testing. Margin violation warning messages are printed if an atom moves outside of a safe zone surrounding the patch to which it is assigned, indicating that pairlistdist should be increased in order for forces to be calculated correctly and energy to be conserved.

Margin violations mean that atoms that are in non-neighboring patches may be closer than the cutoff distance apart. This may sometimes happen in constant pressure simulations when the cell shrinks (since the patch grid remains the same size). The workaround is to increase the margin parameter so that the simulation starts with fewer, larger patches. Restarting the simulation will also regenerate the patch grid.

In rare special circumstances atoms that are involved in bonded terms (bonds, angles, dihedrals, or impropers) or nonbonded exclusions (especially implicit exclusions due to bonds) will be placed on non-neighboring patches because they are more than the cutoff distance apart. This can result in the simulation dying with a message of ``bad global exclusion count''. If an ``atoms moving too fast; simulation has become unstable'', ``bad global exclusion count'', or similar error happens on the first timestep then there is likely something very wrong with the input coordinates, such as the atoms with uninitialized coordinates or different atom orders in the PSF and PDB file. Looking at the system in VMD will often reveal an abnormal structure. Be aware that the atom IDs in the ``Atoms moving too fast'' error message are 1-based, while VMD's atom indices are 0-based. If an ``atoms moving too fast; simulation has become unstable'', ``bad global exclusion count'', or similar error happens later in the simulation then the dynamics have probably become unstable, resulting in the system ``exploding'' apart. Energies printed at every timestep should show an exponential increase. This may be due to a timestep that is too long, or some other strange feature. Saving a trajectory of every step and working backwards in can also sometimes reveal the origin of the instability.


next up previous contents index
Next: Translation between NAMD and Up: Performance Tuning Previous: NAMD performance tuning concepts
http://www.ks.uiuc.edu/Research/namd/