From: Oscar Bastidas (
Date: Mon Jun 06 2022 - 23:12:08 CDT


I came across the following tcl script for printing the values of phi and
psi angles to a file for a loaded trajectory coming from a MD simulation.
However, the original script takes the psf and dcd files as inputs which I
do not have. I have a pdb file which contains all frames of the
trajectory. Would someone please tell me how to modify the tcl script
below so that it works for my pdb file - once my pdb file is loaded -
instead of the psf and dcd files that the script was originally designed
for (I tried replacing the original "set mol..." with "set mol [atomselect
top "all"]" but I got an error in the tcl console stating that it was
expecting an integer)? Thanks for any direction anyone can provide.

Oscar B.


*set mol [mol new "monom.psf" waitfor all] mol addfile "monom.dcd" molid
$mol waitfor all set fp [ open "phi-psi.dat" w ] set sel [
atomselect $mol "alpha" ] set n [ molinfo $mol get numframes ]*

* for {set i 0 } { $i < $n } { incr i } { $sel frame
$i $sel update puts $fp "\# frame: $i"*

* set a [ $sel num ] for {set j 0 } { $j < $a } { incr j }
{ puts $fp "[expr $j + 1] [lindex [$sel get {resname phi psi}]
$j]" } }*

* $sel delete close $fp*