1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
37 BOOST_CHECK_EQUAL(struc.
basis[0].site_occupant().
size(), 3);
39 std::string check_name[3] = {
"A",
"B",
"C"};
41 for(
int i = 0; i < 3; i++) {
45 BOOST_CHECK_EQUAL(struc.
basis[0].site_occupant()[i].name, check_name[i]);
46 BOOST_CHECK_EQUAL(
almost_equal(struc.
basis[0].site_occupant()[i][0].const_frac(), Eigen::Vector3d(0.0, 0.0, 0.0),
tol),
true);
47 BOOST_CHECK_EQUAL(struc.
basis[0].site_occupant()[i][0].specie.name, check_name[i]);
53 BOOST_CHECK_EQUAL(48, factor_grp.
size());
80 BOOST_CHECK_EQUAL(struc.
basis[0].site_occupant().
size(), 3);
82 std::string check_name[3] = {
"A",
"B",
"C"};
83 int check_value[4] = {0, 0, 1, 2};
85 for(
int i = 0; i < 4; i++) {
86 for(
int j = 0; j < 3; j++) {
90 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant()[j].name, check_name[j]);
91 BOOST_CHECK_EQUAL(
almost_equal(struc.
basis[i].site_occupant()[j][0].const_frac(), Eigen::Vector3d(0.0, 0.0, 0.0),
tol),
true);
92 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant()[j][0].specie.name, check_name[j]);
95 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant().value(), check_value[i]);
101 BOOST_CHECK_EQUAL(16, factor_grp.
size());
144 BOOST_CHECK_EQUAL(struc.
basis.
size(), 4);
146 std::string check_name[4] = {
"A",
"A",
"B",
"C"};
148 for(
int i = 0; i < 4; i++) {
150 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant().
size(), 1);
155 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant()[0].name, check_name[i]);
156 BOOST_CHECK_EQUAL(
almost_equal(struc.
basis[i].site_occupant()[0][0].const_frac(), Eigen::Vector3d(0.0, 0.0, 0.0),
tol),
true);
157 BOOST_CHECK_EQUAL(struc.
basis[i].site_occupant()[0][0].specie.name, check_name[i]);
163 BOOST_CHECK_EQUAL(16, factor_grp.
size());
166 BOOST_AUTO_TEST_SUITE(BasicStructureSiteTest)
177 fs::path tmp_file = testdir /
"PRIM1_out";
213 fs::path tmp_file = testdir /
"POS1_out";
214 fs::ofstream sout(tmp_file);
235 fs::path tmp_file = testdir /
"POS1_vasp5_out";
236 fs::ofstream sout(tmp_file);
255 for(
auto it = scel_enum.begin(); it != scel_enum.end(); ++it) {
262 BOOST_CHECK_EQUAL(new_prim.lattice().is_right_handed(),
true);
268 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(PRIM1Test)
void prim2_read_test(BasicStructure< Site > &struc)
Structure specifies the lattice and atomic basis of a crystal.
Data structure for holding supercell enumeration properties.
bool is_primitive(double prim_tol=TOL) const
void prim1_read_test(BasicStructure< Site > &struc)
boost::filesystem::path testdir("tests/unit/crystallography")
void write_prim(const BasicStructure< Site > &prim, fs::path filename, COORD_TYPE mode)
Write prim.json to file.
A fake container of supercell matrices.
const Lattice & lattice() const
void generate_factor_group(SymGroup &factor_group, double map_tol) const
apply a symmetry operation to the current structure (may change lattice vectors and order of basis at...
BasicStructure< Site > read_prim(fs::path filename)
void print(std::ostream &sout)
Print POSCAR to stream.
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
void pos1_read_test(BasicStructure< Site > &struc)
const MasterSymGroup & factor_group() const
Array< CoordType > basis
Lattice vectors that specifies periodicity of the crystal.
Structure create_superstruc(const Lattice &scel_lat, double map_tol=TOL) const
Shortcut routine to create a supercell structure and fill it with sites.
BasicStructure< Site > ZrO_prim()
Print POSCAR with formating options.
bool is_right_handed() const
Check if the lattice is right handed.
void set_append_atom_names_off()
Do not append atom name to end of each coordinate line.
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)