CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
AppIO.hh
Go to the documentation of this file.
1 #ifndef CASM_AppIO
2 #define CASM_AppIO
3 
10 
14 
15 namespace CASM {
16 
17  // --- These functions are for the casm executable file I/O -----------
18 
29  // --------- PrimIO Declarations --------------------------------------------------
30 
31  BasicStructure<Site> read_prim(fs::path filename);
32 
33  BasicStructure<Site> read_prim(const jsonParser &json);
34 
36  void write_prim(const BasicStructure<Site> &prim, fs::path filename, COORD_TYPE mode);
37 
39  void write_prim(const BasicStructure<Site> &prim, jsonParser &json, COORD_TYPE mode);
40 
41 
42 
43  // --------- SymmetryIO Declarations --------------------------------------------------
44 
45  void write_symop(const SymGroup &grp, Index i, jsonParser &j);
46 
47  void write_symgroup(const SymGroup &grp, jsonParser &json);
48 
49 
50  // --------- ChemicalReference IO Declarations --------------------------------------------------
51 
52  ChemicalReference read_chemical_reference(fs::path filename, const Structure &prim, double tol);
53 
54  ChemicalReference read_chemical_reference(const jsonParser &json, const Structure &prim, double tol);
55 
56  void write_chemical_reference(const ChemicalReference &chem_ref, fs::path filename);
57 
58  void write_chemical_reference(const ChemicalReference &chem_ref, jsonParser &json);
59 
60  void write_chemical_reference(const ChemicalReference &chem_ref, jsonParser &json);
61 
62 
63  // --------- CompositionAxes Declarations --------------------------------------------------
64 
65  struct CompositionAxes {
66 
68 
70  CompositionAxes(fs::path _filename);
71 
73  CompositionAxes(const jsonParser &json);
74 
76  void read(fs::path _filename);
77 
79  void read(const jsonParser &json, fs::path filename = fs::path());
80 
82  void write(fs::path _filename);
83 
85  void write(jsonParser &json) const;
86 
88  void select(std::string key);
89 
90 
91  std::map<std::string, CompositionConverter> standard;
92  std::map<std::string, CompositionConverter> custom;
93  bool has_current_axes = false;
94  std::string curr_key;
97 
98  int err_code = 0;
99  std::string err_message;
100  };
101 
102 
104  template<typename OutputIterator>
105  OutputIterator read_composition_axes(OutputIterator result, const jsonParser &json);
106 
107 
108  // --------- CompositionAxes Definitions --------------------------------------------------
109 
120  template<typename OutputIterator>
121  OutputIterator read_composition_axes(OutputIterator result, const jsonParser &json) {
122 
124  for(auto it = json.cbegin(); it != json.cend(); ++it) {
125  from_json(conv, *it);
126  *result++ = std::make_pair(it.name(), conv);
127  }
128  return result;
129  }
130 
131 
132  // ---------- basis.json IO ------------------------------------------------------------------
133 
135  void write_basis(const SiteOrbitree &tree, const Structure &prim, jsonParser &json, double tol);
136 
138 }
139 
140 #endif
CompositionConverter curr
Definition: AppIO.hh:95
std::map< std::string, CompositionConverter > standard
Definition: AppIO.hh:91
void from_json(ClexDescription &desc, const jsonParser &json)
void select(std::string key)
Set this->curr using key.
Definition: AppIO.cc:372
void write_symgroup(const SymGroup &grp, jsonParser &json)
Definition: AppIO.cc:183
void write_prim(const BasicStructure< Site > &prim, fs::path filename, COORD_TYPE mode)
Write prim.json to file.
Definition: AppIO.cc:107
void write_chemical_reference(const ChemicalReference &chem_ref, fs::path filename)
Definition: AppIO.cc:258
Main CASM namespace.
Definition: complete.cpp:8
std::string curr_key
Definition: AppIO.hh:94
const_iterator cend() const
Returns const_iterator to end of JSON object or JSON array.
Definition: jsonParser.cc:480
BasicStructure< Site > read_prim(fs::path filename)
Definition: AppIO.cc:11
double tol
GenericOrbitree< SiteCluster > SiteOrbitree
Definition: Clex.hh:14
void read(fs::path _filename)
Read CompositionAxes from file.
Definition: AppIO.cc:293
EigenIndex Index
For long integer indexing:
ChemicalReference read_chemical_reference(fs::path filename, const Structure &prim, double tol)
Read chemical reference states from JSON file.
Definition: AppIO.cc:212
OutputIterator read_composition_axes(OutputIterator result, const jsonParser &json)
Read standard axes from JSON, and output to std::map ...
Definition: AppIO.hh:121
void write_symop(const SymGroup &grp, Index i, jsonParser &j)
Definition: AppIO.cc:166
Convert between number of species per unit cell and parametric composition.
void write_basis(const SiteOrbitree &tree, const Structure &prim, jsonParser &json, double tol)
Write summary of basis functions.
Definition: AppIO.cc:474
void write(fs::path _filename)
Write CompositionAxes to file.
Definition: AppIO.cc:339
fs::path filename
Definition: AppIO.hh:96
std::map< std::string, CompositionConverter > custom
Definition: AppIO.hh:92
const_iterator cbegin() const
Returns const_iterator to beginning of JSON object or JSON array.
Definition: jsonParser.cc:455
std::string err_message
Definition: AppIO.hh:99