diff --git a/src/Containers/OhmmsPETE/tests/CMakeLists.txt b/src/Containers/OhmmsPETE/tests/CMakeLists.txt index 071c930cdf..238ff76004 100644 --- a/src/Containers/OhmmsPETE/tests/CMakeLists.txt +++ b/src/Containers/OhmmsPETE/tests/CMakeLists.txt @@ -13,6 +13,6 @@ set(UTEST_EXE test_containers_ohmmspete) set(UTEST_NAME deterministic-unit_${UTEST_EXE}) add_executable(${UTEST_EXE} test_Vector.cpp test_Matrix.cpp test_Array.cpp test_TinyVector.cpp) -target_link_libraries(${UTEST_EXE} catch_main containers) +target_link_libraries(${UTEST_EXE} catch_main containers utilities_for_test) add_unit_test(${UTEST_NAME} 1 1 $) diff --git a/src/Containers/OhmmsPETE/tests/test_Matrix.cpp b/src/Containers/OhmmsPETE/tests/test_Matrix.cpp index 0f01bd424b..b6d2cc918d 100644 --- a/src/Containers/OhmmsPETE/tests/test_Matrix.cpp +++ b/src/Containers/OhmmsPETE/tests/test_Matrix.cpp @@ -17,6 +17,7 @@ #include "OhmmsPETE/OhmmsMatrix.h" #include "config.h" +#include using std::string; @@ -53,14 +54,28 @@ TEST_CASE("matrix", "[OhmmsPETE]") CHECK(*ia == Approx(3.1)); } - REQUIRE( A == A); - REQUIRE( A != C); + REQUIRE(A == A); + REQUIRE(A != C); // copy constructor and copy method Mat D(C); CHECK(D.rows() == 3); CHECK(D.cols() == 3); + // Check that the zeroing behavior on construction and resize + // follows assumptions about zeroing. + Mat E(2, 2); + Mat E_expected(2, 2); + E_expected = 0.0; + auto check_matrix = checkMatrix(E, E_expected); + CHECKED_ELSE(check_matrix.result) { FAIL(check_matrix.result_message); } + + E.resize(5, 5); + Mat E2_expected(5, 5); + E2_expected = 0.0; + check_matrix = checkMatrix(E, E2_expected); + CHECKED_ELSE(check_matrix.result) { FAIL(check_matrix.result_message); } + // swap_rows A(0, 0) = 0.0; A(0, 1) = 1.0; @@ -81,8 +96,8 @@ TEST_CASE("matrix", "[OhmmsPETE]") TEST_CASE("matrix converting assignment", "[OhmmsPETE]") { - Matrix mat_A(3,3); - Matrix mat_B(3,3); + Matrix mat_A(3, 3); + Matrix mat_B(3, 3); for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) @@ -90,40 +105,40 @@ TEST_CASE("matrix converting assignment", "[OhmmsPETE]") mat_B = mat_A; - CHECK(mat_B(0,0) == Approx(0)); - CHECK(mat_B(1,1) == Approx(4.2)); + CHECK(mat_B(0, 0) == Approx(0)); + CHECK(mat_B(1, 1) == Approx(4.2)); - Matrix mat_C(2,2); + Matrix mat_C(2, 2); for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) mat_C(i, j) = (i + j) * 2.2; mat_A.assignUpperLeft(mat_C); - CHECK(mat_A(1,0) == Approx(2.2)); - CHECK(mat_A(1,2) == Approx(6.3)); + CHECK(mat_A(1, 0) == Approx(2.2)); + CHECK(mat_A(1, 2) == Approx(6.3)); - Matrix mat_D(4,4); + Matrix mat_D(4, 4); for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) mat_D(i, j) = (i + j) * 2.3; mat_A.assignUpperLeft(mat_D); - CHECK(mat_A(1,0) == Approx(2.3)); - CHECK(mat_A(1,2) == Approx(6.9)); + CHECK(mat_A(1, 0) == Approx(2.3)); + CHECK(mat_A(1, 2) == Approx(6.9)); - Matrix mat_too_small(2,2); + Matrix mat_too_small(2, 2); CHECK_THROWS(mat_too_small = mat_A); - - Matrix mat_too_small_but_larger_value_type(2,2); + + Matrix mat_too_small_but_larger_value_type(2, 2); mat_too_small_but_larger_value_type = mat_B; CHECK(mat_too_small_but_larger_value_type.rows() == 3); CHECK(mat_too_small_but_larger_value_type.cols() == 3); - CHECK(mat_too_small_but_larger_value_type(1,1) == Approx(mat_B(1,1))); - Matrix too_small_but_same(2,2); + CHECK(mat_too_small_but_larger_value_type(1, 1) == Approx(mat_B(1, 1))); + Matrix too_small_but_same(2, 2); too_small_but_same = mat_A; CHECK(too_small_but_same.rows() == 3); CHECK(too_small_but_same.cols() == 3); - CHECK(too_small_but_same(1,1) == Approx(mat_A(1,1))); + CHECK(too_small_but_same(1, 1) == Approx(mat_A(1, 1))); } } // namespace qmcplusplus diff --git a/src/Estimators/EnergyDensityEstimator.cpp b/src/Estimators/EnergyDensityEstimator.cpp index 926e657512..0491cc4207 100644 --- a/src/Estimators/EnergyDensityEstimator.cpp +++ b/src/Estimators/EnergyDensityEstimator.cpp @@ -148,8 +148,11 @@ void NEEnergyDensityEstimator::registerListeners(QMCHamiltonian& ham_leader) QMCHamiltonian::mw_registerKineticListener(ham_leader, kinetic_listener); ListenerVector potential_listener("potential", getListener(local_pot_values_)); QMCHamiltonian::mw_registerLocalPotentialListener(ham_leader, potential_listener); - ListenerVector ion_potential_listener("potential", getListener(local_ion_pot_values_)); - QMCHamiltonian::mw_registerLocalIonPotentialListener(ham_leader, ion_potential_listener); + if (pset_static_) + { + ListenerVector ion_potential_listener("potential", getListener(local_ion_pot_values_)); + QMCHamiltonian::mw_registerLocalIonPotentialListener(ham_leader, ion_potential_listener); + } } /** This function collects the per particle energies. diff --git a/src/Estimators/EnergyDensityInput.h b/src/Estimators/EnergyDensityInput.h index d21ecf9716..24d92569d5 100644 --- a/src/Estimators/EnergyDensityInput.h +++ b/src/Estimators/EnergyDensityInput.h @@ -75,7 +75,9 @@ class EnergyDensityInput std::string name_{type_tag}; std::string type_{type_tag}; std::string dynamic_{"e"}; - std::string static_{"ion"}; + std::string static_{}; // There can't be a default for this since + // some systems, heg namely don't + // have static psets bool ion_points_{false}; EnergyDensityInputSection input_section_; ReferencePointsInput ref_points_input_; diff --git a/src/Estimators/EstimatorManagerCrowd.h b/src/Estimators/EstimatorManagerCrowd.h index 3ca7eaf9eb..87ac3b1c87 100644 --- a/src/Estimators/EstimatorManagerCrowd.h +++ b/src/Estimators/EstimatorManagerCrowd.h @@ -32,14 +32,14 @@ class QMCHamiltonian; * * Stepping away from the CloneManger + clones design which creates EstimatorManagers * Which operate differently based on internal switches. - * + * * see EstimatorManagerNew.h for full description of the new design. */ class EstimatorManagerCrowd { public: - using MCPWalker = Walker; - using RealType = EstimatorManagerNew::RealType; + using MCPWalker = Walker; + using RealType = EstimatorManagerNew::RealType; using FullPrecRealType = EstimatorManagerNew::FullPrecRealType; /** EstimatorManagerCrowd are always spawn of an EstimatorManagerNew @@ -47,7 +47,7 @@ class EstimatorManagerCrowd EstimatorManagerCrowd(EstimatorManagerNew& em); ///destructor - ~EstimatorManagerCrowd(){}; + ~EstimatorManagerCrowd() {}; ///return the number of ScalarEstimators inline int size() const { return scalar_estimators_.size(); } diff --git a/src/Estimators/MagnetizationDensity.h b/src/Estimators/MagnetizationDensity.h index 5798e0e41e..17e1c8fce5 100644 --- a/src/Estimators/MagnetizationDensity.h +++ b/src/Estimators/MagnetizationDensity.h @@ -30,13 +30,13 @@ class MagnetizationDensityTests; } /** Magnetization density estimator for non-collinear spin calculations. * - * As documented in the manual, the following formula is computed: + * As documented in the manual, the following formula is computed: *\mathbf{m}_c = \int d\mathbf{X} \left|{\Psi(\mathbf{X})}\right|^2 \int_{\Omega_c}d\mathbf{r} \sum_i\delta(\mathbf{r}-\hat{\mathbf{r}}_i)\int_0^{2\pi} \frac{ds'_i}{2\pi} \frac{\Psi(\ldots \mathbf{r}_i s'_i \ldots )}{\Psi(\ldots \mathbf{r}_i s_i \ldots)}\langle s_i | \hat{\sigma} | s'_i \rangle * * The way that the above relates to the underlying data structure data_ is as follows. We grid space up and assign an index - * for each of the real space bins (identical to SpinDensityNew). To account for the fact that magnetization is vectorial, we + * for each of the real space bins (identical to SpinDensityNew). To account for the fact that magnetization is vectorial, we * triple the length of this array. If grid_i is the index of the real space gridpoint i, then the data is layed out like: - * [grid_0_x, grid_0_y, grid_0_z, grid_1_x, ..., grid_N_x, grid_N_y, grid_N_z]. This is also the way it is stored in HDF5. + * [grid_0_x, grid_0_y, grid_0_z, grid_1_x, ..., grid_N_x, grid_N_y, grid_N_z]. This is also the way it is stored in HDF5. * */ class MagnetizationDensity : public OperatorEstBase @@ -93,9 +93,9 @@ class MagnetizationDensity : public OperatorEstBase /** * Generates the spin integrand \Psi(s')/Psi(s)* \langle s | \vec{\sigma} | s'\rangle for a specific * electron iat. Since this is a vectorial quantity, this function returns sx, sy, and sz in their own - * arrays. + * arrays. * - * @param[in] pset ParticleSet + * @param[in] pset ParticleSet * @param[in] wfn TrialWaveFunction * @param[in] iat electron index * @param[out] sx x component of spin integrand @@ -110,9 +110,9 @@ class MagnetizationDensity : public OperatorEstBase std::vector& sz); /** - * Implementation of Simpson's 1/3 rule to integrate a function on a uniform grid. + * Implementation of Simpson's 1/3 rule to integrate a function on a uniform grid. * - * @param[in] fgrid f(x), the function to integrate. + * @param[in] fgrid f(x), the function to integrate. * @param[in] gridDx, the grid spacing for the uniform grid. Assumed to be consistent with size of fgrid. * @return Value of integral. */ @@ -120,29 +120,29 @@ class MagnetizationDensity : public OperatorEstBase /** - * Convenience function to generate a grid between 0 and 2pi, consistent with nsamples_ and integration method. - * Can be uniform or random, depending on choice of integrator. + * Convenience function to generate a grid between 0 and 2pi, consistent with nsamples_ and integration method. + * Can be uniform or random, depending on choice of integrator. * * @param[out] sgrid A grid with nsamples_ points between 0 and 2pi. Overwritten. */ void generateGrid(std::vector& sgrid) const; /** - * Generate a uniform grid between [start,stop] for numerical quadrature. + * Generate a uniform grid between [start,stop] for numerical quadrature. * * @param[out] sgrid Random number grid between "start" and "stop". Number of points taken from size of sgrid. - * @param[in] start start of grid interval + * @param[in] start start of grid interval * @param[in] stop end of grid interval */ void generateUniformGrid(std::vector& sgrid, const Real start, const Real stop) const; /** - * Generate random grid between [start,stop] for MC integration. + * Generate random grid between [start,stop] for MC integration. * * @tparam RAN_GEN Random number generator type. * @param[out] sgrid Random number grid between "start" and "stop". Number of points taken from size of sgrid. - * @param[in] rng Random number generator queried to generate random points. - * @param[in] start start of grid interval + * @param[in] rng Random number generator queried to generate random points. + * @param[in] start start of grid interval * @param[in] stop end of grid interval */ @@ -150,11 +150,11 @@ class MagnetizationDensity : public OperatorEstBase /** * For a given spatial position r and spin component s, this returns the bin for accumulating the observable. - * + * * * @param[in] Position in real space. 3D * @param[in] component, the x=0,y=1,z=2 component of the spin. - * @return Index of appropriate bin for this position and spin component + * @return Index of appropriate bin for this position and spin component */ size_t computeBin(const Position& r, const unsigned int component) const; MagnetizationDensityInput input_; diff --git a/src/Estimators/NESpaceGrid.cpp b/src/Estimators/NESpaceGrid.cpp index d57ac67068..7fd63c0f5d 100644 --- a/src/Estimators/NESpaceGrid.cpp +++ b/src/Estimators/NESpaceGrid.cpp @@ -731,7 +731,18 @@ void NESpaceGrid::collect(NESpaceGrid& reduction_grid, const RefVector void NESpaceGrid::normalize(REAL invToWgt) { - std::transform(data_.begin(), data_.end(), data_.begin(), + // I think its better to not transform the weights folling the + // convention that value 0 is always the weight. + + // for (int i = 0, n = buffer_offset_; i < ndomains_; i++, n += nvalues_per_domain_) + // { + // for (int v = 0; v < nvalues_per_domain_; v++) + // { + // data_[n + v] *= invToWgt; + // } + // } + + std::transform(data_.begin() + buffer_offset_, data_.end(), data_.begin() + buffer_offset_, std::bind(std::multiplies(), std::placeholders::_1, invToWgt)); } diff --git a/src/Estimators/tests/test_EnergyDensityEstimatorIntegration.h b/src/Estimators/tests/test_EnergyDensityEstimatorIntegration.h index 23b900b6cf..cc58c42d6f 100644 --- a/src/Estimators/tests/test_EnergyDensityEstimatorIntegration.h +++ b/src/Estimators/tests/test_EnergyDensityEstimatorIntegration.h @@ -66,97 +66,93 @@ double cannedSum() }, }}, }; - CrowdEnergyValues local_potential_values = { + CrowdEnergyValues local_potential_values = {{{"ElecIon"}, + { + { + 0.1902921988, + 0.305111589, + -0.4795567012, + 0.4963486847, + -0.3115299195, + -0.3619893748, + 0.09889833001, + 0.2794993745, + }, + { + -0.5591061161, + -0.1018774551, + -1.758163531, + -0.6303051354, + 0.4878929497, + 0.3358202321, + 0.3278906128, + -0.3592569675, + }, + { + 0.2308181408, + 0.3380463882, + 0.4502142537, + 0.09129681658, + 0.5120332566, + 0.4968745527, + 0.5207083896, + -0.3453223962, + }, + { + 0.1190383565, + -0.1566598476, + -1.061808708, + 0.4489104633, + -0.4774404553, + 0.3925164497, + 0.1283951707, + -0.436834872, + }, + }}, + {{"ElecElec"}, + {{ + -0.6210508854, + -0.5492735065, + -0.5151950441, + -0.5785561754, + -0.5071021975, + -0.5744799702, + -0.5424577691, + -0.7204598054, + }, + { + -0.3894105334, + -0.5444925249, + -0.4896973204, + -0.5645833732, + -0.4432189127, + -0.5226105398, + -0.4715625335, + -0.528633033, + }, + { + -0.04130562213, + -0.04840737416, + -0.5634037657, + -0.6271532836, + -0.1013881328, + -0.2272211231, + -0.2683512191, + -0.2033476916, + }, + { + -0.3962585141, + -0.5585863635, + -0.5626605561, + -0.3180610119, + -0.3441004857, + -0.2138720089, + -0.3116368159, + -0.5650381055, + }}}}; + CrowdEnergyValues local_ion_pot_values = { {{"ElecIon"}, - { - { - 0.1902921988, - 0.305111589, - -0.4795567012, - 0.4963486847, - -0.3115299195, - -0.3619893748, - 0.09889833001, - 0.2794993745, - }, - { - -0.5591061161, - -0.1018774551, - -1.758163531, - -0.6303051354, - 0.4878929497, - 0.3358202321, - 0.3278906128, - -0.3592569675, - }, - { - 0.2308181408, - 0.3380463882, - 0.4502142537, - 0.09129681658, - 0.5120332566, - 0.4968745527, - 0.5207083896, - -0.3453223962, - }, - { - 0.1190383565, - -0.1566598476, - -1.061808708, - 0.4489104633, - -0.4774404553, - 0.3925164497, - 0.1283951707, - -0.436834872, - }, - }}, - {{"ElecElec"}, - { - { - -0.6207395076, - -0.5429517933, - -0.5065277177, - -0.5783610014, - -0.4984350535, - -0.5916988187, - -0.5487789099, - -0.7210825667, - }, - { - -0.3816392959, - -0.5430679423, - -0.482442029, - -0.5642089765, - -0.4469150835, - -0.5218930872, - -0.4652968702, - -0.5215640811, - }, - { - 0.0712246546, - 0.03917229912, - -0.5630155803, - -0.6444294957, - -0.0487069078, - -0.178371135, - -0.2205232716, - -0.1101885998, - }, - { - -0.3381089106, - -0.5573446148, - -0.5798054791, - -0.2771065229, - -0.2847240288, - -0.1318201812, - -0.276998751, - -0.5649121642, - }, - }}, - }; - CrowdEnergyValues local_ion_pot_values = { - {{"ElecIon"}, - { + { { 0.04332090412, 0.1737532775, diff --git a/src/Particle/WalkerConfigurations.h b/src/Particle/WalkerConfigurations.h index 1d150a2232..962e0d80ff 100644 --- a/src/Particle/WalkerConfigurations.h +++ b/src/Particle/WalkerConfigurations.h @@ -49,6 +49,7 @@ struct MCDataType T R2Accepted; T R2Proposed; T LivingFraction; + T WeightedEnergySum; }; /** A set of light weight walkers that are carried between driver sections and restart diff --git a/src/QMCDrivers/DMC/DMCBatched.cpp b/src/QMCDrivers/DMC/DMCBatched.cpp index 320e540cb3..7d34819089 100644 --- a/src/QMCDrivers/DMC/DMCBatched.cpp +++ b/src/QMCDrivers/DMC/DMCBatched.cpp @@ -137,7 +137,7 @@ void DMCBatched::advanceWalkers(const StateForThread& sft, std::vector rr_proposed(num_walkers, 0.0); std::vector rr_accepted(num_walkers, 0.0); - + std::vector accepted_particle_moves(num_walkers, 0); { ScopedTimer pbyp_local_timer(timers.movepbyp_timer); for (int ig = 0; ig < pset_leader.groups(); ++ig) @@ -224,6 +224,7 @@ void DMCBatched::advanceWalkers(const StateForThread& sft, { crowd.incAccept(); isAccepted.push_back(true); + ++accepted_particle_moves[iw]; rr_accepted[iw] += rr[iw]; } else @@ -250,6 +251,11 @@ void DMCBatched::advanceWalkers(const StateForThread& sft, ps_dispatcher.flex_saveWalker(walker_elecs, walkers); } + + std::vector post_branch_weights(num_walkers, 0.0); + for (int iw = 0; iw < num_walkers; ++iw) + post_branch_weights[iw] = walkers[iw].get().Weight; + { // hamiltonian ScopedTimer ham_local(timers.hamiltonian_timer); @@ -265,32 +271,55 @@ void DMCBatched::advanceWalkers(const StateForThread& sft, for (int iw = 0; iw < walkers.size(); ++iw) { - resetSigNLocalEnergy(walkers[iw], walker_twfs[iw], new_energies[iw], rr_accepted[iw], rr_proposed[iw]); - FullPrecRealType branch_weight = sft.branch_engine.branchWeight(new_energies[iw], old_energies[iw]); - walkers[iw].get().Weight *= branch_weight; - if (rr_proposed[iw] > 0) - walkers[iw].get().Age = 0; + // So these energies get no weighting? I guess that's fine if + // old_energies aren't weighted either + // In legacy this is accepted_particlemoves + if (accepted_particle_moves[iw] > 0) + { + // A side affec of this call is setting Age to 0 + resetSigNLocalEnergy(walkers[iw], walker_twfs[iw], new_energies[iw], rr_accepted[iw], rr_proposed[iw]); + } else + { + // This is reproducing some edge case legacy behavior more + // exactly + std::cerr << "Rare event of a walker that couldn't move any electrons occured."; + assert(walkers[iw].get().Properties(WP::R2ACCEPTED) == 0.0); + walkers[iw].get().Properties(WP::R2ACCEPTED) = 0.0; walkers[iw].get().Age++; + new_energies[iw] = old_energies[iw]; + } + FullPrecRealType branch_weight = sft.branch_engine.branchWeight(new_energies[iw], old_energies[iw]); + post_branch_weights[iw] *= branch_weight; } } { // estimator collectables ScopedTimer collectable_local(timers.collectables_timer); + // Now we can assign the post_branch_weights + for (int iw = 0; iw < num_walkers; ++iw) + { + walkers[iw].get().Weight = post_branch_weights[iw]; + walkers[iw].get().Properties(0) = post_branch_weights[iw]; + } // evaluate non-physical hamiltonian elements + // In legacy this was only done if the move was accepted + // This mean many/all estimators did not accumulate failed moves. for (int iw = 0; iw < walkers.size(); ++iw) - walker_hamiltonians[iw].auxHevaluate(walker_twfs[iw], walker_elecs[iw], walkers[iw]); + if (isAccepted[iw]) + walker_hamiltonians[iw].auxHevaluate(walker_twfs[iw], walker_elecs[iw], walkers[iw]); + + if (accumulate_this_step) + { + ScopedTimer est_timer(timers.estimators_timer); + crowd.accumulate(step_context.get_random_gen()); + } // save properties into walker for (int iw = 0; iw < walkers.size(); ++iw) - walker_hamiltonians[iw].saveProperty(walkers[iw].get().getPropertyBase()); - } - - if (accumulate_this_step) - { - ScopedTimer est_timer(timers.estimators_timer); - crowd.accumulate(step_context.get_random_gen()); + if (accepted_particle_moves[iw] > 0) + walker_hamiltonians[iw].saveProperty(walkers[iw].get().getPropertyBase()); } // collect walker logs @@ -509,6 +538,9 @@ bool DMCBatched::run() { const int iter = block * steps_per_block_ + step; + // This is where the dmc.dat energy is written + // At the very end before updating the ensemble_property_ + // for the population. walker_controller_->branch(iter, population_, iter == 0); branch_engine_->updateParamAfterPopControl(walker_controller_->get_ensemble_property(), population_.get_golden_electrons().getTotalNum()); diff --git a/src/QMCDrivers/DMC/WalkerControl.cpp b/src/QMCDrivers/DMC/WalkerControl.cpp index a44a17aa3c..526838b044 100644 --- a/src/QMCDrivers/DMC/WalkerControl.cpp +++ b/src/QMCDrivers/DMC/WalkerControl.cpp @@ -85,12 +85,13 @@ void WalkerControl::start() { dmcStream = std::make_unique(hname); dmcStream->setf(std::ios::scientific, std::ios::floatfield); - dmcStream->precision(10); - (*dmcStream) << "# Index " << std::setw(20) << "LocalEnergy" << std::setw(20) << "Variance" << std::setw(20) - << "Weight" << std::setw(20) << "NumOfWalkers" << std::setw(20) + dmcStream->precision(16); + (*dmcStream) << "# Index " << std::setw(28) << "LocalEnergy" << std::setw(28) << "Variance" << std::setw(28) + << "Weight" << std::setw(28) << "NumOfWalkers" << std::setw(28) << "AvgSentWalkers"; //add the number of walkers - (*dmcStream) << std::setw(20) << "TrialEnergy" << std::setw(20) << "DiffEff"; - (*dmcStream) << std::setw(20) << "LivingFraction"; + (*dmcStream) << std::setw(28) << "TrialEnergy" << std::setw(28) << "DiffEff"; + (*dmcStream) << std::setw(28) << "LivingFraction"; + (*dmcStream) << std::setw(28) << "WeightedEnergySum"; (*dmcStream) << std::endl; dmcFname = std::move(hname); } @@ -110,20 +111,22 @@ void WalkerControl::writeDMCdat(int iter, const std::vector& c ensemble_property_.R2Proposed = curData[R2PROPOSED_INDEX]; ensemble_property_.LivingFraction = static_cast(curData[FNSIZE_INDEX]) / static_cast(curData[WALKERSIZE_INDEX]); - ensemble_property_.AlternateEnergy = FullPrecRealType(0); + ensemble_property_.AlternateEnergy = FullPrecRealType(0); + ensemble_property_.WeightedEnergySum = curData[ENERGY_INDEX]; // \\todo If WalkerControl is not exclusively for dmc then this shouldn't be here. // If it is it shouldn't be in QMDrivers but QMCDrivers/DMC if (dmcStream) { //boost::archive::text_oarchive oa(*dmcStream); //(*oa) & iter & eavg_cur & wgt_cur & Etrial & pop_old; - (*dmcStream) << std::setw(10) << iter << std::setw(20) << ensemble_property_.Energy << std::setw(20) - << ensemble_property_.Variance << std::setw(20) << ensemble_property_.Weight << std::setw(20) - << ensemble_property_.NumSamples << std::setw(20) + (*dmcStream) << std::setw(16) << iter << std::setw(28) << ensemble_property_.Energy << std::setw(28) + << ensemble_property_.Variance << std::setw(28) << ensemble_property_.Weight << std::setw(28) + << ensemble_property_.NumSamples << std::setw(28) << curData[SENTWALKERS_INDEX] / static_cast(num_ranks_); - (*dmcStream) << std::setw(20) << trial_energy_ << std::setw(20) + (*dmcStream) << std::setw(28) << trial_energy_ << std::setw(28) << ensemble_property_.R2Accepted / ensemble_property_.R2Proposed; - (*dmcStream) << std::setw(20) << ensemble_property_.LivingFraction; + (*dmcStream) << std::setw(28) << ensemble_property_.LivingFraction; + (*dmcStream) << std::setw(28) << ensemble_property_.WeightedEnergySum; // Work around for bug with deterministic scalar trace test on select compiler/architectures. // While WalkerControl appears to have exclusive ownership of the dmcStream pointer, // this is not actually true. Apparently it doesn't actually and can loose ownership then it is diff --git a/src/QMCHamiltonians/CoulombPBCAA.cpp b/src/QMCHamiltonians/CoulombPBCAA.cpp index 1c0dc8d951..695eafd98a 100644 --- a/src/QMCHamiltonians/CoulombPBCAA.cpp +++ b/src/QMCHamiltonians/CoulombPBCAA.cpp @@ -40,6 +40,12 @@ struct CoulombPBCAA::CoulombPBCAAMultiWalkerResource : public Resource Vector> values_offload; + /// at least a chunks worth of per particle sr values + Matrix> pp_sr_values_offload; + + /// Working space for pp_sr_values to be returned. + Matrix pp_sr_values; + /// a walkers worth of per particle coulomb AA potential values Vector v_sample; @@ -158,7 +164,8 @@ void CoulombPBCAA::updateSource(ParticleSet& s) eL = evalLR(s); eS = evalSR(s); } - new_value_ = value_ = eL + eS + myConst; + value_ = eL + eS + myConst; + new_value_ = value_; } #if !defined(REMOVE_TRACEMANAGER) @@ -211,8 +218,24 @@ void CoulombPBCAA::mw_evaluate(const RefVectorWithLeader& o_list, auto& p_leader = p_list.getLeader(); assert(this == &o_list.getLeader()); + // Tired of warnings about dangling else if (!o_leader.is_active) - return; + { + if (!o_leader.is_static_initialized) + return; + else + { + for (int iw = 0; iw < o_list.size(); iw++) + { + auto& coulomb_aa = o_list.getCastedElement(iw); + if (!coulomb_aa.is_static_initialized) + { + o_list.getCastedElement(iw).evaluate(p_list[iw]); + } + } + return; + } + } if (use_offload_) { @@ -228,7 +251,9 @@ void CoulombPBCAA::mw_evaluate(const RefVectorWithLeader& o_list, } } else + { OperatorDependsOnlyOnParticleSet::mw_evaluate(o_list, p_list); + } } void CoulombPBCAA::mw_evaluatePerParticle(const RefVectorWithLeader& o_list, @@ -239,42 +264,27 @@ void CoulombPBCAA::mw_evaluatePerParticle(const RefVectorWithLeader(); auto& p_leader = p_list.getLeader(); assert(this == &o_list.getLeader()); - auto num_centers = (is_active ? p_leader.getTotalNum() : Ps.getTotalNum()); + // This may break ion ion for listeners + + auto num_centers = (o_leader.is_active ? p_leader.getTotalNum() : Ps.getTotalNum()); + auto name(o_leader.getName()); Vector& v_sample = o_leader.mw_res_handle_.getResource().v_sample; const auto& pp_consts = o_leader.mw_res_handle_.getResource().pp_consts; auto num_species = p_leader.getSpeciesSet().getTotalNum(); v_sample.resize(num_centers); - auto current_value = o_leader.getValue(); + // This lambda is mostly about getting a handle on what is being // touched by the per particle evaluation. // v_sample is updated as a side effect - auto evaluate_walker = [num_species, num_centers, name, &v_sample, &pp_consts](const CoulombPBCAA& cpbcaa, - const ParticleSet& pset) -> RealType { + auto evaluate_walker = [num_species, num_centers, name, &v_sample, + &pp_consts](const int iw, const CoulombPBCAA& cpbcaa, const ParticleSet& pset, + Matrix& pp_sr_values) -> RealType { mRealType Vsr = 0.0; mRealType Vlr = 0.0; mRealType Vc = cpbcaa.myConst; - v_sample = 0.0; //.begin(), v_sample.end(), 0.0); + v_sample.zero(); { - //SR - const auto& d_aa(pset.getDistTableAA(cpbcaa.d_aa_ID)); - RealType z; - for (int ipart = 1; ipart < num_centers; ipart++) - { - z = .5 * cpbcaa.Zat[ipart]; - const auto& dist = d_aa.getDistRow(ipart); - for (int jpart = 0; jpart < ipart; ++jpart) - { - RealType pairpot = z * cpbcaa.Zat[jpart] * cpbcaa.rVs->splint(dist[jpart]) / dist[jpart]; - v_sample[ipart] += pairpot; - v_sample[jpart] += pairpot; - Vsr += pairpot; - } - } - Vsr *= 2.0; - } - { - //LR const StructFact& PtclRhoK(pset.getSK()); if (PtclRhoK.SuperCellEnum == SUPERCELL_SLAB) { @@ -288,6 +298,10 @@ void CoulombPBCAA::mw_evaluatePerParticle(const RefVectorWithLeader TraceManager::trace_tol) - { - app_log() << "accumtest: CoulombPBCAA::evaluate()" << std::endl; - app_log() << "accumtest: tot:" << Vnow << std::endl; - app_log() << "accumtest: sum:" << Vsum << std::endl; - throw std::runtime_error("Trace check failed"); - } - if (std::abs(Vcsum - Vcnow) > TraceManager::trace_tol) - { - app_log() << "accumtest: CoulombPBCAA::evalConsts()" << std::endl; - app_log() << "accumtest: tot:" << Vcnow << std::endl; - app_log() << "accumtest: sum:" << Vcsum << std::endl; - throw std::runtime_error("Trace check failed"); - } -#endif + // Legacy here assigns value to this walker coulombPBCAA return value; }; + Matrix pp_sr_values; + if (o_leader.is_active) + { + if (use_offload_) + pp_sr_values = mw_evalSRPerParticle_offload(o_list, p_list); + else + pp_sr_values = mw_evalSRPerParticle(o_list, p_list); - if (is_active) for (int iw = 0; iw < o_list.size(); iw++) { auto& coulomb_aa = o_list.getCastedElement(iw); - coulomb_aa.value_ = evaluate_walker(coulomb_aa, p_list[iw]); + coulomb_aa.value_ = evaluate_walker(iw, coulomb_aa, p_list[iw], pp_sr_values); for (const ListenerVector& listener : listeners) listener.report(iw, name, v_sample); } + } else { auto& o_leader = o_list.getCastedLeader(); assert(!o_leader.is_active); + for (auto& samp : v_sample) samp = 0.5 * o_leader.value_; //these static parts of the QMCHamiltonian don't change we just //copy them every time and send them to the listeners to preserve //a common design between per particle hamiltonian energy values for (int iw = 0; iw < o_list.size(); iw++) + { + auto& coulomb_aa = o_list.getCastedElement(iw); + coulomb_aa.value_ = o_leader.value_; for (const ListenerVector& listener : listeners_ions) listener.report(iw, name, v_sample); + } } } @@ -722,6 +728,7 @@ std::vector CoulombPBCAA::mw_evalSR_offload(const RefVec std::fill_n(values_offload.data(), nw, 0); auto value_ptr = values_offload.data(); values_offload.updateTo(); + for (size_t ichunk = 0; ichunk < num_chunks; ichunk++) { const size_t first = ichunk * chunk_size; @@ -762,6 +769,167 @@ std::vector CoulombPBCAA::mw_evalSR_offload(const RefVec return values; } +Matrix CoulombPBCAA::mw_evalSRPerParticle_offload( + const RefVectorWithLeader& o_list, + const RefVectorWithLeader& p_list) +{ + const size_t nw = o_list.size(); + auto& p_leader = p_list.getLeader(); + auto& caa_leader = o_list.getCastedLeader(); + ScopedTimer local_timer(caa_leader.evalSR_timer_); + + RefVectorWithLeader dt_list(p_leader.getDistTable(caa_leader.d_aa_ID)); + dt_list.reserve(p_list.size()); + for (ParticleSet& p : p_list) + dt_list.push_back(p.getDistTable(caa_leader.d_aa_ID)); + + auto& dtaa_leader = dynamic_cast(p_leader.getDistTable(caa_leader.d_aa_ID)); + // This is actually a compile time constant. + const size_t chunk_size = dtaa_leader.get_num_particls_stored(); + if (chunk_size == 0) + throw std::runtime_error("bug dtaa_leader.get_num_particls_stored() == 0"); + // I assume there should also be some maximum chunk size here! + auto& values_offload = caa_leader.mw_res_handle_.getResource().values_offload; + auto& pp_sr_values_offload = caa_leader.mw_res_handle_.getResource().pp_sr_values_offload; + const size_t total_num = p_leader.getTotalNum(); + const size_t total_num_half = (total_num + 1) / 2; + const size_t num_padded = getAlignedSize(total_num); + const size_t num_chunks = (total_num_half + chunk_size - 1) / chunk_size; + const size_t pp_sr_count = (((total_num - 1) * total_num) / 2) * nw; + + const auto m_Y = caa_leader.rVs_offload->get_m_Y().data(); + const auto m_Y2 = caa_leader.rVs_offload->get_m_Y2().data(); + const auto first_deriv = caa_leader.rVs_offload->get_first_deriv(); + const auto const_value = caa_leader.rVs_offload->get_const_value(); + const auto r_min = caa_leader.rVs_offload->get_r_min(); + const auto r_max = caa_leader.rVs_offload->get_r_max(); + const auto X = caa_leader.rVs_offload->get_X().data(); + const auto delta_inv = caa_leader.rVs_offload->get_delta_inv(); + const auto Zat = caa_leader.Zat_offload->data(); + + { + values_offload.resize(nw); + std::fill_n(values_offload.data(), nw, 0); + auto value_ptr = values_offload.data(); + + pp_sr_values_offload.resize(pp_sr_count, nw); + std::fill_n(pp_sr_values_offload.data(), nw * pp_sr_count, 0); + auto pp_sr_value_ptr = pp_sr_values_offload.data(); + + values_offload.updateTo(); + pp_sr_values_offload.updateTo(); + + for (size_t ichunk = 0; ichunk < num_chunks; ichunk++) + { + const size_t first = ichunk * chunk_size; + const size_t last = std::min(first + chunk_size, total_num_half); + const size_t this_chunk_size = last - first; + + auto* mw_dist = dtaa_leader.mw_evalDistsInRange(dt_list, p_list, first, last); + + ScopedTimer offload_scope(caa_leader.offload_timer_); + + // + PRAGMA_OFFLOAD("omp target teams distribute num_teams(nw)") + for (std::int32_t iw = 0; iw < nw; iw++) + { + mRealType SR = 0.0; + PRAGMA_OFFLOAD("omp parallel for reduction(+ : SR)") + for (std::int32_t jcol = 0; jcol < total_num; jcol++) + for (std::int32_t irow = first; irow < last; irow++) + { + const RealType dist = mw_dist[num_padded * (irow - first + iw * this_chunk_size) + jcol]; + if (irow == jcol || (irow * 2 + 1 == total_num && jcol > irow)) + continue; + // Subtraction should be done with signed numbers + const std::int32_t i = irow > jcol ? irow : total_num - 1 - irow; + const std::int32_t j = irow > jcol ? jcol : total_num - 1 - jcol; + auto sr_value = Zat[i] * Zat[j] * + OffloadSpline::splint(r_min, r_max, X, delta_inv, m_Y, m_Y2, first_deriv, const_value, dist) / dist; + // To me this is more intuitive way to map a strictly + // triangular matrix elements into a vector + // it trades more operations for clarity later, and I'd + // wager free compared to the cost of transferring the + // values to the host + std::int32_t index_pp_sr = (pp_sr_count * iw) + ((i * (i - 1)) / 2) + j; + pp_sr_value_ptr[index_pp_sr] += sr_value; + SR += sr_value; + } + value_ptr[iw] += SR; + } + } + + values_offload.updateFrom(); + pp_sr_values_offload.updateFrom(); + } + + Matrix pp_sr_values(pp_sr_count, nw); + std::vector values(nw); + for (int iw = 0; iw < nw; iw++) + { +#ifdef COULOMBAA_DEBUG + Return_t sr_value_sum{0}; +#endif + values[iw] = values_offload[iw]; + + for (int ipi = 1; ipi < total_num; ++ipi) + { + // The diagonal will always still be 0 see the eval above. + for (int ipj = 0; ipj < total_num; ++ipj) + { + if (ipi == ipj || ipj > ipi) + continue; + int tri_index = ((ipi) * (ipi - 1)) / 2 + ipj; + auto value = pp_sr_values_offload(iw, tri_index); +#ifdef COULOMBAA_DEBUG + sr_value_sum += value; +#endif + pp_sr_values(ipi, iw) += value; + } + } + +#ifdef COULOMBAA_DEBUG + if (std::abs(sr_value_sum - values[iw]) > 10e-8) + std::cerr << "std::abs(sr_value_sum - values[iw]) > 10e-8) " << sr_value_sum << " " << values[iw] << '\n'; +#endif + } + return pp_sr_values; +} // namespace qmcplusplus + +Matrix CoulombPBCAA::mw_evalSRPerParticle(const RefVectorWithLeader& o_list, + const RefVectorWithLeader& p_list) +{ + auto& o_leader = o_list.getCastedLeader(); + auto& p_leader = p_list.getLeader(); + const size_t total_num = p_leader.getTotalNum(); + const int num_walkers = o_list.size(); + Matrix pp_sr_values(total_num, num_walkers); + + auto num_centers = p_leader.getTotalNum(); + + for (int iw = 0; iw < num_walkers; ++iw) + { + ParticleSet& pset = p_list[iw]; + + //SR + const auto& d_aa(pset.getDistTableAA(o_leader.d_aa_ID)); + RealType z; + + for (int ipart = 1; ipart < num_centers; ipart++) + { + z = .5 * o_leader.Zat[ipart]; + const auto& dist = d_aa.getDistRow(ipart); + for (int jpart = 0; jpart < ipart; ++jpart) + { + RealType pairpot = z * o_leader.Zat[jpart] * o_leader.rVs->splint(dist[jpart]) / dist[jpart]; + pp_sr_values(ipart, iw) += pairpot; + pp_sr_values(jpart, iw) += pairpot; + } + } + } + return pp_sr_values; +} + CoulombPBCAA::Return_t CoulombPBCAA::evalLR(const ParticleSet& P) const { ScopedTimer local_timer(evalLR_timer_); diff --git a/src/QMCHamiltonians/CoulombPBCAA.h b/src/QMCHamiltonians/CoulombPBCAA.h index 19ea69133b..6cacc77bfa 100644 --- a/src/QMCHamiltonians/CoulombPBCAA.h +++ b/src/QMCHamiltonians/CoulombPBCAA.h @@ -54,6 +54,7 @@ struct CoulombPBCAA : public OperatorDependsOnlyOnParticleSet, public ForceBase bool is_active; bool FirstTime; + bool is_static_initialized{false}; int SourceID; int NumSpecies; int ChargeAttribIndx; @@ -242,6 +243,16 @@ struct CoulombPBCAA : public OperatorDependsOnlyOnParticleSet, public ForceBase * \param[out] pp_consts constant values for the particles self interaction */ void evalPerParticleConsts(Vector& pp_consts) const; + + /** Currently mostly copy paste of mw_evalSR_offload + * but would require branching in OFFLOAD section + * does additional data movement + */ + static Matrix mw_evalSRPerParticle_offload(const RefVectorWithLeader& o_list, + const RefVectorWithLeader& p_list); + + static Matrix mw_evalSRPerParticle(const RefVectorWithLeader& o_list, + const RefVectorWithLeader& p_list); }; } // namespace qmcplusplus diff --git a/src/QMCHamiltonians/CoulombPotentialFactory.cpp b/src/QMCHamiltonians/CoulombPotentialFactory.cpp index 0dbf32fd35..bf412acd5b 100644 --- a/src/QMCHamiltonians/CoulombPotentialFactory.cpp +++ b/src/QMCHamiltonians/CoulombPotentialFactory.cpp @@ -125,7 +125,15 @@ void HamiltonianFactory::addCoulombPotential(xmlNodePtr cur) << std::endl; return; } + // In my opion the ParticleSet should know whether its quantum or + // not. In fact in CoulombPBCAA's attached to quantum particule + // sets are refered to as active and ones with classical + // particlesets are not. The assumption here is that classic + // particles never change position during a qmcrun. bool quantum = (sourceInp == targetPtcl.getName()); + app_summary() << " AA ParticleSet: " << sourceInp << " dynamic particle set: " << (quantum ? "true" : "false") + << '\n'; + if (applyPBC) { if (use_gpu.empty()) diff --git a/src/QMCHamiltonians/NLPPJob.h b/src/QMCHamiltonians/NLPPJob.h index 43f20a1b1f..cc6f67e8a9 100644 --- a/src/QMCHamiltonians/NLPPJob.h +++ b/src/QMCHamiltonians/NLPPJob.h @@ -31,7 +31,7 @@ struct NLPPJob const int electron_id; const RealType ion_elec_dist; const PosType ion_elec_displ; - + int walker_index = -1; /** This allows construction using emplace back * could be a way to pull it off with aggregate initialization * but it is nontrivial @@ -45,6 +45,18 @@ struct NLPPJob ion_elec_dist(ion_elec_dist_in), ion_elec_displ(ion_elec_displ_in) {} + + NLPPJob(const int ion_id_in, + const int electron_id_in, + const RealType ion_elec_dist_in, + const PosType& ion_elec_displ_in, + int walker_index) + : ion_id(ion_id_in), + electron_id(electron_id_in), + ion_elec_dist(ion_elec_dist_in), + ion_elec_displ(ion_elec_displ_in), + walker_index(walker_index) + {} }; } // namespace qmcplusplus #endif diff --git a/src/QMCHamiltonians/NonLocalECPotential.cpp b/src/QMCHamiltonians/NonLocalECPotential.cpp index 9410bba4c5..150ecd5444 100644 --- a/src/QMCHamiltonians/NonLocalECPotential.cpp +++ b/src/QMCHamiltonians/NonLocalECPotential.cpp @@ -17,6 +17,7 @@ #include "NonLocalECPotential.h" +#include #include #include @@ -297,7 +298,7 @@ void NonLocalECPotential::mw_evaluateImpl(const RefVectorWithLeadergetRmax()) { O.neighbor_lists.addElecIonPair(jel, iat); - joblist.emplace_back(iat, jel, dist[iat], -displ[iat]); + joblist.emplace_back(iat, jel, dist[iat], -displ[iat], iw); } } } @@ -391,6 +392,11 @@ void NonLocalECPotential::mw_evaluateImpl(const RefVectorWithLeader QMCHamiltonian::mw_evaluate( ham_leader.mw_res_handle_.getResource().ion_kinetic_listeners_); else ham_leader.H[kinetic_index]->mw_evaluate(HC_list, wf_list, p_list); + for (int iw = 0; iw < ham_list.size(); iw++) updateComponent(HC_list[iw], ham_list[iw], p_list[iw]); } diff --git a/src/QMCHamiltonians/tests/CMakeLists.txt b/src/QMCHamiltonians/tests/CMakeLists.txt index cfc466d3fa..348796933b 100644 --- a/src/QMCHamiltonians/tests/CMakeLists.txt +++ b/src/QMCHamiltonians/tests/CMakeLists.txt @@ -19,7 +19,8 @@ set(SRC_DIR hamiltonian) set(UTEST_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(COULOMB_SRCS test_coulomb_pbcAB.cpp test_coulomb_pbcAB_ewald.cpp test_coulomb_pbcAA.cpp - test_coulomb_pbcAA_ewald.cpp test_EwaldRef.cpp test_NonLocalECPotential.cpp) + test_coulomb_pbcAA_ewald.cpp test_EwaldRef.cpp + test_NonLocalECPotential.cpp) set(EWALD2D_SRCS test_ewald2d.cpp test_ewald_quasi2d.cpp) set(FORCE_SRCS test_force.cpp test_force_ewald.cpp test_stress.cpp test_spacewarp.cpp) set(HAM_SRCS diff --git a/src/QMCHamiltonians/tests/test_QMCHamiltonian.cpp b/src/QMCHamiltonians/tests/test_QMCHamiltonian.cpp index 8b0e9c5a38..5f48eca39e 100644 --- a/src/QMCHamiltonians/tests/test_QMCHamiltonian.cpp +++ b/src/QMCHamiltonians/tests/test_QMCHamiltonian.cpp @@ -233,12 +233,13 @@ TEST_CASE("integrateListeners", "[hamiltonian]") -0, -0, -0.5, -0, -0, -0, -0, -0, -0, -0, -0, -0.5, -0, -0, -0, -0, }; std::vector potential_ref_vector = { - -0.4304472804, -0.2378402054, -0.9860844016, -0.08201235533, -0.8099648952, -0.9536881447, -0.4498806596, - -0.4415832162, -0.9407452345, -0.6449454427, -2.240605593, -1.194514155, 0.04097786546, -0.1860728562, - -0.1374063194, -0.8808210492, 0.3020428121, 0.3772183955, -0.112801373, -0.5531326532, 0.4633262753, - 0.3185032904, 0.3001851439, -0.4555109739, -0.2190704495, -0.7140043378, -1.641614318, 0.1718038917, - -0.7621642947, 0.2606962323, -0.1486036181, -1.001747012, + -0.4307586866, -0.2441619174, -0.9947517455, -0.0822074905, -0.8186321171, -0.9364693452, -0.4435594392, + -0.4409604308, -0.9485166496, -0.6463699802, -2.2478608513, -1.1948885088, 0.0446740372, -0.1867903076, + -0.1436719206, -0.8878900007, 0.1895125187, 0.2896390142, -0.1131895118, -0.5358564671, 0.4106451240, + 0.2696534299, 0.2523571707, -0.5486700879, -0.2772201576, -0.7152462112, -1.6244692644, 0.1308494516, + -0.8215409412, 0.1786444409, -0.1832416452, -1.0018729777, }; + std::vector ion_potential_ref_vector = { 0.04332125187, 0.173753351, -0.9332901239, -1.323815107, 1.695662975, 0.5990064144, 0.1634206772, -1.207304001, }; diff --git a/src/QMCHamiltonians/tests/test_coulomb_pbcAA.cpp b/src/QMCHamiltonians/tests/test_coulomb_pbcAA.cpp index de9d51e41b..614cb997be 100644 --- a/src/QMCHamiltonians/tests/test_coulomb_pbcAA.cpp +++ b/src/QMCHamiltonians/tests/test_coulomb_pbcAA.cpp @@ -26,9 +26,13 @@ #include #include #include +#include "DynamicCoordinates.h" +#include "MCCoords.hpp" +#include "OhmmsPETE/TinyVector.h" #include "TestListenerFunction.h" #include #include "Utilities/RuntimeOptions.h" +#include "config.h" using std::string; @@ -258,6 +262,114 @@ void test_CoulombPBCAA_3p(DynamicCoordinateKind kind) CHECK(caa_clone.get_madelung_constant() == Approx(vmad_bcc)); } +void test_CoulombPBCAA_3p_PerParticle(DynamicCoordinateKind kind) +{ + const double alat = 1.0; + const double vmad_bcc = -1.819616724754322 / alat; + LRCoulombSingleton::CoulombHandler = 0; + + Lattice lattice; + lattice.BoxBConds = true; // periodic + lattice.R = 0.5 * alat; + lattice.R(0, 0) = -0.5 * alat; + lattice.R(1, 1) = -0.5 * alat; + lattice.R(2, 2) = -0.5 * alat; + lattice.reset(); + + const SimulationCell simulation_cell(lattice); + ParticleSet elec(simulation_cell, kind); + + elec.setName("elec"); + elec.create({1, 2}); + elec.R[0] = {0.0, 0.0, 0.0}; + elec.R[1] = {0.1, 0.2, 0.3}; + elec.R[2] = {0.3, 0.1, 0.2}; + + SpeciesSet& tspecies = elec.getSpeciesSet(); + int upIdx = tspecies.addSpecies("u"); + int dnIdx = tspecies.addSpecies("d"); + int chargeIdx = tspecies.addAttribute("charge"); + int massIdx = tspecies.addAttribute("mass"); + tspecies(chargeIdx, upIdx) = -1; + tspecies(chargeIdx, dnIdx) = -1; + tspecies(massIdx, upIdx) = 1.0; + tspecies(massIdx, dnIdx) = 1.0; + + elec.createSK(); + + CoulombPBCAA caa(elec, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + caa.informOfPerParticleListener(); + + ParticleSet elec_clone(elec); + CoulombPBCAA caa_clone(caa); + + elec_clone.R[2] = {0.2, 0.3, 0.0}; + + // testing batched interfaces + ResourceCollection pset_res("test_pset_res"); + ResourceCollection caa_res("test_caa_res"); + elec.createResource(pset_res); + caa.createResource(caa_res); + + // The test Listener emitted by getParticularListener binds a Matrix + // it will write the reported data into it with each walker's particle values + // in a row. + Matrix local_pots(2, 3); + Matrix local_pots2(2, 3); + + using testing::getParticularListener; + std::vector> listeners; + listeners.emplace_back("localenergy", getParticularListener(local_pots)); + listeners.emplace_back("localenergy", getParticularListener(local_pots2)); + std::vector> ion_listeners; + + // testing batched interfaces + RefVectorWithLeader p_ref_list(elec, {elec, elec_clone}); + RefVectorWithLeader caa_ref_list(caa, {caa, caa_clone}); + + ResourceCollectionTeamLock mw_pset_lock(pset_res, p_ref_list); + ResourceCollectionTeamLock mw_caa_lock(caa_res, caa_ref_list); + + ParticleSet::mw_update(p_ref_list); + + caa.mw_evaluate(caa_ref_list, p_ref_list); + CHECK(caa.getValue() == Approx(-5.4954533536)); + CHECK(caa_clone.getValue() == Approx(-6.329373489)); + + caa.mw_evaluatePerParticle(caa_ref_list, p_ref_list, listeners, ion_listeners); + CHECK(caa.getValue() == Approx(-5.4954533536)); + CHECK(caa_clone.getValue() == Approx(-6.329373489)); + + auto dump_particle_pots = [](const auto& local_pots, int row) { + app_log() << "localpots: "; + for (int i = 0; i < local_pots.cols(); ++i) + app_log() << *(local_pots[row] + i) << ", "; + app_log() << '\n'; + }; + + auto dump_pots_size = [](const auto& local_pots) { + app_log() << "local_pots.size(): " << local_pots.rows() << " x " << local_pots.cols() << '\n'; + }; + dump_pots_size(local_pots); + dump_particle_pots(local_pots, 0); + dump_particle_pots(local_pots, 1); + + CHECK(caa.get_madelung_constant() == Approx(vmad_bcc)); + CHECK(caa_clone.get_madelung_constant() == Approx(vmad_bcc)); + + using SingleParticlePos = TinyVector; + std::vector displacements = {{0.1, 0.0, 0.0}, {0.0, 0.0, 0.2}}; + p_ref_list.getLeader().mw_makeMove(p_ref_list, 1, displacements); + + + ParticleSet::mw_update(p_ref_list); + caa.mw_evaluatePerParticle(caa_ref_list, p_ref_list, listeners, ion_listeners); + + dump_pots_size(local_pots); + dump_particle_pots(local_pots, 0); + dump_particle_pots(local_pots, 1); +} + TEST_CASE("Coulomb PBC A-A BCC 3 particles", "[hamiltonian]") { test_CoulombPBCAA_3p(DynamicCoordinateKind::DC_POS); @@ -277,7 +389,9 @@ TEST_CASE("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]") lattice.reset(); const SimulationCell simulation_cell(lattice); - ParticleSet elec(simulation_cell); + const DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS_OFFLOAD; + + ParticleSet elec(simulation_cell, kind); elec.setName("elec"); elec.create({2}); @@ -290,6 +404,7 @@ TEST_CASE("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]") tspecies(chargeIdx, upIdx) = -1; tspecies(massIdx, upIdx) = 1.0; + elec.setQuantumDomain(ParticleSet::quantum); // The XMLParticleParser always calls createSK on particle sets it creates. // Since most code assumes a valid particle set is as created by XMLParticleParser, // we must call createSK(). @@ -297,14 +412,31 @@ TEST_CASE("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]") elec.update(); // golden particle set valid (enough for this test) - DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS; + ParticleSet ions(simulation_cell, kind); + CHECK(ions.is_quantum() == false); + ions.setName("ions"); + ions.create({1}); + ions.R[0] = {0.2, 0.2, 0.2}; + SpeciesSet& ions_tspecies = ions.getSpeciesSet(); + int heIdx = ions_tspecies.addSpecies("he"); + int he_chargeIdx = ions_tspecies.addAttribute("charge"); + int he_massIdx = ions_tspecies.addAttribute("mass"); + ions_tspecies(he_chargeIdx, heIdx) = 2; + ions_tspecies(he_massIdx, heIdx) = 4.0; + + ions.createSK(); + ions.update(); + // golden CoulombPBCAA - CoulombPBCAA caa(elec, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + CoulombPBCAA caa(elec, elec.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); // informOfPerParticleListener should be called on the golden instance of this operator if there // are listeners present for it. This would normally be done by QMCHamiltonian but this is a unit test. caa.informOfPerParticleListener(); + CoulombPBCAA caa_ions(ions, ions.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + caa_ions.informOfPerParticleListener(); + // Now we can make a clone of the mock walker ParticleSet elec2(elec); @@ -326,6 +458,7 @@ TEST_CASE("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]") caa.createResource(caa_res); ResourceCollectionTeamLock caa_lock(caa_res, o_list); + ResourceCollection pset_res("test_pset_res"); elec.createResource(pset_res); ResourceCollectionTeamLock pset_lock(pset_res, p_list); @@ -347,11 +480,319 @@ TEST_CASE("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]") CHECK(caa.getValue() == Approx(-2.9332312765)); CHECK(caa2.getValue() == Approx(-3.4537460926)); // Check that the sum of the particle energies == the total + auto dump_particle_pots = [](const auto& local_pots, int row) { + for (int i = 0; i < local_pots.cols(); ++i) + std::cout << *(local_pots[row] + i) << ", "; + std::cout << '\n'; + }; + CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(-2.9332312765)); + dump_particle_pots(local_pots, 0); CHECK(std::accumulate(local_pots[1], local_pots[1] + local_pots.cols(), 0.0) == Approx(-3.4537460926)); + dump_particle_pots(local_pots, 1); + // Check that the second listener received the same data + auto check_matrix_result = checkMatrix(local_pots, local_pots2); + CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); } + + // Now we need to check the next move + elec2.R[0] = {0.0, 0.5, 0.0}; + elec2.R[1] = {0.0, 0.0, 0.0}; + elec2.update(); + ParticleSet::mw_update(p_list); + //To get this to work you need to call mw_makeMove or the iat will + //not get updated ! + caa.mw_evaluatePerParticle(o_list, p_list, listeners, ion_listeners); + CHECK(caa2.getValue() == Approx(-2.9332312765)); + dump_particle_pots(local_pots, 1); + // FAIL("We are failing to actually mock multiple moves"); +} + +TEST_CASE("CoulombAA::mw_eval_compare", "[hamiltonian]") +{ + using testing::getParticularListener; + LRCoulombSingleton::CoulombHandler = nullptr; + + // Constructing a mock "golden" set of walker elements + Lattice lattice; + lattice.BoxBConds = true; // periodic + lattice.R.diagonal(1.0); + lattice.reset(); + + const SimulationCell simulation_cell(lattice); + const DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS_OFFLOAD; + ParticleSet elec(simulation_cell, kind); + + elec.setName("elec"); + elec.create({3}); + elec.R[0] = {0.0, 0.5, 0.0}; + elec.R[1] = {0.0, 0.0, 0.0}; + elec.R[2] = {0.1, 0.1, 0.1}; + SpeciesSet& tspecies = elec.getSpeciesSet(); + int upIdx = tspecies.addSpecies("u"); + int chargeIdx = tspecies.addAttribute("charge"); + int massIdx = tspecies.addAttribute("mass"); + tspecies(chargeIdx, upIdx) = -1; + tspecies(massIdx, upIdx) = 1.0; + elec.setQuantumDomain(ParticleSet::quantum); + + // The XMLParticleParser always calls createSK on particle sets it creates. + // Since most code assumes a valid particle set is as created by XMLParticleParser, + // we must call createSK(). + elec.createSK(); + elec.update(); + // golden particle set valid (enough for this test) + + // golden CoulombPBCAA + CoulombPBCAA caa(elec, elec.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + CoulombPBCAA caa_per_particle(elec, elec.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + + // informOfPerParticleListener should be called on the golden instance of this operator if there + // are listeners present for it. This would normally be done by QMCHamiltonian but this is a unit test. + caa_per_particle.informOfPerParticleListener(); + + RefVector caas{caa}; + RefVectorWithLeader o_list(caa, caas); + RefVector caas_per_particle{caa_per_particle}; + RefVectorWithLeader o_list_per_particle(caa_per_particle, caas_per_particle); + + // Self-energy correction, no background charge for e-e interaction + double consts = caa.myConst; + double consts_per_particle = caa_per_particle.myConst; + CHECK(consts_per_particle == Approx(consts)); + + RefVector ptcls{elec}; + RefVectorWithLeader p_list(elec, ptcls); + + ResourceCollection caa_res("test_caa_res"); + caa.createResource(caa_res); + ResourceCollectionTeamLock caa_lock(caa_res, o_list); + + ResourceCollection caa_res_per_particle("test_caa_res_per_particle"); + caa_per_particle.createResource(caa_res_per_particle); + ResourceCollectionTeamLock caa_lock_per_particle(caa_res_per_particle, o_list_per_particle); + + ResourceCollection pset_res("test_pset_res"); + elec.createResource(pset_res); + ResourceCollectionTeamLock pset_lock(pset_res, p_list); + + // The test Listener emitted by getParticularListener binds a Matrix + // it will write the reported data into it with each walker's particle values + // in a row. + Matrix local_pots(3); + Matrix local_pots2(3); + + std::vector> listeners; + listeners.emplace_back("localenergy", getParticularListener(local_pots)); + listeners.emplace_back("localenergy", getParticularListener(local_pots2)); + std::vector> ion_listeners; + + ParticleSet::mw_update(p_list); + + caa.mw_evaluate(o_list, p_list); + caa_per_particle.mw_evaluatePerParticle(o_list_per_particle, p_list, listeners, ion_listeners); + CHECK(caa_per_particle.getValue() == Approx(caa.getValue())); + // Check that the sum of the particle energies == the total + CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(caa.getValue())); + // Check that the second listener received the same data + auto check_matrix_result = checkMatrix(local_pots, local_pots2); + CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); } + + // Now we need to check the next move + elec.R[0] = {0.0, 0.5, 0.0}; + elec.R[1] = {0.25, 0.0, 0.0}; + elec.R[2] = {0.1, 0.2, 0.1}; + + elec.mw_update(p_list); + caa.mw_evaluate(o_list, p_list); + caa_per_particle.mw_evaluatePerParticle(o_list_per_particle, p_list, listeners, ion_listeners); + + CHECK(caa_per_particle.getValue() == Approx(caa.getValue())); + MCCoords moves{QMCTraits::PosType(0.25, 0.0, 0.0)}; + p_list.getLeader().mw_makeMove(p_list, 0, moves); + elec.mw_accept_rejectMove(p_list, 0, {true}, true); + elec.mw_update(p_list); + + caa_per_particle.mw_evaluatePerParticle(o_list_per_particle, p_list, listeners, ion_listeners); + caa.mw_evaluate(o_list, p_list); + CHECK(caa_per_particle.getValue() == Approx(caa.getValue())); +} + +TEST_CASE("CoulombAA::mw_evaluatePerParticle_multimove", "[hamiltonian]") +{ + using testing::getParticularListener; + LRCoulombSingleton::CoulombHandler = 0; + + // Constructing a mock "golden" set of walker elements + Lattice lattice; + lattice.BoxBConds = true; // periodic + lattice.R.diagonal(1.0); + lattice.reset(); + + const SimulationCell simulation_cell(lattice); + const DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS_OFFLOAD; + + ParticleSet elec(simulation_cell, kind); + + elec.setName("elec"); + elec.create({2}); + elec.R[0] = {0.0, 0.5, 0.0}; + elec.R[1] = {0.0, 0.0, 0.0}; + SpeciesSet& tspecies = elec.getSpeciesSet(); + int upIdx = tspecies.addSpecies("u"); + int chargeIdx = tspecies.addAttribute("charge"); + int massIdx = tspecies.addAttribute("mass"); + tspecies(chargeIdx, upIdx) = -1; + tspecies(massIdx, upIdx) = 1.0; + + elec.setQuantumDomain(ParticleSet::quantum); + // The XMLParticleParser always calls createSK on particle sets it creates. + // Since most code assumes a valid particle set is as created by XMLParticleParser, + // we must call createSK(). + elec.createSK(); + elec.update(); + // golden particle set valid (enough for this test) + + ParticleSet ions(simulation_cell, kind); + CHECK(ions.is_quantum() == false); + ions.setName("ions"); + ions.create({1}); + ions.R[0] = {0.2, 0.2, 0.2}; + SpeciesSet& ions_tspecies = ions.getSpeciesSet(); + int heIdx = ions_tspecies.addSpecies("he"); + int he_chargeIdx = ions_tspecies.addAttribute("charge"); + int he_massIdx = ions_tspecies.addAttribute("mass"); + ions_tspecies(he_chargeIdx, heIdx) = 2; + ions_tspecies(he_massIdx, heIdx) = 4.0; + + ions.createSK(); + ions.update(); + + // golden CoulombPBCAA + CoulombPBCAA caa(elec, elec.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + + // informOfPerParticleListener should be called on the golden instance of this operator if there + // are listeners present for it. This would normally be done by QMCHamiltonian but this is a unit test. + caa.informOfPerParticleListener(); + + CoulombPBCAA caa_ions(ions, ions.is_quantum(), false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + caa_ions.informOfPerParticleListener(); + + // Now we can make a clone of the mock walker + ParticleSet elec2(elec); + + elec2.R[0] = {0.0, 0.5, 0.1}; + elec2.R[1] = {0.6, 0.05, -0.1}; + elec2.update(); + + CoulombPBCAA caa2(elec2, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD); + RefVector caas{caa, caa2}; + RefVectorWithLeader o_list(caa, caas); + + // Self-energy correction, no background charge for e-e interaction + double consts = caa.myConst; + CHECK(consts == Approx(-6.3314780332)); + RefVector ptcls{elec, elec2}; + RefVectorWithLeader p_list(elec, ptcls); + + ResourceCollection caa_res("test_caa_res"); + caa.createResource(caa_res); + ResourceCollectionTeamLock caa_lock(caa_res, o_list); + + + ResourceCollection pset_res("test_pset_res"); + elec.createResource(pset_res); + ResourceCollectionTeamLock pset_lock(pset_res, p_list); + + // The test Listener emitted by getParticularListener binds a Matrix + // it will write the reported data into it with each walker's particle values + // in a row. + Matrix local_pots(2); + Matrix local_pots2(2); + + std::vector> listeners; + listeners.emplace_back("localenergy", getParticularListener(local_pots)); + listeners.emplace_back("localenergy", getParticularListener(local_pots2)); + std::vector> ion_listeners; + + ParticleSet::mw_update(p_list); + caa.mw_evaluatePerParticle(o_list, p_list, listeners, ion_listeners); + + auto checkValuePotsMatch = [](auto& caa, auto& local_pots, int row, auto expected_val) { + CHECK(caa.getValue() == Approx(expected_val)); + CHECK(std::accumulate(local_pots[row], local_pots[row] + local_pots.cols(), 0.0) == Approx(expected_val)); + }; + + + Real expected_caa1 = -2.9332312765; + Real expected_caa2 = -3.4537460926; + checkValuePotsMatch(caa, local_pots, 0, expected_caa1); + checkValuePotsMatch(caa2, local_pots, 1, expected_caa2); + // Check that the sum of the particle energies == the total + + // Nice to be able to change this to std::cout and not have to wade + // through all the output we don't care about from everywhere else + auto& local_ostream = app_log(); + + auto dump_particle_pots = [&local_ostream](const auto& local_pots, int row) { + for (int i = 0; i < local_pots.cols(); ++i) + local_ostream << *(local_pots[row] + i) << ", "; + local_ostream << '\n'; + auto sum = std::accumulate(local_pots[row], local_pots[row] + local_pots.cols(), 0.0); + local_ostream << "sum: " << sum << '\n'; + }; + + auto dump_particle_pos = [&local_ostream](const RefVector& p_sets) { + for (int iptcls = 0; iptcls < p_sets.size(); ++iptcls) + { + auto& p_set = p_sets[iptcls].get(); + auto nptcls = p_set.getTotalNum(); + local_ostream << "w:" << iptcls << " "; + for (int ip = 0; ip < nptcls; ++ip) + { + local_ostream << p_set.R[ip] << " : "; + } + local_ostream << '\n'; + } + }; + + dump_particle_pos(ptcls); + dump_particle_pots(local_pots, 0); + dump_particle_pots(local_pots, 1); // Check that the second listener received the same data auto check_matrix_result = checkMatrix(local_pots, local_pots2); CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); } + + app_log() << "Make Move 1\n"; + // need to add mw_makeMove + MCCoords moves{QMCTraits::PosType(0.25, 0.0, 0.0), QMCTraits::PosType(0.0, 0.0, 0.25)}; + p_list.getLeader().mw_makeMove(p_list, 0, moves); + ParticleSet::mw_accept_rejectMove(p_list, 0, {true, true}); + ParticleSet::mw_update(p_list); + caa.mw_evaluatePerParticle(o_list, p_list, listeners, ion_listeners); + dump_particle_pos(ptcls); + dump_particle_pots(local_pots, 0); + dump_particle_pots(local_pots, 1); + + checkValuePotsMatch(caa, local_pots, 0, -3.191198434); + checkValuePotsMatch(caa2, local_pots, 1, -3.607459554); + + app_log() << "Make Move 2\n"; + MCCoords moves2{QMCTraits::PosType(0.00, 0.0, 0.11), QMCTraits::PosType(0.0, 0.22, 0.00)}; + p_list.getLeader().mw_makeMove(p_list, 1, moves2); + ParticleSet::mw_accept_rejectMove(p_list, 1, {true, true}); + ParticleSet::mw_update(p_list); + caa.mw_evaluatePerParticle(o_list, p_list, listeners, ion_listeners); + dump_particle_pos(ptcls); + dump_particle_pots(local_pots, 0); + dump_particle_pots(local_pots, 1); + checkValuePotsMatch(caa, local_pots, 0, -3.23305371); + checkValuePotsMatch(caa2, local_pots, 1, -3.476714904); +} + +TEST_CASE("CoulombAA::mw_evaluatePerParticle_multimove2", "[hamiltonian]") +{ + test_CoulombPBCAA_3p_PerParticle(DynamicCoordinateKind::DC_POS); + test_CoulombPBCAA_3p_PerParticle(DynamicCoordinateKind::DC_POS_OFFLOAD); } } // namespace qmcplusplus diff --git a/tests/heg/heg_14_gamma/CMakeLists.txt b/tests/heg/heg_14_gamma/CMakeLists.txt index ab0e4e83fe..994d319857 100644 --- a/tests/heg/heg_14_gamma/CMakeLists.txt +++ b/tests/heg/heg_14_gamma/CMakeLists.txt @@ -12,10 +12,11 @@ # # -# HEG14G - non-interacting Slater only VMC (exact) +# HEG14G - non-interacting Slater only VMC (exact) # list(APPEND HEG14GSNI_SCALARS "totenergy" " 0.627711 0.000001") # total energy -list(APPEND HEG14GSNI_SCALARS "variance" " 0.000000 0.000001") # energy variance +list(APPEND HEG14GSNI_SCALARS "variance" " 0.000000 0.000001") # energy + # variance qmc_run_and_check( short-heg_14_gamma-ni @@ -29,10 +30,12 @@ qmc_run_and_check( HEG14GSNI_SCALARS) # -# HEG14G - non-interacting Slater only DMC (exact) +# HEG14G - non-interacting Slater only DMC (exact) # -list(APPEND HEG14GSNI_DMC_SCALARS "totenergy" " 0.627711 0.000001") # total energy -list(APPEND HEG14GSNI_DMC_SCALARS "variance" " 0.000000 0.000001") # energy variance +list(APPEND HEG14GSNI_DMC_SCALARS "totenergy" " 0.627711 0.000001") # total + # energy +list(APPEND HEG14GSNI_DMC_SCALARS "variance" " 0.000000 0.000001") # energy + # variance qmc_run_and_check( short-heg_14_gamma-ni_dmc @@ -47,10 +50,11 @@ qmc_run_and_check( ) # -# HEG14G - Slater only VMC (Hartree-Fock) +# HEG14G - Slater only VMC (Hartree-Fock) # list(APPEND HEG14GSHF_SCALARS "totenergy" "-0.812484 0.000271") # total energy -list(APPEND HEG14GSHF_SCALARS "variance" " 0.193169 0.018612") # energy variance +list(APPEND HEG14GSHF_SCALARS "variance" " 0.193169 0.018612") # energy + # variance qmc_run_and_check( short-heg_14_gamma-hf @@ -65,10 +69,11 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow VMC +# HEG14G - Slater-Jastrow VMC # list(APPEND HEG14GSSJ_SCALARS "totenergy" "-1.073323 0.000271") # total energy -list(APPEND HEG14GSSJ_SCALARS "variance" " 0.024574 0.000181") # energy variance +list(APPEND HEG14GSSJ_SCALARS "variance" " 0.024574 0.000181") # energy + # variance qmc_run_and_check( short-heg_14_gamma-sj @@ -83,10 +88,12 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow VMC with newer input format +# HEG14G - Slater-Jastrow VMC with newer input format # -list(APPEND HEG14GSSJ_NEW_SCALARS "totenergy" "-1.073286 0.000271") # total energy -list(APPEND HEG14GSSJ_NEW_SCALARS "variance" " 0.024564 0.000342") # energy variance +list(APPEND HEG14GSSJ_NEW_SCALARS "totenergy" "-1.073286 0.000271") # total + # energy +list(APPEND HEG14GSSJ_NEW_SCALARS "variance" " 0.024564 0.000342") # energy + # variance # legacy driver qmc_run_and_check( @@ -114,6 +121,62 @@ qmc_run_and_check( HEG14GSSJ_NEW_SCALARS # VMC ) +# batch driver energy density +qmc_run_and_check( + short-heg_14_gamma-sj_eden_batch + "${qmcpack_SOURCE_DIR}/tests/heg/heg_14_gamma/batch" + short_heg_SJ_eden_batch + short-heg-SJ-eden-batch.xml + 4 + 4 + TRUE + 0 + HEG14GSSJ_NEW_SCALARS # VMC +) + +# batch driver energy density +qmc_run_and_check( + short-heg_14_gamma-sj-dmc_eden_batch + "${qmcpack_SOURCE_DIR}/tests/heg/heg_14_gamma/batch" + short_heg_SJ_dmc_eden_batch + short-heg-SJ-dmc-eden-batch.xml + 4 + 4 + TRUE + 0 + HEG14GSSJ_NEW_SCALARS # DMC +) + +function(add_heg_eden_stats_check test_name output_prefix) + set(full_name "${test_name}-r4-t4") + set(check_name "${full_name}-energydensity") + if(QMC_OMP AND HAVE_MPI AND NOT TEST_MAX_PROCS LESS 16) + add_test( + NAME ${check_name} + COMMAND + ${Python3_EXECUTABLE} + ${qmcpack_SOURCE_DIR}/tests/scripts/check_stats.py + -s + 0 + -q + energydensity,EDcell + -e + 2 + -c + 8 + -p + ${output_prefix} + -r + qmc-ref/short_heg_SJ_eden_batch.s000.stat_ref_energydensity.dat + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${full_name}") + set_property(TEST ${check_name} APPEND PROPERTY DEPENDS ${full_name}) + set_property(TEST ${check_name} APPEND PROPERTY LABELS "QMCPACK-checking-results") + endif() +endfunction() + +add_heg_eden_stats_check(short-heg_14_gamma-sj_eden_batch short_heg_SJ_eden_batch) +add_heg_eden_stats_check(short-heg_14_gamma-sj-dmc_eden_batch short_heg_SJ_dmc_eden_batch) + # batch deterministic if(QMC_MIXED_PRECISION) list(APPEND DET_HEG14GSSJ_SCALARS "totenergy" "-1.24699382 0.00002") @@ -138,10 +201,12 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow DMC +# HEG14G - Slater-Jastrow DMC # -list(APPEND HEG14GSSJ_DMC_SCALARS "totenergy" "-1.110199 0.000322") # total energy -list(APPEND HEG14GSSJ_DMC_SCALARS "variance" " 0.022894 0.000060") # energy variance +list(APPEND HEG14GSSJ_DMC_SCALARS "totenergy" "-1.110199 0.000322") # total + # energy +list(APPEND HEG14GSSJ_DMC_SCALARS "variance" " 0.022894 0.000060") # energy + # variance qmc_run_and_check( short-heg_14_gamma-sj_dmc @@ -160,10 +225,11 @@ qmc_run_and_check( # # -# HEG14G - non-interacting Slater only VMC (exact) +# HEG14G - non-interacting Slater only VMC (exact) # list(APPEND HEG14GLNI_SCALARS "totenergy" " 0.627711 0.000001") # total energy -list(APPEND HEG14GLNI_SCALARS "variance" " 0.000000 0.000001") # energy variance +list(APPEND HEG14GLNI_SCALARS "variance" " 0.000000 0.000001") # energy + # variance qmc_run_and_check( long-heg_14_gamma-ni @@ -178,10 +244,12 @@ qmc_run_and_check( ) # -# HEG14G - non-interacting Slater only DMC (exact) +# HEG14G - non-interacting Slater only DMC (exact) # -list(APPEND HEG14GLNI_DMC_SCALARS "totenergy" " 0.627711 0.000001") # total energy -list(APPEND HEG14GLNI_DMC_SCALARS "variance" " 0.000000 0.000001") # energy variance +list(APPEND HEG14GLNI_DMC_SCALARS "totenergy" " 0.627711 0.000001") # total + # energy +list(APPEND HEG14GLNI_DMC_SCALARS "variance" " 0.000000 0.000001") # energy + # variance qmc_run_and_check( long-heg_14_gamma-ni_dmc @@ -196,10 +264,11 @@ qmc_run_and_check( ) # -# HEG14G - Slater only VMC (Hartree-Fock) +# HEG14G - Slater only VMC (Hartree-Fock) # list(APPEND HEG14GLHF_SCALARS "totenergy" "-0.812484 0.000090") # total energy -list(APPEND HEG14GLHF_SCALARS "variance" " 0.193169 0.006142") # energy variance +list(APPEND HEG14GLHF_SCALARS "variance" " 0.193169 0.006142") # energy + # variance qmc_run_and_check( long-heg_14_gamma-hf @@ -214,10 +283,11 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow VMC +# HEG14G - Slater-Jastrow VMC # list(APPEND HEG14GLSJ_SCALARS "totenergy" "-1.073323 0.000090") # total energy -list(APPEND HEG14GLSJ_SCALARS "variance" " 0.024574 0.000060") # energy variance +list(APPEND HEG14GLSJ_SCALARS "variance" " 0.024574 0.000060") # energy + # variance qmc_run_and_check( long-heg_14_gamma-sj @@ -232,10 +302,12 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow VMC with newer input format +# HEG14G - Slater-Jastrow VMC with newer input format # -list(APPEND HEG14GLSJ_NEW_SCALARS "totenergy" "-1.073286 0.000090") # total energy -list(APPEND HEG14GLSJ_NEW_SCALARS "variance" " 0.024564 0.000113") # energy variance +list(APPEND HEG14GLSJ_NEW_SCALARS "totenergy" "-1.073286 0.000090") # total + # energy +list(APPEND HEG14GLSJ_NEW_SCALARS "variance" " 0.024564 0.000113") # energy + # variance qmc_run_and_check( long-heg_14_gamma-sj_new @@ -250,10 +322,12 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow DMC +# HEG14G - Slater-Jastrow DMC # -list(APPEND HEG14GLSJ_DMC_SCALARS "totenergy" "-1.110199 0.000106") # total energy -list(APPEND HEG14GLSJ_DMC_SCALARS "variance" " 0.022894 0.000020") # energy variance +list(APPEND HEG14GLSJ_DMC_SCALARS "totenergy" "-1.110199 0.000106") # total + # energy +list(APPEND HEG14GLSJ_DMC_SCALARS "variance" " 0.022894 0.000020") # energy + # variance qmc_run_and_check( long-heg_14_gamma-sj_dmc @@ -268,11 +342,11 @@ qmc_run_and_check( ) # -# HEG14G - Slater-Jastrow-Backflow VMC -# Run 16x1, 4x4, 1x16 to test SJB cloning +# HEG14G - Slater-Jastrow-Backflow VMC Run 16x1, 4x4, 1x16 to test SJB cloning # list(APPEND HEG14GSSJB_SCALARS "totenergy" "-1.084963 0.0006") # total energy -list(APPEND HEG14GSSJB_SCALARS "variance" " 0.022667 0.000764") # energy variance +list(APPEND HEG14GSSJB_SCALARS "variance" " 0.022667 0.000764") # energy + # variance qmc_run_and_check( short-heg_14_gamma-sjb @@ -310,11 +384,11 @@ qmc_run_and_check( HEG14GSSJB_SCALARS # VMC ) # -# HEG14G - Slater-Jastrow-Backflow VMC -# Run 16x1, 4x4, 1x16 to test SJB cloning +# HEG14G - Slater-Jastrow-Backflow VMC Run 16x1, 4x4, 1x16 to test SJB cloning # list(APPEND HEG14GLSJB_SCALARS "totenergy" "-1.084963 0.000083") # total energy -list(APPEND HEG14GLSJB_SCALARS "variance" " 0.022667 0.000252") # energy variance +list(APPEND HEG14GLSJB_SCALARS "variance" " 0.022667 0.000252") # energy + # variance qmc_run_and_check( long-heg_14_gamma-sjb diff --git a/tests/heg/heg_14_gamma/batch/qmc-ref/short_heg_SJ_eden_batch.s000.stat_ref_energydensity.dat b/tests/heg/heg_14_gamma/batch/qmc-ref/short_heg_SJ_eden_batch.s000.stat_ref_energydensity.dat new file mode 100644 index 0000000000..6173fc7ef0 --- /dev/null +++ b/tests/heg/heg_14_gamma/batch/qmc-ref/short_heg_SJ_eden_batch.s000.stat_ref_energydensity.dat @@ -0,0 +1,10 @@ +# T T_err V V_err W W_err + 7.81275341e-01 5.00000000e-04 -1.85453971e+00 5.00000000e-04 1.40000000e+01 1.0e-16 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 + 9.76594176e-02 2.00000000e-04 -2.31817464e-01 3.50000000e-04 1.75000000e+00 2.50000000e-03 diff --git a/tests/heg/heg_14_gamma/batch/short-heg-SJ-dmc-eden-batch.xml b/tests/heg/heg_14_gamma/batch/short-heg-SJ-dmc-eden-batch.xml new file mode 100644 index 0000000000..dd8a15fdb4 --- /dev/null +++ b/tests/heg/heg_14_gamma/batch/short-heg-SJ-dmc-eden-batch.xml @@ -0,0 +1,71 @@ + + + + batch + + + + + + p p p + + 6 + 5.0 + 14 + + + + -1 + 1.0 + + + -1 + 1.0 + + + + + + + + + + + + + + + + 1.082858193 0.6653279375 0.4358910287 0.2243616172 0.1102948764 + + + + + 1.696171854 1.047722154 0.6275148566 0.3175982878 0.1446706214 + + + + + + + + + + 200 + 102 + 100 + 5.0 + 64 + + + + + + + + + + + + + diff --git a/tests/heg/heg_14_gamma/batch/short-heg-SJ-eden-batch.xml b/tests/heg/heg_14_gamma/batch/short-heg-SJ-eden-batch.xml new file mode 100644 index 0000000000..771d8e032f --- /dev/null +++ b/tests/heg/heg_14_gamma/batch/short-heg-SJ-eden-batch.xml @@ -0,0 +1,71 @@ + + + + batch + + + + + + p p p + + 6 + 5.0 + 14 + + + + -1 + 1.0 + + + -1 + 1.0 + + + + + + + + + + + + + + + + 1.082858193 0.6653279375 0.4358910287 0.2243616172 0.1102948764 + + + + + 1.696171854 1.047722154 0.6275148566 0.3175982878 0.1446706214 + + + + + + + + + + 200 + 102 + 100 + 5.0 + 64 + + + + + + + + + + + + + diff --git a/tests/scripts/check_stats.py b/tests/scripts/check_stats.py index 10389c5b69..f3ea85fa87 100755 --- a/tests/scripts/check_stats.py +++ b/tests/scripts/check_stats.py @@ -33,6 +33,19 @@ class NexusError(Exception): #end class NexusError +class AliasDict(dict): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.aliases = {} + + def alias(self, alias, key): + self.aliases[alias] = key + + def __getitem__(self, key): + if key in self.aliases: + return super().__getitem__(self.aliases[key]) + return super().__getitem__(key) + exit_call = sys.exit @@ -200,7 +213,7 @@ def __str__(self,nindent=1): return s #end def __str__ - def __eq__(self,other): + def __eq__(self,other): if not hasattr(other,'__dict__'): return False #end if @@ -450,9 +463,9 @@ def _keys(self,*args,**kwargs): return object_interface.keys(self,*args,**kwargs) def _values(self,*args,**kwargs): object_interface.values(self,*args,**kwargs) - def _items(self,*args,**kwargs): - return object_interface.items(self,*args,**kwargs) - def _copy(self,*args,**kwargs): + def _items(self,*args,**kwargs): + return object_interface.items(self,*args,**kwargs) + def _copy(self,*args,**kwargs): return object_interface.copy(self,*args,**kwargs) def _clear(self,*args,**kwargs): object_interface.clear(self,*args,**kwargs) @@ -590,7 +603,7 @@ def last(self): return self[max(self._keys())] #end def last - def select_random(self): + def select_random(self): return self[randint(0,len(self)-1)] #end def select_random @@ -733,7 +746,7 @@ def transfer_from(self,other,keys=None,copy=False,overwrite=True): if k not in self: self[k]=copier(other[k]) #end if - #end for + #end for #end if #end def transfer_from @@ -755,7 +768,7 @@ def transfer_to(self,other,keys=None,copy=False,overwrite=True): if k not in self: other[k]=copier(self[k]) #end if - #end for + #end for #end if #end def transfer_to @@ -1041,13 +1054,13 @@ def _set_parent(self,parent): def _add_dataset(self,name,dataset): self._datasets[name]=dataset - return + return #end def add_dataset def _add_group(self,name,group): group._name=name self._groups[name]=group - return + return #end def add_group def _contains_group(self,name): @@ -1145,9 +1158,9 @@ def get_keys(self): class HDFreader(DevBase): datasets = set(["","",""]) groups = set(["","",""]) - + def __init__(self,fpath,verbose=False,view=False): - + HDFglobals.view = view if verbose: @@ -1309,7 +1322,7 @@ class ColorWheel(DevBase): def __init__(self): colors = 'Black Maroon DarkOrange Green DarkBlue Purple Gray Firebrick Orange MediumSeaGreen DodgerBlue MediumOrchid'.split() lines = '- -- -. :'.split() - markers = '. v s o ^ d p'.split() + markers = '. v s o ^ d p'.split() ls = [] for line in lines: for color in colors: @@ -1416,7 +1429,7 @@ def erf(x): #end def erf -# standalone inverse error function +# standalone inverse error function # credit: https://stackoverflow.com/questions/42381244/pure-python-inverse-error-function import math def polevl(x, coefs, N): @@ -1586,7 +1599,7 @@ def exit_pass(msg=None): # Calculates the mean, variance, errorbar, and autocorrelation time # for a N-d array of statistical data values. -# If 'exclude' is provided, the first 'exclude' values will be +# If 'exclude' is provided, the first 'exclude' values will be # excluded from the analysis. def simstats(x,dim=None,exclude=None): if exclude!=None: @@ -1613,7 +1626,7 @@ def simstats(x,dim=None,exclude=None): shape = tuple(array(shape)[array(permutation)]) dim = ndim-1 #end if - if reshape: + if reshape: nvars = prod(shape[0:dim]) x=x.reshape(nvars,nblocks) rdim=dim @@ -1628,7 +1641,7 @@ def simstats(x,dim=None,exclude=None): N=nblocks if ndim==1: - i=0 + i=0 tempC=0.5 kappa=0.0 mtmp=mean @@ -1655,7 +1668,7 @@ def simstats(x,dim=None,exclude=None): error = zeros(mean.shape) kappa = zeros(mean.shape) for v in range(nvars): - i=0 + i=0 tempC=0.5 kap=0.0 vtmp = var[v] @@ -1679,7 +1692,7 @@ def simstats(x,dim=None,exclude=None): #end if kappa[v]=kap error[v]=sqrt(vtmp/Neff) - #end for + #end for #end if if reshape: @@ -1903,7 +1916,7 @@ def read_command_line(): elif options.quantity not in allowed_quantities: exit_fail('unrecognized quantity provided\nallowed quantities: {0}\nquantity provided: {1}'.format(allowed_quantities,options.quantity)) #end if - + if options.npartial_sums=='none': exit_fail('-c option is required') #end if @@ -1967,7 +1980,7 @@ def process_stat_file(options): vlog('processing stat.h5 file') values = obj() - + try: # find all output files matching prefix vlog('searching for qmcpack output files',n=1) @@ -2241,7 +2254,7 @@ def read_reference_file(filepath): # Checks computed values from stat.h5 files against specified reference values. passfail = {True:'pass',False:'fail'} def check_values(options,values): - # check_values is for statistical tests + # check_values is for statistical tests vlog('\nchecking against reference values') success = True @@ -2304,13 +2317,15 @@ def check_values(options,values): vlog('checking energy density terms per block',n=1) msg+='\n Energy density sums vs. scalar file per block tests:\n' scalars = load_scalar_file(options,'auto') + block_scalar = load_scalar_file(options, 'scalar') ed_success = True - ftol = 1e-8 ed_values = obj( T = values.T.data.full_sum, V = values.V.data.full_sum, ) ed_values.E = ed_values.T + ed_values.V + ed_values.WE = ed_values.T + ed_values.V + if scalars.file_type=='scalar': comparisons = obj( E='LocalEnergy', @@ -2318,32 +2333,67 @@ def check_values(options,values): V='LocalPotential', ) elif scalars.file_type=='dmc': - comparisons = obj(E='LocalEnergy') + comparisons = obj(E='LocalEnergy') #, WE='WeightedEnergySum') else: exit_fail('unrecognized scalar file type: {0}'.format(scalars.file_type)) #end if + print ("Checking block sums of hdf5 and dat files", comparisons.values()) + sc_dmc_energies = dict() for k in sorted(comparisons.keys()): ed_vals = ed_values[k] sc_vals = scalars.data[comparisons[k]] if scalars.file_type=='dmc': - if len(sc_vals)%len(ed_vals)==0 and len(sc_vals)>len(ed_vals): + print("len(sc_vals)%len(ed_vals)", len(sc_vals)%len(ed_vals), len(sc_vals), " >= ", len(ed_vals)) + if len(sc_vals)%len(ed_vals)==0 and len(sc_vals)>=len(ed_vals): steps = len(sc_vals)//len(ed_vals) - sc_vals.shape = len(sc_vals)//steps,steps - sc_vals = sc_vals.mean(1) + if comparisons[k] == 'WeightedEnergySum': + sc_vals.shape = len(sc_vals)//steps,steps + sc_weights = scalars.data['Weight'] + sc_vals = sc_vals.sum(1) + sc_weights = sc_weights.reshape(len(sc_weights)//steps,steps) + sc_weights = sc_weights.sum(1) + sc_vals = sc_vals / sc_weights + elif comparisons[k] == 'LocalEnergy': + sc_weights = scalars.data['Weight'] + sc_vals = array([val * weight for val, weight in zip(sc_vals, sc_weights)]) + sc_vals = sc_vals.reshape(len(sc_vals)//steps,steps) + sc_vals = sc_vals.sum(1) + sc_weights = sc_weights.reshape(len(sc_weights)//steps,steps) + sc_weights = sc_weights.sum(1) + sc_vals = sc_vals / sc_weights + elif comparisons[k] == 'Weight': + sc_vals = sc_vals.reshape(len(sc_vals)//steps,steps) + sc_vals = sc_vals.sum(1) + else: + sc_vals = sc_vals.mean(1) + #end if + sc_dmc_energies[comparisons[k]] = sc_vals #end if #end if + if len(ed_vals)!=len(sc_vals): exit_fail('energy density per block test cannot be completed\nnumber of energy density and scalar blocks do not match\nenergy density blocks: {0}\nscalar file blocks: {1}'.format(len(ed_vals),len(sc_vals))) #end if + + if scalars.file_type=='dmc': + ftol = 1e-7 + else: + ftol = 1e-7 + # This test is actually relative error assuming the + # the scv is the true value. since conventionally the + # divisor is the true value. + print("checking estimator", comparisons[k], "versus scalar agreement") for i,(edv,scv) in enumerate(zip(ed_vals,sc_vals)): if abs((edv-scv)/scv)>ftol: ed_success = False msg += ' {0} {1} {2}!={3}\n'.format(k,i,edv,scv) #end if #end for + #end for + if ed_success: - fmsg = 'all per block sums match the scalar file' + fmsg = f'all per block sums match sums of {scalars.file_type}.dat' else: fmsg = 'some per block sums do not match the scalar file' #end if @@ -2353,7 +2403,6 @@ def check_values(options,values): success &= ed_success #end if - # function used immediately below to test a mean value vs reference def check_mean(label,mean_comp,error_comp,mean_ref,error_ref,nsigma): msg='\n Testing quantity: {0}\n'.format(label) @@ -2440,11 +2489,11 @@ def check_values_abs_err(options,values): success = True msg = '' - + try: msg += '\nTests for series {0} quantity "{1}"\n'.format(options.series,options.quantity) N = options.npartial_sums - + # read in the reference file ref_values,dnames = read_reference_file(options) diff --git a/tests/solids/diamondC_1x1x1_pp/CMakeLists.txt b/tests/solids/diamondC_1x1x1_pp/CMakeLists.txt index f691826919..612bd7ca01 100644 --- a/tests/solids/diamondC_1x1x1_pp/CMakeLists.txt +++ b/tests/solids/diamondC_1x1x1_pp/CMakeLists.txt @@ -7,7 +7,7 @@ list(APPEND DIAMOND_SCALARS "localecp" "-7.046740 0.030") list(APPEND DIAMOND_SCALARS "nonlocalecp" "0.597119 0.0065") list(APPEND DIAMOND_SCALARS "samples" "128000 0.0") list(APPEND DIAMOND_SCALARS "mpc" "-2.453044 0.004431") -# LIST(APPEND DIAMOND_SCALARS "flux" "0.0 0.4") +# LIST(APPEND DIAMOND_SCALARS "flux" "0.0 0.4") # PW does not setup density; MPC can not be used set(DIAMOND_SCALARS_NO_MPC ${DIAMOND_SCALARS}) @@ -49,7 +49,8 @@ qmc_run_and_check( DIAMOND_SCALARS_NO_MPC # VMC ) -# Hybridrep is not implemented in legacy CUDA but should be correctly error trapped +# Hybridrep is not implemented in legacy CUDA but should be correctly error +# trapped qmc_run_and_check( short-diamondC_1x1x1_hybridrep_pp-vmc_sdj "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" @@ -237,21 +238,31 @@ qmc_run_and_check( ) # Coverage test - shorter version of dmc test -coverage_run("diamondC_1x1x1_pp-vmc_sdj-1-1" "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 - qmc_short_vmc_dmc_coverage.in.xml) +coverage_run( + "diamondC_1x1x1_pp-vmc_sdj-1-1" + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 + qmc_short_vmc_dmc_coverage.in.xml) # Test time limit -cpu_limit_run("diamondC_1x1x1_pp-vmc-1-1" "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 180 - qmc_cpu_limit_vmc.xml) - -cpu_limit_run("diamondC_1x1x1_pp-vmc-4-4" "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 4 4 120 - qmc_cpu_limit_vmc.xml) - -cpu_limit_run("diamondC_1x1x1_pp-dmc-1-1" "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 240 - qmc_cpu_limit_dmc.xml) - -cpu_limit_run("diamondC_1x1x1_pp-dmc-4-4" "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 4 4 120 - qmc_cpu_limit_dmc.xml) +cpu_limit_run( + "diamondC_1x1x1_pp-vmc-1-1" + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 180 + qmc_cpu_limit_vmc.xml) + +cpu_limit_run( + "diamondC_1x1x1_pp-vmc-4-4" + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 4 4 120 + qmc_cpu_limit_vmc.xml) + +cpu_limit_run( + "diamondC_1x1x1_pp-dmc-1-1" + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 1 1 240 + qmc_cpu_limit_dmc.xml) + +cpu_limit_run( + "diamondC_1x1x1_pp-dmc-4-4" + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" 4 4 120 + qmc_cpu_limit_dmc.xml) # # Long tests @@ -296,7 +307,7 @@ list(APPEND LONG_DIAMOND_ALLP_SCALARS "localecp" "-7.046740 0.0065") list(APPEND LONG_DIAMOND_ALLP_SCALARS "nonlocalecp" "0.597119 0.0019") list(APPEND LONG_DIAMOND_ALLP_SCALARS "mpc" "-2.453044 0.0014") list(APPEND LONG_DIAMOND_ALLP_SCALARS "samples" "1280000 0.0") -#DMC ref +# DMC ref list(APPEND LONG_DIAMOND_DMC_ALLP_SCALARS "totenergy" "-10.5316 0.0008") list(APPEND LONG_DIAMOND_DMC_ALLP_SCALARS "kinetic" "11.4857 0.0077") list(APPEND LONG_DIAMOND_DMC_ALLP_SCALARS "potential" "-22.0170 0.0080") @@ -798,7 +809,7 @@ if(add_estimator_tests) -s 0 -q - 'energydensity,EDcellBatched' + 'energydensity,EDcell' -e 20 -c @@ -807,7 +818,7 @@ if(add_estimator_tests) qmc_edens_cell_short_batched -r qmc-ref/qmc_edens_cell_short.s000.stat_ref_energydensity.dat) - + simple_run_and_check( short-diamondC_1x1x1_pp-vmc-estimator-energydensity-voronoi "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" @@ -848,6 +859,26 @@ if(add_estimator_tests) -r qmc-ref/qmc_edens_cell_dmc_short.s001.stat_ref_energydensity.dat) + simple_run_and_check( + short-diamondC_1x1x1_pp-dmc-estimator-energydensity-cell-batched + "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" + qmc_edens_cell_dmc_short_batched${IFEXT}.in.xml + ${NMPI} + ${NOMP} + check_stats.py + -s + 1 + -q + 'energydensity,EDcell' + -e + 2 + -c + 8 + -p + qmc_edens_cell_dmc_short_batched + -r + qmc-ref/qmc_edens_cell_dmc_short.s001.stat_ref_energydensity.dat) + simple_run_and_check( long-diamondC_1x1x1_pp-vmc-estimator-energydensity-cell "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" @@ -1059,12 +1090,11 @@ if(add_estimator_tests AND NOT QMC_MIXED_PRECISION) qmc-ref/det_qmc_spindens_short_mw.s000.stat_ref_spindensity_4_4.dat) # SIMPLE_RUN_AND_CHECK( - # deterministic-diamondC_1x1x1_pp-vmcbatch-estimator-spindensity - # "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" - # det_qmc_spindens_short_vmcbatched.in.xml - # 1 1 - # check_stats.py -s 0 -q spindensity -e 0 -c 8 -p det_qmc_spindens_short -r qmc-ref/det_qmc_vmcbatch_spindens_short.s000.stat_ref_spindensity_1_1.dat - # ) + # deterministic-diamondC_1x1x1_pp-vmcbatch-estimator-spindensity + # "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" + # det_qmc_spindens_short_vmcbatched.in.xml 1 1 check_stats.py -s 0 -q + # spindensity -e 0 -c 8 -p det_qmc_spindens_short -r + # qmc-ref/det_qmc_vmcbatch_spindens_short.s000.stat_ref_spindensity_1_1.dat ) simple_run_and_check( deterministic-diamondC_1x1x1_pp-dmc-estimator-spindensity @@ -1084,7 +1114,8 @@ if(add_estimator_tests AND NOT QMC_MIXED_PRECISION) -p det_qmc_spindens_short_vmc_dmc -r - qmc-ref/det_qmc_spindens_short_vmc_dmc.s001.stat_ref_spindensity_1_1${OFEXT}.dat) + qmc-ref/det_qmc_spindens_short_vmc_dmc.s001.stat_ref_spindensity_1_1${OFEXT}.dat + ) simple_run_and_check( deterministic-diamondC_1x1x1_pp-dmc-estimator-spindensity @@ -1104,7 +1135,8 @@ if(add_estimator_tests AND NOT QMC_MIXED_PRECISION) -p det_qmc_spindens_short_vmc_dmc -r - qmc-ref/det_qmc_spindens_short_vmc_dmc.s001.stat_ref_spindensity_4_4${OFEXT}.dat) + qmc-ref/det_qmc_spindens_short_vmc_dmc.s001.stat_ref_spindensity_4_4${OFEXT}.dat + ) simple_run_and_check( deterministic-diamondC_1x1x1_pp-rmc-estimator-spindensity @@ -1245,7 +1277,8 @@ if(add_estimator_tests AND NOT QMC_MIXED_PRECISION) -p det_qmc_momentum_short_vmc_dmc -r - qmc-ref/det_qmc_momentum_short_vmc_dmc.s001.stat_ref_momentum_1_1${OFEXT}.dat) + qmc-ref/det_qmc_momentum_short_vmc_dmc.s001.stat_ref_momentum_1_1${OFEXT}.dat + ) simple_run_and_check( deterministic-diamondC_1x1x1_pp-dmc-estimator-momentum @@ -1265,7 +1298,8 @@ if(add_estimator_tests AND NOT QMC_MIXED_PRECISION) -p det_qmc_momentum_short_vmc_dmc -r - qmc-ref/det_qmc_momentum_short_vmc_dmc.s001.stat_ref_momentum_4_4${OFEXT}.dat) + qmc-ref/det_qmc_momentum_short_vmc_dmc.s001.stat_ref_momentum_4_4${OFEXT}.dat + ) endif() @@ -1450,23 +1484,31 @@ qmc_run_and_check( ) if(QMC_MIXED_PRECISION) - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "totenergy" "-9.83668425 0.00001562") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "totenergy" + "-9.83668425 0.00001562") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "kinetic" "9.63546916 0.00001143") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "potential" "-19.47214772 0.00000463") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "eeenergy" "-2.70238228 0.00000125") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "potential" + "-19.47214772 0.00000463") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "eeenergy" + "-2.70238228 0.00000125") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "localecp" "-4.36957276 0.0000047") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "nonlocalecp" "0.37547763 0.000001 ") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "localecp" + "-4.36957276 0.0000047") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "nonlocalecp" + "0.37547763 0.000001 ") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "mpc" "-2.42116249 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "samples" "9 0.0") else() - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "totenergy" "-9.83667502 0.000001") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "totenergy" + "-9.83667502 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "kinetic" "9.63547298 0.000001") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "potential" "-19.47214800 0.000001") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "potential" + "-19.47214800 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "eeenergy" "-2.70238234 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "ionion" "-12.77566767 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "localecp" "-4.36957578 0.000001") - list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "nonlocalecp" "0.37547753 0.000001") + list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "nonlocalecp" + "0.37547753 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "mpc" "-2.421165687 0.000001") list(APPEND DET_DIAMOND_DMC_EXCITED_SCALARS "samples" "9 0.0") endif() @@ -1485,64 +1527,85 @@ qmc_run_and_check( if(QMC_MIXED_PRECISION) # DMC cycle 1 - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "totenergy" "-9.53121536 0.0000139") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "totenergy" + "-9.53121536 0.0000139") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "kinetic" "9.00930034 0.00001647") - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "potential" "-18.54051114 0.00000446") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "potential" + "-18.54051114 0.00000446") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "eeenergy" "-2.11983595 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "localecp" "-4.36659965 0.00000448") - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "nonlocalecp" "0.72159739 0.00000178") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "localecp" + "-4.36659965 0.00000448") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "nonlocalecp" + "0.72159739 0.00000178") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "mpc" "-1.93675602 0.00000122") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "samples" "9 0.0") # DMC cycle 2 - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "totenergy" "-10.56881667 0.000027") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "totenergy" + "-10.56881667 0.000027") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "kinetic" "14.41362921 0.00003329") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "potential" "-24.98245366 0.00003051") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "eeenergy" "-2.89879032 0.00000133") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "potential" + "-24.98245366 0.00003051") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "eeenergy" + "-2.89879032 0.00000133") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "localecp" "-15.41387689 0.00001471") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "nonlocalecp" "6.10588419 0.00001448") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "localecp" + "-15.41387689 0.00001471") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "nonlocalecp" + "6.10588419 0.00001448") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "mpc" "-2.61905471 0.00000179") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "samples" "9 0.0") # DMC cycle 3 - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "totenergy" "-8.93222965 0.00001861") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "totenergy" + "-8.93222965 0.00001861") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "kinetic" "19.70827934 0.00003064") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "potential" "-28.64051062 0.00001851") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "eeenergy" "-1.15369571 0.00000776") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "potential" + "-28.64051062 0.00001851") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "eeenergy" + "-1.15369571 0.00000776") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "localecp" "-16.18244873 0.00001536") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "nonlocalecp" "1.47130834 0.00000689") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "localecp" + "-16.18244873 0.00001536") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "nonlocalecp" + "1.47130834 0.00000689") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "mpc" "-0.80671517 0.00000857") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "samples" "9 0.0") else() # DMC cycle 1 list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "totenergy" "-9.53119806 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "kinetic" "9.00930862 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "potential" "-18.54050668 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "potential" + "-18.54050668 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "eeenergy" "-2.11983454 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "ionion" "-12.77567000 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "localecp" "-4.36660098 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "nonlocalecp" "0.72159631 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "nonlocalecp" + "0.72159631 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "mpc" "-1.93675646 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI1_SCALARS "samples" "9 0.0") # DMC cycle 2 - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "totenergy" "-10.56879581 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "totenergy" + "-10.56879581 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "kinetic" "14.41364745 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "potential" "-24.98244325 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "potential" + "-24.98244325 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "eeenergy" "-2.89879008 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "ionion" "-12.77567000 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "localecp" "-15.41389327 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "nonlocalecp" "6.10590756 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "nonlocalecp" + "6.10590756 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "mpc" "-2.61905530 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI2_SCALARS "samples" "9 0.0") # DMC cycle 3 list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "totenergy" "-8.93222899 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "kinetic" "19.70828644 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "potential" "-28.64051544 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "potential" + "-28.64051544 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "eeenergy" "-1.15369726 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "ionion" "-12.77567000 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "localecp" "-16.18246211 0.000001") - list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "nonlocalecp" "1.47131139 0.000001") + list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "nonlocalecp" + "1.47131139 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "mpc" "-0.80671598 0.000001") list(APPEND DET_DIAMOND_DMC_MULTI3_SCALARS "samples" "9 0.0") endif() @@ -1565,84 +1628,139 @@ qmc_run_and_check( if(QMC_MIXED_PRECISION) # VMC cycle 1 - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "totenergy" "-10.51887495 0.00000925") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "kinetic" "12.21076917 0.00000858") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "potential" "-22.72964386 0.00000257") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "eeenergy" "-1.39227245 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "localecp" "-8.27168446 0.0000035") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "nonlocalecp" "-0.29001602 0.00000126") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "totenergy" + "-10.51887495 0.00000925") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "kinetic" + "12.21076917 0.00000858") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "potential" + "-22.72964386 0.00000257") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "eeenergy" + "-1.39227245 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "ionion" + "-12.77566507 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "localecp" + "-8.27168446 0.0000035") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "nonlocalecp" + "-0.29001602 0.00000126") list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "mpc" "-0.95018728 0.00000112") list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "samples" "18 0.0") # VMC cycle 2 - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "totenergy" "-10.57006353 0.00001796") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "kinetic" "13.81347725 0.0000143") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "potential" "-24.38354103 0.00000366") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "eeenergy" "-2.08653505 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "localecp" "-10.59945535 0.00000897") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "nonlocalecp" "1.07811994 0.00000743") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "totenergy" + "-10.57006353 0.00001796") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "kinetic" + "13.81347725 0.0000143") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "potential" + "-24.38354103 0.00000366") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "eeenergy" + "-2.08653505 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "ionion" + "-12.77566507 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "localecp" + "-10.59945535 0.00000897") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "nonlocalecp" + "1.07811994 0.00000743") list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "mpc" "-2.00097963 0.000001") list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "samples" "18 0.0") # DMC cycle 1 - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "totenergy" "-10.53543619 0.00000979") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "kinetic" "7.04049333 0.00000959") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "potential" "-17.57593026 0.00000443") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "eeenergy" "-1.15002939 0.00000344") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "localecp" "-3.78048184 0.00000184") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "nonlocalecp" "0.13025148 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "totenergy" + "-10.53543619 0.00000979") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "kinetic" + "7.04049333 0.00000959") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "potential" + "-17.57593026 0.00000443") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "eeenergy" + "-1.15002939 0.00000344") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "ionion" + "-12.77566507 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "localecp" + "-3.78048184 0.00000184") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "nonlocalecp" + "0.13025148 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "mpc" "-1.01499425 0.00000365") list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "samples" "18 0.0") # DMC cycle2 - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "totenergy" "-9.72346878 0.0000083") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "kinetic" "11.45079701 0.00000847") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "potential" "-21.17426291 0.00000232") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "eeenergy" "-1.73937136 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "ionion" "-12.77566507 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "localecp" "-8.33546910 0.00000206") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "nonlocalecp" "1.67624709 0.00000168") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "totenergy" + "-9.72346878 0.0000083") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "kinetic" + "11.45079701 0.00000847") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "potential" + "-21.17426291 0.00000232") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "eeenergy" + "-1.73937136 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "ionion" + "-12.77566507 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "localecp" + "-8.33546910 0.00000206") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "nonlocalecp" + "1.67624709 0.00000168") list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "mpc" "-1.50888912 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "samples" "18 0.0") else() # VMC cycle 1 - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "totenergy" "-10.51886527 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "kinetic" "12.21077547 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "potential" "-22.72964075 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "eeenergy" "-1.39227187 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "localecp" "-8.27169251 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "nonlocalecp" "-0.29000890 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "totenergy" + "-10.51886527 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "kinetic" + "12.21077547 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "potential" + "-22.72964075 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "eeenergy" + "-1.39227187 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "localecp" + "-8.27169251 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "nonlocalecp" + "-0.29000890 0.000001") list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "mpc" "-0.95018933 0.000001") list(APPEND DET_DIAMOND_VMC_MWALKERS1_SCALARS "samples" "18 0.0") # VMC cycle 2 - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "totenergy" "-10.57006352 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "kinetic" "13.81348242 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "potential" "-24.38354594 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "eeenergy" "-2.08653334 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "localecp" "-10.59945467 0.000001") - list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "nonlocalecp" "1.07810954 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "totenergy" + "-10.57006352 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "kinetic" + "13.81348242 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "potential" + "-24.38354594 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "eeenergy" + "-2.08653334 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "localecp" + "-10.59945467 0.000001") + list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "nonlocalecp" + "1.07810954 0.000001") list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "mpc" "-2.00098039 0.000001") list(APPEND DET_DIAMOND_VMC_MWALKERS2_SCALARS "samples" "18 0.0") # DMC cycle 1 - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "totenergy" "-10.53543619 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "totenergy" + "-10.53543619 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "kinetic" "7.04048475 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "potential" "-17.57592094 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "eeenergy" "-1.15002397 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "localecp" "-3.78048098 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "nonlocalecp" "0.13025148 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "potential" + "-17.57592094 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "eeenergy" + "-1.15002397 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "localecp" + "-3.78048098 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "nonlocalecp" + "0.13025148 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "mpc" "-1.01498843 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS1_SCALARS "samples" "18 0.0") # DMC cycle 2 - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "totenergy" "-9.72346093 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "kinetic" "11.45079979 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "potential" "-21.17426072 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "eeenergy" "-1.73936902 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "localecp" "-8.33547227 0.000001") - list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "nonlocalecp" "1.67624804 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "totenergy" + "-9.72346093 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "kinetic" + "11.45079979 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "potential" + "-21.17426072 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "eeenergy" + "-1.73936902 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "localecp" + "-8.33547227 0.000001") + list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "nonlocalecp" + "1.67624804 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "mpc" "-1.50888780 0.000001") list(APPEND DET_DIAMOND_DMC_MWALKERS2_SCALARS "samples" "18 0.0") endif() @@ -1721,7 +1839,7 @@ if((NOT QMC_MIXED_PRECISION) AND (NOT QMC_COMPLEX)) endif() if(QMC_MIXED_PRECISION) - #v0 + # v0 list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "totenergy" "-10.44253935 0.00001861") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "kinetic" "11.35705140 0.00003064") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "potential" "-21.79959076 0.00000232") @@ -1730,7 +1848,7 @@ if(QMC_MIXED_PRECISION) list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "localecp" "-9.65190864 0.00001536") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "nonlocalecp" "1.32159905 0.00000689") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "mpc" "-0.23519803 0.00000857") - #v1 + # v1 list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "totenergy" "-10.49290122 0.00001861") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "kinetic" "12.78036761 0.00003064") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "potential" "-23.27326883 0.00000232") @@ -1739,7 +1857,7 @@ if(QMC_MIXED_PRECISION) list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "localecp" "-10.21261249 0.00001536") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "nonlocalecp" "1.07801130 0.00000689") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "mpc" "-0.98142311 0.00000857") - #v3 + # v3 list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "totenergy" "-10.51064257 0.00001861") list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "kinetic" "14.08671956 0.00003064") list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "potential" "-24.59736212 0.00000232") @@ -1749,7 +1867,7 @@ if(QMC_MIXED_PRECISION) list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "nonlocalecp" "1.26728473 0.00000689") list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "mpc" "-1.59078038 0.00000857") else() - #v0 + # v0 list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "totenergy" "-10.44253935 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "kinetic" "11.35705140 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "potential" "-21.79959076 0.000001") @@ -1758,7 +1876,7 @@ else() list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "localecp" "-9.65190864 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "nonlocalecp" "1.32159905 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_SCALARS "mpc" "-0.23519803 0.000001") - #v1 + # v1 list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "totenergy" "-10.49290122 0.000001") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "kinetic" "12.78036761 0.000001") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "potential" "-23.27326883 0.000001") @@ -1767,7 +1885,7 @@ else() list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "localecp" "-10.21261249 0.000001") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "nonlocalecp" "1.07801130 0.000001") list(APPEND DET_DIAMOND_DMC_TM2_SCALARS "mpc" "-0.98142311 0.000001") - #v3 + # v3 list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "totenergy" "-10.51064257 0.000001") list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "kinetic" "14.08671956 0.000001") list(APPEND DET_DIAMOND_DMC_TM3_SCALARS "potential" "-24.59736212 0.000001") @@ -1795,60 +1913,101 @@ qmc_run_and_check( ) if(QMC_MIXED_PRECISION) - #v0 - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "totenergy" "-10.34857080 0.00001861") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "kinetic" "9.94328567 0.00003064") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "potential" "-20.29185640 0.00000232") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "eeenergy" "-2.70623197 0.00000776") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "ionion" "-12.77566333 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "localecp" "-5.26283000 0.00001536") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "nonlocalecp" "0.45287649 0.00000689") + # v0 + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "totenergy" + "-10.34857080 0.00001861") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "kinetic" + "9.94328567 0.00003064") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "potential" + "-20.29185640 0.00000232") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "eeenergy" + "-2.70623197 0.00000776") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "ionion" + "-12.77566333 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "localecp" + "-5.26283000 0.00001536") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "nonlocalecp" + "0.45287649 0.00000689") list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "mpc" "-2.43479306 0.00000857") - #v1 - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "totenergy" "-10.47605841 0.00001861") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "kinetic" "10.81438943 0.00003064") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "potential" "-21.29044088 0.00000232") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "eeenergy" "-2.90631955 0.00000776") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "ionion" "-12.77566370 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "localecp" "-5.56045812 0.00001536") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "nonlocalecp" "-0.04800030 0.00000689") + # v1 + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "totenergy" + "-10.47605841 0.00001861") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "kinetic" + "10.81438943 0.00003064") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "potential" + "-21.29044088 0.00000232") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "eeenergy" + "-2.90631955 0.00000776") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "ionion" + "-12.77566370 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "localecp" + "-5.56045812 0.00001536") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "nonlocalecp" + "-0.04800030 0.00000689") list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "mpc" "-2.64915619 0.00000857") - #v3 - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "totenergy" "-10.29166891 0.00001861") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "kinetic" "12.08875246 0.00003064") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "potential" "-22.38041792 0.00000232") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "eeenergy" "-2.82248174 0.00000776") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "ionion" "-12.77566535 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "localecp" "-6.53921012 0.00001536") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "nonlocalecp" "-0.24305956 0.00000689") + # v3 + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "totenergy" + "-10.29166891 0.00001861") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "kinetic" + "12.08875246 0.00003064") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "potential" + "-22.38041792 0.00000232") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "eeenergy" + "-2.82248174 0.00000776") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "ionion" + "-12.77566535 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "localecp" + "-6.53921012 0.00001536") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "nonlocalecp" + "-0.24305956 0.00000689") list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "mpc" "-2.57378019 0.00000857") else() - #v0 - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "totenergy" "-10.74426355 0.000001") + # v0 + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "totenergy" + "-10.74426355 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "kinetic" "9.36905833 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "potential" "-20.11332161 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "eeenergy" "-2.55746488 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "localecp" "-5.08312451 0.000001") - list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "nonlocalecp" "0.30293477 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "potential" + "-20.11332161 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "eeenergy" + "-2.55746488 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "localecp" + "-5.08312451 0.000001") + list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "nonlocalecp" + "0.30293477 0.000001") list(APPEND DET_DIAMOND_DMC_TM1_BATCH_SCALARS "mpc" "-2.31725901 0.000001") - #v1 - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "totenergy" "-10.78859676 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "kinetic" "11.17581012 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "potential" "-21.96440688 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "eeenergy" "-2.55624212 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "localecp" "-6.99272066 0.000001") - list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "nonlocalecp" "0.36022260 0.000001") + # v1 + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "totenergy" + "-10.78859676 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "kinetic" + "11.17581012 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "potential" + "-21.96440688 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "eeenergy" + "-2.55624212 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "localecp" + "-6.99272066 0.000001") + list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "nonlocalecp" + "0.36022260 0.000001") list(APPEND DET_DIAMOND_DMC_TM2_BATCH_SCALARS "mpc" "-2.31923312 0.000001") - #v3 - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "totenergy" "-10.77390772 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "kinetic" "13.76835233 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "potential" "-24.54226005 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "eeenergy" "-2.69128089 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "ionion" "-12.77567000 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "localecp" "-9.09412623 0.000001") - list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "nonlocalecp" "0.01881453 0.000001") + # v3 + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "totenergy" + "-10.77390772 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "kinetic" + "13.76835233 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "potential" + "-24.54226005 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "eeenergy" + "-2.69128089 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "ionion" + "-12.77567000 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "localecp" + "-9.09412623 0.000001") + list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "nonlocalecp" + "0.01881453 0.000001") list(APPEND DET_DIAMOND_DMC_TM3_BATCH_SCALARS "mpc" "-2.46961810 0.000001") endif() @@ -1898,7 +2057,7 @@ if(add_traces_tests) check_traces.py -p qmc_trace_scalars - -n + -n 4 -s '0,1' @@ -1953,7 +2112,7 @@ if(add_traces_tests) -m vmc --dmc_steps_exclude=1) - + simple_run_and_check( deterministic-diamondC_1x1x1_pp-vmc-walkerlog_scalars "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" @@ -2002,7 +2161,7 @@ if(add_traces_tests) -m vmc --dmc_steps_exclude=1) - + simple_run_and_check( deterministic-diamondC_1x1x1_pp-vmcbatch-walkerlog_scalars "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" @@ -2068,7 +2227,7 @@ if(add_traces_tests) check_traces.py -p qmc_trace_scalars_selective - -n + -n 4 -s '0,1' @@ -2258,7 +2417,7 @@ qmc_run_and_check( FALSE) # Input file does not exist and does not have XML suffix - qmc_run_and_check( +qmc_run_and_check( deterministic-input_check_not_present_not_xml_suffix "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" det_qmc_input_check_not_present_not_xml_suffix @@ -2280,27 +2439,46 @@ run_qmc_app( TEST_LABELS det_qmc_short_orbital_images.in.xml) # Override the default check for "QMCPACK execution completed successfully" -set_tests_properties(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 - PROPERTIES PASS_REGULAR_EXPRESSION - "orbital images written successfully, exiting") -add_test_check_file_existence(deterministic-restart_batch-8-2 qmc_short_batch.s000.config.h5 TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0000.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0000_imag.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0000_abs.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0000_abs2.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0001.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0001_imag.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0001_abs.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0001_abs2.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0002.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0002_imag.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0002_abs.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0002_abs2.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0003.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0003_imag.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0003_abs.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0003_abs2.xsf TRUE) -add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 spo_ud_orbital_0004.xsf FALSE) +set_tests_properties( + deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + PROPERTIES PASS_REGULAR_EXPRESSION + "orbital images written successfully, exiting") +add_test_check_file_existence(deterministic-restart_batch-8-2 + qmc_short_batch.s000.config.h5 TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0000.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0000_imag.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0000_abs.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0000_abs2.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0001.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0001_imag.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0001_abs.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0001_abs2.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0002.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0002_imag.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0002_abs.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0002_abs2.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0003.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0003_imag.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0003_abs.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0003_abs2.xsf TRUE) +add_test_check_file_existence(deterministic-diamondC_1x1x1_pp-orbital_images-1-1 + spo_ud_orbital_0004.xsf FALSE) # Energy density estimator initial tests qmc_run_and_check( @@ -2335,18 +2513,12 @@ qmc_run_and_check( 1 1 TRUE -# 0 -# DET_DIAMOND_SCALARS # VMC + # 0 DET_DIAMOND_SCALARS # VMC ) -qmc_run_and_check( - deterministic-diamondC_1x1x1_pp-vmcbatch_sdj-estimator-energydensity-voronoi - "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" - det_qmc_short_vmcbatch_edens_voronoi - det_qmc_short_vmcbatch_edens_voronoi.in.xml - 1 - 1 - TRUE -# 0 -# DET_DIAMOND_SCALARS # VMC -) +# qmc_run_and_check( +# deterministic-diamondC_1x1x1_pp-vmcbatch_sdj-estimator-energydensity-voronoi +# "${qmcpack_SOURCE_DIR}/tests/solids/diamondC_1x1x1_pp" +# det_qmc_short_vmcbatch_edens_voronoi +# det_qmc_short_vmcbatch_edens_voronoi.in.xml 1 1 TRUE # 0 # +# DET_DIAMOND_SCALARS # VMC ) diff --git a/tests/solids/diamondC_1x1x1_pp/det_qmc_short_vmcbatch_edens_cell.in.xml b/tests/solids/diamondC_1x1x1_pp/det_qmc_short_vmcbatch_edens_cell.in.xml index bbe6dc1d7b..5d99490dfc 100644 --- a/tests/solids/diamondC_1x1x1_pp/det_qmc_short_vmcbatch_edens_cell.in.xml +++ b/tests/solids/diamondC_1x1x1_pp/det_qmc_short_vmcbatch_edens_cell.in.xml @@ -1,6 +1,6 @@ - + batched @@ -46,27 +46,27 @@ - + - + - --0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 + +-0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 -0.04445345869 -0.02135082917 - -0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936 + +0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936 0.02915953995 0.0122402581 - -0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174 + +0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174 0.04145899033 0.01690645936 @@ -78,7 +78,7 @@ - + diff --git a/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_dmc_short_batched.in.xml b/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_dmc_short_batched.in.xml new file mode 100644 index 0000000000..03c5acf19a --- /dev/null +++ b/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_dmc_short_batched.in.xml @@ -0,0 +1,116 @@ + + + + + batched + + + + + 3.37316115 3.37316115 0.00000000 + 0.00000000 3.37316115 3.37316115 + 3.37316115 0.00000000 3.37316115 + + + p p p + + 15 + + + + -1 + 1.0 + + + -1 + 1.0 + + + + + 4 + 4 + 6 + 21894.7135906 + + 0.00000000 0.00000000 0.00000000 + 1.68658058 1.68658058 1.68658058 + + + + + + + + + + + + + + + + +-0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 +-0.04445345869 -0.02135082917 + + + + + + + 0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936 +0.02915953995 0.0122402581 + + + + + 0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174 + 0.04145899033 0.01690645936 + + + + + + + + + + + + + + + + + + 64 + no + 100 + 0.01 + 1 + 1 + no + + + + + + + + + + + + + + + 256 + no + 100 + 0.01 + 100 + 100 + no + + diff --git a/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_short_batched.in.xml b/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_short_batched.in.xml index bdda65c53e..c51ae31a8d 100644 --- a/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_short_batched.in.xml +++ b/tests/solids/diamondC_1x1x1_pp/qmc_edens_cell_short_batched.in.xml @@ -1,104 +1,109 @@ - - - batched - - - - - 3.37316115 3.37316115 0.00000000 - 0.00000000 3.37316115 3.37316115 - 3.37316115 0.00000000 3.37316115 - - - p p p - - 15 - - - - -1 - 1.0 - - - -1 - 1.0 - - - - - 4 - 4 - 6 - 21894.7135906 - - 0.00000000 0.00000000 0.00000000 - 1.68658058 1.68658058 1.68658058 - - - - - - - - - - - - - - - - --0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 --0.04445345869 -0.02135082917 - - - - - - -0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 0.05302065936 -0.02915953995 0.0122402581 - - - - -0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 0.07714708174 -0.04145899033 0.01690645936 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16 - 1000 - 8 - 2 - 0.3 - 100 - + + + batched + + + + + 3.37316115 3.37316115 0.00000000 + 0.00000000 3.37316115 3.37316115 + 3.37316115 0.00000000 3.37316115 + + + p p p + + 15 + + + + -1 + 1.0 + + + -1 + 1.0 + + + + + 4 + 4 + 6 + 21894.7135906 + + 0.00000000 0.00000000 0.00000000 + 1.68658058 1.68658058 1.68658058 + + + + + + + + + + + + + + + + + -0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 + -0.09919771951 -0.07111729038 + -0.04445345869 -0.02135082917 + + + + + + + 0.2797730287 0.2172604155 0.1656172964 0.1216984261 0.083995349 + 0.05302065936 + 0.02915953995 0.0122402581 + + + + + 0.4631099906 0.356399124 0.2587895287 0.1829298509 0.1233653291 + 0.07714708174 + 0.04145899033 0.01690645936 + + + + + + + + + + + + + + + + + + + + + + + + + + 16 + 200 + 100 + 2 + 0.3 + 100 +