39 std::map<std::string, Point>::const_iterator it, end =
points_.end();
40 for (it =
points_.begin(); it != end; ++it)
42 os <<
" {\"" << it->first <<
"\", {" << std::setw(16) << std::setprecision(16) << it->second[0] <<
"," 43 << it->second[1] <<
"," << it->second[2] <<
"}}," <<
'\n';
57 std::ostream&
operator<<(std::ostream& out,
const testing::TestableNEReferencePoints& rhs);
61 template<
typename T1,
typename T2,
unsigned D>
64 for (
int i = 0; i < D; ++i)
65 if (val_a[i] != Approx(val_b[i]))
98 {3.000459944, 3.329603408, 4.265030556}, {3.748660329, 3.63420622, 5.393637791},
99 {3.033228526, 3.391869137, 4.654413566}, {3.114198787, 2.654334594, 5.231075822},
100 {3.657151589, 4.883870516, 4.201243939}, {2.97317591, 4.245644974, 4.284564732}};
103 ref_psets.push_back(pset_ions);
110 if constexpr (std::is_same_v<NEReferencePoints::Real, double>)
111 expected_reference_points = {
112 {
"a1", {3.37316107749939, 3.37316107749939, 0}},
113 {
"a2", {0, 3.37316107749939, 3.37316107749939}},
114 {
"a3", {3.37316107749939, 0, 3.37316107749939}},
115 {
"cmmm", {-3.37316107749939, -3.37316107749939, -3.37316107749939}},
116 {
"cmmp", {0, -3.37316107749939, 0}},
117 {
"cmpm", {-3.37316107749939, 0, 0}},
118 {
"cmpp", {0, 0, 3.37316107749939}},
119 {
"cpmm", {0, 0, -3.37316107749939}},
120 {
"cpmp", {3.37316107749939, 0, 0}},
121 {
"cppm", {0, 3.37316107749939, 0}},
122 {
"cppp", {3.37316107749939, 3.37316107749939, 3.37316107749939}},
123 {
"f1m", {-1.686580538749695, -1.686580538749695, 0}},
124 {
"f1p", {1.686580538749695, 1.686580538749695, 0}},
125 {
"f2m", {0, -1.686580538749695, -1.686580538749695}},
126 {
"f2p", {0, 1.686580538749695, 1.686580538749695}},
127 {
"f3m", {-1.686580538749695, 0, -1.686580538749695}},
128 {
"f3p", {1.686580538749695, 0, 1.686580538749695}},
130 {
"ion2", {1.686580538749695, 1.686580538749695, 1.686580538749695}},
131 {
"r1", {3.37316107749939, 3.37316107749939, 0}},
132 {
"r2", {0, 3.37316107749939, 3.37316107749939}},
133 {
"r3", {3.37316107749939, 0, 3.37316107749939}},
137 expected_reference_points = {
138 {
"a1", {3.37316115, 3.37316115, 0}},
139 {
"a2", {0, 3.37316115, 3.37316115}},
140 {
"a3", {3.37316115, 0, 3.37316115}},
141 {
"cmmm", {-3.37316115, -3.37316115, -3.37316115}},
142 {
"cmmp", {0, -3.37316115, 0}},
143 {
"cmpm", {-3.37316115, 0, 0}},
144 {
"cmpp", {0, 0, 3.37316115}},
145 {
"cpmm", {0, 0, -3.37316115}},
146 {
"cpmp", {3.37316115, 0, 0}},
147 {
"cppm", {0, 3.37316115, 0}},
148 {
"cppp", {3.37316115, 3.37316115, 3.37316115}},
149 {
"f1m", {-1.686580575, -1.686580575, 0}},
150 {
"f1p", {1.686580575, 1.686580575, 0}},
151 {
"f2m", {0, -1.686580575, -1.686580575}},
152 {
"f2p", {0, 1.686580575, 1.686580575}},
153 {
"f3m", {-1.686580575, 0, -1.686580575}},
154 {
"f3p", {1.686580575, 0, 1.686580575}},
156 {
"ion2", {1.68658058, 1.68658058, 1.68658058}},
157 {
"r1", {3.37316115, 3.37316115, 0}},
158 {
"r2", {0, 3.37316115, 3.37316115}},
159 {
"r3", {3.37316115, 0, 3.37316115}},
162 return expected_reference_points;
165 TEST_CASE(
"ReferencePoints::DefaultConstruction",
"[estimators]")
174 std::cout <<
"expected_reference_points" << tref_points;
180 for (
auto& [key, value] : ref_points.
get_points())
182 bool coords_match =
approxEquality(expected_reference_points[key], value);
187 TEST_CASE(
"ReferencePoints::Construction",
"[estimators]")
196 std::cout <<
"expected_reference_points" << tref_points;
202 for (
auto& [key, value] : ref_points.
get_points())
204 bool coords_match =
approxEquality(expected_reference_points[key], value);
209 TEST_CASE(
"ReferencePoints::Description",
"[estimators]")
215 std::ostringstream ostr_stream;
218 std::string expected_description;
220 if constexpr (std::is_same_v<QMCTraits::RealType, double>)
221 expected_description = R
"( reference_points 222 a1: 3.37316115 3.37316115 0 223 a2: 0 3.37316115 3.37316115 224 a3: 3.37316115 0 3.37316115 225 cmmm: -3.37316115 -3.37316115 -3.37316115 226 cmmp: 0 -3.37316115 0 227 cmpm: -3.37316115 0 0 229 cpmm: 0 0 -3.37316115 232 cppp: 3.37316115 3.37316115 3.37316115 233 f1m: -1.686580575 -1.686580575 0 234 f1p: 1.686580575 1.686580575 0 235 f2m: 0 -1.686580575 -1.686580575 236 f2p: 0 1.686580575 1.686580575 237 f3m: -1.686580575 0 -1.686580575 238 f3p: 1.686580575 0 1.686580575 240 ion2: 1.68658058 1.68658058 1.68658058 241 r1: 3.37316115 3.37316115 0 242 r2: 0 3.37316115 3.37316115 243 r3: 3.37316115 0 3.37316115 248 expected_description = R
"( reference_points 249 a1: 3.373161077 3.373161077 0 250 a2: 0 3.373161077 3.373161077 251 a3: 3.373161077 0 3.373161077 252 cmmm: -3.373161077 -3.373161077 -3.373161077 253 cmmp: 0 -3.373161077 0 254 cmpm: -3.373161077 0 0 255 cmpp: 0 0 3.373161077 256 cpmm: 0 0 -3.373161077 257 cpmp: 3.373161077 0 0 258 cppm: 0 3.373161077 0 259 cppp: 3.373161077 3.373161077 3.373161077 260 f1m: -1.686580539 -1.686580539 0 261 f1p: 1.686580539 1.686580539 0 262 f2m: 0 -1.686580539 -1.686580539 263 f2p: 0 1.686580539 1.686580539 264 f3m: -1.686580539 0 -1.686580539 265 f3p: 1.686580539 0 1.686580539 267 ion2: 1.686580539 1.686580539 1.686580539 268 r1: 3.373161077 3.373161077 0 269 r2: 0 3.373161077 3.373161077 270 r3: 3.373161077 0 3.373161077 274 CHECK(ostr_stream.str() == expected_description); 277 std::ostringstream ostr_testing_stream;
278 ostr_testing_stream << test_ref_points;
279 std::string expected_testable_description;
280 if constexpr (std::is_same_v<QMCTraits::RealType, double>)
282 std::cout <<
"ParticleSet coords were double\n";
283 expected_testable_description = R
"({ 284 {"a1", { 3.37316115,3.37316115,0}}, 285 {"a2", { 0,3.37316115,3.37316115}}, 286 {"a3", { 3.37316115,0,3.37316115}}, 287 {"cmmm", { -3.37316115,-3.37316115,-3.37316115}}, 288 {"cmmp", { 0,-3.37316115,0}}, 289 {"cmpm", { -3.37316115,0,0}}, 290 {"cmpp", { 0,0,3.37316115}}, 291 {"cpmm", { 0,0,-3.37316115}}, 292 {"cpmp", { 3.37316115,0,0}}, 293 {"cppm", { 0,3.37316115,0}}, 294 {"cppp", { 3.37316115,3.37316115,3.37316115}}, 295 {"f1m", { -1.686580575,-1.686580575,0}}, 296 {"f1p", { 1.686580575,1.686580575,0}}, 297 {"f2m", { 0,-1.686580575,-1.686580575}}, 298 {"f2p", { 0,1.686580575,1.686580575}}, 299 {"f3m", { -1.686580575,0,-1.686580575}}, 300 {"f3p", { 1.686580575,0,1.686580575}}, 302 {"ion2", { 1.68658058,1.68658058,1.68658058}}, 303 {"r1", { 3.37316115,3.37316115,0}}, 304 {"r2", { 0,3.37316115,3.37316115}}, 305 {"r3", { 3.37316115,0,3.37316115}}, 312 std::cout <<
"ParticleSet coords were in float.\n";
313 expected_testable_description = R
"({ 314 {"a1", {3.37316107749939,3.37316107749939,0}}, 315 {"a2", { 0,3.37316107749939,3.37316107749939}}, 316 {"a3", {3.37316107749939,0,3.37316107749939}}, 317 {"cmmm", {-3.37316107749939,-3.37316107749939,-3.37316107749939}}, 318 {"cmmp", { 0,-3.37316107749939,0}}, 319 {"cmpm", {-3.37316107749939,0,0}}, 320 {"cmpp", { 0,0,3.37316107749939}}, 321 {"cpmm", { 0,0,-3.37316107749939}}, 322 {"cpmp", {3.37316107749939,0,0}}, 323 {"cppm", { 0,3.37316107749939,0}}, 324 {"cppp", {3.37316107749939,3.37316107749939,3.37316107749939}}, 325 {"f1m", {-1.686580538749695,-1.686580538749695,0}}, 326 {"f1p", {1.686580538749695,1.686580538749695,0}}, 327 {"f2m", { 0,-1.686580538749695,-1.686580538749695}}, 328 {"f2p", { 0,1.686580538749695,1.686580538749695}}, 329 {"f3m", {-1.686580538749695,0,-1.686580538749695}}, 330 {"f3p", {1.686580538749695,0,1.686580538749695}}, 332 {"ion2", {1.686580538749695,1.686580538749695,1.686580538749695}}, 333 {"r1", {3.37316107749939,3.37316107749939,0}}, 334 {"r2", { 0,3.37316107749939,3.37316107749939}}, 335 {"r3", {3.37316107749939,0,3.37316107749939}}, 340 CHECK(ostr_testing_stream.str() == expected_testable_description); 350 std::string test_file{
"reference_points_test.hdf"};
354 ref_points.
write(hd);
359 bool okay_read = hd.
open(test_file);
361 hd.
push(
"reference_points");
366 for (
auto& map_entry : expected_reference_points)
368 std::string key{map_entry.first};
This class creates, contains, and writes both user and machine readable referencepoints.
class that handles xmlDoc
Lattice makeTestLattice()
bool open(const std::filesystem::path &fname, unsigned flags=H5F_ACC_RDWR)
open a file
helper functions for EinsplineSetBuilder
void write(hdf_archive &file) const
machine readable output
if(!okay) throw std xmlNodePtr node
PSetsAndRefList makePsets()
std::map< std::string, Point > Points
static ParticleSetPool make_diamondC_1x1x1(Communicate *c)
TEST_CASE("complex_helper", "[type_traits]")
void close()
close all the open groups and file
constexpr bool generate_test_data
set to true to generate new random R for particles.
Attaches a unit to a Vector for IO.
Communicate * Controller
Global Communicator for a process.
Wrapping information on parallelism.
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
Specialized paritlce class for atomistic simulations.
RefVector< ParticleSet > ref_psets
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
ReferencePointsInput makeTestRPI()
std::ostream & operator<<(std::ostream &out, const AntiSymTensor< T, D > &rhs)
bool approxEquality(T val_a, T val_b, std::optional< double > eps)
void push(const std::string &gname, bool createit=true)
push a group to the group stack
void write_description(std::ostream &os, const std::string &indent) const
writes a human readable representation of the reference points.
std::vector< std::reference_wrapper< T > > RefVector
bool create(const std::filesystem::path &fname, unsigned flags=H5F_ACC_TRUNC)
create a file
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
auto expectedReferencePoints()
void write_testable_description(std::ostream &os) const
const Points & get_points() const
return const ref to map of reference points.
bool readEntry(T &data, const std::string &aname)
read the data from the group aname and return status use read() for inbuilt error checking ...
TestableNEReferencePoints(const NEReferencePoints &nerp)