How to make MSD output for every 0.5 ns

Dear All

I run simulation for 3ns and I want to calculate MSD for every 0.5ns.

Is it possible to make different MSD output file for each 0.5ns? or any other way?

Any kinds of comments will be helpful


You can use a run every command (or put a loop in

your input script) and redefine the compute msd command

and/or fix ave time command you are using for the output,

to start afresh every N timesteps.


Dear Steve

Thank you very much for your suggestion

I tried with run every command, my command is like

compute MSD centeratoms msd

Run 30000 every 10000 "fix 2 centeratoms time/ave 100 1 100 c_MSD file msd.txt mode vector

In that case I am facing two problems-

  1. Since in the fix its only mentioned one file then, its printing only the updated values. But I need three files for 1-10000 timesteps, 10100-20000 timesteps and 20100-30000 timesteps. Is it possible to make different files with this fix command ? or by any others command in LAMMPS?

  2. The averaging output value is printed in the file from 10000 timesteps, therefore how about the 1 to 10000 timesteps?

Pardon if I make any silly mistake.

Thank you very much

Best regard

Not clear on what you are asking. If you simply

want the MSD after 10000 steps, and you want to do

that multiple times, you could do something like this:

loop over:

uncompute 1 # need to define this fix before the loop as well

compute 1 all msd

run 10000

variable out equal c_1[4]

print “OUTMSD ${out}”

See the next and jump commands for how to setup a loop

in your input script.