From: Blake Charlebois (bdc_at_mie.utoronto.ca)
Date: Wed Aug 17 2005 - 12:57:30 CDT

Hi,

I wrote this a while ago. I don't remember whether I actually tested it.

I would suggest using a for loop or a foreach loop
(http://www.tcl.tk/man/tcl8.3/TclCmd/contents.htm) to control your script if
you are working with a large number of molecules. It will make things less
confusing.

You will need to fix line breaks in this. You might also need to make it
more general by having two selectiontext arguments instead of one
(selectiontext1 and selectiontext2).

proc align_two_structures {selection_text mol_id mol_id_to_align_to\
                                frame_to_align frame_to_align_to} {
        set sel0 [atomselect $mol_id_to_align_to\
                $selection_text frame $frame_to_align_to]
        set sel [atomselect $mol_id $selection_text frame $frame_to_align]
        set sel_all [atomselect $mol_id "all" frame $frame_to_align]
        $sel_all move [measure fit $sel $sel0]
        $sel delete
        $sel_all delete
        $sel0 delete
}

-----Original Message-----
From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On Behalf Of
Vlad Cojocaru
Sent: August 17, 2005 12:31 PM
To: vmd list
Subject: vmd-l: overlaying more than 2 molecules

Dear vmd users,
   I am trying to perform an overlay of more than 2 molecules using the
script below. It happens that the second molecule is not moved on top of
mol. 0 (molecule 1 is moved properly). I guess is something about the
order of selecting the molecules. Could somebody correct my script so
that the molecule 2 will also be moved on top of molecule 0?
   Also I would like to continue this overlaying until up to 6
moilecules. Is there any trick that I shall take care of?
Thank you very much.
Best wishes
vlad

logfile vmd.log

mol load pdb RRM-model_o.pdb
mol load pdb 1aud.pdb
mol load pdb 1dz5.pdb

set sel0 [atomselect 0 {{name C CA N O} and {resid 6 to 8 32 to 35 46 to
50 76 to 78}}]
set sel1 [atomselect 1 {{name C CA N O} and {resid 10 to 12 40 to 43 54
to 58 83 to 85}}]
set sel2 [atomselect 2 {{name C CA N O} and {resid 10 to 12 40 to 43 53
to 57 83 to 85}}]

set tm1 [measure fit $sel1 $sel0]
set tm2 [measure fit $sel2 $sel0]

set move_sel1 [atomselect 1 all]
set move_sel2 {atomselect 2 all]

$move_sel1 move $tm1
$move_sel2 move $tm2

measure rmsd $sel1 $sel0
measure rmsd $sel2 $sel0

-- 
Vlad Cojocaru                                  
Max Planck Institute for Biophysical Chemistry  
Department of Molecular Biology                
Am Fassberg 11, 37077 Goettingen, Germany      
tel: ++49-551-201.1327                         
e-mail: Vlad.Cojocaru_at_mpi-bpc.mpg.de