From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Fri Jun 08 2007 - 11:37:06 CDT

Hi Pavan,
this is because the
atomselect get attribute
idiom returns a list of attributes, with one entry per atom in the
selection. This occurs even if there is only one atom, for the sake of
consistency. Operating on any single element of that list (using foreach
or [lindex $vector 0]) will give you the flat {x y z} list that you
want. So, for instance,
set vector [lindex [$h12 get {x y z}] 0]
will work.

Peter

Pavan Ghatty wrote:
> Hello all,
>
> I loaded a pdb file on vmd and typed the following commands on the
> Tcl/Tk console:
>
> set h12 [atomselect top "serial 6"]
>
> set vector [$h12 get {x y z}]
>
> veclength $vector
>
> That is what I want to do but Tcl keeps complaining that $vector is
> non-numeric. How else should I load the coordinates of h12 in to a
> vector without using foreach.
> This worked
> foreach coord [$h12 get {x y z}] {
> puts [veclength $coord]
> }
>
> Thanks.
> Pavan