53 log() <<
"from: " <<
root <<
"\n" << std::endl;
59 for(
int i = 0; i < struc_mol_name.size(); ++i) {
70 bool read_settings =
false;
71 bool read_composition =
true;
72 bool read_chem_ref =
true;
73 bool read_configs =
true;
74 bool clear_clex =
false;
76 refresh(read_settings, read_composition, read_chem_ref, read_configs, clear_clex);
91 bool read_composition,
102 catch(std::exception &e) {
108 if(read_composition) {
113 if(fs::is_regular_file(comp_axes)) {
114 log() <<
"read: " << comp_axes <<
"\n";
124 catch(std::exception &e) {
126 err_log() <<
"file: " << comp_axes <<
"\n" << std::endl;
137 if(fs::is_regular_file(chem_ref_path)) {
138 log() <<
"read: " << chem_ref_path <<
"\n";
142 catch(std::exception &e) {
144 err_log() <<
"file: " << chem_ref_path <<
"\n" << std::endl;
160 catch(std::exception &e) {
172 catch(std::exception &e) {
183 log() <<
"refresh cluster expansions\n";
221 return root /
".casm" /
"config_list.json";
272 m_nlist = notstd::make_cloneable<PrimNeighborList>(
327 err_log() <<
"supercell '" << scellname <<
"' not found." << std::endl;
328 throw std::invalid_argument(
"Error in PrimClex::get_supercell(std::string scellname) const: Not found");
353 catch(std::out_of_range &e) {
355 err_log() <<
"ERROR: In PrimClex::configuration(), configuration index out of range\n";
356 err_log() <<
"configname: " << configname <<
"\n";
357 err_log() <<
"index: " << res.second <<
"\n";
493 ScelEnumByProps e(*
this, enum_props);
494 for(
auto it = e.begin(); it != e.end(); ++it) {}
513 std::cerr <<
"ERROR in PrimClex::add_canonical_supercell()." << std::endl
514 <<
" Passed a Supercell Lattice that is not a superlattice of PRIM lattice\n" << std::endl;
562 fs::create_directory(
get_path() /
"training_data");
564 catch(
const fs::filesystem_error &ex) {
565 std::cerr <<
"Error in PrimClex::print_supercells()." << std::endl;
566 std::cerr << ex.what() << std::endl;
569 fs::ofstream scelfile(
get_path() /
"training_data" /
"SCEL");
579 if(!fs::exists(latpath)) {
580 fs::ofstream latfile(latpath);
585 catch(
const fs::filesystem_error &ex) {
586 std::cerr <<
"Error in PrimClex::print_supercells()." << std::endl;
587 std::cerr << ex.what() << std::endl;
596 stream <<
"Supercell Name: '" <<
supercell_list[i].get_name() <<
"' Number: " << i <<
" Volume: " <<
supercell_list[i].get_transf_mat().determinant() <<
"\n";
597 stream <<
"Supercell Transformation Matrix: \n";
623 std::vector<std::pair<Lattice, Lattice> > non_canon;
626 std::set<Supercell> in_scel;
629 while(!stream.eof()) {
630 std::getline(stream, s);
632 std::getline(stream, s);
636 in_scel.emplace(
this, lat);
644 non_canon.push_back(std::make_pair(lat, canon));
650 for(
const auto &scel : in_scel) {
654 if(non_canon.size()) {
658 log() <<
"A bug in a previous version of CASM resulted in the generation \n"
659 "of the following non-canonical supercells: \n";
660 for(
const auto &val : non_canon) {
665 log() <<
"To prevent errors, please use 'casm import' to convert existing \n"
666 "configurations and data.\n";
734 std::cerr <<
"Error in PrimClex::calc_transf_mat(const Lattice &superlat)" << std::endl
735 <<
" Bad supercell, the transformation matrix is not integer. Exiting!" << std::endl;
976 tau.row(i) =
prim.
basis[i].const_cart().transpose();
986 if(!fs::exists(
dir().clust(key.
bset))) {
1036 throw std::runtime_error(
1037 std::string(
"Error loading clexulator ") + key.
bset +
". No basis functions exist.");
1043 dir().clexulator_dir(key.
bset),
1049 catch(std::exception &e) {
1054 std::cout <<
"Error constructing Clexulator. Current settings: \n" << std::endl;
1055 Log tlog(std::cout);
1067 auto it =
m_eci.find(key);
1068 if(it ==
m_eci.end()) {
1078 auto it =
m_eci.find(key);
1079 if(it ==
m_eci.end()) {
1081 if(!fs::exists(eci_path)) {
1082 throw std::runtime_error(
1083 std::string(
"Error loading ECI. eci.json does not exist.\n")
1084 +
" Expected at: " + eci_path.string());
1087 it =
m_eci.insert(std::make_pair(key,
read_eci(eci_path))).first;
1107 tree.min_num_components = 2;
1108 tree.min_length = -1.5 * _tol;
1110 tree.max_length.clear();
1111 auto update_max_length = [&](
int branch,
double max_length) {
1112 while(branch > tree.max_length.size() - 1) {
1113 tree.max_length.push_back(0.0);
1115 tree.max_length[branch] = max_length;
1118 for(
auto it = json[
"orbit_branch_specs"].cbegin(); it != json[
"orbit_branch_specs"].
cend(); ++it) {
1119 update_max_length(std::stoi(it.name()), it->find(
"max_length")->get<
double>());
1121 tree.max_num_sites = tree.max_length.size() - 1;
1123 tree.generate_orbitree(prim);
1128 bool verbose =
false;
1129 tree.read_custom_clusters_from_json(json[
"orbit_specs"], prim, prim.
factor_group(), verbose);
1131 tree.collect_basis_info(prim);
1136 std::cerr <<
"Error in make_orbitree, with JSON input: \n";
1137 std::cerr << json <<
"\n";
1152 Index N_sublat = sublat_indices.size();
1155 for(
Index i = 0; i < tree.
size(); i++) {
1157 for(
Index j = 0; j < tree[i].
size(); j++) {
1159 for(
Index k = 0; k < tree[i][j].
size(); k++) {
1161 clust_nlist_inds.
resize(tree[i][j][k].size());
1164 for(
Index l = 0; l < tree[i][j][k].
size(); l++) {
1170 for(
Index b = 0; b < tree[i][j][k].
size(); b++) {
1176 auto unitcell_index =
find_index(nlist, delta);
1177 if(unitcell_index == nlist.
size()) {
1178 std::cerr <<
"Error generating unitcell index." << std::endl;
1179 std::cerr <<
" Did not find unitcell: " << delta.transpose() <<
" in the prim nlist." << std::endl;
1184 if(sublat_index == sublat_indices.size()) {
1185 std::cerr <<
"Error generating sublat index" << std::endl;
1186 std::cerr <<
" Did not find sublat: " << tuccb.
sublat() <<
" in the nlist sublattice indices: " <<
jsonParser(sublat_indices) << std::endl;
1190 clust_nlist_inds[b] = unitcell_index * N_sublat + sublat_index;
1200 tree[i][j][k].set_nlist_inds(clust_nlist_inds);
1205 for(t = 0; t < tree[i][j][k].trans_nlists().
size(); t++) {
1206 if(clust_nlist_inds.
all_in(tree[i][j][k].trans_nlist(t)))
1209 if(t == tree[i][j][k].trans_nlists().
size())
1210 tree[i][j][k].add_trans_nlist(clust_nlist_inds);
1222 std::string class_name,
1223 std::ostream &stream,
1230 for(
Index b = 0; b < Nsublat; b++) {
1231 if(prim.
basis[b].site_occupant().
size() > 1) {
1232 dof_manager.
add_dof(prim.
basis[b].site_occupant().type_name());
1236 for(
Index b = 0; b < Nsublat; b++) {
1238 dof_manager.
add_dof(prim.
basis[b].displacement()[i].type_name());
1247 std::stringstream private_def_stream, public_def_stream, interface_imp_stream, bfunc_imp_stream;
1249 std::string uclass_name;
1250 for(
Index i = 0; i < class_name.size(); i++)
1251 uclass_name.push_back(std::toupper(class_name[i]));
1253 std::string indent(2,
' ');
1254 private_def_stream <<
1256 indent <<
" /// \\brief Clone the Clexulator\n" <<
1257 indent <<
" virtual " << class_name <<
"* _clone() const override {\n" <<
1258 indent <<
" return new " << class_name <<
"(*this);\n" <<
1259 indent <<
" }\n\n" <<
1261 indent <<
" // typedef for method pointers\n" <<
1262 indent <<
" typedef double (" << class_name <<
"::*BasisFuncPtr)() const;\n\n" <<
1264 indent <<
" // typedef for method pointers\n" <<
1265 indent <<
" typedef double (" << class_name <<
"::*DeltaBasisFuncPtr)(int, int) const;\n\n" <<
1267 indent <<
" // array of pointers to member functions for calculating basis functions\n" <<
1268 indent <<
" BasisFuncPtr m_orbit_func_list[" << N_corr <<
"];\n\n" <<
1270 indent <<
" // array of pointers to member functions for calculating flower functions\n" <<
1271 indent <<
" BasisFuncPtr m_flower_func_lists[" << Nsublat <<
"][" << N_corr <<
"];\n\n" <<
1283 indent <<
" // array of pointers to member functions for calculating DELTA flower functions\n" <<
1284 indent <<
" DeltaBasisFuncPtr m_delta_func_lists[" << Nsublat <<
"][" << N_corr <<
"];\n\n";
1302 private_def_stream <<
1303 indent <<
" //default functions for basis function evaluation \n" <<
1304 indent <<
" double zero_func() const{ return 0.0;};\n" <<
1305 indent <<
" double zero_func(int,int) const{ return 0.0;};\n\n";
1307 public_def_stream <<
1308 indent <<
" " << class_name <<
"();\n\n" <<
1309 indent <<
" ~" << class_name <<
"();\n\n" <<
1311 indent <<
" /// \\brief Clone the " << class_name <<
"\n" <<
1312 indent <<
" std::unique_ptr<" << class_name <<
"> clone() const { \n" <<
1313 indent <<
" return std::unique_ptr<" << class_name <<
">(_clone()); \n" <<
1314 indent <<
" }\n\n" <<
1316 indent <<
" /// \\brief Calculate contribution to global correlations from one unit cell\n" <<
1317 indent <<
" void calc_global_corr_contribution(double *corr_begin) const override;\n\n" <<
1319 indent <<
" /// \\brief Calculate contribution to select global correlations from one unit cell\n" <<
1320 indent <<
" void calc_restricted_global_corr_contribution(double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const override;\n\n" <<
1322 indent <<
" /// \\brief Calculate point correlations about basis site 'b_index'\n" <<
1323 indent <<
" void calc_point_corr(int b_index, double *corr_begin) const override;\n\n" <<
1325 indent <<
" /// \\brief Calculate select point correlations about basis site 'b_index'\n" <<
1326 indent <<
" void calc_restricted_point_corr(int b_index, double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const override;\n\n" <<
1328 indent <<
" /// \\brief Calculate the change in point correlations due to changing an occupant\n" <<
1329 indent <<
" void calc_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin) const override;\n\n" <<
1331 indent <<
" /// \\brief Calculate the change in select point correlations due to changing an occupant\n" <<
1332 indent <<
" void calc_restricted_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const override;\n\n";
1353 bool make_newline(
false);
1356 for(
Index np = 0; np < tree.
size(); np++) {
1357 for(
Index no = 0; no < tree[np].
size(); no++) {
1360 indent <<
"// Basis functions for empty cluster:\n";
1363 indent <<
"/**** Basis functions for orbit " << np <<
", " << no <<
"****\n";
1364 tree[np][no].
prototype.print(bfunc_imp_stream,
'\n');
1365 bfunc_imp_stream <<
"****/\n";
1368 formulae = tree[np][no].orbit_function_cpp_strings(labelers);
1369 tlf = formulae.
size();
1371 make_newline =
false;
1372 for(
Index nf = 0; nf < formulae.
size(); nf++) {
1373 if(!formulae[nf].size())
1375 make_newline =
true;
1377 private_def_stream <<
1378 indent <<
" double " << orbit_method_names[lf + nf] <<
"() const;\n";
1381 indent <<
"double " << class_name <<
"::" << orbit_method_names[lf + nf] <<
"() const{\n" <<
1382 indent <<
" return " << formulae[nf] <<
";\n" <<
1386 bfunc_imp_stream <<
'\n';
1387 private_def_stream <<
'\n';
1389 make_newline =
false;
1393 for(
Index na = 0; na < asym_unit.size(); na++) {
1394 for(
Index ne = 0; ne < asym_unit[na].size(); ne++) {
1395 Index nb = asym_unit[na][ne][0].basis_ind();
1398 formulae = tree[np][no].flower_function_cpp_strings(labelers, nlist_index);
1399 for(
Index nf = 0; nf < formulae.
size(); nf++) {
1400 if(!formulae[nf].size())
1402 make_newline =
true;
1404 private_def_stream <<
1405 indent <<
" double " << flower_method_names[nb][lf + nf] <<
"() const;\n";
1408 indent <<
"double " << class_name <<
"::" << flower_method_names[nb][lf + nf] <<
"() const{\n" <<
1409 indent <<
" return " << formulae[nf] <<
";\n" <<
1415 bfunc_imp_stream <<
'\n';
1416 private_def_stream <<
'\n';
1418 make_newline =
false;
1421 formulae.
resize(formulae.
size(), std::string());
1423 const BasisSet &site_basis(asym_unit[na][ne].clust_basis);
1424 for(
Index nsbf = 0; nsbf < site_basis.
size(); nsbf++) {
1428 tformulae = tree[np][no].delta_occfunc_flower_function_cpp_strings(site_basis, labelers, nlist_index, nb, nsbf);
1429 for(
Index nf = 0; nf < tformulae.
size(); nf++) {
1430 if(!tformulae[nf].size())
1433 if(formulae[nf].size())
1434 formulae[nf] +=
" + ";
1436 formulae[nf] += delta_prefix;
1438 if(tformulae[nf] ==
"1" || tformulae[nf] ==
"(1)")
1441 formulae[nf] +=
"*";
1442 formulae[nf] += tformulae[nf];
1447 for(
Index nf = 0; nf < formulae.
size(); nf++) {
1448 if(!formulae[nf].size())
1450 make_newline =
true;
1453 private_def_stream <<
1454 indent <<
" double " << dflower_method_names[nb][lf + nf] <<
"(int occ_i, int occ_f) const;\n";
1457 indent <<
"double " << class_name <<
"::" << dflower_method_names[nb][lf + nf] <<
"(int occ_i, int occ_f) const{\n" <<
1458 indent <<
" return " << formulae[nf] <<
";\n" <<
1462 bfunc_imp_stream <<
'\n';
1463 private_def_stream <<
'\n';
1465 make_newline =
false;
1475 for(
Index nl = 0; nl < labelers.size(); nl++)
1476 delete labelers[nl];
1481 interface_imp_stream <<
1482 indent << class_name <<
"::" << class_name <<
"() :\n" <<
1483 indent <<
" Clexulator_impl::Base(" << nlist.
size() <<
", " << N_corr <<
") {\n";
1487 for(
Index nf = 0; nf < orbit_method_names.
size(); nf++) {
1488 if(orbit_method_names[nf].size() == 0)
1489 interface_imp_stream <<
1490 indent <<
" m_orbit_func_list[" << nf <<
"] = &" << class_name <<
"::zero_func;\n";
1492 interface_imp_stream <<
1493 indent <<
" m_orbit_func_list[" << nf <<
"] = &" << class_name <<
"::" << orbit_method_names[nf] <<
";\n";
1495 interface_imp_stream <<
"\n\n";
1497 for(
Index nb = 0; nb < flower_method_names.
size(); nb++) {
1498 for(
Index nf = 0; nf < flower_method_names[nb].
size(); nf++) {
1499 if(flower_method_names[nb][nf].size() == 0)
1500 interface_imp_stream <<
1501 indent <<
" m_flower_func_lists[" << nb <<
"][" << nf <<
"] = &" << class_name <<
"::zero_func;\n";
1503 interface_imp_stream <<
1504 indent <<
" m_flower_func_lists[" << nb <<
"][" << nf <<
"] = &" << class_name <<
"::" << flower_method_names[nb][nf] <<
";\n";
1506 interface_imp_stream <<
"\n\n";
1509 for(
Index nb = 0; nb < dflower_method_names.
size(); nb++) {
1510 for(
Index nf = 0; nf < dflower_method_names[nb].
size(); nf++) {
1511 if(dflower_method_names[nb][nf].size() == 0)
1512 interface_imp_stream <<
1513 indent <<
" m_delta_func_lists[" << nb <<
"][" << nf <<
"] = &" << class_name <<
"::zero_func;\n";
1515 interface_imp_stream <<
1516 indent <<
" m_delta_func_lists[" << nb <<
"][" << nf <<
"] = &" << class_name <<
"::" << dflower_method_names[nb][nf] <<
";\n";
1518 interface_imp_stream <<
"\n\n";
1523 interface_imp_stream << indent <<
" m_weight_matrix.row(0) << " << W(0, 0) <<
", " << W(0, 1) <<
", " << W(0, 2) <<
";\n";
1524 interface_imp_stream << indent <<
" m_weight_matrix.row(1) << " << W(1, 0) <<
", " << W(1, 1) <<
", " << W(1, 2) <<
";\n";
1525 interface_imp_stream << indent <<
" m_weight_matrix.row(2) << " << W(2, 0) <<
", " << W(2, 1) <<
", " << W(2, 2) <<
";\n\n";
1529 std::set<UnitCellCoord> nbors;
1542 interface_imp_stream << indent <<
" m_neighborhood = std::set<UnitCellCoord> {\n";
1543 auto it = nbors.begin();
1544 while(it != nbors.end()) {
1545 interface_imp_stream << indent <<
" {UnitCellCoord("
1546 << it->sublat() <<
", "
1547 << it->unitcell(0) <<
", "
1548 << it->unitcell(1) <<
", "
1549 << it->unitcell(2) <<
")}";
1551 if(it != nbors.end()) {
1552 interface_imp_stream <<
",";
1554 interface_imp_stream <<
"\n";
1556 interface_imp_stream << indent <<
" };\n";
1557 interface_imp_stream <<
"\n\n";
1559 interface_imp_stream << indent <<
" m_orbit_neighborhood.resize(corr_size());\n";
1561 for(
Index nb = 0; nb < tree.
size(); ++nb) {
1562 for(
Index no = 0; no < tree[nb].
size(); ++no) {
1563 std::set<UnitCellCoord> orbit_nbors;
1566 Index proto_index = lno;
1576 interface_imp_stream << indent <<
" m_orbit_neighborhood[" << lno <<
"] = std::set<UnitCellCoord> {\n";
1577 auto it = orbit_nbors.begin();
1578 while(it != orbit_nbors.end()) {
1579 interface_imp_stream << indent <<
" {UnitCellCoord("
1580 << it->sublat() <<
", "
1581 << it->unitcell(0) <<
", "
1582 << it->unitcell(1) <<
", "
1583 << it->unitcell(2) <<
")}";
1585 if(it != orbit_nbors.end()) {
1586 interface_imp_stream <<
",";
1588 interface_imp_stream <<
"\n";
1590 interface_imp_stream << indent <<
" };\n";
1592 for(
Index nf = 1; nf < tree.
prototype(nb, no).clust_basis.size(); ++nf) {
1593 interface_imp_stream << indent <<
" m_orbit_neighborhood[" << lno <<
"] = m_orbit_neighborhood[" << proto_index <<
"];\n";
1596 interface_imp_stream <<
"\n";
1602 interface_imp_stream <<
1607 interface_imp_stream <<
1608 indent << class_name <<
"::~" << class_name <<
"(){\n" <<
1610 indent <<
" //nothing here for now\n" <<
1616 interface_imp_stream <<
1617 indent <<
"/// \\brief Calculate contribution to global correlations from one unit cell\n" <<
1618 indent <<
"void " << class_name <<
"::calc_global_corr_contribution(double *corr_begin) const {\n" <<
1619 indent <<
" for(size_type i=0; i<corr_size(); i++){\n" <<
1620 indent <<
" *(corr_begin+i) = (this->*m_orbit_func_list[i])();\n" <<
1622 indent <<
"}\n\n" <<
1624 indent <<
"/// \\brief Calculate contribution to select global correlations from one unit cell\n" <<
1625 indent <<
"void " << class_name <<
"::calc_restricted_global_corr_contribution(double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const {\n" <<
1626 indent <<
" for(; ind_list_begin<ind_list_end; ind_list_begin++){\n" <<
1627 indent <<
" *(corr_begin+*ind_list_begin) = (this->*m_orbit_func_list[*ind_list_begin])();\n" <<
1629 indent <<
"}\n\n" <<
1631 indent <<
"/// \\brief Calculate point correlations about basis site 'b_index'\n" <<
1632 indent <<
"void " << class_name <<
"::calc_point_corr(int b_index, double *corr_begin) const {\n" <<
1633 indent <<
" for(size_type i=0; i<corr_size(); i++){\n" <<
1634 indent <<
" *(corr_begin+i) = (this->*m_flower_func_lists[b_index][i])();\n" <<
1636 indent <<
"}\n\n" <<
1638 indent <<
"/// \\brief Calculate select point correlations about basis site 'b_index'\n" <<
1639 indent <<
"void " << class_name <<
"::calc_restricted_point_corr(int b_index, double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const {\n" <<
1640 indent <<
" for(; ind_list_begin<ind_list_end; ind_list_begin++){\n" <<
1641 indent <<
" *(corr_begin+*ind_list_begin) = (this->*m_flower_func_lists[b_index][*ind_list_begin])();\n" <<
1643 indent <<
"}\n\n" <<
1645 indent <<
"/// \\brief Calculate the change in point correlations due to changing an occupant\n" <<
1646 indent <<
"void " << class_name <<
"::calc_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin) const {\n" <<
1647 indent <<
" for(size_type i=0; i<corr_size(); i++){\n" <<
1648 indent <<
" *(corr_begin+i) = (this->*m_delta_func_lists[b_index][i])(occ_i, occ_f);\n" <<
1650 indent <<
"}\n\n" <<
1652 indent <<
"/// \\brief Calculate the change in select point correlations due to changing an occupant\n" <<
1653 indent <<
"void " << class_name <<
"::calc_restricted_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin, size_type const* ind_list_begin, size_type const* ind_list_end) const {\n" <<
1654 indent <<
" for(; ind_list_begin<ind_list_end; ind_list_begin++){\n" <<
1655 indent <<
" *(corr_begin+*ind_list_begin) = (this->*m_delta_func_lists[b_index][*ind_list_begin])(occ_i, occ_f);\n" <<
1662 "#include <cstddef>\n" <<
1663 "#include \"casm/clex/Clexulator.hh\"\n" <<
1665 "/****** CLEXULATOR CLASS FOR PRIM ******" << std::endl;
1674 "/// \\brief Returns a Clexulator_impl::Base* owning a " << class_name <<
"\n" <<
1675 "extern \"C\" CASM::Clexulator_impl::Base* make_" + class_name <<
"();\n\n" <<
1677 "namespace CASM {\n\n" <<
1680 indent <<
"class " << class_name <<
" : public Clexulator_impl::Base {\n\n" <<
1682 indent <<
"public:\n\n" <<
1683 public_def_stream.str() <<
"\n" <<
1685 indent <<
"private:\n\n" <<
1686 private_def_stream.str() <<
"\n" <<
1688 indent <<
"};\n\n" <<
1692 "//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n" <<
1694 interface_imp_stream.str() <<
1695 bfunc_imp_stream.str() <<
1698 "extern \"C\" {\n" <<
1699 indent <<
"/// \\brief Returns a Clexulator_impl::Base* owning a " << class_name <<
"\n" <<
1700 indent <<
"CASM::Clexulator_impl::Base* make_" + class_name <<
"() {\n" <<
1701 indent <<
" return new CASM::" + class_name +
"();\n" <<
1702 indent <<
"}\n\n" <<
CompositionConverter m_comp_converter
Clexulator clexulator(const ClexDescription &key) const
bool has_orbitree(const ClexDescription &key) const
const Access to global orbitree
fs::path eci(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.json.
void close()
Closes stream, and if not a failed write, removes "file" and renames "file.tmp" to "file"...
boost::container::stable_vector< Supercell > & get_supercell_list()
Access entire supercell_list.
int amount_selected() const
Count over the number of configurations that are selected in all supercells.
const SublatIndices & sublat_indices() const
pair of const_iterators over a range of indices of sublattices to include
std::string get_name() const
Return supercell name.
Specifies a particular cluster expansion.
void print_clexulator_member_definitions(std::ostream &stream, const SiteOrbitree &tree, const std::string &indent) const
CompositionConverter curr
void write_config_list(std::set< std::string > scel_to_delete={})
static std::pair< std::string, Index > split_name(std::string configname)
Split configuration name string into scelname and config index.
ClustJsonHelper< ValueType > jsonHelper(ValueType &_value, const Structure &_struc, double tol=TOL)
fs::path get_config_list_path() const
Return config_list.json file path.
void print_clexulator_private_method_definitions(std::ostream &stream, const SiteOrbitree &tree, const std::string &indent) const
ProjectSettings m_settings
void from_json(ClexDescription &desc, const jsonParser &json)
bool has_clexulator(const ClexDescription &key) const
Eigen::MatrixXd shift_vectors() const
private:
Eigen::Matrix3l nlist_weight_matrix() const
Get neighbor list weight matrix.
fs::path composition_axes() const
Return composition axes file path.
fs::path SCEL() const
Return SCEL path.
const DirectoryStructure & dir() const
void resize_neighborhood(Index nlist_size)
std::string generate_name(const Eigen::Matrix3i &transf_mat)
const SymGroup & point_group() const
bool is_vacancy(const std::string &name)
A vacancy is any Specie/Molecule with (name == "VA" || name == "va" || name == "Va") ...
ConfigIterator< Configuration, PrimClex > config_iterator
fs::path get_path() const
Return casm project directory path.
Structure specifies the lattice and atomic basis of a crystal.
void print_compiler_settings_summary(Log &log) const
Print summary of compiler settings, as for 'casm settings -l'.
Data structure for holding supercell enumeration properties.
void print_clexulator_public_method_definitions(std::ostream &stream, const SiteOrbitree &tree, const std::string &indent) const
bool has_composition_axes() const
check if CompositionConverter object initialized
void refresh(bool read_settings=false, bool read_composition=false, bool read_chem_ref=false, bool read_configs=false, bool clear_clex=false)
Reload PrimClex data from settings.
void set_composition_axes(const CompositionConverter &_converter)
Sets the composition axes.
void write_prim(const BasicStructure< Site > &prim, fs::path filename, COORD_TYPE mode)
Write prim.json to file.
Index find_index(Iterator begin, Iterator end, const T &value)
Equivalent to std::distance(begin, std::find(begin, end, value))
std::map< ClexDescription, ECIContainer > m_eci
ReturnArray< FunctionVisitor * > get_function_label_visitors() const
ConfigList & get_config_list()
bool read(std::istream &stream)
Reads json from the stream.
const std::set< int > & nlist_sublat_indices() const
Get set of sublattice indices to include in neighbor lists.
Write to a temporary file to ensure a good write, then rename.
std::string to_string(ENUM val)
Return string representation of enum class.
const Lattice & lattice() const
fs::ofstream & ofstream()
Access underlying stream.
Represents a supercell of the primitive parent crystal structure.
ECIContainer read_eci(const fs::path &filepath)
Read eci.json file from specified path.
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
std::string name() const
Return project name.
const_iterator cend() const
Returns const_iterator to end of JSON object or JSON array.
config_iterator selected_config_end()
Configuration iterator: end.
config_iterator config_begin()
Configuration iterator: begin.
void generate_supercells(const ScelEnumProps &enum_props)
Use the given CSPECS.
config_iterator config_end()
Configuration iterator: end.
boost::container::stable_vector< Supercell > supercell_list
Contains all the supercells that were involved in the enumeration.
BasicStructure< Site > read_prim(fs::path filename)
void print(std::ostream &stream, unsigned int indent=2, unsigned int prec=12) const
Print json to stream.
std::vector< std::string > get_struc_molecule_name() const
Returns an Array of each possible Molecule in this Structure.
bool has_chemical_reference() const
check if ChemicalReference object initialized
Index basis_set_size() const
Count number of basis functions at each orbit and sum result.
void open(fs::path name, std::string tmp_ext="tmp")
Opens "file.tmp" for writing, with intended final target "file".
ConfigIterator< const Configuration, const PrimClex > config_const_iterator
bool vacancy_allowed() const
returns true if vacancy are an allowed species
void construct(const std::string &what)
void custom(const std::string &what)
std::string name() const
Get project name.
const Eigen::Matrix3d & inv_lat_column_mat() const
Inverse of Lattice::lat_column_mat() It is the transformation matrix 'C2F', such that f = C2F * c whe...
bool set_crystallography_tol(double _tol)
Set crystallography tolerance.
GenericOrbitree< SiteCluster > SiteOrbitree
config_const_iterator selected_config_cend() const
const Configuration iterator: end
size_type erase(const std::string &name)
Erase key:value pair from an object.
double crystallography_tol() const
void set_nlist_ind(const Structure &prim, SiteOrbitree &tree, const PrimNeighborList &nlist, double xtal_tol)
const MasterSymGroup & factor_group() const
Read/modify settings of an already existing CASM project.
fs::path project_settings() const
Return project_settings.json path.
config_const_iterator selected_config_cbegin() const
const Configuration iterator: begin
std::map< ClexDescription, SiteOrbitree > m_orbitree
EigenIndex Index
For long integer indexing:
OutputIterator neighborhood(OutputIterator result, const TreeType &tree, const StrucType &struc, double tol)
Iterate over all sites in an orbitree and insert a UnitCellCoord.
void read_supercells(std::istream &stream)
Lattice canonical_equivalent_lattice(const Lattice &in_lat, const SymGroup &point_grp, double compare_tol)
Find the niggli, most standard oriented version of the given orbit (defined by the given SymGroup) of...
void set_bspecs(const jsonParser &_bspecs)
Array< CoordType > basis
Lattice vectors that specifies periodicity of the crystal.
config_const_iterator config_cend() const
const Configuration iterator: end
ProjectSettings & settings()
config_iterator selected_config_begin()
Configuration iterator: begin.
PrimClex is the top-level data structure for a CASM project.
const CompositionConverter & composition_axes() const
const Access CompositionConverter object
bool is_supercell_of(const Lattice &tile, Eigen::Matrix3d &multimat, double _tol=TOL) const
Matrix that relates two lattices (e.g., strain or slat)
ChemicalReference read_chemical_reference(fs::path filename, const Structure &prim, double tol)
Read chemical reference states from JSON file.
Index add_canonical_supercell(const Lattice &superlat)
const ChemicalReference & chemical_reference() const
const Access ChemicalReference object
double lin_alg_tol() const
config_const_iterator config_cbegin() const
const Configuration iterator: begin
PrimNeighborList & nlist() const
Access to the primitive neighbor list.
const Configuration & configuration(const std::string &configname) const
access configuration by name (of the form "scellname/[NUMBER]", e.g., ("SCEL1_1_1_1_0_0_0/0") ...
bool has_eci(const ClexDescription &key) const
void print_supercells(std::set< std::string > scel_to_delete={}) const
bool m_has_composition_axes
notstd::cloneable_ptr< ChemicalReference > m_chem_ref
Index add_supercell(const Lattice &superlat)
bool is_integer(const Eigen::MatrixBase< Derived > &M, double tol)
Check if Eigen::Matrix is integer.
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
notstd::cloneable_ptr< PrimNeighborList > m_nlist
bool all_in(const Array &superset) const
Index vacancy_index() const
returns the index of vacancies in composition vectors
jsonParser & put_obj()
Puts new empty JSON object.
size_type size() const
size of the neighborhood of unit cells
Convert between number of species per unit cell and parametric composition.
const ClustType & prototype(Index np, Index no) const
Access prototype of orbit (np, no)
fs::path config_list() const
Return master config_list.json file path.
The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell...
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'.
void print_clexulator(const Structure &prim, SiteOrbitree &tree, const PrimNeighborList &nlist, std::string class_name, std::ostream &stream, double xtal_tol)
Print clexulator.
void warning(const std::string &what)
void print_to_clexulator_constructor(std::ostream &stream, const SiteOrbitree &tree, const std::string &indent) const
PrimClex(const Structure &_prim, const Logging &logging=Logging())
Initial construction of a PrimClex, from a primitive Structure.
void error(const std::string &what)
Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::iround< typename Derived::Scalar >)), const Derived > iround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXi.
DoFManager holds multiple DoFEnvironments, and provides a simple interface for adding and managing Do...
const Eigen::Matrix3i & get_transf_mat() const
void generate_clust_bases(std::vector< BasisSet const * > const &global_args, Index max_poly_order=-1)
get clust_basis for all equivalent clusters
Matrix3Type weight_matrix() const
Return the weighting matrix W used to define the canonical order.
Eigen::Matrix3l Matrix3Type
OutputIterator orbit_neighborhood(OutputIterator result, const TreeType &tree, const StrucType &struc, Index nb, Index no, double tol)
Iterate over all sites in an orbit and insert a UnitCellCoord.
bool contains_supercell(std::string scellname, Index &index) const
const ClexDescription & default_clex() const
std::map< ClexDescription, Clexulator > m_clexulator
fs::path chemical_reference(std::string calctype, std::string ref) const
Return chemical reference file path.
SiteOrbitree make_orbitree(Structure &prim, const jsonParser &json, double _tol)
Make orbitree. For now specifically global.
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)
const GenericOrbitBranch< ClustType > & asym_unit() const
const SiteOrbitree & orbitree(const ClexDescription &key) const
void register_dofs(GenericOrbitree< ClustType > &tree) const
void add_dof(const std::string &dof_name)
void _init()
Initialization routines.
Index size(Index np) const
Number of orbits in OrbitBranch 'np'.
Eigen::Matrix3i calc_transf_mat(const Lattice &superlat) const
A Configuration represents the values of all degrees of freedom in a Supercell.
const Structure & get_prim() const
const Access to primitive Structure
const ECIContainer & eci(const ClexDescription &key) const
A sparse container of ECI values and their corresponding orbit indices.