From: Roni Saiba (ronis_at_imsc.res.in)
Date: Tue Jun 07 2022 - 02:08:34 CDT

In the second line instead of adding the .dcd file change the name to
your .pdb file. Since the pdb is just a single frame you do not need
the fifth line. In the original code, the first for loop is going over
all frames of the dcd. You do not need this loop so just remove it.
The rest of the code remains same. Also please go over the
documentation of the mol command here -
https://www.ks.uiuc.edu/Research/vmd/current/ug/node140.html and
molinfo command here -
https://www.ks.uiuc.edu/Research/vmd/vmd-1.7.1/ug/node125.html.

Regards,
Roni

Quoting Oscar Bastidas <obastida777_at_gmail.com>:

> Hello,
>
> 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.
>
> ORIGINAL SCRIPT:
>
>
>
>
>
>
>
> *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*