[lammps-users] calculating diffusion with computes?

with all the nice new features for compute/fix, etc., I was wondering if one can calculate diffusion constants directly, without post-processing.
Does anyone know how to store the positions of a group of atoms set of vectors/scalars, at time t_0, to calculate at any later time [x(t)-x(t_0)]^2?
The only thing that occurs to me now, which might not work, is to do a compute, pass that compute to a variable, and then do an uncompute to avoid deleting the original coordinates.

Look forward to any suggestions/comments. Thank sin advance!




fix msd does what you are looking for: it computes the mean square displacement for the group of atoms you select.

The only drawback is that it does not consider multiple origins in time, so the msd has less statistics and may look a
bit shaky if your system is small.

See http://lammps.sandia.gov/doc/fix_msd.html.


Computes don't store previous time info. But fixes do, so
the fix msd or some variant is your best bet, as vale indicated.