Re: Format of namd restartfile *.coor, *.vel) (2nd try ;) )

From: Joshua D. Moore (joshuadmoore_at_gmail.com)
Date: Thu Nov 18 2010 - 18:27:22 CST

Dear Henri,

It's been a little while since I was working with them, but as I
recall, the *coor and *vel files (if binary) are in fortran
unformatted format (form = "binary" in fortran 90) .

I wrote fortran programs to read them and if so, something like this
will work (reverse to write)

open(unit=8,file=bincoorfilename,form="binary",status="old")
open(unit=9,file=binvelfilename,form="binary",status="old")
read(8) totatom_coor
read(9) totatom_vel
read(8) (coor(j),j=1,totatoms*3)
read(9) (vel(j),j=1,totatoms*3)
if(totatom_coor.ne.totatom_vel) then
   print*, "ERROR: Total atoms in coordinate and velocity files do not match"
endif
totatoms = totatom_coor
k = 0
do i = 1, totatoms
              x(i) = coor(k+1)
              y(i) = coor(k+2)
              z(i) = coor(k+3)
              velx(i) = vel(k+1)
              vely(i) = vel(k+2)
              velz(i) = vel(k+3)
              k = k + 3
enddo

So the basic format is

total atoms (integer)
x(1),y(1),z(1),......x(totatoms),y(totatoms),z(totatoms)

Velocities are in the same format.

coor are the coordinates in Angstroms and are in double precision.
vel are the velocities in double precision and are in "NAMD" internal
units. Multiplying the velocities by 20.45482706 puts them in
Angstroms/ps.

See, http://www.ks.uiuc.edu/Research/namd/mailing_list/namd-l/4125.html
for the units of velocity.

I was able to get it to work with form="binary" in fortran. *dcd
files on the other hand I use form="unformatted". The difference as I
recall had to do with how they are written in C. The *vel and *coor
files are written with a continuous stream of bytes using fwrite in C.
 The *dcd files are written differently, and I don't remember exactly
the difference in C now. The format is of course different also.

This doesn't seem to be well documented anywhere, so if I've goofed
something up, someone let me know. Maybe this thread can serve useful
to someone.

There's a page with the *dcd file format:

http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/dcdplugin.html

It has a couple errors on it I think. The coordinates in the *dcd are
in single-precision (NOT double precision), while the box lengths are
in double precision. Furthermore it doesn't store any information
about "free" atoms as it seems to indicate, at least by NAMD. This
was confusing for me when I was using "fixed" atoms.

CHARMM used to have a page (linked to on the previous link) but it no
longer exists. Comparing the two documentations was useful to me;
it's too bad it's gone now.

The formats can all be ascertained from the source code though (NAMD or VMD).

Best.

Josh

On Thu, Nov 18, 2010 at 11:05 AM, henri mone <henrimone_at_gmail.com> wrote:
> Dear Namd users, beginners and experts,
>
> I tried some time ago to ask the same question on the NAMD
> mailinglist. But no one could answer it [1].
> I will try to ask the same question but slightly rephrased, in the
> hope to get this time an answer.
>
> In which format are the namd restartfiles *.coor and *.vel written?
> I got from a simulation the coordinate and the velocity trajectories.
> I want to extract from the last frame of both trajectories the
> coordiantes and the velocities to restart my trajectory.
> I used the program "catdcd" (outputfile option "-otype namdbin") but
> NAMD complains that it is the wrong option.
> Which format should I use in catdcd?
> Is there a possibility to create the namd restartfiles *.coor and
> *.vel with VMD?
>
> Thanks and waiting desperate for an answer to my question ;) ,
> Henri
>
>
>
>
> 1: http://www.ks.uiuc.edu/Research/namd/mailing_list/namd-l/13141.html
>
>

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:23:24 CST