How to calculate RMSD and RMSF

From Computational Biophysics and Materials Science Group
Jump to: navigation, search

RMSD TCL File

Save the following text into a tcl file and execute it. Modify it accordingly.

set molnum [mol new ../../ionized.pdb type pdb waitfor all]
#for {set i 1 } {$i<2} {incr i} {
   mol addfile NPT-01.dcd type dcd step 4 waitfor all
   mol addfile NPT-02.dcd type dcd step 4 waitfor all
#}
set num_frames [molinfo $molnum get numframes]
set a0 [atomselect top "protein " frame 0]
set b [atomselect top "protein"]
set outfile [open "rmsd-npt.dat" "w"]
for {set i 0} {$i<$num_frames} {incr i} {
$b frame $i
$b move [measure fit $b $a0]
set rmsd1 [measure rmsd $b $a0]
puts $outfile "$i \t $rmsd1 "
}
close $outfile

RMSF TCL File

Save the following text into a tcl file and execute it. Modify it accordingly.

set molnum [mol new ../../ionized.pdb type pdb waitfor all]
 for {set i 3 } {$i<5} {incr i} {
   mol addfile NPT-0$i.dcd type dcd step 4 waitfor all
 }
set num_frames [molinfo $molnum get numframes]
set kk 2250
set a [atomselect top "protein and name CA and segname P1 and resid 1 to 198" ]
set c [atomselect top "protein and name CA and segname P1 and resid 1 to 198"  frame $kk]
 for {set i 0} {$i<$num_frames} {incr i} {
 $a frame $i
 $a move [measure fit $a $c]
 }
set outfile [open "rmsf-chain1-n-mar26-cse.dat" "w"]
set rmsf [measure rmsf $a first $kk last -1 step 1]
  for {set i 0} {$i <  [$a num] } {incr i} {
  puts $outfile "[expr {$i+1}] [lindex $rmsf $i]"
  }
close $outfile