I am trying to make the connection from statistical mechanics to thermodynamics for the isothermal isobaric ensemble. Partition function = (sum of)exp(-BEj-gamma*Vj). I have followed T.L. Hill [Statistical Mechanics, p. 67] but can not understand how he justifies dE=(sum of)EdP, rather than (sum of) EdP +(sum of)PdE. This makes it easy, but I think (sum of)PdE is not zero. He doesn't make this simplification for the canonical or grand canonical ensembles. However, since Ej = Ej(P, N) this will introduce an unpleasant (dE/dP)dP term (partial derivative with N held constant) which I do not know what to do with. I can get the TdS and PdV terms but am stuck with what this nasty extra term means. Any ideas would be appreciated.