From: lug2002_at_med.cornell.edu
Date: Tue Sep 28 2004 - 11:27:10 CDT

Hi!

Whitout knowing the error that you get it is quite difficult to debug it,
but let's give it a chance.
Back before RMSDTT pluging
(http://physiology.med.cornell.edu/faculty/hweinstein/vmdplugins/rmsdtt/index.html)
when I wanted to fit a trajectory to the first frame I use this function:

----------
# Fit trajectory (molid) to a reference structure (top)
proc fitframes2ref { molid seltext } {
    set ref [atomselect top $seltext frame 0]
    set sel [atomselect $molid $seltext frame 0]
    set move_sel [atomselect $molid "all" frame 0]
    set n [molinfo $molid get numframes]
    for {set i 0} {$i < $n} {incr i} {
        $sel frame $i
        $move_sel frame $i
        set trans_mat [measure fit $sel $ref]
        $move_sel move $trans_mat
        puts "Fitting $molid $i $trans_mat"
    }
    return
}
----------

I looks close to yours, but for example look at the {$i < $n}, you are
missing the '$' in your script.
Changing this script to use different rmsd and alignments should be
straight forward. Add a second selection. I haven't try the following
script but give it a try:

----------
# Fit trajectory (molid) to a reference structure (top), calculate rmsd
base on seltext2
proc fitframes2ref { molid seltext seltext2 } {
    set ref [atomselect top $seltext frame 0]
    set ref2 [atomselect top $seltext2 frame 0]
    set sel [atomselect $molid $seltext frame 0]
    set sel2 [atomselect $molid $seltext2 frame 0]
    set move_sel [atomselect $molid "all" frame 0]
    set n [molinfo $molid get numframes]
    for {set i 0} {$i < $n} {incr i} {
        $sel frame $i
        $move_sel frame $i
        set trans_mat [measure fit $sel $ref]
        set rmsd [measure rmsd $sel2 $ref2]
        $move_sel move $trans_mat
        puts "Fitting $molid $i $trans_mat $rmsd"
    }
    return
}
----------

You can even make it easier for you if you are always going to align first
the backbone of a residue, then it calculate the rmsd of the sidechain of
the residue. Then you can use one selection only (your residue(s)) and
include the keywords 'and backbone' and 'and sidechain' in the
corresponding selections inside the script.

Give a try to the RMSDTT plugin, it might solve you problem pressing two
buttons, and for a some trajectories at the same time.

Hope this helps,

Luis

bora erdemli wrote:
> Hi all?
>
> I would like to calculate rmsd during a simulation. I
> used a tcl script before. I would like to modify it
> such that it can align first the backbone of a
> residue, then it calculate the rmsd of the sidechain
> of the residue. I tried to do it by altering the
> script that I am going to copy and paste here but I
> could not succeed it. Do you have any suggestion about
> it?
>
> The script that I was trying to change:
> ----------------------------------------
>
> set reference [atomselect top "selection " frame 0]
>
>
> set num_steps [molinfo top get
> numframes]
>
>
> set compare [atomselect top
> "selection"]
>
>
> for {set i 1} {$i <= num_steps} {incr
> i} {
>
> set trans_mat [measure fit $compare
> $reference]
>
> $compare frame $i
>
>
> $compare move $trans_mat
>
>
> set rmsd [measure rmsd $compare
> $reference]
>
>
>
> puts "RMSD of $i is $rmsd"
>
> }
>