From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Mon Nov 06 2017 - 11:39:57 CST

Hi Clement,

No. VMD will always return indicies in order because of how the return
list is assembled. Normally, the way to get around this it to make a
selection that WILL give you what you want. How can you tell which atoms
are "first" or "second"? Do they have specific names? Are their resids
different somehow? Is it based on bonding?

-Josh

On 11/05/2017 10:37 PM, Clement Fang Jin Koh wrote:
> Hi,
>
> I have a system of polymer chains, whose atom indexes of each chain
> are not in sequential order (i.e. instead of {1 2 3 4 5 6}, they could
> be {4 6 5 3 2 1}). For my tcl analysis script I need to reference the
> first and second atoms on each chain, then the first and third, and so
> on.
>
> I tried doing so by atomselecting the fragment, then getting the
> indexes. But vmd seems to rearrange the index list to be in sequential
> order. So {4 6 5 3 2 1} becomes {1 2 3 4 5 6}. So I am unable to
> reference the correct atom on the chain by lindex of the index list.
>
> Is there another way to reference the chain atoms? Or another way to
> get the indexes without having them pre-sorted?
>
> Thanks,
> Clement