Skip to content

Commit

Permalink
Merge branch 'develop' into stream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
prckent authored Nov 2, 2023
2 parents a68bf97 + e9cd2c8 commit 3968de5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/QMCHamiltonians/tests/test_QMCHamiltonian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ TEST_CASE("integrateListeners", "[hamiltonian]")
auto sum_kinetic = std::accumulate(kinetic.begin(), kinetic.end(), 0.0);
auto sum_local_nrg = std::accumulate(local_nrg.begin(), local_nrg.end(), 0.0);
CHECK(sum_local_nrg == Approx(sum_local_pots + sum_kinetic));

// Here we test consistency between the per particle energies and the per hamiltonian energies
typename decltype(energies)::value_type hamiltonian_local_nrg_sum = 0.0;
typename decltype(energies)::value_type energies_sum = 0.0;
for (int iw = 0; iw < num_walkers; ++iw) {
hamiltonian_local_nrg_sum += ham_list[iw].getLocalEnergy();
energies_sum += energies[iw];
}

// the QMCHamiltonian.getLocalEnergy() contains the ion_potential as well.
sum_local_nrg += std::accumulate(ion_pots.begin(), ion_pots.end(), 0.0);
CHECK(sum_local_nrg == Approx(hamiltonian_local_nrg_sum));
CHECK(sum_local_nrg == Approx(energies_sum));
}
}

Expand Down

0 comments on commit 3968de5

Please sign in to comment.