RMSFΒΆ

try pytraj online:

http://mybinder.org/badge.svg

../_images/rmsf_adk.png mean_squared_displacement_rmsf
In [1]:
# DCD and PSF files were downloaded from 
# https://github.com/MDAnalysis/mdanalysis/tree/develop/testsuite/MDAnalysisTests/data
In [2]:
import pytraj as pt

traj = pt.load('adk_dims.dcd', top='adk.psf')
traj
Out[2]:
pytraj.Trajectory, 98 frames: 
Size: 0.007318 (GB)
<Topology: 3341 atoms, 214 residues, 1 mols, non-PBC>
           
In [13]:
# superimpose to 1st frame
pt.superpose(traj, ref=0)

# compute rmsf
rmsf_data = pt.rmsf(traj)
rmsf_data
Out[13]:
array([[  1.00000000e+00,   1.26553727e+00],
       [  2.00000000e+00,   1.36630617e+00],
       [  3.00000000e+00,   1.33039340e+00],
       ..., 
       [  3.33900000e+03,   1.93633843e+00],
       [  3.34000000e+03,   2.08765936e+00],
       [  3.34100000e+03,   1.99500670e+00]])
In [14]:
# plot by using matplotlib

%matplotlib inline
import matplotlib
matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi'] # larger image
from matplotlib import pyplot as plt

plt.plot(rmsf_data.T[0], rmsf_data.T[1])
plt.xlabel('atom')
plt.ylabel('RMSF (Angstrom)')
Out[14]:
<matplotlib.text.Text at 0x7ff114421278>