Rewrote the calculation of the number of DOFs.

It was broken for the combination of PIMD, centroid freezing and ghost
atoms present in the system. This fixes it.
Use the right number of DOFs to estimate pressure