CASM  1.1.0
A Clusters Approach to Statistical Mechanics
SupercellSymInfo_data_io.cc
Go to the documentation of this file.
2 
10 
11 namespace CASM {
12 
13 namespace SupercellSymInfo_dataformatter_impl {
14 
15 // use for ValueType=bool, int, double, std::string, jsonParser
16 template <typename ValueType>
19 
22 
25 
28 
31 
34  "transformation_matrix_to_super",
35  "Transformation matrix T, defining the supercell lattice vectors, S, in "
36  "terms of the prim lattice vectors, P: `S = T * P`, where S and P are "
37  "column vector matrices.",
38  [](SupercellSymInfo const &supercell_sym_info) -> Eigen::MatrixXi {
39  return supercell_sym_info.transformation_matrix_to_super().cast<int>();
40  });
41 }
42 
45  "supercell_lattice",
46  "Supercell lattice vectors, unrolled: (a0, a1, a2, b0, ...)",
48  Eigen::Matrix<double, 3, 3, Eigen::ColMajor> L =
49  supercell_sym_info.supercell_lattice().lat_column_mat();
50  return Eigen::Map<Eigen::VectorXd>(L.data(), L.size());
51  });
52 }
53 
56  "supercell_lattice_column_matrix",
57  "Supercell lattice vectors, as column vector matrix",
59  return supercell_sym_info.supercell_lattice().lat_column_mat();
60  });
61 }
62 
65  "supercell_lattice_vectors",
66  "Supercell lattice vectors, as row vector matrix",
68  Lattice const &supercell_lattice =
69  supercell_sym_info.supercell_lattice();
70  return supercell_lattice.lat_column_mat().transpose();
71  });
72 }
73 
76  "unitcells",
77  "Integer coordinates of unit cells in the supercell. The order "
78  "corresponds to the both the linear order of site degree of freedom "
79  "values within one sublattice of a configuration, and the order in which "
80  "translational symmetry operations are applied.",
82  jsonParser json;
84  supercell_sym_info.transformation_matrix_to_super()),
85  json, jsonParser::as_flattest());
86  return json;
87  });
88 }
89 
92  "integral_site_coordinates",
93  "Integer coordinates `(b, i, j, k)` of sites in the supercell, where `b` "
94  "is the sublattice index of the site, and `(i,j,k)` are the integral "
95  "coordinates of the unit cell containing the site.",
98  auto f = supercell_sym_info.unitcellcoord_index_converter();
99  for (Index l = 0; l < f.total_sites(); l++) {
100  jsonParser l_json;
101  to_json(f(l), l_json);
102  json.push_back(l_json);
103  }
104  return json;
105  });
106 }
107 
110  "translation_permutations",
111  "Describes how sites permute due to translation. Outer array (with size "
112  "equal to the supercell volume) corresponds to possible translations "
113  "within the supercell, and the inner array (with size is equal to the "
114  "total number of sites, prim basis size * supercell volume) describes "
115  "how sites permute for the `i`th translation, according to `after[l] = "
116  "before[translation_permutation[i][l]]`.",
118  jsonParser json = jsonParser::array();
119  to_json(supercell_sym_info.translation_permutations(), json);
120  return json;
121  });
122 }
123 
126  "factor_group",
127  "The supercell factor group is the subgroup of the prim factor group "
128  "that keeps the supercell lattice invariant.",
130  jsonParser json;
131  write_symgroup(supercell_sym_info.factor_group(), json);
132  return json;
133  });
134 }
135 
138  "factor_group_size",
139  "The number of operations in the supercell factor group.",
141  return supercell_sym_info.factor_group().size();
142  });
143 }
144 
147  "factor_group_permutations",
148  "Describes how sites permute due to supercell factor group operations. "
149  "Outer array corresponds to supercell factor group operations (prim "
150  "factor group operations that keep the supercell lattice invariant), and "
151  "the inner array (with size is equal to the total number of sites, prim "
152  "basis size * supercell volume) describes how sites permute for the "
153  "`i`th supercell factor group operation, according to `after[l] = "
154  "before[factor_group_permutations[i][l]]`.",
156  jsonParser json = jsonParser::array();
157  auto const &factor_group = supercell_sym_info.factor_group();
158  for (int i = 0; i < factor_group.size(); ++i) {
159  jsonParser permute_json;
160  to_json(supercell_sym_info.factor_group_permute(i), permute_json);
161  json.push_back(permute_json);
162  }
163  return json;
164  });
165 }
166 
169  "global_dof_reps",
170  "Symmetry representations (matrices) that describe how values of global "
171  "degrees of freedom transform under application of symmetry operations. "
172  "The `i`th supercell factor group operation transforms vectorized DoF "
173  "values according to `vector_after = global_dof_reps[dof_key][i] * "
174  "vector_before`, where `dof_key` is the name of the DoF.",
176  jsonParser json;
177  for (auto const &pair : supercell_sym_info.global_dof_symreps()) {
178  write_matrix_rep(pair.second, json[pair.first]);
179  }
180  return json;
181  });
182 }
183 
186  "local_dof_reps",
187  "Symmetry representations (matrices) that describe how values of local "
188  "degrees of freedom transform under application of symmetry operations. "
189  "The `i`th supercell factor group operation transforms vectorized local "
190  "DoF values on sublattice `b` according to `vector_after = "
191  "local_dof_reps[dof_key][b][i] * vector_before`, where `dof_key` is the "
192  "name of the DoF. After transforming values at a site, values are "
193  "permuted among sites.",
195  jsonParser json;
196  for (auto const &pair : supercell_sym_info.local_dof_symreps()) {
197  json[pair.first] =
198  jsonParser::array(pair.second.size(), jsonParser::object());
199  Index b = 0;
200  for (auto const &group_handle : pair.second) {
201  write_matrix_rep(group_handle, json[pair.first][b]);
202  ++b;
203  }
204  }
205  return json;
206  });
207 }
208 
209 } // namespace SupercellSymInfo_dataformatter_impl
210 
211 template <>
212 DataFormatterDictionary<SupercellSymInfo>
214  using namespace SupercellSymInfo_dataformatter_impl;
215  DataFormatterDictionary<SupercellSymInfo> dict;
221 
222  return dict;
223 }
224 
225 } // namespace CASM
SupercellSymInfo const & supercell_sym_info
A DatumFormatter that returns a 1D value of specified type, via functions that may be specified at ru...
A DatumFormatter that returns a 2D value of specified type, via functions that may be specified at ru...
A DatumFormatter that returns a value of specified type, via functions that may be specified at runti...
A class that collects all symmetry information for for performing symmetry transformations on the sit...
static jsonParser array()
Returns an empty json array.
Definition: jsonParser.hh:409
jsonParser & push_back(const T &value, Args &&... args)
Definition: jsonParser.hh:684
VectorXdSupercellSymInfoFormatter supercell_lattice()
MatrixXdSupercellSymInfoFormatter supercell_lattice_column_matrix()
SupercellSymInfoFormatter< jsonParser > factor_group()
Generic2DDatumFormatter< Eigen::MatrixXd, SupercellSymInfo > MatrixXdSupercellSymInfoFormatter
SupercellSymInfoFormatter< Index > factor_group_size()
MatrixXdSupercellSymInfoFormatter supercell_lattice_vectors()
Generic2DDatumFormatter< Eigen::MatrixXi, SupercellSymInfo > MatrixXiSupercellSymInfoFormatter
SupercellSymInfoFormatter< jsonParser > unitcells()
Generic1DDatumFormatter< Eigen::VectorXd, SupercellSymInfo > VectorXdSupercellSymInfoFormatter
Generic1DDatumFormatter< Eigen::VectorXi, SupercellSymInfo > VectorXiSupercellSymInfoFormatter
SupercellSymInfoFormatter< jsonParser > integral_site_coordinates()
MatrixXiSupercellSymInfoFormatter transformation_matrix_to_super()
SupercellSymInfoFormatter< jsonParser > local_dof_reps()
SupercellSymInfoFormatter< jsonParser > global_dof_reps()
SupercellSymInfoFormatter< jsonParser > translation_permutations()
SupercellSymInfoFormatter< jsonParser > factor_group_permutations()
std::vector< UnitCell > make_lattice_points(const Eigen::Matrix3l &transformation_matrix)
Main CASM namespace.
Definition: APICommand.hh:8
Eigen::MatrixXd MatrixXd
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void write_symgroup(SymGroup const &grp, jsonParser &json)
DataFormatterDictionary< SupercellSymInfo > make_attribute_dictionary< SupercellSymInfo >()
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Eigen::VectorXd VectorXd