energy conservation with NPT vs NVT

Hi all-
I have noticed that the energy conservation using fix npt is about three orders of magnitude worse than with fix nvt. Does anyone know why this is? I am using “fix_modify energy yes” to get the conserved quantity for the NPT and NVT ensembles. I am using the unstable version of lammps cloned from github today. Attached is an MWE (in.lj). The comment can be switched between lines 35 and 36 to switch between NPT and NVT, leaving everything else the same. Also attached is a plot of the mean squared deviation of the energy from its average value for both ensembles. This plot shows that the error is about three orders of magnitude worse using npt. Any thoughts?
Thanks, Steve

in.lj (744 Bytes)

lj_etotal.png

My slightly uneducated guess is that when the volume of the box can fluctuate along with the potential energy, there is more “wiggle room” around the total energy. The thing of main importance is that there is no drift in the total energy, which there does not seem to be. Three orders of magnitude is a big difference though so perhaps there is something I am missing.

not sure, if this can explain the magnitude of the energy drift, but with variable cell simulations, the system is converted back and forth between box coordinates and fractional coordinates in between the update of the box dimensions. this should increase numerical noise due to floating point truncation and rounding errors.

axel.