qmcpack icon indicating copy to clipboard operation
qmcpack copied to clipboard

Integrated energy density is not equal to the total energy

Open aannabe opened this issue 1 year ago • 5 comments

Describe the bug I might be doing something wrong, but I can't get the integrated energy density to be equal to the total energy. Specifically, I am comparing the VMC total energy from the scalar.dat file against the integrated energy density from the stat.h5 file. The integration is carried out as np.sum(self.total) * domain_volumes / np.sum(self.weights) in the attached get_edens.py script.

VMC total: -84.891(5) Ha Integrated Total Energy: -355.2907763843961

To Reproduce An example is attached. vmc_J123.zip

Expected behavior VMC total energy and the integrated edens should be equal.

System: NERSC

aannabe avatar Nov 12 '24 20:11 aannabe

@aannabe Please can you post files from an equivalent legacy run?

jtkrogel avatar Nov 18 '24 15:11 jtkrogel

@aannabe Here is an absolute correctness check you can make:

  1. Setup a VMC run with a single walker, a number of blocks, and 1 step per block
  2. Lightly edit qmcpack/src/Estimators/EnergyDensityEstimator.cpp as follows:
  • Go to the ::evaluate function (line 232)
  • Write a pair of loops that sum the per-particle quantities Ts, Vd, and Vs into a scalar (say, at line 291).
  • Print the scalar using app_log()<<"summed particle energy: "<<scalar<<std::endl;
  1. Recompile QMCPACK and run VMC. The printed summed energies should match those written to scalar.dat, otherwise there is a bug. These should similarly match the summed energies from the EnergyDensityEstimator in stat.h5.

jtkrogel avatar Nov 18 '24 20:11 jtkrogel

Thank you for taking a look and the suggested checks to make. I ran a similar input with the legacy code (attached below). Somehow I seem to be getting all zeros written to the stat.h5 file.

For the sake of time, we have decided to drop the EnergyDensity from our current work, but I will try to test the above once I get the time.

vmc_J123_legacy.zip

aannabe avatar Nov 18 '24 20:11 aannabe

@PDoakORNL can you post the legacy inputs you are using to compare your batched implementation against?

jtkrogel avatar Nov 18 '24 21:11 jtkrogel

tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_short.in.xml

PDoakORNL avatar Dec 02 '24 20:12 PDoakORNL