Wrong *bin volume* by chunk in NPT ensemble

Dear Axel, Steve, and other developers

I recently simulated a liquid in NPT ensemble (pressure adjustment only via z axis and fixed cross section) and then dumped the results for post-processing. However, I realized a marked difference between * Density/Number* obtained by my code and that generated using ave/chunk. Although the number of particles calculated by both methods was exactly the same in all bins and whole timesteps, by further inspection, I realized that LAMMPS does NOT consider the effect of box length fluctuation into account! In other words, when using NPT is a given axis the corresponding box’s length would change accordingly and reasonably, one should take the correct bin volume for density calculation. Why does LAMMPS take the bin volume constant, equal to the value obtained in the first time step?!

Any hint is welcome.

The compute chunk/atom command has a units reduced option. If you use it,

the bin size should adjust for a variable box size, e.g. NPT. The chunk/atom

doc page explains this.


Thanks Steve

I’ve already used units reduced.

I’m sure that LAMMPS has a bug in this calculation.

ok - then please post a simple-as-possible, short (run-time) script that illustrates the problem

and explain why the answer is wrong.