Hello, I am working on a MC simulation of a solid using NVT ensemble with Metropolis algorithm. The botlzman factor is of the form exp(-βΔU(r1,r2...rN)), where U is just the potential energy. From thermodyanmics, dU=dq+dw (dq is the amount of heat put in, and dw is the amount of work done on the system). Since there is no work done (constant volume). dU=dq. Therefore this factor makes sense to me. Now what I would like to do is let the volume change under constant pressure and temperature. That requires NPT ensemble. Again from thermodynamics du=dq+dw, but since volume is changing, dU=dq-pdV=dq-d(pV), thus d(U+pV)=dq. That's the enthalpy. What I would expect the boltzman factor to be is exp(-β(ΔU+pΔV)). Am I thinking wrong? However, I found it to be in the form exp(-β(ΔU+pΔV-NkTln(V'/V)) where V'=V+ΔV. Where does this extra term come from!? Thank you very much for your help.