From: Kristy L. Mardis (klmardis_at_wisc.edu)
Date: Wed Feb 11 2004 - 15:51:17 CST

Hello,

I've written a script to calculation the dot product between two vectors
defined by four atoms in my system. When I type the script in at the
command line, it works. However, when I take the same lines, put them in
a file and type
source dotprodmesi2.txt
dotprod
I get the error: usage: atomselect <command> [args...]

I've tried adding square brackets around the frame $iframe part of the
atomselect line, this results in the error: bad window path name "0"

I've attached the script below. If anyone has any hints/suggestions, I'd
appreciate it.

proc dotprod {} {
set fileId [open c:/testfoo.txt w 0600]
#get number of frames
set numframe [molinfo top get numframes]
#loop through the frames
for {set iframe 0} {$iframe < $numframe} {incr iframe} {
set ecoord1 [atomselect top "residue ESI and type C3" frame $iframe]
set ecoord2 [atomselect top “residue ESI and type C6" frame $iframe]
lassign [$ecoord1 get {x y z}] pos1
lassign [$ecoord2 get {x y z}] pos2
set esivec [vecsub $pos1 $pos2]
set nesivec [vecnorm $esivec]
set pcoord1 [atomselect top “residue PH1 and type C1" frame $iframe"]
set pcoord2 [atomselect top “residue PH1 and type C4" frame $iframe"]
lassign [$pcoord1 get {x y z}] pos3
lassign [$pcoord2 get {x y z}] pos4
set phivec [vecsub $pos3 $pos4]
set nphivec [vecnorm $phivec]
lassign [vecdot $nesivec $nphivec] vdot
puts $fileId “The dot product is $vdot”
}
close $fileId
}

Kristy