We got the number of particles in a 3D bin of r, theta and Phi. I wonder how to calculate the volume of this bin so that we can divide the number by the bin volume to get density? Can anybody suggest?
If I understand you correctly your bins are in a 3D sphere? One simple approach is to calculate the volume of the full sphere and divide by the number of bins.
You could also approximate the sphere into a polyhedron and calculate the volume of the corresponding pyramid. You would need to calculate the shape of the base of the pyramid and the edge is r. You could calculate the shape of the base by using phi and theta. Check the link on stackexchange for equations.
I recently published a paper doing a similar thing, but in 2D. The details are in the supplementary information.
Consider you find n particles in the bin from [r-Dr/2, r+Dr/2], [phi-Dphi/2, phi+Dphi/2] and [theta-Dtheta/2, theta+Dtheta/2]. Then your local density will be