Hello I have problem in lammps, but calculate msd can use compute msd and
fix ave/time, I use another method but calulate meam cuadratic
desplacement, firts use compute displace/atom after compute reduce,
variable and fix ave/time my question is both should give the same result,
but not so.
compute msd make calculation meam desplacement all particles setting
position initial and in the program compute msd xoriginal is position
initial.

# This script builds a cylinder solid using the gamma phase structure

read_restart liquidT900k.restart.1000000
pair_style meam
pair_coeff * * library.meam Ga Ga.meam Ga

Offhand I would say the 2 approaches should give the
same answer. Figuring out why they don't is a debugging
problem. I suggest you use your script to print
the various elements of the calculation at each step,
using a small test problem (e.g. start with one or two atoms)
and see if/why they differ. You can do that as well as
anyone else.

Hello
I have a question regarding the calculation msd, is the time-average over
time and an ensemble-average over several trajectories or
or can be calculated from a single trajectory by only performing a time
average this aproximation is valid on all system.

Ensemble averaging over many systems is equivalent to time averaging for a single system only if that system is in thermodynamic equilibrium. This holds for any quantity you’d measure, including time-evolving ones like msd. Is that what you were asking?

You are calculating things like the non-Gaussian parameter ngp. That’s usually (though not always) of interest in systems close to ergodicity-breaking transitions. Ergodicity breaking implies breakdown of the equivalence of time and ensemble averaging.

Anyway, this is more a physics question than a simulation question; in simulations, if you can’t figure out from the known physics whether ensemble and time averaging should be equivalent, the best thing to do is to try both and compare the results.

If you were asking a LAMMPS question, then the compute
msd command is calculating the MSD from a single trajectory
of the system, with a time origin at the time you invoked
the compute msd command.