From: Elizabeth K. White (ekwhite_at_goober.cs.colorado.edu)
Date: Wed Aug 15 2001 - 15:03:11 CDT

I modified the RMSD calculator to align parts of a protein over multiple
frames, in order to see what regions might be folding. The calculations
are going suspiciously slowly, and VMD often crashes without finishing
them. I am writing the files to a huge disk, so space shouldn't be a
problem. Can anyone suggest what is wrong? I am running VMD 1.6 on a DEC
Alpha using Linux. The script follows.

Thanks, Elizabeth

# Prints the RMSD of the protein atoms between each timestep
# and the first timestep for the given molecule id (default: top)
proc overlap_rmsd {aminos dir seglength {mol top}} {
        puts "$aminos aminos, $dir subdir, $seglength seglength"
        set file1 [molinfo top get {source filename}]
        set file2 [molinfo top get {source filename2}]
        # note the filename of the molecule
        exec echo ".parm file is $file1" > thisframe.out
        exec cat thisframe.out >> header.out
        exec echo ".crd file is $file2" > thisframe.out
        exec cat thisframe.out >> header.out
        set num_steps [molinfo $mol get numframes]
        set maxk [expr $aminos - $seglength + 2]
        for {set frame 0} {$frame < $num_steps} {incr frame} {
                for {set k 1} {$k < $maxk} {incr k} {
                        set m [expr $k + $seglength - 1]
                        # use frame 0 for the reference
                        set reference [atomselect $mol "protein and resid
$k to $m" frame 0]
                        # the frame being compared
                        set compare [atomselect $mol "protein and resid $k
to $m"]
                        # get the correct frame
                        $compare frame $frame
                        # compute the transformation
                        set trans_mat [measure fit $compare $reference]
                        # do the alignment
                        $compare move $trans_mat
                        # compute the RMSD
                        set rmsd [measure rmsd $compare $reference]
                        set spc "_"
                        set output "$seglength$spc$frame"
                        # puts "output is $output"
                        # print the RMSD
                        puts "frame=$frame k=$k m=$m $rmsd=rmsd"
                        set x [expr ($k + $m) / 2.0]
                        exec echo "$x $rmsd" > thisframe.out
                        exec cat thisframe.out >>
/home/ri/ekwhite/rmsd/$dir/$output
                }
        }
puts "Okay, done"
}