Question: MSD calculations vs time
gravatar for
5.7 years ago by

I have a trajectory file from simulation of 20,000 frames with 5 ps time in between every frame, what I want to do is to calculate diffusion in 2 dimension (x and y axis). but to calculate diffusion in 2D, first I have to calculate Mean square displacement of the selected atom from the trajectory. would also like to calculate MSD and diffusion for all atom.  MSD calculates the average time taken by molecule to explore the system. 


The formula for MSD would be 

{\rm MSD} = \langle \vert{\bf r}(t) - {\bf r}(0)\vert^2 \rangle\end{displaymath}

I am very new to python programming and I would really want some help to get started this problem and to solve this problem. Hope to get positive response.

I can use the following approach to calculate MSD 

import numpy as np
    r = np.sqrt(xdata**2 + ydata**2)
    diff = np.diff(r) #this calculates r(t + dt) - r(t)
    diff_sq = diff**2
    MSD = np.mean(diff_sq)

I cannot figure it out how can I make the whole script which adds and take sqroot of position of atoms in x y and z  at particular time interval here in the code it is:

r = np.sqrt(xdata**2 + ydata**2)
How can I select the atomic positions (which I have already obtained coordinates in .xyz file from .DCD file using Catdcd.) .xyz file contain x y and z coordiantes from .DCD file and I need to calculate diffusion across x and Y plane.  Now how can I calculate MSD from the positions? Can anyone help me with the coding in python. I will be really grateful. 



ADD COMMENTlink modified 5.5 years ago by Biostar ♦♦ 20 • written 5.7 years ago by contact.lifesciences.inc30


We believe that this post does not fit the main topic of this site.

Not a bioinformatics question

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.


ADD REPLYlink modified 5.7 years ago • written 5.7 years ago by Ram32k

I have re-opened the question because I think that molecular dynamics simulations is very much on topic. Indeed,  I feel it would be a very narrow perspective if computational biology and bioinformatics were restricted to NGS and sequence analysis only.

ADD REPLYlink modified 5.7 years ago • written 5.7 years ago by Michael Dondrup48k

Looks like I was mistaken. I closed it because I saw nothing bio related - I certainly don't think NGS is the only part of bioinformatics. Thank you for clarifying the MD part.

ADD REPLYlink modified 5.7 years ago • written 5.7 years ago by Ram32k


This is purely a bioinformatics question, you are mistaken. This lipid diffusion is a very important property which needs to be calculated. it gets calculated by analyzing large data files which are trajectory file. Bioinformatics does not only deals with pdb files. I asked a question related to trajectory file which got data and which is analyzed by making small python scripts.

ADD REPLYlink written 5.7 years ago by contact.lifesciences.inc30

Yes, I was mistaken. I saw nothing biology related and that's why I closed the question. I apologize.

ADD REPLYlink written 5.7 years ago by Ram32k

Kindly make my question live so that I can get answers for my research related problem...

ADD REPLYlink written 5.7 years ago by contact.lifesciences.inc30
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2130 users visited in the last hour