From: jo hanna (jfhanna_at_gmail.com)
Date: Sat Sep 08 2007 - 09:16:15 CDT

Hi

Could anyone please advise why the first script works but the second script
retuns the following error: vecsub two vectors don't have the same size

Thanks
Jo

script 1
**
set outfile [open angle_BAC_test.dat w]

set nf [molinfo top get numframes]

set A [atomselect top "index 2"]
set B [atomselect top "index 0"]
set C [atomselect top "index 1"]

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

  global M_PI

  $A frame $i
  $B frame $i
  $C frame $i

  set atoms [atomselect top {index 0 1 2}]

  $atoms frame $i

  set coords [$atoms get {x y z}]

  set av [lindex $coords 2]
  set bv [lindex $coords 0]
  set cv [lindex $coords 1]

  set ab [vecsub $av $bv]
  set ac [vecsub $av $cv]

puts $outfile "[expr acos([vecdot $ab $ac]/([veclength $ab] * [veclength
$ac])) *(180.0/$M_PI)]"

}
close $outfile
**

script 2
**
set outfile [open angle_EAF_test.dat w]

set nf [molinfo top get numframes]

set A [atomselect top "index 2"]
set E [atomselect top "index 4"]
set F [atomselect top "index 5"]

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

  global M_PI

  $A frame $i
  $E frame $i
  $F frame $i

  set atoms [atomselect top {index 2 4 5}]

  $atoms frame $i

  set coords [$atoms get {x y z}]

  set av [lindex $coords 2]
  set ev [lindex $coords 4]
  set fv [lindex $coords 5]

  set ae [vecsub $av $ev]
  set af [vecsub $av $fv]

puts $outfile "[expr acos([vecdot $ae $af]/([veclength $ae] * [veclength
$af])) *(180.0/$M_PI)]"

}
close $outfile
**