From: Clement Fang Jin Koh (cfk2120_at_columbia.edu)
Date: Mon Nov 06 2017 - 15:46:07 CST

Ah I see! This would work! The only downside I see for this is that the
conditions for the selections can get out of hand fast for really long
chains, and I have chains as long as 800 beads.

But thank you! This was helpful!

-Clement

On Mon, Nov 6, 2017 at 4:12 PM, Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov>
wrote:

> AHAH!!! Well this is much easier then, since it is symmetric, and you only
> care about the distance between stuff, so the order doesn't matter. First,
> you'd find your ends:
>
> set endsel [atomselect top "numbonds == 1"]
>
> Then you'd get the corresponding index for each of the ends. If you wanted
> the neighbor, you'd do something like:
>
> foreach endidx [$endsel get index] {
> set neighborsel [atomselect top "withinbonds 1 of index $endidx"]
> #This is now a pair of atoms that are adjacent to one another
> puts [$neighborsel get index]
> }
>
> For those that are 2-away from the end, you would do something like:
>
> foreach endidx [$endsel get index] {
> set neighborsel [atomselect top "index $endidx or ((not withinbonds 1
> of index $endidx) and (not withinbonds 2 of index $endidx))"]
> #This is now a pair of atoms that are adjacent to one another
> puts [$neighborsel get index]
> }
>
> You can play similar games if you want internal distances, but I'll let
> you work those out yourself.
>
> -Josh
>
> On 11/06/2017 01:58 PM, Clement Fang Jin Koh wrote:
> Hi Josh,
>
> My polymers are polymers with coarse-grained beads with LJ potentials and
> each of my systems have different polymer chain lengths. My initial
> configuration had each polymer chain with indices in running order, so {0 1
> 2 3 4 5} were bonded together and {6 7 8 9 10 11} were bonded together
> and so on and so forth. Due to a bond swapping algorithm in LAMMPS, the
> indices ended up being messed up but the chain lengths are preserved, where
> after the bond swapping, the chains could become {11 1 2 3 4 5} {6 7 8 9 10
> 0}. I am trying to find the internal end to end distances for each chain,
> thus I would need to refer to the "right" index along the chain. Hope this
> makes sense.
>
> Best,
> Clement
>
> On Mon, Nov 6, 2017 at 3:42 PM, Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov<
> mailto:Joshua.Vermaas_at_nrel.gov>> wrote:
> 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?
>
> -Josh
>
> 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.
>
> Best,
> Clement
>
> On Mon, Nov 6, 2017 at 12:39 PM, Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov<
> mailto:Joshua.Vermaas_at_nrel.gov><mailto:Joshua.Vermaas_at_nrel.gov<mailto:
> Joshua.Vermaas_at_nrel.gov>>> 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?
>
> -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
>
>
>
>
>
>