From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Jun 13 2007 - 03:23:27 CDT

The easiest way to deal with this sort of thing is to sort the
values and their IDs together either by storing them as tuples or
lists of some sort and moving both together as you sort, or
by shuffling indices around rather than reordering the data itself.
You should be able to do this using the Tcl "lsort" command,
specifically by writing your own comparison command that looks
at the value element of the name/value pairs for its comparison,
for example.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Jun 08, 2007 at 12:09:56PM -0400, Manali Mehendale wrote:
> Hi,
>
> I am trying to write a Tcl script that calculates the minimum distance
> between
> a set of residues in each frame of a trajectory over time.
>
> In the process i generate a list that contains the min. distances between
> each residue (r1-r2, r1-r3, r2-r3 etc) which then i sort to find the least
> number.
>
> What i also would like is the names of the residues that have this minimum
> distance. I have created a parallel list that contains the names of
> residues interacting (r1-r2, r1-r3, r2-3).
>
> Is it possible to find which element no. in the previous list is the
> minimum and then access the same element no. from the second list ?
>
> Any help will be greatly appreciated !
>
> Thanks,
> -Manali
>

-- 
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