VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue May 02 2006 - 10:13:23 CDT
- Next message: John Stone: "Re: Compile of OpenGL shader vmdsphere failed"
- Previous message: Leandro Martínez: "Re: OFF drawing method"
- In reply to: Enzo Vitale: "coordinates of an atom"
- Next in thread: Axel Kohlmeyer: "Re: coordinates of an atom"
- Reply: Axel Kohlmeyer: "Re: coordinates of an atom"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Enzo,
If you don't like writing the long expression below, you could
simply do something like:
proc getatomcoords { index } {
return [lindex [[atomselect top "index $index"] get {x y z}] 0]
}
You could then write the much more compact expression:
getatomcoords 25
If you want to be able to specify the atom in a 1-based indexing scheme, you
could use "serial" rather than index, if you prefer:
proc getatomcoords { serial } {
return [lindex [[atomselect top "serial $serial"] get {x y z}] 0]
}
You could then write the same command with 1-based indices:
getatomcoords 26
John Stone
vmd_at_ks.uiuc.edu
On Tue, May 02, 2006 at 04:39:10PM +0200, Enzo Vitale wrote:
> Dear VMD experts,
>
> I have another simple question, again related to scripting VMD by
> means of TCL: is there a predefined array variable holding the
> coordinates of all atoms of a given molecule ?
>
> So far, I get the coordinates via the following ugly expression:
>
> [lindex [[atomselect top "index 25"] get {x y z}] 0]
>
> when for instance I need the coordinates of the 26-th atom, but I
> guess there must be a simpler and more readable form for getting the
> same result.
>
> Thank you in advance,
> Enzo
-- 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
- Next message: John Stone: "Re: Compile of OpenGL shader vmdsphere failed"
- Previous message: Leandro Martínez: "Re: OFF drawing method"
- In reply to: Enzo Vitale: "coordinates of an atom"
- Next in thread: Axel Kohlmeyer: "Re: coordinates of an atom"
- Reply: Axel Kohlmeyer: "Re: coordinates of an atom"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]