From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Thu Jun 23 2005 - 04:09:59 CDT

On Thu, 23 Jun 2005 matteo.pennestri_at_virgilio.it wrote:

matteo,

MP> Does anybody know how to obtain and print out in a file the phi and psi
MP> angles of my protein by tcl script?

you can get this information through the VMD selection mechanism.
how this would be done in detail depends on what you want to do
with that information.
the following example script will load a trajectory and then
create a file 'phi-psi.dat' that contains the phi/psi values
in the following format:

# frame: 0
1 VAL -97.3160629272 -156.380996704
2 GLY 173.780517578 -174.389297485
3 VAL -105.462280273 163.233963013
4 PRO -69.460144043 145.422637939
5 GLY -163.291229248 176.206176758
6 VAL -112.040077209 168.416717529
# frame: 1
...

of course, you will need to adapt it for your purposes, but
i hope you'll get an idea of how it can be done.

ciao,
        axel.

---- cut here ---

    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

--- cut here ---

MP> Thanks a lot......ciao.
MP>
MP>
MP>
MP>

-- 
=======================================================================
Dr. Axel Kohlmeyer   e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum  http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.