1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
15 BOOST_AUTO_TEST_SUITE(ChemicalReferenceTest)
23 std::vector<ChemicalReferenceState> ref_state(3);
24 ref_state[0].species_num[
"A"] = 1.0;
25 ref_state[0].energy_per_species = -1.0;
27 ref_state[1].species_num[
"B"] = 1.0;
28 ref_state[1].energy_per_species = -2.0;
30 ref_state[2].species_num[
"C"] = 1.0;
31 ref_state[2].energy_per_species = -4.0;
43 BOOST_CHECK_EQUAL(
almost_equal(chem_ref.global(), Eigen::Vector3d(-1.0, -2.0, -4.0),
tol),
true);
51 BOOST_CHECK_EQUAL(json.
contains(
"global"),
true);
55 BOOST_CHECK_EQUAL(
almost_equal(chem_ref2.global(), Eigen::Vector3d(-1.0, -2.0, -4.0),
tol),
true);
60 BOOST_CHECK_EQUAL(json.
contains(
"chemical_reference"),
true);
64 BOOST_CHECK_EQUAL(
almost_equal(chem_ref3.global(), Eigen::Vector3d(-1.0, -2.0, -4.0),
tol),
true);
82 Eigen::Vector3d(-1.0, -2.0, -4.0)
95 BOOST_CHECK_EQUAL(json.
contains(
"global"),
true);
100 BOOST_CHECK_EQUAL(json.
contains(
"chemical_reference"),
true);
104 BOOST_AUTO_TEST_SUITE_END()
Structure specifies the lattice and atomic basis of a crystal.
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void write_chemical_reference(const ChemicalReference &chem_ref, fs::path filename)
T get(Args...args) const
Get data from json, using one of several alternatives.
BasicStructure< Site > FCC_ternary_prim()
ChemicalReference read_chemical_reference(fs::path filename, const Structure &prim, double tol)
Read chemical reference states from JSON file.
Structure to help print ChemicalReference.
const Eigen::VectorXd & global() const
const Access the global reference
BOOST_AUTO_TEST_CASE(Basics)
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)