1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
20 BOOST_AUTO_TEST_SUITE(ConfigEnumEquivalentsTest)
27 fs::path test_cases_path(
"tests/unit/clex/ConfigEnumEquivalents_test_cases.json");
29 fs::path test_proj_dir(
"tests/unit/clex/test_proj");
31 for(
auto test_it = tests.
begin(); test_it != tests.
end(); ++test_it) {
40 BOOST_CHECK_MESSAGE(j.
contains(
"title"),
"test case 'title' is required");
41 BOOST_CHECK_MESSAGE(j.
contains(
"prim"),
"test case 'prim' is required");
42 BOOST_CHECK_MESSAGE(j.
contains(
"max_vol"),
"test case 'max_vol' is required");
48 if(fs::exists(test_proj_dir /
".casm")) {
49 fs::remove_all(test_proj_dir);
52 fs::create_directory(test_proj_dir);
54 j[
"prim"].
write(test_proj_dir /
"prim.json");
57 ProjectBuilder builder(test_proj_dir, j[
"title"].get<std::string>(),
"formation_energy");
69 std::map<Index, Index> prim_count;
70 std::map<Index, Index> total_count;
84 for(
Index j = 0; j < i; j++) {
87 for(
const auto &tunit : e) {
89 total_count[i] += prim_count[j];
94 for(
auto &config : enumerator) {
96 for(
auto &equiv : equiv_enum) {
104 long prod = std::accumulate(max_occ.begin(), max_occ.end(),
long {1}, [](
long a,
int b) {
111 BOOST_CHECK_EQUAL(total_count[i], prod);
118 if(fs::exists(test_proj_dir /
".casm")) {
119 fs::remove_all(test_proj_dir);
124 BOOST_AUTO_TEST_SUITE_END()
Enumerate over all possible occupations in a particular Supercell.
boost::container::stable_vector< Supercell > & get_supercell_list()
Access entire supercell_list.
ReturnArray< int > max_allowed_occupation() const
iterator end()
Returns iterator to end of JSON object or JSON array.
void write(const std::string &file_name, unsigned int indent=2, unsigned int prec=12) const
Write json to file.
Structure specifies the lattice and atomic basis of a crystal.
Data structure for holding supercell enumeration properties.
const Lattice & get_real_super_lattice() const
Represents a supercell of the primitive parent crystal structure.
iterator begin()
Returns const_iterator to beginning of JSON object or JSON array.
void generate_supercells(const ScelEnumProps &enum_props)
Use the given CSPECS.
BasicStructure< Site > read_prim(fs::path filename)
double crystallography_tol() const
Sets up directories and files for a new CASM project.
BOOST_AUTO_TEST_CASE(Test1)
EigenIndex Index
For long integer indexing:
bool get_else(T &t, const std::string &key, const T &default_value, Args...args) const
PrimClex is the top-level data structure for a CASM project.
void build() const
Builds a new CASM project.
const Supercell & get_supercell(Index i) const
const Access supercell by index
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
std::pair< bool, Eigen::MatrixXi > is_supercell(const Lattice &scel, const Lattice &unit, double tol)
Check if scel is a supercell of unitcell unit and some integer transformation matrix T...
Enumerate equivalent Supercell.
Enumerate all equivalent Configurations in a Supercell, as generated by Supercell factor group symmet...