Update compute_density_diag.cc

Closes #17