From: Geist, Norman (
Date: Tue Jun 07 2022 - 00:59:28 CDT

Hey Oscar,

you changed the wrong lines ;)


   set mol [mol new "monom.psf" waitfor all]
   mol addfile "monom.dcd" molid $mol waitfor all


set mol [molinfo top]


_set sel [ atomselect $mol "alpha" ]_


_set sel [ atomselect $mol "all" ]_

_In case of selection "all" you can also remove the "$sel update"
which might optimize performance._

_Norman Geist_

Am Dienstag, den 07-06-2022 um 06:12 schrieb Oscar Bastidas:


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