From: Jernej Zidar (
Date: Tue Sep 20 2011 - 03:47:24 CDT

Dear all,
  I have a NAMD-generated trajectory that I would like to analyze. As
part of that I would like to measure the changes of a dihedral angle
during the simulation. To do that I prepared the following Tcl script
(I removed most comments):
# input
set input wpoly-opt-cubi-ion
mol load psf $input.psf dcd $input-prod-cpt.dcd

# output
set outdi "./ana/dihe-lang.dat"
set outdiid [open $outdi "w"]

# write header
set headdi "# frame ALY1 AVA2 APH3 AVA4 ALY5"
puts $outdiid $headdi

# atom selection
set dihe01 [[atomselect top "segname O1 and (name O1 C1 C2 CB) and
residue 0"] get index]

# obtain total number of frames
set ntot [molinfo top get numframes]

# measure the dihedral and save to output
for { set frame 0 } { $frame < $ntot } { incr frame } {
set xdihe01 [measure dihed "$dihe01" ]
puts $outdiid $frame\t$xdihe01

# close output
close $outdiid

------ end of script ---

  The problem is that the output file contains the values of $frame
for all the frames (e.g. going from 0 to 9999), but only the last
value (e.g. 57.453456) of $dihe01 for all the respective frame
numbers. I did a Google search and it appears the syntax is OK.

Thanks in advance for any tips,
Jernej Zidar