CASM  1.1.0
A Clusters Approach to Statistical Mechanics
DirectoryStructure.hh
Go to the documentation of this file.
1 #ifndef CASM_DirectoryStructure
2 #define CASM_DirectoryStructure
3 
4 #include <boost/filesystem/path.hpp>
5 #include <string>
6 #include <vector>
7 
9 
10 namespace CASM {
11 
18 template <typename DataObject>
19 struct QueryTraits;
20 class Log;
21 
24 fs::path find_casmroot(const fs::path &cwd);
25 
29 fs::path relative_casmroot(const fs::path &cwd);
30 
32 void recurs_rm_files(fs::path p, bool dry_run, Log &log);
33 
35 Index recurs_cp_files(const fs::path &from_dir, const fs::path &to_dir,
36  bool dry_run, Log &log);
37 
40  public:
42 
43  DirectoryStructure(const fs::path _root);
44 
45  // ** Query filesystem **
46 
49  std::vector<std::string> all_bset() const;
50 
53  std::vector<std::string> all_calctype() const;
54 
57  std::vector<std::string> all_ref(std::string calctype) const;
58 
61  std::vector<std::string> all_property() const;
62 
65  std::vector<std::string> all_eci(std::string property, std::string calctype,
66  std::string ref, std::string bset) const;
67 
68  // ** File and Directory paths **
69 
70  // -- Project directory --------
71 
73  fs::path root_dir() const;
74 
76  fs::path prim() const;
77 
78  // -- Hidden .casm directory --------
79 
81  fs::path casm_dir() const;
82 
84  fs::path project_settings() const;
85 
87  fs::path scel_list() const;
88 
90  fs::path config_list() const;
91 
93  fs::path enumerator_plugins() const;
94 
96  template <typename DataObject>
97  fs::path query_plugins() const;
98 
100  fs::path dof_plugins() const;
101 
103  fs::path symrep_builder_plugins() const;
104 
105  template <typename DataObject>
106  fs::path master_selection() const;
107 
110  template <typename DataObject>
111  fs::path aliases() const;
112 
113  // -- Symmetry --------
114 
116  fs::path symmetry_dir() const;
117 
119  fs::path symmetry_dir(std::string config_name) const;
120 
122  fs::path lattice_point_group() const;
123 
125  fs::path factor_group() const;
126 
128  fs::path crystal_point_group() const;
129 
130  // -- Basis sets --------
131 
133  fs::path bset_dir(std::string bset) const;
134 
137  std::vector<fs::path> bset_data(std::string project_name,
138  std::string bset) const;
139 
141  fs::path bspecs(std::string bset) const;
142 
143  // \brief Returns path to the clust.json file
144  fs::path clust(std::string bset) const;
145 
146  // \brief Returns path to the basis.json file
147  fs::path basis(std::string bset) const;
148 
150  fs::path clexulator_dir(std::string bset) const;
151 
153  fs::path clexulator_src(std::string project_name, std::string bset) const;
154 
156  fs::path clexulator_o(std::string project_name, std::string bset) const;
157 
159  fs::path clexulator_so(std::string project_name, std::string bset) const;
160 
162  fs::path eci_in(std::string bset) const;
163 
165  fs::path corr_in(std::string bset) const;
166 
167  // -- Calculations and reference --------
168 
170  fs::path training_data() const;
171 
173  fs::path SCEL() const;
174 
176  fs::path supercell_dir(std::string scelname) const;
177 
179  fs::path LAT(std::string scelname) const;
180 
182  fs::path configuration_dir(std::string configname) const;
183 
185  fs::path POS(std::string configname) const;
186 
188  fs::path config_json(std::string configname) const;
189 
191  fs::path structure_json(std::string configname) const;
192 
194  fs::path calc_settings_dir(std::string calctype) const;
195 
198  fs::path supercell_calc_settings_dir(std::string scelname,
199  std::string calctype) const;
200 
203  fs::path configuration_calc_settings_dir(std::string configname,
204  std::string calctype) const;
205 
207  fs::path configuration_calc_dir(std::string configname,
208  std::string calctype) const;
209 
211  fs::path calculated_properties(std::string configname,
212  std::string calctype) const;
213 
215  fs::path calc_status(std::string configname, std::string calctype) const;
216 
219  fs::path ref_dir(std::string calctype, std::string ref) const;
220 
222  fs::path composition_axes() const;
223 
225  fs::path chemical_reference(std::string calctype, std::string ref) const;
226 
227  // -- Cluster expansions --------
228 
230  fs::path clex_dir(std::string property) const;
231 
233  fs::path eci_dir(std::string property, std::string calctype, std::string ref,
234  std::string bset, std::string eci) const;
235 
237  fs::path eci(std::string property, std::string calctype, std::string ref,
238  std::string bset, std::string eci) const;
239 
240  // -- Reports -------------------------
242  fs::path reports_dir() const;
243 
244  // -- other maybe temporary --------------------------
245 
247  fs::path CSPECS(std::string bset) const;
248 
249  // \brief Returns path to the clust.json file
250  fs::path FCLUST(std::string bset) const;
251 
252  // -- deprecated ------------------------------------
253 
256  fs::path query_alias() const;
257 
258  // ** Add directories for additional project data **
259 
261  bool new_casm_dir() const;
262 
264  bool new_symmetry_dir() const;
265 
267  bool new_reports_dir() const;
268 
270  bool new_bset_dir(std::string bset) const;
271 
273  bool new_clex_dir(std::string property) const;
274 
276  bool new_calc_settings_dir(std::string calctype) const;
277 
279  bool new_supercell_calc_settings_dir(std::string scelname,
280  std::string calctype) const;
281 
285  std::string calctype) const;
286 
288  bool new_ref_dir(std::string calctype, std::string ref) const;
289 
291  bool new_eci_dir(std::string property, std::string calctype, std::string ref,
292  std::string bset, std::string eci) const;
293 
294  // ** Delete Clexulators **
295 
297  void delete_bset_data(std::string project_name, std::string bset) const;
298 
300  void delete_clexulator(std::string project_name, std::string bset) const;
301 
303  void delete_all_clexulators(std::string project_name) const;
304 
305  private:
306  std::string _bset(std::string bset) const;
307 
308  std::string _calctype(std::string calctype) const;
309 
310  std::string _ref(std::string ref) const;
311 
312  std::string _property(std::string property) const;
313 
314  std::string _eci(std::string eci) const;
315 
316  std::string _ref_state(int index) const;
317 
318  void _init(const fs::path &_root);
319 
322  std::vector<std::string> _all_settings(std::string pattern,
323  fs::path location) const;
324 
325  fs::path m_root;
326  std::string m_casm_dir;
327  std::string m_bset_dir;
328  std::string m_calc_dir;
329  std::string m_set_dir;
330  std::string m_sym_dir;
331  std::string m_clex_dir;
332  std::string m_reports_dir;
333 };
334 
335 void throw_if_no_basis_set_specs(std::string basis_set_name,
336  DirectoryStructure const &dir);
337 
338 void throw_if_no_clexulator_src(std::string project_name,
339  std::string basis_set_name,
340  DirectoryStructure const &dir);
341 
343 } // namespace CASM
344 
345 #endif
Specification of CASM project directory structure.
fs::path prim() const
Return prim.json path.
fs::path root_dir() const
Return casm project directory path.
std::string _property(std::string property) const
fs::path casm_dir() const
Return hidden .casm dir 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.
fs::path configuration_calc_settings_dir(std::string configname, std::string calctype) const
Return calculation settings directory path, for configuration specific settings.
fs::path SCEL() const
Return SCEL path.
fs::path calculated_properties(std::string configname, std::string calctype) const
Return properties.calc.json file path.
fs::path eci_in(std::string bset) const
Returns path to eci.in, in bset directory.
fs::path ref_dir(std::string calctype, std::string ref) const
Return calculation reference settings directory path, for global settings.
void delete_bset_data(std::string project_name, std::string bset) const
Delete Basis set generated files.
bool new_supercell_calc_settings_dir(std::string scelname, std::string calctype) const
Add calculation settings directory path, for supercell specific settings.
fs::path crystal_point_group() const
Return crystal_point_group.json path.
fs::path eci_dir(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci directory.
void _init(const fs::path &_root)
fs::path symmetry_dir() const
Return symmetry directory path.
fs::path symrep_builder_plugins() const
Return SymrepBuilder plugin dir.
bool new_calc_settings_dir(std::string calctype) const
Add calculation settings directory path.
fs::path config_list() const
Return master config_list.json file path.
fs::path LAT(std::string scelname) const
Return supercell LAT file path.
fs::path project_settings() const
Return project_settings.json path.
fs::path configuration_calc_dir(std::string configname, std::string calctype) const
Return directory containing properties.calc.json.
fs::path clust(std::string bset) const
fs::path structure_json(std::string configname) const
Return path to standard structure.json file location.
std::string _ref_state(int index) const
bool new_bset_dir(std::string bset) const
Add a basis set directory.
fs::path enumerator_plugins() const
Return enumerators plugin dir.
fs::path reports_dir() const
Returns path to reports directory.
fs::path config_json(std::string configname) const
Return path to standard config.json file location.
fs::path training_data() const
Return 'training_data' directorty path.
bool new_configuration_calc_settings_dir(std::string configname, std::string calctype) const
fs::path configuration_dir(std::string configname) const
Return configuration directory path.
fs::path supercell_dir(std::string scelname) const
Return supercell directory path.
fs::path FCLUST(std::string bset) const
std::string _bset(std::string bset) const
fs::path query_alias() const
Query aliases file (deprecated: now stored in project_settings.json)
std::string _calctype(std::string calctype) const
bool new_clex_dir(std::string property) const
Add a cluster expansion directory.
fs::path clexulator_o(std::string project_name, std::string bset) const
Returns path to clexulator o file.
fs::path chemical_reference(std::string calctype, std::string ref) const
Return chemical reference file path.
fs::path corr_in(std::string bset) const
Returns path to corr.in, in bset directory.
void delete_clexulator(std::string project_name, std::string bset) const
Delete Clexulator files.
std::vector< std::string > all_calctype() const
Check filesystem directory structure and return list of all calctype names.
fs::path query_plugins() const
Return enumerators plugin dir.
void delete_all_clexulators(std::string project_name) const
Delete files for all Clexulators.
bool new_casm_dir() const
Create new project data directory.
fs::path CSPECS(std::string bset) const
Return cluster specs (CSPECS) file path.
std::vector< std::string > all_bset() const
Check filesystem directory structure and return list of all basis set names.
fs::path basis(std::string bset) const
std::string _eci(std::string eci) const
fs::path clex_dir(std::string property) const
Returns path to eci directory.
fs::path eci(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Returns path to eci.json.
fs::path calc_settings_dir(std::string calctype) const
Return calculation settings directory path, for global settings.
fs::path supercell_calc_settings_dir(std::string scelname, std::string calctype) const
Return calculation settings directory path, for supercell specific settings.
fs::path calc_status(std::string configname, std::string calctype) const
Return calculation status file path.
fs::path lattice_point_group() const
Return lattice_point_group.json path.
fs::path bset_dir(std::string bset) const
Return path to directory contain basis set info.
std::vector< fs::path > bset_data(std::string project_name, std::string bset) const
Return paths where bset generated data is stored (excludes bspecs.json)
fs::path master_selection() const
fs::path scel_list() const
Return master scel_list.json path.
std::vector< std::string > _all_settings(std::string pattern, fs::path location) const
Find all directories at 'location' that match 'pattern.something' and return a std::vector of the 'so...
bool new_reports_dir() const
Create new reports directory.
fs::path clexulator_src(std::string project_name, std::string bset) const
Returns path to clexulator source file.
fs::path aliases() const
File containing DataObject name aliases (not query function aliases)
fs::path composition_axes() const
Return composition axes file path.
fs::path POS(std::string configname) const
Return path to standard POS file location.
bool new_ref_dir(std::string calctype, std::string ref) const
Add a ref directory.
bool new_symmetry_dir() const
Create new symmetry directory.
std::string _ref(std::string ref) const
fs::path dof_plugins() const
Return DoF plugin dir.
fs::path factor_group() const
Return factor_group.json path.
bool new_eci_dir(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Add an eci directory.
fs::path bspecs(std::string bset) const
Return basis function specs (bspecs.json) file path.
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.
std::vector< std::string > all_property() const
Check filesystem directory structure and return list of all property names.
fs::path clexulator_dir(std::string bset) const
Returns path to directory containing clexulator files.
fs::path clexulator_so(std::string project_name, std::string bset) const
Returns path to clexulator so file.
Definition: Log.hh:48
std::string scelname(const Structure &prim, const Lattice &superlat)
Make supercell name name [deprecated].
Definition: Supercell.cc:497
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
Definition: ConfigIO.cc:563
Main CASM namespace.
Definition: APICommand.hh:8
void throw_if_no_basis_set_specs(std::string basis_set_name, DirectoryStructure const &dir)
Log & log()
Definition: Log.hh:424
void throw_if_no_clexulator_src(std::string project_name, std::string basis_set_name, DirectoryStructure const &dir)
fs::path relative_casmroot(const fs::path &cwd)
fs::path find_casmroot(const fs::path &cwd)
void recurs_rm_files(fs::path p, bool dry_run, Log &log)
Remove files recursively.
Index recurs_cp_files(const fs::path &from_dir, const fs::path &to_dir, bool dry_run, Log &log)
Copy files recursively, and returns a count of copied files.
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
pair_type ref
Definition: settings.cc:144
pair_type calctype
Definition: settings.cc:143
pair_type property
Definition: settings.cc:142
DirectoryStructure const & dir
Definition: settings.cc:136
pair_type bset
Definition: settings.cc:145