CASM  1.1.0
A Clusters Approach to Statistical Mechanics
dof_space_analysis.hh
Go to the documentation of this file.
1 #ifndef CASM_enumerator_io_json_dof_space_analysis
2 #define CASM_enumerator_io_json_dof_space_analysis
3 
4 #include <boost/filesystem/path.hpp>
5 
10 
11 namespace CASM {
12 
13 class ConfigEnumInput;
14 class DirectoryStructure;
15 class DoFSpace;
16 class SymGroup;
17 class make_symmetry_adapted_dof_space_error;
18 
19 namespace SymRepTools_v2 {
20 struct VectorSpaceSymReport;
21 }
22 
23 namespace DoFSpaceIO {
24 
25 class OutputImpl {
26  public:
28  struct Error {
29  Error(Index _state_index, std::string _identifier, DoFKey _dof_key,
30  std::string _what, jsonParser _data);
32  std::string identifier;
34  std::string what;
36  };
37 
40  void write_symmetry(Index state_index, std::string const &identifier,
41  ConfigEnumInput const &config_enum_input,
42  std::vector<PermuteIterator> const &group);
43 
52  virtual void write_symmetry(Index state_index, std::string const &identifier,
53  ConfigEnumInput const &config_enum_input,
55  SymGroup const &factor_group,
56  SymGroup const &crystal_point_group) = 0;
57 
58  // /// Write input state configuration
59  // virtual void write_config(
60  // Index state_index,
61  // std::string const &identifier,
62  // ConfigEnumInput const &config_enum_input) = 0;
63 
65  virtual void write_structure(Index state_index, std::string const &identifier,
66  ConfigEnumInput const &config_enum_input) = 0;
67 
69  virtual void write_dof_space(
70  Index state_index, DoFSpace const &dof_space,
71  std::string const &identifier, ConfigEnumInput const &config_enum_input,
72  std::optional<SymRepTools_v2::VectorSpaceSymReport> const
73  &sym_report) = 0;
74 
77  make_symmetry_adapted_dof_space_error const &e, Index state_index,
78  DoFSpace const &dof_space, std::string const &identifier,
79  ConfigEnumInput const &config_enum_input,
80  std::optional<SymRepTools_v2::VectorSpaceSymReport> const &sym_report);
81 
82  std::vector<Error> const &errors() const { return m_errors; }
83  std::vector<Error> &errors() { return m_errors; }
84 
87  void write_errors() const;
88 
89  private:
90  std::vector<Error> m_errors;
91 };
92 
93 class DirectoryOutput : public OutputImpl {
94  public:
96 
97  void write_symmetry(Index state_index, std::string const &identifier,
98  ConfigEnumInput const &config_enum_input,
100  SymGroup const &factor_group,
101  SymGroup const &crystal_point_group) override;
102 
103  // void write_config(
104  // Index state_index,
105  // std::string const &identifier,
106  // ConfigEnumInput const &config_enum_input) override;
107 
108  void write_structure(Index state_index, std::string const &identifier,
109  ConfigEnumInput const &config_enum_input) override;
110 
111  void write_dof_space(Index state_index, DoFSpace const &dof_space,
112  std::string const &identifier,
113  ConfigEnumInput const &config_enum_input,
114  std::optional<SymRepTools_v2::VectorSpaceSymReport> const
115  &sym_report) override;
116 
117  private:
120  virtual void _check_config(Index state_index, std::string const &identifier,
121  ConfigEnumInput const &config_enum_input) = 0;
122 
125  virtual fs::path _output_dir(Index state_index, std::string const &identifier,
126  ConfigEnumInput const &config_enum_input) = 0;
127 };
128 
131  public:
133 
134  private:
137  void _check_config(Index state_index, std::string const &identifier,
138  ConfigEnumInput const &config_enum_input) override;
139 
141  fs::path _output_dir(Index state_index, std::string const &identifier,
142  ConfigEnumInput const &config_enum_input) override;
143 
145 };
146 
149  public:
150  SequentialDirectoryOutput(fs::path output_dir);
151 
152  private:
154  void _check_config(Index state_index, std::string const &identifier,
155  ConfigEnumInput const &config_enum_input) override;
156 
158  fs::path _output_dir(Index state_index, std::string const &identifier,
159  ConfigEnumInput const &config_enum_input) override;
160 
161  fs::path m_output_dir;
162 };
163 
167  public:
168  CombinedJsonOutput(fs::path output_dir);
169 
171 
173 
174  void write_symmetry(Index state_index, std::string const &identifier,
175  ConfigEnumInput const &config_enum_input,
177  SymGroup const &factor_group,
178  SymGroup const &crystal_point_group) override;
179 
180  // void write_config(
181  // Index state_index,
182  // std::string const &identifier,
183  // ConfigEnumInput const &config_enum_input) override;
184 
185  void write_structure(Index state_index, std::string const &identifier,
186  ConfigEnumInput const &config_enum_input) override;
187 
188  void write_dof_space(Index state_index, DoFSpace const &dof_space,
189  std::string const &identifier,
190  ConfigEnumInput const &config_enum_input,
191  std::optional<SymRepTools_v2::VectorSpaceSymReport> const
192  &sym_report) override;
193 
194  private:
195  jsonParser &_output_json(Index state_index);
196 
198 
199  fs::path m_output_dir;
200 };
201 
203  std::vector<std::string> dofs;
204  bool sym_axes = true;
205  bool calc_wedge = false;
206  bool write_symmetry = true;
207  bool write_structure = true;
208 };
209 
210 void output_dof_space(Index state_index, std::string const &identifier,
211  ConfigEnumInput const &input_state,
212  DoFSpaceAnalysisOptions const &options,
213  OutputImpl &output);
214 
215 void dof_space_analysis(
216  std::vector<std::pair<std::string, ConfigEnumInput>> const &named_inputs,
217  DoFSpaceAnalysisOptions const &options, OutputImpl &output);
218 } // namespace DoFSpaceIO
219 
220 } // namespace CASM
221 
222 #endif
Specification of CASM project directory structure.
jsonParser & _output_json(Index state_index)
void write_symmetry(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::vector< PermuteIterator > const &group)
void write_structure(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
Write input state structure.
void write_dof_space(Index state_index, DoFSpace const &dof_space, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::optional< SymRepTools_v2::VectorSpaceSymReport > const &sym_report) override
Write dof space analysis.
virtual fs::path _output_dir(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input)=0
void write_symmetry(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::vector< PermuteIterator > const &group)
virtual void _check_config(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input)=0
void write_dof_space(Index state_index, DoFSpace const &dof_space, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::optional< SymRepTools_v2::VectorSpaceSymReport > const &sym_report) override
Write dof space analysis.
void write_structure(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
Write input state structure.
std::vector< Error > const & errors() const
void write_dof_space_error(make_symmetry_adapted_dof_space_error const &e, Index state_index, DoFSpace const &dof_space, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::optional< SymRepTools_v2::VectorSpaceSymReport > const &sym_report)
Write dof space analysis error information.
void write_symmetry(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::vector< PermuteIterator > const &group)
virtual void write_dof_space(Index state_index, DoFSpace const &dof_space, std::string const &identifier, ConfigEnumInput const &config_enum_input, std::optional< SymRepTools_v2::VectorSpaceSymReport > const &sym_report)=0
Write dof space analysis.
virtual void write_symmetry(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input, SymGroup const &lattice_point_group, SymGroup const &factor_group, SymGroup const &crystal_point_group)=0
virtual void write_structure(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input)=0
Write input state structure.
std::vector< Error > & errors()
Implementation that outputs to <output_dir>/dof_space/state.<index>
fs::path _output_dir(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
For SequentialDirectoryOutput return output directory path.
void _check_config(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
For SequentialDirectoryOutput, any input state is allowed.
Implementation that outputs to <casm_project>/symmetry/analysis/<configname>
fs::path _output_dir(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
For SymmetryDirectoryOutput return output directory path in symmetry dir.
void _check_config(Index state_index, std::string const &identifier, ConfigEnumInput const &config_enum_input) override
SymmetryDirectoryOutput(DirectoryStructure const &dir)
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
void output_dof_space(Index state_index, std::string const &identifier, ConfigEnumInput const &input_state, DoFSpaceAnalysisOptions const &options, OutputImpl &output)
void dof_space_analysis(std::vector< std::pair< std::string, ConfigEnumInput >> const &named_inputs, DoFSpaceAnalysisOptions const &options, OutputImpl &output)
SharedPrimFormatter< jsonParser > factor_group()
SharedPrimFormatter< jsonParser > lattice_point_group()
SharedPrimFormatter< jsonParser > crystal_point_group()
Main CASM namespace.
Definition: APICommand.hh:8
std::string DoFKey
Definition: DoFDecl.hh:7
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
DirectoryStructure const & dir
Definition: settings.cc:136
Provide state_index, indentifier, and dof_key for any errors.
Error(Index _state_index, std::string _identifier, DoFKey _dof_key, std::string _what, jsonParser _data)