CASM  1.1.0
A Clusters Approach to Statistical Mechanics
SymRepTools.cc
Go to the documentation of this file.
2 
3 #include "casm/casm_io/Log.hh"
7 
8 namespace CASM {
9 
11  if (irrep.pseudo_irrep) {
12  to_json_array(irrep.characters.imag(),
13  json["is_direct_sum_of_complex_irreps"]
14  ["symop_characters_imag_component"]);
15  to_json_array(irrep.characters.real(),
16  json["is_direct_sum_of_complex_irreps"]
17  ["symop_characters_real_component"]);
18  }
19 
20  /*
21  if(!almost_zero(irrep.trans_mat.imag())) {
22  json["axes"]["imaginary"] = -irrep.trans_mat.imag();
23  }
24 
25  json["axes"]["real"] = irrep.trans_mat.real();
26  */
27  /*
28  if(irrep.directions.empty()) {
29  json["high_symmetry_directions"] = "none";
30  }
31  else {
32  json["high_symmetry_directions"].put_array(irrep.directions.size());
33  }
34 
35  for(Index i = 0; i < irrep.directions.size(); ++i) {
36  json["high_symmetry_directions"][i].put_array(irrep.directions[i].size());
37  for(Index j = 0; j < irrep.directions[i].size(); ++j) {
38  to_json_array(Eigen::MatrixXd(irrep.trans_mat.real()*irrep.directions[i][j]),
39  json["high_symmetry_directions"][i][j]);
40  }
41  }
42  */
43  return json;
44 }
45 
47  json["full_wedge_axes"] = wedge.trans_mat().transpose();
48 
49  for (Index i = 0; i < wedge.irrep_wedges().size(); ++i) {
50  std::string irrep_name =
51  "irrep_" + to_sequential_string(i + 1, wedge.irrep_wedges().size());
52  json["irrep_wedge_axes"][irrep_name] =
53  wedge.irrep_wedges()[i].axes.transpose();
54  }
55  return json;
56 }
57 
59  json["symmetry_representation"] = obj.symgroup_rep;
60 
61  json["glossary"] = obj.axis_glossary;
62 
63  std::vector<Index> mults;
64  for (auto const &irrep : obj.irreps) {
65  if (irrep.index == 0) mults.push_back(0);
66  mults.back()++;
67  }
68 
69  Index NQ = obj.symmetry_adapted_dof_subspace.cols();
70  Index i(0), l(0), q(1);
71  for (Index mult : mults) {
72  ++i;
73  for (Index m = 0; m < mult; ++m) {
74  std::string irrep_name = "irrep_" +
75  to_sequential_string(i, mults.size()) + "_" +
76  to_sequential_string(m + 1, mult);
77  auto const &irrep = obj.irreps[l];
78  if (irrep.pseudo_irrep) {
79  json["irreducible_representations"]["pseudo_irrep"][irrep_name] = irrep;
80  }
81  // json["irreducible_representations"][irrep_name]["multiplicity"] = mult;
82  if (obj.irreducible_wedge.size()) {
83  json["irreducible_representations"]["irreducible_wedge"][irrep_name] =
84  (irrep.trans_mat * obj.irreducible_wedge[0].irrep_wedges()[l].axes)
85  .real()
86  .transpose();
87  }
88  json["irreducible_representations"]["irrep_axes"][irrep_name].put_array();
89  for (Index a = 0; a < irrep.irrep_dim(); ++a, ++q) {
90  std::string axis_name = "q" + to_sequential_string(q, NQ);
91  json["irreducible_representations"]["irrep_axes"][irrep_name].push_back(
92  axis_name);
93  }
94 
95  jsonParser &irrep_matrices =
96  json["irreducible_representations"]["symop_matrices"]
97  [irrep_name]; //.put_array();
98  for (Index o = 0; o < obj.symgroup_rep.size(); ++o) {
99  Eigen::MatrixXd const &op = obj.symgroup_rep[i];
100  std::string op_name =
101  "op_" + to_sequential_string(o + 1, obj.symgroup_rep.size());
102  irrep_matrices[op_name] =
103  (irrep.trans_mat * op * irrep.trans_mat.transpose()).real();
104  }
105 
106  {
107  jsonParser &djson = json["irreducible_representations"]
108  ["subgroup_invariant_directions"];
109  if (irrep.directions.empty()) {
110  djson[irrep_name] = "none";
111  } else {
112  for (Index d = 0; d < irrep.directions.size(); ++d) {
113  std::string orbit_name =
114  "direction_orbit_" +
115  to_sequential_string(d + 1, irrep.directions.size());
116  djson[irrep_name][orbit_name].put_array(irrep.directions[d].size());
117  for (Index j = 0; j < irrep.directions[d].size(); ++j) {
118  to_json_array(Eigen::MatrixXd(irrep.trans_mat.real() *
119  irrep.directions[d][j]),
120  djson[irrep_name][orbit_name][j]);
121  }
122  }
123  }
124  }
125 
126  ++l;
127  }
128  }
129 
130  for (Index q = 0; q < obj.symmetry_adapted_dof_subspace.cols(); ++q) {
131  std::string axis_name = "q" + to_sequential_string(q + 1, NQ);
134  json["irreducible_representations"]["adapted_axes"][axis_name]);
135  }
136 
137  for (Index i = 0; i < obj.irreducible_wedge.size(); ++i) {
138  std::string subwedge_name =
139  "subwedge_axes_" +
140  to_sequential_string(i + 1, obj.irreducible_wedge.size());
141  json["irreducible_wedge"][subwedge_name] =
142  obj.irreducible_wedge[i].trans_mat().transpose();
143  }
144 
145  return json;
146 }
147 
148 } // namespace CASM
149 
150 #include "casm/casm_io/Log.hh"
155 
156 namespace CASM {
157 
159  if (irrep.pseudo_irrep) {
160  to_json_array(irrep.characters.imag(),
161  json["is_direct_sum_of_complex_irreps"]
162  ["symop_characters_imag_component"]);
163  to_json_array(irrep.characters.real(),
164  json["is_direct_sum_of_complex_irreps"]
165  ["symop_characters_real_component"]);
166  }
167 
168  /*
169  if(!almost_zero(irrep.trans_mat.imag())) {
170  json["axes"]["imaginary"] = -irrep.trans_mat.imag();
171  }
172 
173  json["axes"]["real"] = irrep.trans_mat.real();
174  */
175  /*
176  if(irrep.directions.empty()) {
177  json["high_symmetry_directions"] = "none";
178  }
179  else {
180  json["high_symmetry_directions"].put_array(irrep.directions.size());
181  }
182 
183  for(Index i = 0; i < irrep.directions.size(); ++i) {
184  json["high_symmetry_directions"][i].put_array(irrep.directions[i].size());
185  for(Index j = 0; j < irrep.directions[i].size(); ++j) {
186  to_json_array(Eigen::MatrixXd(irrep.trans_mat.real()*irrep.directions[i][j]),
187  json["high_symmetry_directions"][i][j]);
188  }
189  }
190  */
191  return json;
192 }
193 
195  json["full_wedge_axes"] = wedge.trans_mat().transpose();
196 
197  for (Index i = 0; i < wedge.irrep_wedges().size(); ++i) {
198  std::string irrep_name =
199  "irrep_" + to_sequential_string(i + 1, wedge.irrep_wedges().size());
200  json["irrep_wedge_axes"][irrep_name] =
201  wedge.irrep_wedges()[i].axes.transpose();
202  }
203  return json;
204 }
205 
207  jsonParser &json) {
208  json["symmetry_representation"] = obj.symgroup_rep;
209 
210  json["glossary"] = obj.axis_glossary;
211 
212  std::vector<Index> mults;
213  for (auto const &irrep : obj.irreps) {
214  if (irrep.index == 0) mults.push_back(0);
215  mults.back()++;
216  }
217 
218  Index NQ = obj.symmetry_adapted_subspace.cols();
219  Index i(0), l(0), q(1);
220  for (Index mult : mults) {
221  ++i;
222  for (Index m = 0; m < mult; ++m) {
223  std::string irrep_name = "irrep_" +
224  to_sequential_string(i, mults.size()) + "_" +
225  to_sequential_string(m + 1, mult);
226  auto const &irrep = obj.irreps[l];
227  if (irrep.pseudo_irrep) {
228  json["irreducible_representations"]["pseudo_irrep"][irrep_name] = irrep;
229  }
230  // json["irreducible_representations"][irrep_name]["multiplicity"] = mult;
231  if (obj.irreducible_wedge.size()) {
232  json["irreducible_representations"]["irreducible_wedge"][irrep_name] =
233  (irrep.trans_mat * obj.irreducible_wedge[0].irrep_wedges()[l].axes)
234  .real()
235  .transpose();
236  }
237  json["irreducible_representations"]["irrep_axes"][irrep_name].put_array();
238  for (Index a = 0; a < irrep.irrep_dim(); ++a, ++q) {
239  std::string axis_name = "q" + to_sequential_string(q, NQ);
240  json["irreducible_representations"]["irrep_axes"][irrep_name].push_back(
241  axis_name);
242  }
243 
244  jsonParser &irrep_matrices =
245  json["irreducible_representations"]["symop_matrices"]
246  [irrep_name]; //.put_array();
247  for (Index o = 0; o < obj.symgroup_rep.size(); ++o) {
248  Eigen::MatrixXd const &op = obj.symgroup_rep[i];
249  std::string op_name =
250  "op_" + to_sequential_string(o + 1, obj.symgroup_rep.size());
251  irrep_matrices[op_name] =
252  (irrep.trans_mat * op * irrep.trans_mat.transpose()).real();
253  }
254 
255  {
256  jsonParser &djson = json["irreducible_representations"]
257  ["subgroup_invariant_directions"];
258  if (irrep.directions.empty()) {
259  djson[irrep_name] = "none";
260  } else {
261  for (Index d = 0; d < irrep.directions.size(); ++d) {
262  std::string orbit_name =
263  "direction_orbit_" +
264  to_sequential_string(d + 1, irrep.directions.size());
265  djson[irrep_name][orbit_name].put_array(irrep.directions[d].size());
266  for (Index j = 0; j < irrep.directions[d].size(); ++j) {
267  to_json_array(Eigen::MatrixXd(irrep.trans_mat.real() *
268  irrep.directions[d][j]),
269  djson[irrep_name][orbit_name][j]);
270  }
271  }
272  }
273  }
274 
275  ++l;
276  }
277  }
278 
279  for (Index q = 0; q < obj.symmetry_adapted_subspace.cols(); ++q) {
280  std::string axis_name = "q" + to_sequential_string(q + 1, NQ);
282  obj.symmetry_adapted_subspace.col(q),
283  json["irreducible_representations"]["adapted_axes"][axis_name]);
284  }
285 
286  for (Index i = 0; i < obj.irreducible_wedge.size(); ++i) {
287  std::string subwedge_name =
288  "subwedge_axes_" +
289  to_sequential_string(i + 1, obj.irreducible_wedge.size());
290  json["irreducible_wedge"][subwedge_name] =
291  obj.irreducible_wedge[i].trans_mat().transpose();
292  }
293 
294  return json;
295 }
296 
297 } // namespace CASM
SubWedge is a vector of IrrepWedge, one from each irreducible subspace Together, the IrrepWedges that...
Definition: SymRepTools.hh:108
std::vector< IrrepWedge > const & irrep_wedges() const
IrrepWedges comprising the Subwedge.
Definition: SymRepTools.hh:114
Eigen::MatrixXd const & trans_mat() const
Definition: SymRepTools.hh:118
Eigen::MatrixXd const & trans_mat() const
Definition: IrrepWedge.hh:47
std::vector< IrrepWedge > const & irrep_wedges() const
IrrepWedges comprising the Subwedge.
Definition: IrrepWedge.hh:43
jsonParser & put_array()
Puts new empty JSON array.
Definition: jsonParser.hh:362
CASM::jsonParser & to_json_array(const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json)
Write Eigen Matrix with 1 row or 1 column to JSON array.
Definition: json_io.hh:313
jsonParser & push_back(const T &value, Args &&... args)
Definition: jsonParser.hh:684
Main CASM namespace.
Definition: APICommand.hh:8
Eigen::MatrixXd MatrixXd
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
std::string to_sequential_string(Index i, Index max_i, char prepend_char='0')
Definition: CASM_math.cc:248
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Eigen::VectorXcd characters
Definition: SymRepTools.hh:67
Summary of data associated with the action of a symmetry group on a vector space.
std::vector< Eigen::MatrixXd > symgroup_rep
Matrix representation for each operation in the group – defines action of group on vector space.
std::vector< std::string > axis_glossary
Names given to individual axes in initial (un-adapted) vector space, corresponding to rows of symmetr...
std::vector< SubWedge > irreducible_wedge
Irreducible wedge in the vector space encoded as a vector of symmetrically distinct SubWedges.
std::vector< IrrepInfo > irreps
A list of all irreducible representation that make up the full representation.
Eigen::MatrixXd symmetry_adapted_subspace
Symmetry-oriented subspace of the vector space (columns are the basis vectors)
Summary of data associated with the action of a symmetry group on a vector space.
Definition: SymRepTools.hh:185
std::vector< Eigen::MatrixXd > symgroup_rep
Matrix representation for each operation in the group – defines action of group on vector space.
Definition: SymRepTools.hh:188
std::vector< std::string > axis_glossary
Names given to individual axes in initial (un-adapted) vector space, corresponding to rows of symmetr...
Definition: SymRepTools.hh:204
Eigen::MatrixXd symmetry_adapted_dof_subspace
Symmetry-oriented subspace of the vector space (columns are the basis vectors)
Definition: SymRepTools.hh:200
std::vector< SymRepTools::SubWedge > irreducible_wedge
Irreducible wedge in the vector space encoded as a vector of symmetrically distinct SubWedges.
Definition: SymRepTools.hh:196
std::vector< SymRepTools::IrrepInfo > irreps
A list of all irreducible representation that make up the full representation.
Definition: SymRepTools.hh:192