How to calculate averaged MSD?

Dear List,

I'm have a molecular simulation where I want to calculate the MSD, I do:

compute cc all chunk/atom molecule
compute myChunk all msd/chunk cc
fix molmsd all ave/time 1000 1 1000 c_myChunk[4] file msd.t mode vector

variable avgmsd equal ave(c_myChunk[4])
thermo_style custom step temp press ke etotal c_rmin c_bmax c_bavg v_avgmsd

msd.t contains the mean square displacements as expected for all the
molecules (2000), and I can post process this file to calculate the
averaged MSD.

However, to avoid this post processing step I tried to obtain the average
by defining the variable. It does not give any errors, but v_avgmsd = -Nan
on output. This used to work for e.g. for taking the average of
compute gyration/molecule

Hi Carsten. Have a look at my post below. Might be the same issue.


Hi Carsten. Have a look at my post below. Might be the same issue.

​yup, looks like it. i'm including it in LAMMPS-ICMS so that it doesn't get
lost (again) and i can forward it to steve​ whenever he is ready and able
to process patches (again).

tim (and everybody else with uncommented/unanswered/unprocessed bug reports
or bugfixes),

in order to avoid "losing" bugfixes in the mailing list, it would be highly
appreciated, if you could post them as "Issue" or "Pull request" at or

for reporting problems, posting to the mailing list usually gives the
fastest turnaround (more eyes looking at it), however, if there is no
answer within a reasonable amount of time, filing an Issue would help to
make sure that it gets looked into. if a mail to the mailing list isn't
answered within a couple of days, chances are slim that somebody will look
at it. for submitting changes, going via the websites is often simpler,
especially when submitting pull requests, as those can be integrated into
the source code management system very easily (at least into LAMMPS-ICMS).
...and once changes make it this far, they are unlikely to get lost.


this should be fixed in the 22Oct patch …


Dear Steve,