reading dcd files

Steve Schmerler elco... at
Wed May 20 08:34:13 UTC 2015


I'm trying read dcd files written by cp2k. I have a reader which works
for dcd files written by lammps, but now I'm struggling with the cp2k
dcd header. In particular, I don't seem to be able to read the number of
steps from the header. The file src/motion_utils.F in version 2.6.1 has

    WRITE (UNIT=traj_unit) id_dcd,0,it,iskip,0,0,0,0,0,0,REAL(dtime,KIND=sp),&
    WRITE (UNIT=traj_unit) 2,remark1,remark2
    WRITE (UNIT=traj_unit) nat

I assume from the surrounding code that `it` is the number of steps.
So, with something like

    integer :: it, natoms, dummyi, ntitle, iskip, i, unt
    real :: timestep
    character(len=4) :: id_dcd
    character(len=80) :: remark1, remark2
    open(unt, ...) 
    read(unt) id_dcd, dummyi, it, iskip, (dummyi, i=1,6), &
              timestep, (dummyi, i=1,10)
    read(unt) ntitle, remark1, remark2
    read(unt) natoms

the number of steps `it` is always 0, while `natoms` etc are read

Also, one of the dcd format specifications found in the documentation of
VMD's dcdplugin [1] suggests that the step variable is the first integer
written after `id_dcd`, whereas cp2k writes a zero first, and then the
steps. Is this another flavor of the dcd format? If so, is there a
specification? My Fortran is somewhat rusty so there may be something
obvious which I have overlooked.

Another related question. Lammps writes the cell information as double
precision, but the coordinates as real. How does cp2k do that? If you
have pointers to the relevant documentation, that would help me a lot.
Thank you very much.



Steve Schmerler
Institut für Theoretische Physik
TU Freiberg, Germany

More information about the CP2K-user mailing list