MDA diffusivity

37 views
Skip to first unread message

Aashish Bhatt

unread,
Nov 21, 2023, 3:42:31 PM11/21/23
to MDnalysis discussion
Hi, MD analysis Group Member,

I have a ligand with a water system and I want to calculate the diffusion constant. 
I am confused about the timestep. I am using NAMD (100ns) and the dcd frequency is 50000 and the timestep is 2fs in my input.
can you please guide me what is the actual time between the frames in my case for the below script since I am confused is it the same as we define in the input or something else?
import matplotlib.pyplot as plt
nframes = MSD.n_frames timestep = 1 # 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() Regards,Ashish

Oliver Beckstein

unread,
Nov 21, 2023, 4:29:42 PM11/21/23
to mdnalysis-discussion
Hello Aashish,

welcome to the MDAnalysis mailing list!

You can use MDAnalysis to see what the time between frames in the trajectory is (DCD records this information):

import MDAnalysis as mda
u = mda.Universe(PSF, DCD)    # load your topology and trajectory
print(u.trajectory.dt)        # trajectory time between frames in ps

Note that MDAnalysis will output times in ps and lengths in Å. It generally knows how to convert the input values. 

*If* your u.trajectory.dt does not look like a number that you expect (eg like 2.0 ps) but instead you get values like 0.09777642 or 0.04888821 then you probably wrote your trajectories with NAMD ≤ 2.5 (see https://github.com/MDAnalysis/mdanalysis/wiki/FileFormats#dcd): as far as we know, NAMD changed the units it outputs (see also  https://userguide.mdanalysis.org/stable/formats/reference/dcd.html ). If that is the case then load the trajectory as

# for NAMD ≤ 2.5 (time saved in DCD in ps instead of AKMA units)
# set the timeunit explicitly and use the more flexible LAMMPS DCD reader
u = mda.Universe(PSF, DCD, timeunit="ps", format="LAMMPS")

But if the dt comes out correctly without setting the time unit explicitly then do not set it explicitly! This is one of the cases where the file format does not provide enough information for us to automatically read it correctly.

Hope that helps!

Oliver


--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/7d913f02-1c7a-488a-8b81-def027f46373n%40googlegroups.com.



--
Oliver Beckstein (he/his/him)

email: orbe...@mdanalysis.org
twitter: @orbeckst
GitHub: @orbeckst

MDAnalysis – a NumFOCUS fiscally sponsored project





Reply all
Reply to author
Forward
0 new messages