Re: Question regarding NAMD nonbonded routines

From: Floris Buelens (
Date: Thu Jul 26 2007 - 05:04:55 CDT

Hi Vincent,

I had to go through the same thing a while back to implement a modified LJ potential. Very roughly the layout as I have it in my head is as follows:

- The actual pairwise nonbonded forces are evaluated in ComputeNonbondedBase2.h - for an atom 'i' this cycles through all atoms 'j' in its pairlist and calculates forces and energies. However, this is done by means of interpolation from a preculculated table ('table_four_i') rather than by evaluating the expressions directly.
- ComputeNonbondedBase.h (as far as I've gone into it) handles pairlist construction and other tasks that apply to every atom 'i' (as opposed to an 'ij' pair).
- ComputeNonbondedUtil.C is where you'll find the familiar expressions for the LJ and electrostatic potentials - these are evaluated on startup for a series of r^2 values and energy / force components are stored for later lookup and interpolation. This is the place to modify the actual nonbonded potential expressions - either by replacing the existing one, or in my case by extending the tables to include alternative values that apply to certain pairs of atoms only.

I also found the following helpful - this NAMD programming guide: is 10 years old but still helps for the basics; and Jim Phillips was a great help in clearing up this question about force evaluation:

Good luck!

Floris Buelens
Department of Crystallography, Birkbeck College, London

----- Original Message ----
From: Vincent Kraeutler <>
Sent: Wednesday, 25 July, 2007 5:55:40 PM
Subject: namd-l: Question regarding NAMD nonbonded routines


I am new to NAMD and faced with the task performing a modification of
the nonbonded (shortrange) interaction evaluation routines
(Lennard-Jones and real-space electrostatic interactions).

To my shame I have to admit I am having a rather difficult time
navigating the corresponding code, and I am looking for hints regarding
the higher-level layout of the nonbonded routines in NAMD. In
particular, pointers to the routines carrying out the evaluation of the
corresponding two-body terms would be much appreciated. It seems obvious
that they are contained in the ComputeNonbonded* files, but that is
still quite a number of files, and I am finding it difficult to
disentangle their relationships. (In particular, I'm unable to find a
definition for "calc_pair_energy", which seemed like a promising candidate.)

Also, I have some specific questions, which perhaps you may find easy to

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?

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?

Kind regards,

Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today*

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