Density

Dear users,
How can I calculate density (gr/cm3) of a kind of molecule as a function of one axis for example z?
Is it possible to calculate this property in this manner?

Dear users,
How can I calculate density (gr/cm3) of a kind of molecule as a function of one axis for example z?
Is it possible to calculate this property in this manner?

Dear users,
How can I calculate density (gr/cm3) of a kind of molecule as a function of one axis for example z?

use spatial binning via chunks to compute the mass per bin, if you define a group that only contains the molecules of interest, you get only contribution of those molecules (or rather their atoms) to the bins. when collecting/averaging over chunks, you can request to compute mass density. from there is is simply a unit conversion to get g/cm^3

https://lammps.sandia.gov/doc/Howto_chunk.html