Dear All,
I need some clarifications on the MSD code as contained in the v2.0 (available through the GitHub page). Using the approach as provided in refs
[1] and
[2]. I got the following plots.
Figure 1 is the plot of MSD (in arbitrary units) against tau while figure 2 is the log-log plot of MSD against time. I am not sure about why my plot (as shown in Figure 1) didn't follow the same trend. Figure 2 is similar to that generated from the gromacs gmx-msd command. Kindly advise accordingly.
PS: my trajectory contains 99991 frames with timestep of 10. The modified is as shown below.
# trajectory information
traj = 'PAM_1000ns.xtc'
grofile = 'em.gro'
# load traj
u = mda.Universe(grofile, traj)
# calc MSD
atom_select = u.select_atoms('resid 25 and name C1')
MSD = msd.EinsteinMSD(atom_select, select='all', msd_type='xyz', fft=True)
MSD.run()
# access msd values
msd = MSD.timeseries
# plot msd
import matplotlib.pyplot as plt
nframes = MSD.n_frames
print(nframes)
timestep = 10 # this needs to be the actual time between frames
lagtimes = np.arange(nframes)*timestep # make the lag-time axis
fig = plt.figure()
ax = plt.axes()
#plot the actual MSD
ax.plot(lagtimes, msd, ls="-",color='blue')
exact = lagtimes*6
# plot the exact result
ax.plot(lagtimes, exact, ls="--",color='black')
ax.legend(labels = ('3D random walk','$y=2 D\tau$'))
plt.show()
plt.loglog(lagtimes, msd)
plt.show()