proc rmsd_residue_over_time_igem {{mol top} res debut refer} { # utilisé pour aligner les résidus avant rmsd set reference [atomselect $mol "backbone" frame $refer] # the frame being compared set compare [atomselect $mol "backbone"] #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 set prev 0 foreach r $res { if { $prev != $r } { set ref [atomselect $mol "resid $r and noh" frame $refer] set comp [atomselect $mol "resid $r and noh" frame $frame] #it could be interesting to test this, much faster and meaningfull #set ref [atomselect $mol "resid $r and name CA" frame $refer] #set comp [atomselect $mol "resid $r and name CA" frame $frame] set rmsd($frame) [expr $rmsd($frame) + [measure rmsd $comp $ref]] $comp delete $ref delete set prev [ expr $r ] } } } set nbr_elem [llength $res] for {set frame $debut} {$frame < $num_steps} {incr frame} { set rmsd_temp [expr $rmsd($frame) / $nbr_elem] puts $fil " $frame \t $rmsd_temp" } close $fil }