Diffusion Coefficient

First i calculated MSD values using Compute msd command, then i plot the graph between MSD value on Y axis & time on X axis.
To find diffusion coefficient we need the slope of MSD curve so to calculate the slope of MSD curve i used Linear regression techinque using python & i got the slop value of MSD curve.

slope, intercept, r, p, se = linregress(x, y)

is this correct method to find slope of MSD curve ??
am i correct ?


Yes, this is the correct method. Usually the fit is done for a restricted time domain (ie 0.1 < x < 0.9).


note: It would have been better not to create a new topic for this. Also at this point those are not really LAMMPS-related questions.