From: klsale (klsale_at_sandia.gov)
Date: Mon Jul 18 2005 - 18:49:15 CDT

Thanks Blake and Christopher. I had already tried having movesel inside
and/or outside the loop without any luck. Turns out having it inside the
loop with a reference to the frame is what worked.

 proc fit2mols_traj { refid reftext selid seltext } {
 set ref [atomselect $refid $reftext]
 
 set outfile [open rmsd.dat w];
 set nf [molinfo $selid get numframes]
 
 # atom move and rmsd calculation loop
 for {set i 1 } {$i < $nf } { incr i } {
     set sel [atomselect $selid $seltext frame $i]
     set movesel [atomselect $selid all frame $I]
     $movesel move [measure fit $sel $ref]
     puts $outfile "[measure rmsd $sel $ref]"
 }
 close $outfile
 }