From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Fri Apr 11 2014 - 09:28:15 CDT

Hi Vlad,

It is certainly doable, but requires some bookkeeping on your end. If
you look at the user guide, the measure fit command takes an optional
argument:
*fit /selection1/ /selection2/ [weight /weight/] [order /index list/]*
Again taken from the user guide:
The optional flag /order/ takes as argument a list of 0-based indices
specifying how to reorder the atoms in /selection2/ (Example: To reverse
the order of atoms in a selection containing 10 atoms one would use
order {9 8 7 6 5 4 3 2 1 0}).

I've never needed to use this feature so far, but what I believe you'd
need to do is make an index list that puts them into the order you want.
This is an outline to get you started:

set indexlist [list ]

foreach resid [list 8 9 10] {
    set sel [atomselect 2 "resid $resid"]
    #To figure out how big the offset needs to be, we need to know how
many atoms in the selection are out of order before us.
    set abovesel [atomselect 2 "resid 8 9 10 and resid > $resid"]
    set counter 0
    foreach el [$sel get index] {
        lappend indexlist [expr { [$abovesel num] + $counter] } ]
        incr counter
    }
    $abovesel delete
    $sel delete
}

The reason you have to do these gymnastics is because VMD stores atoms
in the order they were loaded, and decides if an atom is inside or
outside of an atomselection following this order. This is why if you
ever tried an atomselection like "resid 11 1", it will return indices
that are in increasing order, rather than returning the indices
belonging to residue 11 then those belonging to residue 1.

-Josh Vermaas

On 04/11/2014 07:16 AM, Vlad Cojocaru wrote:
> Dear all,
>
> I have a rather simple question but for which I did no figure an
> answer yet ... I have 2 DNA molecules which I want to superimpose.
> The superposition should be done like this:
>
> res 1 from mol 1 on res 10 from mol 2,
> res 2 from mol 1 on res 9 from mol 2,
> res 3 from mol 1 on res 8 from mol2,
>
> .. and so on ...
>
> If I do the selections "resid 1 to 3" and "resid 10 to 8", it does not
> work as VMD tries to superimpose 1 on 8, 2 on 9, and 3 on 10.
> I also tried to change the residue numbers in mol 2 such as res 10
> becomes res 100, res 9 becomes res 101, res 8 becomes res 102 (to have
> ascending order). However, still no success, VMD does not care about
> the residue number, it still tries the same. ...
>
> Do I need to change all atom indices to actually make VMD superimpose
> the way I want ? Or is there an easier solution to this ?
>
> Thanks for any advice ..
>
> Best wishes
> Vlad
>
>