reading dcd files

Matthias Krack matthia... at
Wed May 20 09:37:42 UTC 2015

Hi Steve

I have just checked in a tool called dumpdcd.f90 which you can find now in 
the cp2k/tools folder of the current CP2K trunk version. It should allow 
the dump of DCD files generated by CP2K. It provides also some other useful 
functionality. After compiling it using e.g.

gfortran -o dumdcd.exe dumpdcd.f90

dumpdcd.exe -h

prints a help menu. The flags -i and -d provide a more detail dump. For 
atomic labels you have to supply an XYZ template file.


On Wednesday, 20 May 2015 10:34:18 UTC+2, Steve S wrote:
> Hello 
> 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),& 
>                            1,0,0,0,0,0,0,0,0,24 
>     [....] 
>     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 
> correctly. 
> 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. 
> best, 
> Steve 
> [1] 
> -- 
> Steve Schmerler 
> Institut für Theoretische Physik 
> TU Freiberg, Germany 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the CP2K-user mailing list