From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Feb 11 2004 - 18:39:41 CST

Kristy,
  The script you included below seems to have some errors in it
just based on a quick visual inspection, I'm not sure why it would work
if you typed it in, it shouldn't. I see unmatched pairs of " characters
in some of the atom selection statements which are likely causes of
some of your problems. Also, there were apparently some other control
characters in there that your email program has replaced with escape
characters, so I don't know what those were. Triple check that all
of your quotes are properly matched, that was the thing I immediately
noticed that is likely causing problems. If you need to escape
quotation characters, please read up on that in the VMD User's Guide
in the text about atom selections here:
  http://www.ks.uiuc.edu/Research/vmd/current/ug/node81.html

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Feb 11, 2004 at 03:51:17PM -0600, Kristy L. Mardis wrote:
> 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

-- 
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