Question about binning in fix ave/spatial

Dear Lammps users,

I have a problem with create bins in z-direction in the desired region of the 3D simulation box. The box in z-direction ranges from -108 to 197 and the desired region ranges from 9.45 to 79.92. I specified the “origin” coordinate in z-direction as 9.45 and the bin size 3.52 (20 bins). However, when I look the file which stores the average values the coordinate of center point of bins in z-direction ranges from -108.47 to 197.77 instead of 11.21 to 197.77. Why is it like that? I have included part of input file for reference.



That’s not the way the command works. From the doc page:

Starting at the origin, sufficient bins are created in both directions to completely cover the box. On subsequent timesteps every atom is mapped to one of the bins. Atoms beyond the lowermost/uppermost bin in a dimension are counted in the first/last bin in that dimension.

If you want to exclude atoms outside your smaller region, then use the region
option on the command. But that doesn’t affect the # of bins.