From: Peter Freddolino (
Date: Fri May 30 2008 - 08:44:00 CDT

Hi Andrea,
I'm not immediately sure what's going wrong, but I can point out a
couple things that do need fixing (see below).

Aside from that, you may want to add a little more debug output; can you
verify, for example, that the measure fit command is producing a 4x4
matrix for each molecule pair, and that
$sel molid
gives the expected output for each of your selections? I'm particularly
concerned given the apparent errors in the atomselect text below...
> set mid($i) [mol load pdb $com]
mol load is deprecated and should be replaced with mol new
> # puts "reading $mid($i) $i ...";
> set sel($i) [atomselect $mid($i) "(resid 1 to 400 and backbone"]
> set lig($i) [atomselect $mid($i) "((resid 500 to 510 and name CA C N O)"]
> }
It looks like you're missing close parens on your atom selections; does
this script run without errors?
> # now loop and compare
> for {set i 0} {$i < $nrmols} {incr i} {
> set trans_mat [measure fit $sel($i) $sel(0)]
> set all [atomselect $i all]
> $all move $trans_mat
> set rmsd [measure rmsd $lig($i) $lig(0)]
> set my [lindex $data $i]
> set nrmsd [format %.3f $rmsd]
> puts $outfile " $my $nrmsd"
> }
> # now clean up
> for {set i 0} {$i < $nrmols} {incr i} {
> set sel($i) delete
> set lig($i) delete
The last two lines should be
$sel($i) delete
$lig($i) delete

Effectively, you're telling the atoms elections to delete themselves;
what the code currently does instead is replace element i of each array
with "delete", which still leaves those atom selections floating around.