From: Tim Isgro (timisgro_at_ks.uiuc.edu)
Date: Wed Feb 11 2004 - 18:50:04 CST

Hi Kristy,

After testing your script on my own system, I cannot reproduce the
problem, so...
1. Make sure you're not copying over those literal "^o" characters that
appeared in your email.
2. Make sure your atomselections are valid by typing them into the VMD
Graphical Representations window.

Also, use 'resname' instead of 'residue'. VMD doesn't complain about
something like 'residue ASP', even though it should since 'residue'
arguments are numbers, not 3-letter codes. As far as I can tell 'residue
xxx' simply selects the first residue in the protein chain, as opposed to
spitting out an error message. This should be fixed.

Also, get rid of the quotes after $iframe on the set pcoord lines.

Hope it helps,
Tim

On Wed, 11 Feb 2004, 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
>