28 TEST_CASE(
"read_particle_mass_same_xml",
"[particle_io][xml]")
33 const char* particles = R
"(<tmp> 34 <particleset name="e" random="yes"> 35 <group name="u" size="4" mass="1.0"> 36 <parameter name="charge" > -1 </parameter> 37 <parameter name="mass" > 1.0 </parameter> 39 <group name="d" size="4" mass="1.0"> 40 <parameter name="charge" > -1 </parameter> 41 <parameter name="mass" > 1.0 </parameter> 44 <particleset name="ion0"> 45 <group name="H" size="8" mass="1836.15"> 46 <parameter name="charge" > 1 </parameter> 47 <parameter name="valence" > 1 </parameter> 48 <parameter name="atomicnumber" > 1 </parameter> 49 <parameter name="mass" > 1836.15 </parameter> 50 <attrib name="position" datatype="posArray" condition="0"> 51 0.00000000 0.00000000 0.00000000 52 2.11170946 0.00000000 0.00000000 53 0.00000000 2.11170946 0.00000000 54 2.11170946 2.11170946 0.00000000 55 0.00000000 0.00000000 2.11170946 56 2.11170946 0.00000000 2.11170946 57 0.00000000 2.11170946 2.11170946 58 2.11170946 2.11170946 2.11170946 70 xmlNodePtr part1 = xmlFirstElementChild(root);
71 xmlNodePtr part2 = xmlNextElementSibling(part1);
74 ParticleSet ions(simulation_cell), electrons(simulation_cell);
81 parse_ions.readXML(part2);
82 REQUIRE(ions.getName() ==
"ion0");
90 char order[] =
"uuuudddd";
91 for (
int iat = 0; iat < electrons.
getTotalNum(); iat++)
93 int species_id = electrons.
GroupID[iat];
94 std::string species_name = tspecies.speciesName[species_id];
95 REQUIRE(*species_name.c_str() == order[iat]);
96 CHECK(tspecies(massind, species_id) == Approx(1.0));
102 char porder[] =
"HHHHHHHH";
103 for (
int iat = 0; iat < ions.getTotalNum(); iat++)
105 int species_id = ions.GroupID[iat];
106 std::string species_name = pspecies.speciesName[species_id];
107 REQUIRE(*species_name.c_str() == porder[iat]);
108 CHECK(pspecies(pmassind, species_id) == Approx(1836.15));
class that handles xmlDoc
const std::string & getName() const
return the name
helper functions for EinsplineSetBuilder
size_t getTotalNum() const
TEST_CASE("complex_helper", "[type_traits]")
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
ParticleIndex GroupID
Species ID.
Specialized paritlce class for atomistic simulations.
REQUIRE(std::filesystem::exists(filename))
bool readXML(xmlNodePtr cur)
process xmlnode <particleset/> which contains everything about the particle set to initialize ...
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Custom container for set of attributes for a set of species.