From: fabrizio.benedetti_at_unil.ch
Date: Fri Aug 10 2012 - 02:23:30 CDT

Hello everybody,

I need some help for dcd files.
Looking at the mailing list I found another guy that had a
similar problem to mine. I need to export the coordinate
of a dcd file in a simple "x y z" file (ascii).
Using the email found here I was able to write this simple
code:
set file [open output.dat w]
set rings [atomselect 0 "all"]
set nfram [molinfo 0 get numframes]
set natoms [$rings num]
put $file "Num_of_atoms $natoms"
put $file "Num_of_frames $nfram"
for {set j 0} {$j < $nfram } { incr j } {
  $rings frame $j
  $rings update
  set coords [$rings get {x y z} ]
  put $file "$coords"
}
close $file

It simply put in a file all the coordinate of all the atoms
in all the frames.
To be more clear, imagine that you have 2 atoms and 2
frames, you will get:
{val_x_of_frame_1 val_y_of_frame_1
val_z_of_frame_1}{val_x_of_frame_1
val_x_of_frame_1val_x_of_frame_1 } {val_x_of_frame_2
val_y_of_frame_2 val_z_of_frame_2}{val_x_of_frame_2
val_y_of_frame_2 val_z_of_frame_2}

The problem now is the following:
do the coordinate, that I write for each frame, correspond
to the same atom? I mean, in the first position (second and
so on)
do the coordinate refer to the same atom of the previous
frame?

Can somebody help please?
Does somebody know a better way to export the dcd files to a
text coordinate file?

Thanks in advance