Re: Question regarding NAMD nonbonded routines

From: Peter Freddolino (
Date: Wed Jul 25 2007 - 20:48:19 CDT

Hi Vincent,
the namd nonbond code really is quite complicated, for two reasons:
-It's very highly optimized to be as fast as possible
-A number of different types of evaluations are carried out using pieces
of the same code, to avoid having redundant code -- this is all stitched
together at compile time based on macros defined in the files

To find the actual energy evaluation, you'll want to look in
ComputeNonbondedBase2.h. This code is included in numerous places (with
various parts of it included or not based on the exact function being
compiled) and has all the meat of the nonbonded energy calculations.
You'll want to pay particular attention to variables *_val and *_dir,
which hold the energy and force (respectively) of the nonbond
calculations. Note that all of these calculations are based on looking
up values in an interpolation table rather than calculating the 1/r^12
and 1/r^6 terms on the fly. It takes awhile to grok this code, but
hopefully this at least gets you started.

To answer your other questions:

> a) The NAMD paper briefly discusses "patches" (corresponding to disjoint
> pieces of the computational box) and "compute objects" (responsible for
> "evaluating" patches or pairs thereof). Do these two concepts correspond
> to specific classes/data structures? If so, which ones?
Might want to have a look at the Compute class (and its children) and
the Patch class.
> b) The User's Guide suggests that the short-range nonbonded interactions
> in NAMD consist of just the LJ and Coulomb (plus PME correction) terms.
> Is this correct? Is my understanding correct that straight truncation is
> used for the LJ interactions (i.e. no correction terms)? From the
> contents of the User's Guide I am tempted to infer that the cutoff used
> for the real-space electrostatic interactions is the same as the cutoff
> for the LJ interactions (i.e. the two pairlists are identical). Can you
> confirm this?
Please have a look at, which describes
the types of switching that can be used to avoid straight truncation
(which is a *very* bad idea). The electrostatic and vdw cutoffs are the
same *unless* you define eleccutoff and vdwcutoff. In practice these are
usually identical. The same pairlist is used either way.

> Kind regards,
> v.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:45:00 CST