Unrecognized DCD header in CP2K

DCD files are quite versatile but suffer from nearly non-existing documentation. They can hold atomic coordinates, velocities and forces – all designated by a different DCD file header: CORD, VEL, FRC. CP2K allows the user to write out all the aforementioned information for a trajectory, but many software packages have limited support for reading forces and velocities from DCD files, mostly, because they use the original source from VMD which only reads coordinates. The ones I tested are VMD/catdcd, mdtraj, and MDAnalysis.

The typical error message would be:

If the header is “wrong” in the sense that the bytes read “FRC” instead of “CORD”, you can either change this in a hex editor (make sure you do not insert bytes to the file) or you can use the dumpdcd tool in CP2K.

Update, 04.02.2016
Please use the updated version of dumpdcd.f90. The author of the tool, Matthias Krack, has updated the code such that no patching is necessary. Thank you!

Only if you happen to be stuck with former versions (CP2K svn revision < 16559) for whatever reason, feel free to follow this approach: It is in the cp2k/tools folder and needs a bit of patching first: open dumpdcd.f90, and find line 443:

and exchange "CORD" for "FRC". Then add the following line in the IF branch.

Now compile and you can write new DCD files from them:

The resulting DCD file has the "CORD" header and can be read by any of the tools mentioned above.

Leave a comment

Your email address will not be published.

2 thoughts on “Unrecognized DCD header in CP2K”