From: Vermaas, Joshua (
Date: Mon Nov 06 2017 - 14:42:45 CST

Hi Clement,

Do you mind me asking what the polymer is? I'm having a hard time conceptualizing a polymer with only 6 atoms in it, especially one whose order changes depending on the fragment. If you were dealing with a linear polymer, you could pick the end of a polymer with something like "numbonds == 1", except that will give you *both* ends of a linear polymer. Or, if the offsets are consistent, you can rearrange the list yourself in Tcl. For instance, to rearrange your output index list, you could do something like:

set idxlist [list 1 2 3 4 5 6]
set orderlist [list 3 5 4 2 1 0]
set newlist [list ]
foreach order $orderlist {
lappend newlist [lindex $idxlist $order]
puts $newlist

Do either of those make sense for your polymer topology?


On 11/06/2017 12:58 PM, Clement Fang Jin Koh wrote:
Hi Josh,

The only way I can tell in VMD is by looking visually at the OpenGL display window. If it helps, I loaded a lammpsdata file for my system into VMD. It seems like I only can get a list of all the indices in each chain by getting "fragment #". Their resids are different in the sense that for a chain of 6 atoms, they are numbered {3 2 1 1 2 3}. Selecting their resids as well as the fragment might help but I need to be able to sequentially go down the chain (select atom #1 and atom #2, atom #1 and atom #3 and so on). I would be really grateful if you have any suggestions.


On Mon, Nov 6, 2017 at 12:39 PM, Vermaas, Joshua <<>> wrote:
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?


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