VMD-L Mailing List
From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Fri Jun 08 2007 - 11:37:06 CDT
- Next message: Manali Mehendale: "Help with Tcl script"
- Previous message: Harry Bullen: "Re: Python Module"
- In reply to: Pavan Ghatty: "Simple TCL/Tk question"
- Next in thread: Robert Brunner: "Re: Simple TCL/Tk question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: Manali Mehendale: "Help with Tcl script"
- Previous message: Harry Bullen: "Re: Python Module"
- In reply to: Pavan Ghatty: "Simple TCL/Tk question"
- Next in thread: Robert Brunner: "Re: Simple TCL/Tk question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]