From: Axel Kohlmeyer (
Date: Fri Nov 18 2005 - 08:54:02 CST

On Fri, 18 Nov 2005, andrea spitaleri wrote:


sorry to beat a dead horse one more time, but even
though the script may now work for you, there is a
way to improve the script, which makes no assumptions
about the molecule ids and selections etc. and puts
the some of the 'expensive' operations outside the
measurement loop by using arrays for molecule
ids and selections. note that the mol load command
returns the (unique) mol id that vmd assigns to
a molecule.

please consider the following variation of the script
(untested, but you should get the general idea).

# set up molecules and selections
set nrmols 100
for {set i 1} {$i < $nrmols} {incr i} {
    set mid($i) [mol load pdb "pro_$i.pdb" waitfor all]
    set sel($i) [atomselect $mid($i) "protein and backbone"]
    set lig($i) [atomselect $mid($i) "segid B"]
    set all($i) [atomselect $mid($i) "all"]

# now loop and compare
for {set i 1} {$i < $nrmols} {incr i} {
    for {set j [expr $i +1]} {$j < $nrmols} {incr j} {
        $all($i) move [measure fit $sel($j) $sel($i)]
        set rmsd [measure rmsd $lig($j) $lig($i)]
        puts "RMSD of $i and $j is $rmsd"
        puts $outfile "RMSD of $i and $j is $rmsd"

# clean up
for {set i 1} {$i < $nrmols} {incr i} {
    set sel($i) delete
    set lig($i) delete
    set all($i) delete
    mol delete mid($i)



Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.