From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Jul 22 2008 - 11:48:31 CDT

On Tue, 22 Jul 2008, Katherine Parra wrote:

KP> Dear VMD community:
KP> *How do I correctly use the vecsub command to evaluate previously defined
KP> variables?
KP> *
KP> This is part of my script:
KP>
KP> set pta [atomselect top "index 1856"]
KP> set ptb [atomselect top "index 1835"]
KP> set ptc [atomselect top "index 724"]
KP> set all [atomselect top all]
KP>
KP> set acoor [lindex{$pta get {x y z}}0]
KP> set bcoor [lindex{$ptb get {x y z}}0]
                   ^^^^ the $ptX get should be
                        bracketed in square brackets not curly

cheers,
   axel.
KP>
KP> set absub [vecsub $bcoor $acoor]
KP> set abmag [veclength $absub]
KP>
KP> set ccoor [lindex{$ptc get {x y z}}0]
KP>
KP> set acsub [vecsub $ccoor $acoor]
KP> set acmag [veclength $acsub]
KP>
KP>
KP> everytime I try to run this script I get an error message: *vecsub:
KP> non-numeric in first argument
KP>
KP> I was trying without using the lindex command first but then I read that
KP> somebody else asked you about this and he used the lindex command and it
KP> worked, but know I am using the lindex command and It is not working at all.
KP> What could I do?
KP>
KP> Thanks in advance.
KP> KP
KP> *
KP>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.