Density profile along the interface normal

Dear all,
I’d like to observe how density varies within the box, therefore could someone please explain how to find density within each of the slices of a simulation box formed by slicing the simulation cell into 1 angstrom-partitions along the z axis?

gmx density: gmx density — GROMACS 2022 documentation.

Dear Sasha,
I tried but couldn’t figure out how to do the partition and determine density, so could you please explain in detail how I should proceed?

To set a specific number of slices use -sl. The default is 50 slices. To get slices of 1 A, use the length of your box in the Z direction in A as the number of slices. To get the density along the z-axis use -d Z.

Thank you Minalde