3.4.6. Root Mean Square Deviation (RMSD)#

The Root Mean Square Deviation (RMSD) is a measure of the average distance between atoms in a superimposed structure. You will see this analysis used to judge convergence of an MD simulation in just about every MD paper. The equation is

RMSD=1Ni=1Nviwi2

Where, N is the number of points for the structures vi and wi. With xyz-coordinates, we have

RMSD(v,w)=1ni=1n((vixwix)2+(viywiy)2+(vizwiz)2)
import pytraj as pt
import matplotlib.pyplot as plt

# Load trajectory
traj = pt.iterload('prod.nc', top='step3_pbcsetup_1264.parm7')

rmsd = pt.rmsd(traj, mask="@CA")

# Plot Simulation Time vs RMSD
plt.plot(rmsd)
plt.xlabel('Time ')
plt.ylabel('RMSF (Å)')
plt.savefig('rmsf.png', dpi=300)

3.4.6.1. Pairwise Root Mean Square Deviation (2D RMSD)#

import pytraj as pt
import matplotlib.pyplot as plt

# Load trajectory
traj = pt.iterload('prod.nc', top='step3_pbcsetup_1264.parm7')

data = pt.pairwise_rmsd(traj, mask="@CA")

im = plt.imshow(data
plt.colorbar(im, label='2D-RMSD (Å)')
plt.gca().invert_yaxis()
plt.xlabel('Frame Number')
plt.ylabel('Frame Number')

plt.savefig('rmsf.png', dpi=300)