11 template<
typename ClustType>
13 prototype.set_lattice(new_home, mode);
15 for(
Index i = 0; i < size(); i++)
16 at(i).set_lattice(new_home, mode);
33 template<
typename ClustType>
35 if(sym_group.
size() == 0) {
36 std::cerr <<
"WARNING: In Orbit::get_equivalent, sym_group must at least have one element (identity).\n";
41 ClustType t_cluster(prototype.home());
42 Coordinate map_shift(Eigen::Vector3d::Zero(), prototype.home(),
CART);
45 equivalence_map.clear();
48 prototype.prepare_prototype();
51 this->push_back(prototype);
52 equivalence_map.resize(1);
55 for(i = 0; i < sym_group.
size(); i++) {
56 t_cluster = sym_group[i] * prototype;
58 map_ind =
find(t_cluster, map_shift, tol);
62 if(map_ind < size()) {
71 t_cluster.within(0, within_shift);
72 this->push_back(t_cluster);
80 prototype.set_clust_group(equivalence_map[0]);
81 at(0).set_clust_group(equivalence_map[0]);
82 std::vector<Permutation> proto_perms(prototype.clust_group_permutations(tol));
84 prototype.set_permute_rep(perm_rep_ID);
85 at(0).set_permute_rep(perm_rep_ID);
86 for(j = 0; j < prototype.clust_group().size(); j++)
87 prototype.clust_group()[j].set_rep(perm_rep_ID,
SymPermutation(proto_perms[j]));
88 for(i = 1; i < size(); i++) {
89 equivalence_map[i][0].set_rep(perm_rep_ID,
SymPermutation(proto_perms[0]));
90 for(j = 1; j < prototype.clust_group().size(); j++) {
91 equivalence_map[i].push_back(equivalence_map[i][0]*prototype.clust_group()[j]);
92 equivalence_map[i][j].set_rep(perm_rep_ID,
SymPermutation(proto_perms[j]));
94 SymGroup tclust_group(prototype.clust_group());
95 tclust_group.
apply_sym(equivalence_map[i][0]);
96 at(i).set_clust_group(tclust_group);
97 at(i).set_permute_rep(perm_rep_ID);
105 template<
typename ClustType>
108 for(
Index i = 0; i < size(); i++) {
110 if(equivalence_map.size() < size())
continue;
111 for(
Index j = 0; j < equivalence_map[i].size(); j++) {
123 template<
typename ClustType>
125 ClustType tclust(test_clust);
126 for(
Index i = 0; i < size(); i++) {
127 if(tclust.map_onto(at(i), tol)) {
139 template<
typename ClustType>
142 for(
Index i = 0; i < size(); i++) {
143 if(at(i).contains_periodic(test_coord, tol))
155 template<
typename ClustType>
158 ClustType tclust(test_clust);
159 for(i = 0; i < size(); i++) {
160 if(tclust.map_onto(at(i), tol))
171 template<
typename ClustType>
174 trans.
frac() = Eigen::Vector3d::Zero();
175 ClustType tclust(test_clust);
176 for(i = 0; i < size(); i++) {
177 if(tclust.map_onto(at(i), trans, tol)) {
187 template<
typename ClustType>
189 prototype.collect_basis_info(basis, shift);
190 for(
Index ne = 0; ne < size(); ne++)
191 at(ne).collect_basis_info(basis, shift);
196 template<
typename ClustType>
198 prototype.collect_basis_info(basis);
199 for(
Index ne = 0; ne < size(); ne++)
200 at(ne).collect_basis_info(basis);
212 template<
typename ClustType>
219 while((ch !=
'C') && (ch !=
'c') && !stream.eof()) {
220 stream.ignore(1000,
'\n');
224 stream.ignore(1000,
':');
227 std::cout <<
"ch in cluster is " << ch <<
"\n";
229 while(ch < '0' || ch >
'9') {
230 stream.ignore(1,
'\n');
236 std::cout <<
"num_clust is " << num_clust <<
"\n";
239 for(
int i = 0; i < num_clust; i++) {
242 prototype.read(stream, mode);
243 (*this).push_back(prototype);
248 (*this).back().read(stream, mode);
256 if((*this).back().size() > 0) {
258 std::cout <<
"Inside this loop the cluster is \n";
259 std::cout << (*this).back() <<
"\n";
261 get_equivalent(sym_group);
265 for(
Index t = 0; t < size(); t++) {
277 template<
typename ClustType>
279 std::string suffix(
"");
282 formulae.
resize(prototype.clust_basis.size(), std::string(
"("));
286 for(
Index ne = 0; ne < size(); ne++) {
287 for(
Index nl = 0; nl < labelers.
size(); nl++)
288 at(ne).clust_basis.accept(*labelers[nl]);
291 for(
Index nf = 0; nf < prototype.clust_basis.size(); nf++) {
292 for(
Index ne = 0; ne < size(); ne++) {
293 if(!at(ne).clust_basis[nf] || (at(ne).clust_basis[nf]->formula()) ==
"0")
295 if(formulae[nf].size() > 1)
296 formulae[nf] +=
" + ";
297 formulae[nf] +=
"(" + at(ne).clust_basis[nf]->formula() +
")";
300 if(formulae[nf].size() <= 1)
301 formulae[nf].clear();
303 formulae[nf] += suffix;
311 template<
typename ClustType>
319 if(size()*prototype.size() > 1) {
320 formulae.
resize(prototype.clust_basis.size(), std::string(
"("));
324 for(
Index ne = 0; ne < size(); ne++) {
326 for(
Index nt = 0; nt < at(ne).trans_nlists().size(); nt++) {
327 ib = at(ne).trans_nlist(nt).find(nlist_index);
330 if(ib == at(ne).size())
333 at(ne).set_nlist_inds(at(ne).trans_nlist(nt));
335 for(
Index nl = 0; nl < labelers.
size(); nl++)
336 at(ne).clust_basis.accept(*labelers[nl]);
338 for(
Index nf = 0; nf < at(ne).clust_basis.size(); nf++) {
339 if(!at(ne).clust_basis[nf] || (at(ne).clust_basis[nf]->formula()) ==
"0")
342 if(formulae[nf].size() > 1)
343 formulae[nf] +=
" + ";
344 formulae[nf] +=
"(" + at(ne).clust_basis[nf]->formula() +
")";
350 for(
Index nf = 0; nf < prototype.clust_basis.size(); nf++) {
351 if(formulae[nf].size() <= 1)
352 formulae[nf].clear();
354 formulae[nf] += suffix;
363 template<
typename ClustType>
375 if(size()*prototype.size() > 1) {
376 formulae.resize(prototype.clust_basis.size(), std::string(
"("));
380 for(
Index ne = 0; ne < size(); ne++) {
382 for(
Index nt = 0; nt < at(ne).trans_nlists().size(); nt++) {
383 ib = at(ne).trans_nlist(nt).find(nlist_index);
384 if(ib == at(ne).size())
387 at(ne).set_nlist_inds(at(ne).trans_nlist(nt));
389 new_id[0] = at(ne)[ib].nlist_ind();
394 for(
Index nl = 0; nl < labelers.
size(); nl++)
395 quotient_basis.
accept(*labelers[nl]);
397 for(
Index nf = 0; nf < quotient_basis.
size(); nf++) {
399 if((quotient_basis[nf]->formula()) ==
"0")
402 if(formulae[nf].size() > 1)
403 formulae[nf] +=
" + ";
404 formulae[nf] +=
"(" + quotient_basis[nf]->formula() +
")";
410 for(
Index nf = 0; nf < prototype.clust_basis.size(); nf++) {
411 if(formulae[nf].size() <= 1)
412 formulae[nf].clear();
414 formulae[nf] += suffix;
423 template<
typename ClustType>
431 for(
Index i = 0; i < size(); i++) {
432 json[
"clusters"][i] = at(i);
436 json[
"index"] = index;
446 json[
"prototype"] = prototype;
457 template<
typename ClustType>
464 ClustType clust(prototype);
jsonParser & to_json(jsonParser &json) const
ReturnArray< std::string > delta_occfunc_flower_function_cpp_strings(BasisSet site_basis, const Array< FunctionVisitor * > &labelers, Index nlist_index, Index b_index, Index f_index)
ReturnArray< std::string > flower_function_cpp_strings(const Array< FunctionVisitor * > &labelers, Index nlist_index)
nlist_index is the index into the nlist for the site the flower centers on
void read(std::istream &stream, int num_sites, COORD_TYPE mode)
static SymOp translation(const Eigen::Ref< const vector_type > &_tau)
static method to create operation that describes pure translation
GenericOrbit & apply_sym(const SymOp &op)
Apply symmetry to prototype and all the clusters in the orbit.
void from_json(ClexDescription &desc, const jsonParser &json)
Type-safe ID object for communicating and accessing Symmetry representation info. ...
SymGroup & apply_sym(const SymOp &op)
Calls 'apply_sym' on all SymOps in the group.
void from_json(const jsonParser &json)
Assumes the prototype lattice is already set.
bool contains(const ClustType &test_clust, double tol) const
std::string to_string(ENUM val)
Return string representation of enum class.
void push_back(const Site &new_site)
BasisSet poly_quotient_set(const Function *divisor) const
SymPermutation describes how a symmetry operation permutes a list of 'things' For example...
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Represents cartesian and fractional coordinates.
EigenIndex Index
For long integer indexing:
bool accept(const FunctionVisitor &visitor)
Index find(const ClustType &test_clust, double tol) const
Same as contains, but returns index of equivalent cluster that maps onto test_clust.
Iterator find(Iterator begin, Iterator end, const T &value, BinaryCompare q)
Equivalent to std::find(begin, end, value), but with custom comparison.
ReturnArray< std::string > orbit_function_cpp_strings(const Array< FunctionVisitor * > &labelers)
returns Array of std::string, each of which is
void get_equivalent(const SymGroup &sym_group, double tol)
jsonParser & put_obj()
Puts new empty JSON object.
void collect_basis_info(const Array< typename ClustType::WhichCoordType > &basis, const Coordinate &shift)
calls collect_basis_info on all clusters in orbit
Coordinate_impl::FracCoordinate frac()
Set the fractional coordinate vector.
void set_dof_IDs(const Array< Index > &new_IDs)
void set_lattice(const Lattice &new_home, COORD_TYPE mode)
calls set_lattice on prototype, and all equivalent clusters
SymGroupRepID add_empty_representation() const
Add a new empty representation.
jsonParser & put_array()
Puts new empty JSON array.