Re: NAMD trajectory format

From: Axel Kohlmeyer (
Date: Tue May 27 2008 - 05:27:04 CDT

On Tue, 27 May 2008, Konrad Hinsen wrote:

KH> Dear NAMD users,

dear konrad,

KH> I am trying to figure out the exact meaning of the information contained in
KH> a trajectory (dcd + xst) produced by NAMD, for use in an analysis program.
KH> Ideally, I would like my program to handle any NAMD-produced trajectory
KH> correctly. I looked at the manual, of course, but this was not sufficient.

the best way to read NAMD trajectories (and many other formats) is
through molfile plugin interface from VMD. the .dcd format is taken
from x-plor/charmm and as such not exactly thoroughly documented.
KH> What is not clear to me is the interpretation of constant-pressure
KH> trajectories. There is information about the size and shape of the box in
KH> the dcd file, but also in the xst file. The dcd file has six numbers per

in older versions of NAMD a different variety of dcd (one without cell
information). this has been changed (for convenience i guess), but i
suspect the .xst file is still needed for restarting.

KH> step for which I have no documentation. The example file I received from a
KH> colleague is rectangular, so it is not sufficient to completely decode the
KH> six numbers.

please see the molfile code. for your convenience here is the unitcell
decoding section of the dcdplugin.c file:

  ts->A = unitcell[0];
  ts->B = unitcell[2];
  ts->C = unitcell[5];

  if (unitcell[1] >= -1.0 && unitcell[1] <= 1.0 &&
      unitcell[3] >= -1.0 && unitcell[3] <= 1.0 &&
      unitcell[4] >= -1.0 && unitcell[4] <= 1.0) {
    /* This file was generated by CHARMM, or by NAMD > 2.5, with the angle */
    /* cosines of the periodic cell angles written to the DCD file. */
    /* This formulation improves rounding behavior for orthogonal cells */
    /* so that the angles end up at precisely 90 degrees, unlike acos(). */
    ts->alpha = 90.0 - asin(unitcell[4]) * 90.0 / M_PI_2; /* cosBC */
    ts->beta = 90.0 - asin(unitcell[3]) * 90.0 / M_PI_2; /* cosAC */
    ts->gamma = 90.0 - asin(unitcell[1]) * 90.0 / M_PI_2; /* cosAB */
  } else {
    /* This file was likely generated by NAMD 2.5 and the periodic cell */
    /* angles are specified in degrees rather than angle cosines. */
    ts->alpha = unitcell[4]; /* angle between B and C */
    ts->beta = unitcell[3]; /* angle between A and C */
    ts->gamma = unitcell[1]; /* angle between A and B */

KH> The xst file has three vectors per time step, which is clear enough.
KH> However, is it safe to assume that
KH> 1) there is an xst file for every constant-pressure trajectory?
KH> 2) the box size/shape information is available for the same time steps that
KH> are recorded in the dcd file?

KH> The other unclear point concerns the "cell origin" data. After reading the
KH> manual, it is not clear to me how exactly this data enters in the
KH> interpretation of the coordinate sequences. In my example file, the cell
KH> origin is constant over the trajectory, but I suppose this is not always the
KH> case (otherwise there would be no need to record it at every time step).
KH> What exactly is this cell origin? The fixed central point of the coordinate
KH> scaling? An offset to be added to the coordinates? Or yet something else?

i don't know for sure, but i would suspect it serves as a
reference point for PBC wrapping. in any case it should be
irrelevant for analysis of trajectory data that was written
with recent NAMD versions (2.6 and onward) where you have
all required information in the .dcd file.


KH> Thanks in advance for any help,
KH> Konrad.
KH> --
KH> ---------------------------------------------------------------------
KH> Konrad Hinsen
KH> Centre de Biophysique Moléculaire, CNRS Orléans
KH> Synchrotron Soleil - Division Expériences
KH> Saint Aubin - BP 48
KH> 91192 Gif sur Yvette Cedex, France
KH> Tel. +33-1 69 35 97 15
KH> E-Mail:
KH> ---------------------------------------------------------------------

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:49:30 CST