From: Mark M Huntress (markmh_at_bgsu.edu)
Date: Thu Nov 20 2008 - 10:03:10 CST

I am kind of new at using Namd/vmd, and I saw this correspondence on the vmd mailing list archive. I am also trying to align my frames so I can find the average positions of the atoms. Could you please give an example of how to use this proc command? I mean, do you specify mol or something? Do you specify sel by
set sel [atomselect top "protein"]
?
I mean, could you maybe show me the three or so lines that you would type to make this work (After the script below is typed in)?
Thanks,
Mark

This is the old message:

Hi Li,
If you want to compute the average structure or the RMSD of the system
throughout your trajectory you should really align all frames first. This
removes rotation and center of mass movements which could lead to distorted
average structure.
But even after the alignment your avg structure will suffer from "unnatural"
atom positions, especially in rotating parts like methyl groups:
The trajectory_smooth script just computes the arithmetic meanof each
coordinate over the specified number of frames. The arithmetic mean position
of methyl H-atoms is somewhere on the rotation axis, leading to an ill
looking conformation of these atoms. But this should be no problem for
studying the structure in general.
Below is a script that does the alignment for you.
Hope this helps,
Jan

This is the process I am trying to use:

#############################################################
# Align all frames of a molecule to the first frame #
#############################################################
proc align_all_frames {sel {mol top}} {
    set seltext [$sel text]
    # use frame 0 for the reference
    set reference [atomselect $mol "$seltext" frame 0]
    # the frame being compared
    set compare [atomselect $mol "$seltext"]
    set all [atomselect $mol all]
    set num_steps [molinfo $mol get numframes]
    for {set frame 0} {$frame < $num_steps} {incr frame} {
        # get the correct frame
        $compare frame $frame
        $all frame $frame
        # compute the transformation
        set trans_mat [measure fit $compare $reference]
        # do the alignment
        $all move $trans_mat
        # compute the RMSD
        set rmsd [measure rmsd $compare $reference]
        puts "$frame $rmsd"
    }
    display update
}