From: Katherine Parra (kparra_at_mail.usf.edu)
Date: Fri Sep 19 2008 - 13:56:01 CDT

*Dear VMD community:
I've been trying to use this script to get the projection of a vector on to
other.
*

set outfile [open HOR_disp_CO_P1.dat w]
set nf [molinfo top get numframes]
set pta [atomselect top "index 33030"]
set ptb [atomselect top "index 33037"]
set ptc [atomselect top "index 33041"]
set ptd [atomselect top "index 34344"]
set all [atomselect top all]

for {set i 0} {$i < $nf} {incr i} {

$pta frame $i
$ptb frame $i
set acoor [lindex [$pta get {x y z}] 0]
set bcoor [lindex [$ptb get {x y z}] 0]
set absub [vecsub $bcoor $acoor]

$pta frame $i
$ptc frame $i
set ccoor [lindex [$ptc get {x y z}] 0]
set acsub [vecsub $ccoor $acoor]

set crossp [veccross $absub $acsub]
set Bmag [veclength $crossp]
set Uvec [expr ($crossp/$Bmag)]

$pta frame $i
$ptd frame $i
set Acoor [lindex [$ptd get {x y z}] 0]
set Aasub [vecsub $Acoor $acoor]
set dotp [vecdot $crossp $Aasub]

set Bmag2 [veclength2 $crossp]
set hzproj [expr ($Uvec*($dotp/$Bmag2))]

puts $outfile "[expr ($i +1)] $hzproj"

}

close $outfile

*The problem is that I keep getting the same error message:
*syntax error in expression "(-4.40645236929 -17.6657989656
0.811552879677/18.2251445441)": looking for close parenthesis*
I've checked every single step in the TkConsole and they worked. Why when I
use the source command to get all the steps done the script doesn't work?
Thanks for your attention and your Help.
KP
*