Added 3d option for one-body densities.