# % $Id: residue_rmsd.tcl,v 1.4 2006/03/06 23:56:46 timisgro Exp $ proc rmsd_residue_over_time {{mol top} res debut refer} { # use frame 0 for the reference # utilisé pour aligner les résidus avant rmsd set reference [atomselect $mol "protein and resname FMN" frame $refer] # the frame being compared # utilisé pour aligner les résidus avant rmsd set compare [atomselect $mol "protein and resname FMN"] #make a selection with all atoms set all [atomselect top all] #get the number of frames set num_steps [molinfo $mol get numframes] puts "Number of steps $num_steps ..." #open file for writing set fil [open data_rmsd.dat w] #init tableau rmsd for {set ff $debut} {$ff < $num_steps} {incr ff} { set rmsd($ff) 0 } #loop over all frames in the trajectory for {set frame $debut} {$frame < $num_steps} {incr frame} { puts "Calculating rmsd for frame $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 #loop through all residues foreach r $res { set ref [atomselect $mol "protein and resid $r and noh and not mass 1.008000" frame 0$refer] set comp [atomselect $mol "protein and resid $r and noh and not mass 1.008000" frame $frame] set rmsd($frame) [expr $rmsd($frame) + [measure rmsd $comp $ref]] $comp delete $ref delete } } for {set frame $debut} {$frame < $num_steps} {incr frame} { puts $fil " $frame \t $rmsd($frame)" } close $fil }