From: Irene Newhouse (
Date: Mon Mar 24 2008 - 17:16:39 CDT

I'm still battling with trying to read a dcd file a frame at a time, making a selection & writing that out
as a pdb file [because there may be differing numbers of atoms in the selection along the trajectory].
I want this to be a self-contained script so that I can submit it in batch mode to analyze my entire, looong trajectory. Each trajectory is a trimer, we want to know how each one of those is behaving, & we have 6 separate trajectories. I don't have access to a computer than can read the entire trajectory. In fact, the cluster on which I intend to batch process can't do that either.
I'm having a very hard time getting the dcd file read. This is what I have so far:
set numfr 350
set pref h5a100
mol load parm7 $pref.prmtop rst7 $pref.inpcrd
set brdg [atomselect top "(same residue as water and within 5 of resid 1447 to 1449) \
or (resid 1447 to 1449) or (resid 220 to 228) or (resid 130 to 135) or (resid 180 to 190)"]
#loop over all frames
for {set frame 0} {$frame < $numfr} {incr frame} {
# read the current frame & update the selection
puts "Frame $frame ..."
animate read dcd $pref.dcd waitfor 1 top
$brdg frame $frame
# write the current frame into a pdb file
$brdg writepdb [format $pref-%04d.pdb $frame]
#end loop over all frames
I am debugging with an extraction from the full trajectory, that's 350 frames long. The last 2 lines of the VMD console read:
read_dcdheader: premature end of file
ERROR: could not readh h5a100.dcd
How do I code reading 1 frame of the dcd file?
Irene Newhouse
Test your Star IQ