From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Sep 20 2008 - 02:11:41 CDT

Hi,
  The line where you set Uvec might be the source of your problem, I
think you're going to have to divide the elements of crossp individually
in order to fix that...

  John

On Fri, Sep 19, 2008 at 02:56:01PM -0400, Katherine Parra wrote:
> *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
> *

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078