# chunk volume with bin style and keyword region

Dear all,

I've been trying to compute a density profile in a given region of the
simulation using fix ave/chunk and compute chunk/atom with 1D bin
style and keyword region.

However it seems that the volume of the chunk (=bin) is evaluated as
the bin width multiplied by the transverse total box area, and is not
limited to the volume of the bin enclosed in the region of interest.

The density is then inconsistently computed as the number of atoms in
the bin and in the region of interest, divided by the volume of the
bin over the whole simulation box.

Would it make sense, when the keyword region is used, to compute the
volume of the chunk only inside the region of interest? Could that
create issues for other possible uses of compute chunk/atom? In that
case, could that be implemented as an option?

Best regards,
Laurent

Dear all,

I've been trying to compute a density profile in a given region of the
simulation using fix ave/chunk and compute chunk/atom with 1D bin
style and keyword region.

However it seems that the volume of the chunk (=bin) is evaluated as
the bin width multiplied by the transverse total box area, and is not
limited to the volume of the bin enclosed in the region of interest.

The density is then inconsistently computed as the number of atoms in
the bin and in the region of interest, divided by the volume of the
bin over the whole simulation box.

Would it make sense, when the keyword region is used, to compute the
volume of the chunk only inside the region of interest? Could that
create issues for other possible uses of compute chunk/atom? In that
case, could that be implemented as an option?

since regions can have very complex shapes, i don't see how one could
suitably determine the volume of the intersection of a region and a
bin.
at best, you can do some kind of approximation using either monte
carlo or overlaying a regular grid and summing up which fraction of
the volume of a bin intersects with the region.

you could do the latter with LAMMPS, by comparing the output of a
calculation with and without the region keyword of a system that has
particles in a regular grid.

axel.

Dear Axel,

Thanks, indeed it would be a lot of work to implement this generally,
for very little gain... And for simple geometries, it's easier to
postprocess the atom count in each bin in order to compute the
density.

Best regards,
Laurent