LAMMPS example script for calculating diffusion coefficient from MSD

Greetings
I have been studying the input script for calculating diffusion coefficient given in the ‘DIFFUSE’ folder in ‘examples’. A part of the input script ‘in.msd.2d’ is mentioned here:

fix 1 all nve
fix 2 all langevin $t $t 0.1 498094
fix 3 all enforce2d

#equilibration run
thermo 1000
run 5000

unfix 2

#data gathering run
reset_timestep 0

#factor of 4 in 2 variables is for 2d

compute msd all msd com yes
variable twopoint equal c_msd[4]/4/(step * dt + 1.0e-6)
fix 9 all vector 10 c_msd[4]
variable fitslope equal slope(f_9)/4/(10*dt)

I have some questions form this part of script as follows:

  1. Why was the thermostat turned off before data gathering run?
  2. The c_msd[4] is divided by a factor of 4. I do not understand the reasoning behind it. What would be the case for 3d systems?

Because a thermostat influences the diffusion behavior.

Please look up the derivation of the self-diffusion from MSD via the Einstein relation in a text book or equivalent source of knowledge. You need to understand what you are computing. How there is a factor of 4 and what that value would be for a 3d system should become evident once you understand it.

1 Like

Thanks for your quick response. I was able to find the equation on Wikipedia: Mean squared displacement - Wikipedia

Wikipedia may be a good source to look up some detail quickly, but it is no replacement for the level of understanding that a proper text book provides.

2 Likes