I don’t know exactly what you mean, but compute msd will compute
a z displacement of every atom from its original position. It will
also store each atoms original z position. You can dump those 2
values or the difference to a dump file whenever you want. You
can write a per-atom formula as a function of those 2 values.
You can use fix ave/histo to bin any of those quantities. You
can post process the dump file. Somewhere in that combination
should be the values you are looking for.
Steve