Velocity DCD file broken

158 views
Skip to first unread message

NORMAN GEIST

unread,
Jan 21, 2016, 8:41:07 AM1/21/16
to cp2k
Dear experts,

I noticed that CP2k (Version 2.6.0) will output broken DCD VELOCITY files. I used the following to enable
velocity output in DCD format:

&VELOCITIES
    LOG_PRINT_KEY T
    FORMAT DCD
    &EACH
      MD 10
    &END EACH
    ADD_LAST NUMERIC
 &END VELOCITIES

Cheers

Norman Geist

Matthias Krack

unread,
Jan 21, 2016, 10:17:58 AM1/21/16
to cp2k
Hi Norman,

please could you provide an example. I tried v2.6.0 and it produced a (binary) velocity DCD file which could be dumped and/or converted using dumpdcd.f90 for instance.

Cheers

Matthias

Matt W

unread,
Jan 23, 2016, 3:54:31 AM1/23/16
to cp2k
I seem to remember that VMD wouldn't parse the header of the velocity dcd file that cp2k produced. I had to edit it with hexedit or similar.

I can't remember details of the top of my head.

Matt

NORMAN GEIST

unread,
Jan 28, 2016, 3:07:35 AM1/28/16
to cp2k
Hey guys,

1st thanks for your interest. Yes, VMD will not parse it, and my own DCD reader code does also complain. Usually a DCD file should start with a 4 or 8 byte Integer containing "84" to detect 32 or 64-bit encoding, followed by 4 chars containing "CORD", this already doesn't seem to by right in the vel dcd.

I attached an example file

Cheers
Norman Geist


cp2ktest.pdb
cp2ktest_h40-pos-1.dcd
cp2ktest_h40-vel-1.dcd

NORMAN GEIST

unread,
Jan 28, 2016, 3:19:53 AM1/28/16
to cp2k
...just added some debug outputs to my DCD reader and noticed that velocity dcd files made by cp2k contain "VEL" instead of "CORD" as the magic string.

IMHO, as the whole world don't differ coordinate and velocity DCDs, this should be fixed ;)

Krack Matthias (PSI)

unread,
Jan 28, 2016, 4:01:21 AM1/28/16
to cp...@googlegroups.com

Hi Norman,

 

right, the problem is the magic string. After I overwrote the VEL string with CORD in a hex editor, VMD imported the vel file without error message. This magic string could easily be changed to CORD also for velocity files. In this case the CP2K velocities dumped in atomic units could be imported to VMD, but they are considered as coordinates. Just out of curiosity what do you expect to be displayed by VMD then? What would be the benefit?

 

Best regards,

 

Matthias

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To post to this group, send email to cp...@googlegroups.com.
Visit this group at https://groups.google.com/group/cp2k.
For more options, visit https://groups.google.com/d/optout.

NORMAN GEIST

unread,
Jan 28, 2016, 5:10:07 AM1/28/16
to cp2k
Hey Matthias,

IMHO I wouldn't expect any DCD code out there to accept something else to be the magic string than "CORD", therefore the greatest benefit might just be, being able to load the files without trouble.
In VMD in particular, one don't want to actually visualize the data like coordinates, but use VMD mechanisms of file and trajectory processing for analysation purpose, e.g temperature distributions along various atom types /elements.

Best wishes

Norman Geist

Krack Matthias (PSI)

unread,
Jan 28, 2016, 6:21:37 AM1/28/16
to cp...@googlegroups.com

Hi Norman,

 

for such purpose (post-processing of CP2K pos and vel files) you may employ the dumpdcd.f90 code in the cp2k/tools folder which I mentioned already in my first email. It performs also the simple task of just changing “VEL” to “CORD”. Please check the examples listed using the –h flag. For example check the last examples which are mostly related to VMD specifically like:

 

-          dumpdcd -o new.dcd -of dcd -vel2cord old.dcd         (dump old.dcd as new.dcd and change only the DCD id string from VEL to CORD)

 

This is fixes the issue we are discussing here. I am also reluctant in changing VEL to CORD for CP2K vel files, because one would loose the information about the type of that file.

 

Please note, that dumpdcd.f90 provides even more advanced functionalities for conversion which sometimes might make the use of VMD for such purposes dispensable,  like

 

-          Output of an “atomic temperature”

-          Application of periodic boundary conditions (PBC), i.e. “folding back” atoms to the original cell)

