CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
status.cc
Go to the documentation of this file.
5 #include "casm/clex/PrimClex.hh"
6 
8 
9 namespace CASM {
10  void status_unitialized(const CommandArgs &args) {
11 
12  args.log << "NEXT STEPS:\n\n";
13 
14  args.log <<
15  "Initialize a CASM project\n\
16 - Create and cd to the directory where you want the project to be located.\n\
17  This will be called the 'project root directory' or project's 'location'.\n\
18 - Add a 'prim.json' file to the directory describing the primitive cell. \n\
19  See 'casm format --prim' for the format of the 'prim.json' file. \n\
20 - Execute: 'casm init' \n\
21 - Several directories are created: 'symmetry', 'basis_sets', \n\
22  'training_data', and 'cluster_expansions' \n\
23 - If necessary, set configuration options for runtime compilation and \n\
24  linking by using the 'casm settings' command or by setting environment \n\
25  variables. \n\
26  \n\
27  'cxx': \n\
28  Specifies compiler to use. In order of priority: \n\
29  1) User specified by 'casm settings --set-cxx' (use '' to clear) \n\
30  2) $CASM_CXX \n\
31  3) $CXX \n\
32  4) \"g++\" \n\
33 \n\
34  'cxxflags': \n\
35  Compiler flags. In order of priority: \n\
36  1) User specified by 'casm settings --set-cxxflags' \n\
37  2) $CASM_CXXFLAGS \n\
38  3) \"-O3 -Wall -fPIC --std=c++11\" \n\
39 \n\
40  'soflags': \n\
41  Shared object construction flags. In order of priority: \n\
42  1) User specified by 'casm settings --set-soflags' \n\
43  2) $CASM_SOFLAGS \n\
44  3) \"-shared -lboost_system\" \n\
45 \n\
46  'casm headers and libraries': \n\
47  CASM header files and shared libraries are expected in the following\n\
48  locations. \n\
49  In order of priority: \n\
50  1) User specified by 'casm settings --set-casm-includedir' and \n\
51  'casm settings --set-casm-libdir' \n\
52  2) $CASM_INCLUDEDIR and $CASM_LIBDIR \n\
53  3) $CASM_PREFIX/include and $CASM_PREFIX/lib \n\
54  3) (default search paths) \n\
55 \n\
56  Note: For the 'casm' Python package, $LIBCASM and $LIBCCASM, have \n\
57  highest priority for locating libcasm and libccasm, respectively. \n\
58 \n\
59  'boost headers and libraries': \n\
60  The boost libraries are expected in the following locations. \n\
61  In order of priority: \n\
62  1) User specified by 'casm settings --set-boost-includedir' and \n\
63  'casm settings --set-boost-libdir' and \n\
64  2) $CASM_BOOST_INCLUDEDIR and $CASM_BOOST_LIBDIR \n\
65  3) $CASM_BOOST_PREFIX/include $CASM_BOOST_PREFIX/lib \n\
66  4) (default search paths) \n\
67 \n\
68  Note: If shared libraries are installed in non-standard locations, you \n\
69  may need to set: \n\
70  (Linux) export LD_LIBRARY_PATH=$CASM_PREFIX/lib:$CASM_BOOST_PREFIX/lib:$LD_LIBRARY_PATH \n\
71  (Mac) export DYLD_FALLBACK_LIBRARY_PATH=$CASM_PREFIX/lib:$CASM_BOOST_PREFIX/lib:$DYLD_FALLBACK_LIBRARY_PATH \n\
72 \n\
73 - Subsequently, work on the CASM project can be done by executing 'casm' \n\
74  from the project's root directory or any subdirectory. \n\
75 - See 'casm format --prim' for description and location of the 'prim.json' file.\n";
76  }
77 
78  void composition_unselected(const CommandArgs &args) {
79 
80  args.log << "NEXT STEPS:\n\n";
81 
82  args.log <<
83  "Select composition axes\n\
84 - Execute: 'casm composition -d' to display standard composition axes. \n\
85 - Then execute 'casm composition -s <#>' to select one of the listed axes.\n\
86 - If no standard composition axis is satisfactory, edit the file \n\
87  'composition_axes.json' to add your own custom composition axes to the \n\
88  'custom_axes' JSON object.\n\
89 - See 'casm format --comp' for description and the location of \n\
90  the 'composition_axes.json' file.\n\n";
91 
92  }
93 
94  void supercells_ungenerated(const CommandArgs &args) {
95 
96  args.log << "NEXT STEPS:\n\n";
97 
98  args.log <<
99  "Enumerate supercells\n\
100 - Execute: 'casm enum --method ScelEnum --max V' to enumerate supercells up to \n\
101  volume V (units: number of primitive cells). \n\
102 - Supercells are listed in the SCEL file.\n\
103 - See 'casm enum --desc ScelEnum' for extended help documentation on how to use the\n\
104  '--matrix' and '--lattice-directions' options to perform restricted \n\
105  supercell enumeration (i.e. 2d, 1d, multiples of other supercells). \n\
106 - See 'casm format' for a description and location of the \n\
107  'SCEL' file.\n\n";
108 
109  }
110 
111  void configs_ungenerated(const CommandArgs &args) {
112 
113  args.log << "NEXT STEPS:\n\n";
114 
115  args.log <<
116  "Enumerate configurations\n\
117 - Several options are possible: \n\
118 - Execute: 'casm enum --method ConfigEnumAllOccupations --all' to \n\
119  enumerate configurations for all supercells. \n\
120 - Execute: 'casm enum --method ConfigEnumAllOccupations --min MINV --max MAXV' \n\
121  to enumerate configurations for supercells ranging in volume from \n\
122  MINV to MAXV (units: number of primitive cells). \n\
123 - Execute: 'casm enum --method ConfigEnumAllOccupations --scelname NAME' \n\
124  to enumerate configurations for a particular supercell. \n\
125 - Generated configurations are listed in the 'config_list.json' file. \n\
126  This file should not usually be edited manually. \n\
127 - Use the 'casm view' command to quickly view configurations in your \n\
128  favorite visualization program. See 'casm view -h' for help. \n\
129 - See 'casm enum --desc ConfigEnumAllOccupations' for extended help documentation on how to use \n\
130  '--filter' command to perform restricted enumeration of \n\
131  configurations. \n\
132 - Once you have a cluster expansion, see 'casm format --monte' for \n\
133  a description of how to save configurations enumerated during Monte \n\
134  Carlo calculations. \n\
135 - See 'casm format --config' for a description and location of \n\
136  the 'config_list.json' file. \n\n";
137  }
138 
139  void configs_uncalculated(const CommandArgs &args) {
140  args.log << "NEXT STEPS:\n\n";
141 
142  args.log <<
143  "Calculate configuration properties\n\
144  \n\
145 Instructions for volume relaxed VASP energies: \n\n\
146 - Create INCAR, KPOINTS, POSCAR, SPECIES, and 'relax.json' files for \n\
147  VASP in: '$ROOT/training_data/settings/$CURR_CALCTYPE'. See \n\
148  'casm format --vasp' for a description and location of the VASP \n\
149  settings files. \n\
150 Instructions for volume relaxed Quantum Espresso energies: \n\n\
151 - Create $inputfile, SPECIES, and 'relax.json' (with calculator tag set) files for\n\
152  Quantum Espresso in: '$ROOT/training_data/settings/$CURR_CALCTYPE'. See\n\
153  'casm format --qe' for a description and location of the Quantum Espresso\n\
154  settings files. \n\n\
155 For either of the choices above do the following: \n\n\
156 - Select which configurations to calculate properties for using the \n\
157  'casm select' command. Use 'casm select --set-on' to select all \n\
158  configurations. By default, the 'selected' state of each \n\
159  configuration is stored by CASM in the master config_list.json file, \n\
160  located in the hidden '.casm' directory. The standard selections \n\
161  'MASTER', 'CALCULATED', 'ALL', or 'NONE' may always be used. \n\
162 - You can also save additional selection using the 'casm select -o' \n\
163  option to write a selection to a file. \n\
164 - Selections may be operated on to create new selections that are \n\
165  subsets, unions, or intersections of existing selections. \n\
166 - Selection files may also be edited manually or via programs for more \n\
167  complex selections than currently supported by 'casm select'. For all\n\
168  options related to selection configurations, see 'casm select -h'. \n\
169 - Selections may be used to query the properties of particular \n\
170  configurations using the 'casm query' command. See 'casm query -h' \n\
171  for the complete list of options. \n\
172  '$ROOT/training_data/$SCELNAME/$CONFIGID/$CURR_CALCTYPE/properties.calc.json'\n\
173 - Execute: 'casm-calc --setup' to setup VASP/QuantumEspresso input files for all\n\
174  selected configurations, but not submit the jobs. This is often a \n\
175  useful first step to check that input files have been prepared \n\
176  correctly. \n\
177 - Execute: 'casm-calc --submit' to submit VASP/QuantumEspresso jobs for all selected \n\
178  configurations. Only configurations which have not yet been \n\
179  calculated will run. \n\
180 - See 'casm-calc -h' for help and other options. \n\
181 - VASP/QuantumEspresso results will be stored at: \n\
182  '$ROOT/training_data/$SCELNAME/$CONFIGID/$CURR_CALCTYPE/properties.calc.json'\n\
183  Results in 'properties.calc.json' are expected to be ordered to match\n\
184  the 'POS' file at '$ROOT/training_data/$SCELNAME/$CONFIGID/POS' \n\
185 - Execute 'casm update' to read in calculation results from the \n\
186  'properties.calc.json' files once completed. \n\n";
187 
188  }
189 
190  void references_unset(const CommandArgs &args) {
191 
192  args.log << "NEXT STEPS:\n\n";
193 
194  args.log <<
195  "Set chemical reference\n"
196  " \n"
197  "- The chemical reference determines the value of the formation energy \n"
198  " and chemical potentials calculated by CASM. \n\n"
199 
200  "- Chemical references states are set by specifying a hyperplane in \n"
201  " energy/atom - composition (as atom_frac) space. This may be done by \n"
202  " specifying the hyperplane explicitly, or by specifying several \n"
203  " reference states with energy/atom and composition (as atom_frac) for \n"
204  " enough states to span the composition space of the allowed occupants \n"
205  " specified in the prim. For consistency with other CASM projects, \n"
206  " additional reference states extending to other compositional \n"
207  " dimensions may be included also. \n\n"
208 
209  "- Execute 'casm ref --set-auto' to automatically set project level \n"
210  " references using DFT calculated energies from configurations with \n"
211  " extreme parametric compositions.\n\n"
212 
213  "- Execute 'casm ref --set '...JSON...'' to manually set the project \n"
214  " level reference energies. See 'casm ref --help' for more information.\n\n"
215 
216  "- It is also possible to specialize the chemical reference at the \n"
217  " supercell or configuration level. \n\n"
218 
219  "- See 'casm format' for a description and location of the \n"
220  " 'chemical_reference.json' file. \n\n";
221 
222  }
223 
224  void bset_uncalculated(const CommandArgs &args) {
225  args.log << "NEXT STEPS:\n\n";
226 
227  args.log <<
228  "Generate basis functions \n\
229  \n\
230 Instructions for generating basis functions: \n\n\
231 - Write a '$ROOT/basis_sets/$CURR_BSET/bspecs.json' file containing \n\
232  specifications for how which orbits to include and which site basis \n\
233  functions to use in generating cluster expansion basis functions. \n\
234  See 'casm format --bspecs' for an example file. \n\
235 - Execute 'casm bset -u' to generate basis functions. If you edit the \n\
236  'bspecs.json' file, execute 'casm bset -u' again to update basis \n\
237  functions. \n\
238 - See 'casm format --bspecs' for description and location of the \n\
239  'bspecs.json' file.\n\n";
240  }
241 
242  void eci_uncalculated(const CommandArgs &args) {
243  args.log << "NEXT STEPS:\n\n";
244 
245  args.log <<
246  "Fit effective cluster interactions (ECI)\n\
247  \n\
248 Instructions for fitting ECI: \n\n\
249 - Create a new directory within the CASM project, for example: \n\
250  mkdir fit_1 && cd fit_1 \n\
251 - Select which configurations to use as the training data with the \n\
252  'casm select' command. To select all calculated configurations: \n\
253  casm select --set 'is_calculated' -o train \n\
254 - See 'casm select -h' for more options. \n\
255 - Create a 'casm-learn' input file. Several example input files can be \n\
256  generated from 'casm-learn --exMethodName'. For example: \n\
257  casm-learn --exGeneticAlgorithm > fit_1_ga.json \n\
258  This file can be edited to adjust the problem being solved (training \n\
259  data, weighting scheme, cross validation sets and scoring, linear \n\
260  estimator method, feature selection method, etc.) \n\
261 - See 'casm-learn --settings-format' for description and help with the \n\
262  input file. \n\
263 - Execute: 'casm-learn -s fit_1_ga.json' \n\
264 - Results are stored in a Hall Of Fame file containing the best \n\
265  solutions as determined from cross validation scores. \n\
266 - Different estimator methods (LinearRegression, Lasso, etc.) and \n\
267  different feature selection methods (GeneticAlgorithm, RFE, etc.) can\n\
268  be used with the same problem specs (training data, weighting scheme,\n\
269  cross validation sets and scoring) and compared in a single Hall Of \n\
270  Fame. \n\
271 - When some candidate ECI have been stored in a Hall Of Fame, use the \n\
272  'casm-learn --checkhull' option to check if ground state configurations \n\
273  are accurately predicted by the cluster expansion. \n\
274 - When ready, use 'casm-learn --select' to write an 'eci.json' file to \n\
275  use for Monte Carlo. \n\
276 - See 'casm format --eci' for a description and location of the \n\
277  'eci.json' files.\n\n";
278  }
279 
280  void montecarlo(const CommandArgs &args) {
281 
282  args.log << "NEXT STEPS:\n\n";
283 
284  args.log <<
285  "Monte Carlo calculations\n\
286  \n\
287 - Use 'casm monte' to run Monte Carlo calculations. \n\
288 - See 'casm monte --format' and 'casm monte -h' for help. \n\n";
289  }
290 
291  int update_eci_format(fs::path root, const CommandArgs &args) {
292 
293  DirectoryStructure dir(root);
294  ProjectSettings set(root);
295 
296  // convert eci.out to eci.json (if eci.json does not exist)
297  for(auto property : dir.all_property()) {
298  for(auto bset : dir.all_bset()) {
299  for(auto calctype : dir.all_calctype()) {
300  for(auto ref : dir.all_ref(calctype)) {
301  for(auto eci : dir.all_eci(property, calctype, ref, bset)) {
302 
303  auto eci_path = dir.eci(property, calctype, ref, bset, eci);
304  auto eci_out = dir.eci_out(property, calctype, ref, bset, eci);
305  fs::path basis_json_path = dir.basis(bset);
306 
307  if(!fs::exists(eci_path) && fs::exists(eci_out) && fs::exists(basis_json_path)) {
308  // create an eci.json from eci.out and basis.json
309 
310  args.log << "Converting: \n " << eci_out << "\nto:\n " << eci_path << std::endl;
311 
312  auto eci = read_eci_out(eci_out);
313 
314  fs::path basis_json_path = dir.basis(bset);
315  // read basis.json
316  jsonParser basis_json = jsonParser::parse(basis_json_path);
317 
318  // set eci
319  for(int i = 0; i < eci.index().size(); ++i) {
320  auto index = eci.index()[i];
321  auto value = eci.value()[i];
322  basis_json["cluster_functions"][index]["eci"] = value;
323  }
324 
325  //write eci.json
326  basis_json.write(eci_path);
327  args.err_log << "DONE" << std::endl << std::endl;
328 
329  }
330  }
331  }
332  }
333  }
334  }
335 
336  return 0;
337  }
338 
339  int update_format(fs::path root, const CommandArgs &args) {
340  return update_eci_format(root, args);
341  }
342 
343  namespace Completer {
345 
348 
349  m_desc.add_options()
350  ("next,n", "Write next steps")
351  ("warning,w", "Suppress warnings")
352  ("details,d", "Print detailed information")
353  ("all,a", "Print all 'casm status -n' help messages");
354 
355  return;
356  }
357  }
358 
359  void print_details(const CommandArgs &args, const PrimClex &primclex) {
360  int tot_gen = 0;
361  int tot_calc = 0;
362  int tot_sel = 0;
363 
364  //args.log << std::setw(6) << " " << " " << std::setw(30) << " " << " " << "#CONFIGS" << std::endl;
365  args.log << std::setw(6) << "INDEX" << " " << std::setw(30) << "SUPERCELL" << " " << "#CONFIGS G / C / S" << std::endl;
366  args.log << "---------------------------------------------------------------------------" << std::endl;
367  for(int i = 0; i < primclex.get_supercell_list().size(); i++) {
368  int gen = primclex.get_supercell(i).get_config_list().size();
369  int calc = 0, sel = 0;
370  const Supercell &scel = primclex.get_supercell(i);
371  for(int j = 0; j < scel.get_config_list().size(); j++) {
372  if(scel.get_config(j).selected()) {
373  sel++;
374  }
375  if(scel.get_config(j).calc_properties().contains("relaxed_energy")) {
376  calc++;
377  }
378  }
379  tot_gen += gen;
380  tot_calc += calc;
381  tot_sel += sel;
382  args.log << std::setw(6) << i << " " << std::setw(30) << primclex.get_supercell(i).get_name() << " " << gen << " / " << calc << " / " << sel << std::endl;
383  }
384  args.log << "---------------------------------------------------------------------------" << std::endl;
385  args.log << std::setw(6) << " " << " " << std::setw(30) << "TOTAL" << " " << tot_gen << " / " << tot_calc << " / " << tot_sel << std::endl;
386  args.log << "\nG:Generated, C:Calculated, S:Selected" << std::endl << std::endl;
387  }
388 
389  int status_command(const CommandArgs &args) {
390 
391  po::variables_map vm;
392 
394  Completer::StatusOption status_opt;
395  try {
396  po::store(po::parse_command_line(args.argc, args.argv, status_opt.desc()), vm); // can throw
397 
400  if(vm.count("help")) {
401  args.log << "\n";
402  args.log << status_opt.desc() << std::endl;
403 
404  return 0;
405  }
406 
407  if(vm.count("desc")) {
408  args.log << "\n";
409  args.log << status_opt.desc() << std::endl;
410  args.log << "DESCRIPTION" << std::endl;
411  args.log << " Get status information for the current CASM project.\n\n";
412 
413  return 0;
414  }
415 
416  po::notify(vm); // throws on error, so do after help in case
417  // there are any problems
418  }
419  catch(po::error &e) {
420  args.err_log << "ERROR: " << e.what() << std::endl << std::endl;
421  args.err_log << status_opt.desc() << std::endl;
422  return 1;
423  }
424  catch(std::exception &e) {
425  args.err_log << "Unhandled Exception reached the top of main: "
426  << e.what() << ", application will now exit" << std::endl;
427  return 1;
428 
429  }
430 
432 
433  args.log << "\n#################################\n\n";
434 
435  args.log << "CASM status:\n\n";
436 
437  if(vm.count("all")) {
438  args.log << "\n#################################\n\n";
439  status_unitialized(args);
440  }
441 
442 
443  const fs::path &root = args.root;
444 
445  if(root.empty()) {
446  args.log << "1) Project initialized: FALSE\n\n";
447 
448  if(vm.count("next")) {
449  args.log << "\n#################################\n\n";
450 
451  status_unitialized(args);
452  }
453  else {
454  args.log << "For next steps, run 'casm status -n'\n\n";
455  }
456 
457  return 0;
458  }
459 
460  {
461  DirectoryStructure dir(root);
462 
463  if(!fs::exists(dir.prim())) {
464  args.log << " ERROR\n\n";
465 
466  args.log << "- Found a CASM project, but no '" << dir.prim() << "' file." << std::endl;
467  args.log << "- CASMP project location: " << root << std::endl;
468  args.log << "Please add a prim.json file, or rm the '.casm' directory." << std::endl << std::endl;
469 
470  return 1;
471  }
472  }
473 
474  // If 'args.primclex', use that, else construct PrimClex in 'uniq_primclex'
475  // Then whichever exists, store reference in 'primclex'
476  std::unique_ptr<PrimClex> uniq_primclex;
477  PrimClex &primclex = make_primclex_if_not(args, uniq_primclex);
478 
479  const DirectoryStructure &dir = primclex.dir();
480  const ProjectSettings &settings = primclex.settings();
481  const ClexDescription &desc = settings.default_clex();
482 
483  std::string property = desc.property;
484  std::string calctype = desc.calctype;
485  std::string ref = desc.ref;
486  std::string bset = desc.bset;
487  std::string eci = desc.eci;
488 
489 
490  args.log << "1) Project initialized: TRUE\n\n";
491  args.log << "- Project name: " << primclex.name() << std::endl;
492  args.log << "- Project location: " << primclex.get_path().string() << std::endl;
493 
494  // it'd be nice to just read this...
495  SymGroup prim_pg;
496  primclex.get_prim().lattice().generate_point_group(prim_pg);
497  prim_pg.character_table();
498  args.log << "- Lattice point group size: " << prim_pg.size() << std::endl;
499  args.log << "- Lattice point group is " << prim_pg.get_name() << std::endl;
500  args.log << "- Factor group size: " << primclex.get_prim().factor_group().size() << std::endl;
501  args.log << "- Crystal point group is: " << primclex.get_prim().point_group().get_name() << std::endl;
502  if(!vm.count("warning")) {
503  if(primclex.get_prim().factor_group().size() > prim_pg.size()) {
504  args.log << "*** Warning: Finding a factor group that is larger than the lattice \n"
505  << " point group implies that your structure is not primitive." << std::endl;
506  }
507  }
508  args.log << std::endl << std::endl;
509 
511 
512  if(vm.count("all")) {
513  args.log << "\n#################################\n\n";
514  args.log << "\n2) Composition axes \n\n";
516 
517  }
518 
519  args.log << "2) Composition axes \n";
520 
521  args.log << "- Composition axes selected: ";
522 
523  if(!primclex.has_composition_axes()) {
524  args.log << "FALSE\n\n";
525 
526  if(vm.count("next")) {
527  args.log << "\n#################################\n\n";
528 
530  }
531  else {
532  args.log << "For next steps, run 'casm status -n'\n\n";
533  }
534 
535  return 0;
536  }
537 
538  args.log << "TRUE\n\n\n";
539  /*
540  // It'd be nice to note standard vs. custom axes, and just '*' the current composition axes
541  args.log << "- Standard & custom composition axes: " << std::endl << std::endl;
542  primclex.get_param_comp().print_composition_axes(args.log);
543  args.log << std::endl;
544  args.log << "- Current composition axes: " << std::endl << std::endl;
545  primclex.get_param_comp().print_curr_composition_axes(args.log);
546  args.log << std::endl << std::endl;
547  */
548 
550 
551 
552  if(vm.count("all")) {
553  args.log << "\n#################################\n\n";
554  args.log << "3) Generate configurations \n\n";
555 
557 
558  configs_ungenerated(args);
559 
560  }
561 
562  args.log << "\n3) Generate configurations \n";
563 
564  int tot_gen = 0;
565  int tot_calc = 0;
566  int tot_sel = 0;
567 
568  for(int i = 0; i < primclex.get_supercell_list().size(); i++) {
569  int gen = primclex.get_supercell(i).get_config_list().size();
570  int calc = 0, sel = 0;
571  const Supercell &scel = primclex.get_supercell(i);
572  for(int j = 0; j < scel.get_config_list().size(); j++) {
573  if(scel.get_config(j).selected()) {
574  sel++;
575  }
576  if(scel.get_config(j).calc_properties().contains("relaxed_energy")) {
577  calc++;
578  }
579  }
580  tot_gen += gen;
581  tot_calc += calc;
582  tot_sel += sel;
583  }
584 
585  args.log << "- Number of supercells generated: " << primclex.get_supercell_list().size() << "\n";
586  args.log << "- Number of configurations generated: " << tot_gen << "\n";
587  args.log << "- Number of configurations currently selected: " << tot_sel << "\n";
588 
589  if(primclex.get_supercell_list().size() == 0) {
590 
591  if(vm.count("next")) {
592  args.log << "\n#################################\n\n";
593 
595  }
596  else {
597  args.log << "For next steps, run 'casm status -n'\n\n";
598  }
599 
600  return 0;
601  }
602 
603  if(tot_gen == 0) {
604 
605  if(vm.count("next")) {
606  args.log << "\n#################################\n\n";
607 
608  configs_ungenerated(args);
609  }
610  else {
611  args.log << "For next steps, run 'casm status -n'\n\n";
612  }
613 
614  if(vm.count("details")) {
615  print_details(args, primclex);
616  }
617  else {
618  args.log << "For the number of configurations generated, calculated,\n and selected by supercell, run 'casm status -d'\n\n";
619  }
620 
621  return 0;
622  }
623 
624  args.log << std::endl << std::endl;
625 
627 
628 
629  if(vm.count("all")) {
630  args.log << "\n#################################\n\n";
631  args.log << "4) Calculate configuration properties\n\n";
632  configs_uncalculated(args);
633 
634  }
635 
636  args.log << "4) Calculate configuration properties\n";
637 
638  args.log << "- Current calctype: " << calctype << "\n";
639  args.log << "- Current cluster expansion: " << desc.name << "\n";
640  args.log << "- Number of configurations calculated: " << tot_calc << " / " << tot_gen << " generated (Update with 'casm update')\n\n";
641 
642  if(vm.count("details")) {
643  print_details(args, primclex);
644  }
645  else {
646  args.log << "For the number of configurations generated, calculated,\n and selected by supercell, run 'casm status -d'\n\n";
647  }
648 
649  if(tot_calc == 0) {
650  if(vm.count("next")) {
651  args.log << "\n#################################\n\n";
652 
653  configs_uncalculated(args);
654  }
655  else {
656  args.log << "For next steps, run 'casm status -n'\n\n";
657  }
658 
659  return 0;
660  }
661 
662  args.log << std::endl;
663 
664 
666 
667 
668  if(vm.count("all")) {
669  args.log << "\n#################################\n\n";
670  args.log << "5) Choose chemical reference\n\n";
671  references_unset(args);
672  }
673 
674  args.log << "5) Choose chemical reference\n";
675 
676  args.log << "- Chemical reference set: ";
677  if(primclex.has_chemical_reference()) {
678  args.log << "TRUE" << "\n";
679  }
680  else {
681  args.log << "FALSE" << "\n";
682  }
683  args.log << "\n";
684 
685  if(primclex.has_chemical_reference()) {
686  args.log << "To show the chemical reference, run 'casm ref -d'\n\n";
687  }
688  else {
689 
690  args.log << "No chemical reference set." << std::endl << std::endl;
691 
692  if(vm.count("next")) {
693  args.log << "\n#################################\n\n";
694 
695  references_unset(args);
696  }
697  else {
698  args.log << "For next steps, run 'casm status -n'\n\n";
699  }
700 
701  return 0;
702  }
703 
704  args.log << std::endl;
705 
706 
708 
709 
710  if(vm.count("all")) {
711  args.log << "\n#################################\n\n";
712  args.log << "6) Generate basis functions: \n\n";
713  bset_uncalculated(args);
714  }
715 
716  args.log << "6) Generate basis functions: ";
717 
718  if(!fs::exists(dir.clexulator_src(settings.name(), bset))) {
719  args.log << "FALSE\n\n";
720 
721  if(vm.count("next")) {
722  args.log << "\n#################################\n\n";
723 
724  bset_uncalculated(args);
725  }
726  else {
727  args.log << "For next steps, run 'casm status -n'\n\n";
728  }
729 
730  return 0;
731  }
732  args.log << "TRUE\n\n\n";
733 
735 
736 
737  if(vm.count("all")) {
738  args.log << "\n#################################\n\n";
739  args.log << "7) Fit effective cluster interactions (ECI): \n\n";
740  eci_uncalculated(args);
741  }
742 
743  args.log << "7) Fit effective cluster interactions (ECI): ";
744 
745  if(!fs::exists(dir.eci(property, calctype, ref, bset, eci))) {
746  args.log << "FALSE\n\n";
747 
748  if(vm.count("next")) {
749  args.log << "\n#################################\n\n";
750 
751  eci_uncalculated(args);
752  }
753  else {
754  args.log << "For next steps, run 'casm status -n'\n\n";
755  }
756 
757  return 0;
758  }
759  args.log << "TRUE\n\n\n";
760 
762 
763  args.log << std::endl;
764 
765  if(vm.count("next") || vm.count("all")) {
766  args.log << "\n#################################\n\n";
767  args.log << "8) Monte Carlo Calculations: \n\n";
768  montecarlo(args);
769  }
770  else {
771  args.log << "For next steps, run 'casm status -n'\n\n";
772  }
773 
774  return 0;
775 
776  };
777 
778 }
779 
780 
const Configuration & get_config(Index i) const
Definition: Supercell.hh:287
Data structure holding basic CASM command info.
pair_type eci
Definition: settings.cc:112
fs::path eci(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.json.
ClexDescription & desc
Definition: settings.cc:104
boost::container::stable_vector< Supercell > & get_supercell_list()
Access entire supercell_list.
Definition: PrimClex.cc:299
std::string get_name() const
Return supercell name.
Definition: Supercell.cc:123
void initialize() override
Fill in the options descriptions accordingly.
Definition: status.cc:346
Specifies a particular cluster expansion.
void bset_uncalculated(const CommandArgs &args)
Definition: status.cc:224
bool selected() const
True if this Configuration is currently selected in the MASTER config list.
Index size() const
Definition: Array.hh:145
void generate_point_group(SymGroup &point_group, double pg_tol=TOL) const
Populate.
Definition: Lattice.cc:304
Specification of CASM project directory structure.
const DirectoryStructure & dir() const
Definition: PrimClex.hh:112
void write(const std::string &file_name, unsigned int indent=2, unsigned int prec=12) const
Write json to file.
Definition: jsonParser.cc:191
const SymGroup & point_group() const
Definition: Structure.cc:101
fs::path get_path() const
Return casm project directory path.
Definition: PrimClex.cc:202
PrimClex * primclex
Definition: settings.cc:101
void add_help_suboption()
Add a plain –help suboption.
Definition: Handlers.cc:276
bool has_composition_axes() const
check if CompositionConverter object initialized
Definition: PrimClex.cc:231
ConfigList & get_config_list()
Definition: Supercell.hh:279
Main CASM namespace.
Definition: complete.cpp:8
int update_format(fs::path root, const CommandArgs &args)
Definition: status.cc:339
const Lattice & lattice() const
fs::path prim() const
Return prim.json path.
std::vector< std::string > all_eci(std::string property, std::string calctype, std::string ref, std::string bset) const
Check filesystem directory structure and return list of all eci names.
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:37
std::string name() const
Return project name.
Definition: PrimClex.cc:194
std::vector< std::string > all_property() const
Check filesystem directory structure and return list of all property names.
ProjectSettings & set
Definition: settings.cc:103
pair_type ref
Definition: settings.cc:110
bool has_chemical_reference() const
check if ChemicalReference object initialized
Definition: PrimClex.cc:245
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:33
std::string name() const
Get project name.
const Properties & calc_properties() const
const po::options_description & desc()
Get the program options, filled with the initialized values.
Definition: Handlers.cc:160
const MasterSymGroup & factor_group() const
Definition: Structure.cc:94
Read/modify settings of an already existing CASM project.
int status_command(const CommandArgs &args)
Definition: status.cc:389
pair_type property
Definition: settings.cc:108
fs::path eci_out(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.out.
fs::path clexulator_src(std::string project, std::string bset) const
Returns path to global clexulator source file.
const Array< std::complex< double > >::X2 & character_table() const
Definition: SymGroup.cc:3212
void montecarlo(const CommandArgs &args)
Definition: status.cc:280
pair_type calctype
Definition: settings.cc:109
fs::path basis(std::string bset) const
void status_unitialized(const CommandArgs &args)
Definition: status.cc:10
po::options_description m_desc
Boost program options. All the derived classes have them, but will fill them up themselves.
Definition: Handlers.hh:126
ProjectSettings & settings()
Definition: PrimClex.hh:116
ECIContainer read_eci_out(const fs::path &filepath)
Read eci.out file from specified path (deprecated)
Definition: ECIContainer.cc:48
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
DirectoryStructure & dir
Definition: settings.cc:102
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...
static jsonParser parse(const std::string &str)
Construct a jsonParser from a string containing JSON data.
Definition: jsonParser.hh:312
const Supercell & get_supercell(Index i) const
const Access supercell by index
Definition: PrimClex.cc:311
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
Definition: jsonParser.cc:500
void print_details(const CommandArgs &args, const PrimClex &primclex)
Definition: status.cc:359
void configs_ungenerated(const CommandArgs &args)
Definition: status.cc:111
void configs_uncalculated(const CommandArgs &args)
Definition: status.cc:139
std::vector< std::string > all_calctype() const
Check filesystem directory structure and return list of all calctype names.
int update_eci_format(fs::path root, const CommandArgs &args)
Definition: status.cc:291
void composition_unselected(const CommandArgs &args)
Definition: status.cc:78
const std::string & get_name() const
Definition: SymGroup.cc:3220
pair_type bset
Definition: settings.cc:111
std::vector< std::string > all_bset() const
Check filesystem directory structure and return list of all basis set names.
void references_unset(const CommandArgs &args)
Definition: status.cc:190
const ClexDescription & default_clex() const
void supercells_ungenerated(const CommandArgs &args)
Definition: status.cc:94
std::vector< std::string > all_ref(std::string calctype) const
Check filesystem directory structure and return list of all ref names for a given calctype...
const Structure & get_prim() const
const Access to primitive Structure
Definition: PrimClex.cc:260
void eci_uncalculated(const CommandArgs &args)
Definition: status.cc:242