-
Hello everyone! I am trying to calculate the self-diffusitivy of water with MDAnalysis. I followed this tutorial: https://docs.mdanalysis.org/stable/documentation_pages/analysis/msd.html and the tips of Maginn (2018). My code is: import MDAnalysis as mda MSD = msd.EinsteinMSD(u, select='all', msd_type='xyz', fft=True) import matplotlib.pyplot as plt msd = MSD.results.timeseries nframes = MSD.n_frames from scipy.stats import linregress threshold = 1e-6 start_time = 0 for i in range(len(msd) - 1): linear_model = linregress(lagtimes[start_index:end_index], msd[start_index:end_index]) D = slope * 1 / (2 * dim_fac) My result with this code is kinda close to the experimental value: 2.12 nm^2/ns (I am assuming these are the units - could you confirm me that? I haven't seen it anywhere on the tutorial). I performed my simulation with GROMACS, with a timestep of 0.001 ps. However, if I do u.trajectory.dt, I get 0.1 (I think the units are ps). If I use 0.1 as timestep in the code, I get 0.021 (again, I wanted to be sure of the units here). So I don't know which calculation is correct, and I don't know exactly which are the units either. Thank you in advance for your answer, and I wish you a merry christimas and a happy new year! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @horlust, that's right, the time units in MDAnalysis should be in picoseconds. However, it is quite common to not save every frame due to the size of the trajectory you would end up with -- for example, might you have only saved every 100th frame to get a time difference of 0.1 ps? Our length unit is typically angstrom so if there's no conversion happening my default expectations would be units of |
Beta Was this translation helpful? Give feedback.
@horlust there are two issues here.
dt
as specified in yourmdp
file. We mean the actual time between frames in your saved trajectory. For example, ifnstxout-compressed=1000
writing an XTC file every 1000 steps, and yourdt
is 0.002 (2fs, very common) the time between frames in your trajectory is