From: Sara baretller (sarabiocomputation_at_gmail.com)
Date: Fri Jul 01 2011 - 13:13:14 CDT

I will really appreciate any help or suggestion.

the script is for getting a vector of two selections of a peptide and then
the angle of this vector with another vector.
the script it will calculate the vectors and the angle for the first loop
fine however when i run the script in the tcl council it gives me the
vectors and angle for the first loop(residue 0 of 6 ) but then it will not
go for the next (residue 1 of 6) , 2,3,4,5, and so far till the 6th (
peptide 6)

the Tcl counsel gives me this:

residue 0 of 6 peptides
atomselect28 atomselect29

 1 1
{39.70000076293945 -4.400000095367432 53.599998474121094} {46.10000228881836
4.899999618530273 37.099998474121094}
-6.400001525878906 -9.299999713897705 16.5

 vec1l vec2l : 19.99249894859944 1.0

 dotprod: -0.46517445056808215

angle 2.0546279983239657

Final angle : 117.72161220856759

117.72161220856759

*I dont know why it s not going to next peptide , please if you can help.
it was going to the next peptide before i added the part of the vector and
the angle. i can not figure out whats the problem is now.*

script is:

 set outfile [open "out_vecot.dat" "w"]

        for {set j 0} {$j < 6} {incr j} {

                set mol [molinfo top]

                set sel1 [atomselect $mol "residue $j and resname LEU and
name BBc"]

                set sel2 [atomselect $mol "residue $j and resname GLU and
name BBc"]

                $sel1 frame $j
                $sel2 frame $j

                $sel1 update
                $sel2 update

                puts "residue $j of 6 peptides"
                puts "$sel1 $sel2"

                set nLEU [llength [$sel1 list]]
                set nGLU [llength [$sel2 list]]

                   puts " $nLEU $nGLU"

                set coord1 [$sel1 get { x y z }]
                set coord2 [$sel2 get { x y z }]

                puts "$coord1 $coord2"

                set vec1 [vecsub [lindex $coord1 0] [lindex $coord2 0]]

                puts "$vec1"

                set vec2 {0 1 0}

                set vec1l [veclength $vec1]
                set vec2l [veclength $vec2]

        puts " vec1l vec2l : $vec1l $vec2l"

                if {$vec1l != 0} {
                set vec1 [vecnorm $vec1]
                }
                if {$vec2l != 0} {
                set vec2 [vecnorm $vec2]
                }

        set dotprod [vecdot $vec1 $vec2]
        puts " dotprod: $dotprod"

        set angle [expr acos($dotprod)]
        puts "angle $angle"

        set angle [expr ($angle * 180/3.14159)]
        puts "Final angle : $angle"
        return $angle

                puts $outfile "$j $angle"
        }
                close $outfile

Thank you

Sara