-          Extraction of a subset of configurations (frames): scope by first and last frame, optionally with a stride

-          Concatenation of several DCD files

-          Dump in XMOL format

-          List of atoms leaving the box (given a threshold value)

-          Displacement of the atoms w.r.t. the first (original) configuration

 

Here is the full list of examples available with the –h flag:

  dumpdcd UO2-2x2x2-pos-1.dcd (without atomic labels from XYZ file)

  dumpdcd -xyz UO2-2x2x2.xyz UO2-2x2x2-pos-1.dcd (single DCD file)

  dumpdcd -xyz UO2-2x2x2.xyz UO2-2x2x2-pos-1.dcd UO2-2x2x2-pos-2.dcd ... (multiple DCD files are dumped consecutively)

  dumpdcd -info -xyz UO2-2x2x2.xyz UO2-2x2x2-pos-1.dcd UO2-2x2x2-pos-2.dcd (print additional information)

  dumpdcd -debug -xyz UO2-2x2x2.xyz UO2-2x2x2-pos-1.dcd UO2-2x2x2-pos-2.dcd (print debug information)

  dumpdcd -ekin -d -xyz UO2-2x2x2.xyz UO2-2x2x2-vel-1.dcd (print the "temperature" of each atom)

  dumpdcd -ekin -xyz UO2-2x2x2.xyz UO2-2x2x2-vel-1.dcd (print just the temperature of each atom)

  dumpdcd -first_frame 5 -last_frame 10 UO2-2x2x2-pos-1.dcd (just dump frame 5 to 10, ie. 6 frames in total)

  dumpdcd -o outfile.xyz UO2-2x2x2-pos-1.dcd (write output to the file "outfile.xyz" instead of stdout)

  dumpdcd -o test.xyz -output_format xmol -xyz ref.xyz -first 10 -last 10 test.dcd (dump 10th frame in XMOL format)

  dumpdcd -of dcd -ff 10 -lf 20 test.dcd (dump the frames 10 to 20 in DCD format to the default output file output.dcd)

  dumpdcd -o part.dcd -of dcd -ff 1 -lf 3 test.dcd (dump the frames 1 to 3 in DCD format to the output file part.dcd)

  dumpdcd -o part.dcd -of dcd -first 10 -lf 100 -stride 10 test.dcd (dump the frames 10, 20, ..., 100 to the file part.dcd)

  dumpdcd -output new.dcd -output_format dcd -pbc old.dcd (dump all frames applying PBC to the output file new.dcd)

  dumpdcd -o new.dcd -of dcd -pbc -trace_atoms 0.02 old.dcd (all atoms more than 2% out of the box are listed)

  dumpdcd -o new.dcd -e out_of_box.log -of dcd -pbc -trace_atoms 0.1 old.dcd (atoms more than 10% out of the box are listed)

  dumpdcd -o new.dcd -of dcd -vel2cord old.dcd (dump old.dcd as new.dcd and change only the DCD id string from VEL to CORD)

  dumpdcd -i -disp UO2-2x2x2-pos-1.dcd (dump the displacements of all atoms w.r.t. their positions in the first frame)

  dumpdcd -i -of dcd -disp UO2-2x2x2-pos-1.dcd (dump the atomic displacements as x-coordinates of a DCD CORD file)

  dumpdcd -i -of dcd -ekin -v2c -xyz UO2-2x2x2.xyz UO2-2x2x2-vel-1.dcd (dump the atomic temperatures as x-coordinates of a

                                                                        DCD CORD file -> hack for VMD)

                                                                                                                                                                            

HTH,

 

Matthias

--

NORMAN GEIST

unread,
Jan 28, 2016, 6:36:09 AM1/28/16
to cp2k
Alright, that's a good solution, and can now be found by searching the internet.

Regards

Norman Geist

Krack Matthias (PSI)

unread,
Jan 28, 2016, 8:20:53 AM1/28/16
to cp...@googlegroups.com

Hi Norman,

 

thanks for rising the issue.

 

I have just added also a  –frc2cord flag for the CP2K frc files with the forces to complete the story.

Best,

 

Matthias

 

From: cp...@googlegroups.com [mailto:cp...@googlegroups.com] On Behalf Of NORMAN GEIST


Sent: Donnerstag, 28. Januar 2016 12:36
To: cp2k

--

Reply all
Reply to author
Forward
0 new messages