28 TEST_CASE(
"read_particleset_xml",
"[particle_io][xml]")
30 const char* particles = R
"(<tmp> 31 <particleset name="ion0" size="1"> 33 <parameter name="charge">2</parameter> 35 <attrib name="position" datatype="posArray"> 39 <particleset name="e"> 40 <group name="u" size="1"> 41 <parameter name="charge">-1</parameter> 42 <attrib name="position" datatype="posArray"> 46 <group name="d" size="1"> 47 <parameter name="charge">-1</parameter> 48 <attrib name="position" datatype="posArray"> 49 -1.08389 1.9679 -0.0128914 62 ParticleSet ions(simulation_cell), electrons(simulation_cell);
65 xmlNodePtr part1 = xmlFirstElementChild(root);
70 CHECK(ions.R[0][0] == Approx(0.1));
71 CHECK(ions.R[0][1] == Approx(0.2));
72 CHECK(ions.R[0][2] == Approx(0.3));
73 REQUIRE(ions.getName() ==
"ion0");
76 xmlNodePtr part2 = xmlNextElementSibling(part1);
77 parse_electrons.readXML(part2);
81 CHECK(electrons.
R[0][0] == Approx(-0.28));
82 CHECK(electrons.
R[0][1] == Approx(0.0225));
83 CHECK(electrons.
R[0][2] == Approx(-2.709));
85 CHECK(electrons.
R[1][0] == Approx(-1.08389));
86 CHECK(electrons.
R[1][1] == Approx(1.9679));
87 CHECK(electrons.
R[1][2] == Approx(-0.0128914));
91 TEST_CASE(
"read_particleset_recorder_xml",
"[particle_io][xml]")
93 const char* particles = R
"(<tmp> 94 <particleset name="ion0" size="3"> 96 <parameter name="charge">2</parameter> 99 <parameter name="charge">1</parameter> 101 <attrib name="position" datatype="posArray"> 106 <attrib name="ionid" datatype="stringArray"> 119 ParticleSet ions(simulation_cell), electrons(simulation_cell);
122 xmlNodePtr part1 = xmlFirstElementChild(root);
125 CHECK(ions.groups() == 2);
126 CHECK(ions.R.size() == 3);
127 CHECK(ions.GroupID[0] == 0);
128 CHECK(ions.GroupID[1] == 0);
129 CHECK(ions.GroupID[2] == 1);
130 CHECK(ions.R[0][0] == Approx(0.3));
131 CHECK(ions.R[0][1] == Approx(0.1));
132 CHECK(ions.R[0][2] == Approx(0.2));
133 CHECK(ions.R[1][0] == Approx(0.2));
134 CHECK(ions.R[1][1] == Approx(0.3));
135 CHECK(ions.R[1][2] == Approx(0.1));
136 CHECK(ions.R[2][0] == Approx(0.1));
137 CHECK(ions.R[2][1] == Approx(0.2));
138 CHECK(ions.R[2][2] == Approx(0.3));
139 CHECK(ions.getName() ==
"ion0");
142 TEST_CASE(
"read_dynamic_spin_eset_xml",
"[particle_io][xml]")
144 const char* particles = R
"(<tmp> 145 <particleset name="e"> 146 <group name="e" size="3"> 147 <parameter name="charge">-1</parameter> 148 <attrib name="position" datatype="posArray"> 153 <attrib name="spins" datatype="scalarArray"> 168 xmlNodePtr part1 = xmlFirstElementChild(root);
174 parse_electrons.
readXML(part1);
180 CHECK(electrons.
R[0][0] == Approx(-0.28));
181 CHECK(electrons.
R[0][1] == Approx(0.0225));
182 CHECK(electrons.
R[0][2] == Approx(-2.709));
184 CHECK(electrons.
R[1][0] == Approx(-1.28));
185 CHECK(electrons.
R[1][1] == Approx(1.0225));
186 CHECK(electrons.
R[1][2] == Approx(-1.709));
188 CHECK(electrons.
R[2][0] == Approx(-2.28));
189 CHECK(electrons.
R[2][1] == Approx(2.0225));
190 CHECK(electrons.
R[2][2] == Approx(-0.709));
class that handles xmlDoc
const std::string & getName() const
return the name
helper functions for EinsplineSetBuilder
ParticleScalar spins
internal spin variables for dynamical spin calculations
TEST_CASE("complex_helper", "[type_traits]")
int groups() const
return the number of groups
Specialized paritlce class for atomistic simulations.
size_type size() const
return the current size
REQUIRE(std::filesystem::exists(filename))
bool readXML(xmlNodePtr cur)
process xmlnode <particleset/> which contains everything about the particle set to initialize ...
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))