From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Dec 02 2015 - 19:56:14 CST

On Wed, Dec 2, 2015 at 8:20 PM, Tristan Croll <tristan.croll_at_qut.edu.au> wrote:
> Hi all,
>
>
>
> At present VMD has the commands:
>
> measure bond
>
> measure angle
>
> measure dihed
>
> measure imprp
>
>
>
> each of which takes as its input a list of atom indices. However, unless I’m
> missing something, to get the coordinates of a single atom from its index
> still requires the use of three commands:
>
> set sel [atomselect top “index $thisindex”]
>
> set pos {*}[$sel get {x y z}]
>
> $sel delete
>
>
>
> Would anyone else find it useful to have a command, say, “measure pos
> <index>” to do this?

if i need to look up coordinates by index a lot, i usually do the following:

set sel [atomselect top all]
set pos [$sel get {x y z}]
$sel del

and then for all future operations on the same coordinate frame pull
the desired coordinate triplet from $pos with list operations:

set xyz [lindex $pos $idx]

similar code constructs, i.e. lookup tables, can be built for a lot of
operations to make them more efficient. much better than putting this
into the VMD code. the topotools plugin uses this approach quite
extensively and thus we have avoided having to put many operations
into the VMD core. it still works quite fast for fairly large systems
(i've processed topology files for systems with 10s of millions of
atoms with quite decent performance, considering that this code is
almost exclusively Tcl scripting.

axel.

>
>
>
> Thanks,
>
>
>
> Tristan
>
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.