22 (
"update,u",
"Update basis set")
23 (
"orbits",
"Pretty-print orbit prototypes")
24 (
"functions",
"Pretty-print prototype cluster functions for each orbit")
25 (
"clusters",
"Pretty-print all clusters")
26 (
"clex", po::value<std::string>(),
"Name of the cluster expansion using the basis set")
27 (
"force,f",
"Force overwrite");
44 po::store(po::parse_command_line(args.
argc, args.
argv, bset_opt.
desc()), vm);
45 bool call_help =
false;
49 if(vm.count(
"help") || call_help) {
51 args.
log << bset_opt.
desc() << std::endl;
56 if(vm.count(
"desc")) {
58 args.
log << bset_opt.
desc() << std::endl;
59 args.
log <<
"DESCRIPTION" << std::endl;
60 args.
log <<
" Generate and inspect cluster basis functions. A bspecs.json file should be available at\n"
61 <<
" $ROOT/basis_set/$current_bset/bspecs.json\n"
62 <<
" Run 'casm format --bspecs' for an example file.\n\n" ;
72 args.
err_log <<
"\nERROR: " << e.what() << std::endl << std::endl;
75 catch(std::exception &e) {
77 args.
err_log <<
"\nERROR: " << e.what() << std::endl;
91 std::unique_ptr<PrimClex> uniq_primclex;
98 if(!vm.count(
"clex")) {
105 args.
err_log << vm[
"clex"].as<std::string>() <<
" not found.";
108 clex_desc = it->second;
110 bset = clex_desc.
bset;
112 if(vm.count(
"update")) {
117 if(!fs::is_regular_file(dir.
bspecs(bset))) {
119 args.
err_log <<
"expected basis set specifications file at: " << dir.
bspecs(bset) <<
"\n" << std::endl;
124 std::vector<fs::path> filepaths({dir.
clust(bset),
131 bool any_existing_files =
false;
132 std::for_each(filepaths.cbegin(),
136 if(!any_existing_files) {
138 any_existing_files =
true;
140 args.
log <<
"found: " << p <<
"\n";
144 if(any_existing_files) {
145 if(vm.count(
"force")) {
146 args.
log <<
"Using --force. Will overwrite existing files.\n" << std::endl;
155 args.
log <<
"Exiting due to existing files. Use --force to force overwrite.\n" << std::endl;
168 if(tree.min_num_components < 2) {
170 args.
err_log <<
"Custom clusters include a site with only 1 allowed component. \n";
171 args.
err_log <<
"This is not currently supported.\n" << std::endl;
172 for(
int nb = 0; nb < tree.size(); ++nb) {
173 for(
int no = 0; no < tree[nb].size(); ++no) {
174 for(
int ns = 0; ns < tree[nb][no].prototype.size(); ++ns) {
175 if(tree[nb][no].prototype[ns].site_occupant().size() < 2) {
176 args.
err_log <<
"--- Prototype --- " << std::endl;
177 tree[nb][no].prototype.print(args.
err_log,
'\n');
185 tree.generate_clust_bases();
187 args.
log <<
"orbit generation time: " << args.
log.
lap_time() <<
" (s)\n";
188 args.
log <<
"# of cluster orbits: " << tree.Norbits <<
"\n";
189 args.
log <<
"# of basis functions: " << tree.basis_set_size() <<
"\n" << std::endl;
191 catch(std::exception &e) {
192 args.
err_log << e.what() << std::endl;
197 args.
log.
write(
"Cluster and basis set files");
201 args.
log <<
"write: " << dir.
clust(bset) << std::endl;
209 args.
log <<
"write: " << dir.
basis(bset) << std::endl;
222 std::set<UnitCellCoord> nbors;
224 nlist.expand(nbors.begin(), nbors.end());
227 fs::ofstream outfile;
236 else if(vm.count(
"orbits") || vm.count(
"clusters") || vm.count(
"functions")) {
238 if(!fs::exists(dir.
clust(bset))) {
240 args.
err_log <<
"Make sure to update your basis set with 'casm bset -u'.\n" << std::endl;
246 if(vm.count(
"orbits")) {
249 args.
log << std::endl;
251 if(vm.count(
"clusters")) {
254 args.
log << std::endl;
256 if(vm.count(
"functions")) {
259 args.
log << std::endl;
264 args.
err_log << bset_opt.
desc() <<
"\n" << std::endl;
Data structure holding basic CASM command info.
Clexulator clexulator(const ClexDescription &key) const
Specifies a particular cluster expansion.
ClustJsonHelper< ValueType > jsonHelper(ValueType &_value, const Structure &_struc, double tol=TOL)
Eigen::Matrix3l nlist_weight_matrix() const
Get neighbor list weight matrix.
Specification of CASM project directory structure.
void write(const std::string &what)
const DirectoryStructure & dir() const
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.
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void add_help_suboption()
Add a plain –help suboption.
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.
const std::set< int > & nlist_sublat_indices() const
Get set of sublattice indices to include in neighbor lists.
const Lattice & lattice() const
void print_proto_clust_funcs(std::ostream &out) const
fs::path bspecs(std::string bset) const
Return basis function specs (bspecs.json) file path.
void custom(const std::string &what)
std::string name() const
Get project name.
void print_proto_clust(std::ostream &out) const
void generate(const std::string &what)
double crystallography_tol() const
const po::options_description & desc()
Get the program options, filled with the initialized values.
Read/modify settings of an already existing CASM project.
fs::path clexulator_so(std::string project, std::string bset) const
Returns path to global clexulator so file.
fs::path clust(std::string bset) const
OutputIterator neighborhood(OutputIterator result, const TreeType &tree, const StrucType &struc, double tol)
Iterate over all sites in an orbitree and insert a UnitCellCoord.
fs::path clexulator_src(std::string project, std::string bset) const
Returns path to global clexulator source file.
int bset_command(const CommandArgs &args)
fs::path basis(std::string bset) const
po::options_description m_desc
Boost program options. All the derived classes have them, but will fill them up themselves.
void initialize() override
Fill in the options descriptions accordingly.
ProjectSettings & settings()
PrimClex is the top-level data structure for a CASM project.
void print_full_clust(std::ostream &out) const
std::string clexulator() const
const std::map< std::string, ClexDescription > & cluster_expansions() const
PrimClex & make_primclex_if_not(const CommandArgs &args, std::unique_ptr< PrimClex > &uniq_primclex)
If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or c...
The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell...
void write_basis(const SiteOrbitree &tree, const Structure &prim, jsonParser &json, double tol)
Write summary of basis functions.
fs::path clexulator_o(std::string project, std::string bset) const
Returns path to global clexulator o file.
void print_clexulator(const Structure &prim, SiteOrbitree &tree, const PrimNeighborList &nlist, std::string class_name, std::ostream &stream, double xtal_tol)
Print clexulator.
void error(const std::string &what)
#define ERR_EXISTING_FILE
#define ERR_MISSING_INPUT_FILE
const ClexDescription & default_clex() const
SiteOrbitree make_orbitree(Structure &prim, const jsonParser &json, double _tol)
Make orbitree. For now specifically global.
const SiteOrbitree & orbitree(const ClexDescription &key) const
const Structure & get_prim() const
const Access to primitive Structure
#define ERR_MISSING_DEPENDS
#define ERR_INVALID_INPUT_FILE