How to print the density and gamma on the grids for ground and excited states

I am now needing the info of density and gamma on the grid point, including each grid point’s:
coordinates, the atom which it belongs to, density, gamma (the square of the norm of the gradient) on this point, (and quadrature weight if possible)

Do you know how to print these for the ground state and excited states?

The developer forum is probably a better place for this question. I think this is reasonably straightforward in the code but I’m not sure that there’s a user-facing way to do this. Someone can correct me if I’m wrong, but esp. the square of the norm of the gradient is a slightly nonstandard quantity, as are the atoms associated with the grid points.