61 TEST_CASE(
"MomentumDistribution::MomentumDistribution",
"[estimators]")
65 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/> 73 throw std::runtime_error(
"cannot parse MomentumDistributionInput section");
92 CHECK(md.twist[0] == Approx(0.0));
93 CHECK(md.twist[1] == Approx(0.0));
94 CHECK(md.twist[2] == Approx(0.0));
95 CHECK(md.kPoints.size() == 27);
98 using namespace testing;
107 TEST_CASE(
"MomentumDistribution::accumulate",
"[estimators]")
112 const char* xml = R
"( 113 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/> 121 throw std::runtime_error(
"cannot parse MomentumDistributionInput section");
139 {3.000459944, 3.329603408, 4.265030556}, {3.748660329, 3.63420622, 5.393637791},
140 {3.033228526, 3.391869137, 4.654413566}, {3.114198787, 2.654334594, 5.231075822},
141 {3.657151589, 4.883870516, 4.201243939}, {2.97317591, 4.245644974, 4.284564732}};
150 std::vector<MCPWalker>
walkers;
152 for (
int iw = 0; iw < nwalkers; ++iw)
155 std::vector<ParticleSet> psets;
156 for (
int iw = 0; iw < nwalkers; ++iw)
157 psets.emplace_back(
pset);
160 std::vector<UPtr<TrialWaveFunction>> wfns(nwalkers);
161 for (
int iw = 0; iw < nwalkers; ++iw)
162 wfns[iw] = trial_wavefunction.makeClone(psets[iw]);
165 for (
int iw = 0; iw < nwalkers; ++iw)
168 auto&
pset = psets[iw];
171 wfns[iw]->evaluateLog(
pset);
176 std::vector<QMCHamiltonian> hams;
178 auto ref_walkers = makeRefVector<MCPWalker>(
walkers);
179 auto ref_psets = makeRefVector<ParticleSet>(psets);
181 auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
187 md.accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
190 std::vector<RealType>& data = md.get_data();
195 ref_data = {3.92261216, -5.752141485, 4.78276286, 8.307662762, -5.130834919, 0.08942598353, 0.9716326509,
196 21.82310933, -9.177741101, -0.2024849597, -2.520417488, -9.470020717, -9.4969045, 3.866360129,
197 -9.4969045, -9.470020717, -2.520417488, -0.2024849597, -9.177741101, 21.82310933, 0.9716326509,
198 0.08942598353, -5.130834919, 8.307662762, 4.78276286, -5.752141485, 3.92261216};
205 for (
size_t id = 0;
id < ref_data.size(); ++id)
207 #ifdef MIXED_PRECISION 208 CHECK(data[
id] == Approx(ref_data[
id]).epsilon(2.
e-05));
212 CHECK(data[
id] == Approx(ref_data[
id]).epsilon(1.192092896
e-05));
219 TEST_CASE(
"MomentumDistribution::spawnCrowdClone",
"[estimators]")
222 const char* xml = R
"( 223 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/> 231 throw std::runtime_error(
"cannot parse MomentumDistributionInput section");
250 auto clone = md.spawnCrowdClone();
253 REQUIRE(
dynamic_cast<decltype(&md)
>(
clone.get()) !=
nullptr);
260 CHECK_THROWS_AS(
clone = fail_md.spawnCrowdClone(), std::runtime_error);
class that handles xmlDoc
Lattice makeTestLattice()
void pause()
Pause the summary and log streams.
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
if(!okay) throw std xmlNodePtr node
static ParticleSetPool make_diamondC_1x1x1(Communicate *c)
TEST_CASE("complex_helper", "[type_traits]")
static WaveFunctionPool make_diamondC_1x1x1(const RuntimeOptions &runtime_options, Communicate *comm, ParticleSetPool &particle_pool)
Class that collects momentum distribution of electrons.
class to preserve access control in MomentumDistribution
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Attaches a unit to a Vector for IO.
Communicate * Controller
Global Communicator for a process.
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
QMCTraits::PosType PosType
Wrapping information on parallelism.
DataLocality get_data_locality() const
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
void resume()
Resume the summary and log streams.
REQUIRE(std::filesystem::exists(filename))
A minimally functional wrapper for the since c++11 <random>
Declaration of a TrialWaveFunction.
std::vector< QMCT::RealType > Data
QMCTraits::RealType RealType
const PosType twist
twist angle
std::vector< PosType > kPoints
list of k-points in Cartesian Coordinates
void testCopyConstructor(const MomentumDistribution &md)
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
DataLocality
data locality with respect to walker buffer
break encapsulation of data_ by OperatorEstBase only for testing!
A container class to represent a walker.
Native representation for Momentum Distribution Estimators inputs.
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker