1 #ifndef CASM_ClexBasis_impl
2 #define CASM_ClexBasis_impl
20 template <
typename OrbitType>
30 template <
typename OrbitIteratorType>
32 OrbitIteratorType _orbit_end) {
33 std::vector<DoFKey> dof_keys =
35 std::vector<DoFKey> global_keys;
36 std::vector<DoFKey> local_keys;
38 if (dof_keys.empty()) {
40 global_keys.push_back(dof.first);
43 local_keys.push_back(dof.first);
45 }
else if (dof_keys.size() > 1 || dof_keys[0] !=
"none") {
47 for (
DoFKey const &key : dof_keys) {
49 global_keys.push_back(key);
51 local_keys.push_back(key);
55 ss <<
"Attempting to build Clex basis set, but missing degree of "
58 throw std::runtime_error(ss.str());
62 m_bset_tree.resize(std::distance(_orbit_begin, _orbit_end));
65 for (; _orbit_begin != _orbit_end; ++_orbit_begin, ++bset_it) {
66 auto const &orbit = *_orbit_begin;
67 Index max_poly_order =
69 bset_it->reserve(orbit.size());
71 global_keys, max_poly_order));
72 for (
Index j = 1; j < orbit.size(); j++)
73 bset_it->push_back((*(orbit.equivalence_map(j).first)) * (*bset_it)[0]);
108 template <
typename OrbitType>
110 OrbitType
const &_orbit, std::vector<DoFKey>
const &local_keys,
111 std::vector<DoFKey>
const &global_keys,
Index max_poly_order)
const {
118 max_poly_order =
max(max_poly_order,
Index(_orbit.prototype().size()));
123 std::vector<BasisSet const *> arg_subsets;
124 for (
DoFKey const &key : global_keys) {
127 arg_subsets.push_back(&(find_it->second[0]));
129 throw std::runtime_error(
130 "Unable to construct basis sets. No known global DoF: " + key +
"\n");
135 std::vector<BasisSet> all_local;
136 all_local.reserve(local_keys.size());
139 for (
DoFKey const &key : local_keys) {
145 throw std::runtime_error(
146 "Unable to construct basis sets. No known local DoF: " + key +
"\n");
148 std::vector<BasisSet>
const &arg_vec(find_it->second);
151 std::vector<BasisSet> tlocal;
152 tlocal.reserve(_orbit.prototype().size());
154 for (
Index i = 0; i < _orbit.prototype().size(); i++) {
155 tlocal.push_back(arg_vec[_orbit.prototype()[i].sublattice()]);
156 tlocal.back().set_dof_IDs(std::vector<Index>(1, i));
162 if (all_local.back().size()) arg_subsets.push_back(&(all_local.back()));
164 SymGroup clust_group(_orbit.equivalence_map(0).first,
165 _orbit.equivalence_map(0).second);
167 arg_subsets, max_poly_order, 1);
170 namespace ClexBasis_impl {
171 template <
typename OrbitType>
174 SymGroup clust_group(_orbit.equivalence_map(0).first,
175 _orbit.equivalence_map(0).second);
177 std::vector<SymGroupRep const *> subspace_reps;
178 for (
BasisSet const *site_bset_ptr : site_dof_sets) {
181 clust_group, site_bset_ptr->basis_symrep_ID())
184 subspace_reps.push_back(
void set_basis_symrep_ID(SymGroupRepID new_ID)
std::map< DoFKey, std::vector< BasisSet > > m_global_bases
Dictionary of all global BasisSets, initialized.
std::map< DoFKey, std::vector< BasisSet > > m_site_bases
Dictionary of all site BasisSets, initialized on construction m_site_basis[DOF][b] gives site basis f...
notstd::cloneable_ptr< ClexBasisBuilder > m_basis_builder
pointer to class that constructs cluster functions
void generate(OrbitIterType _begin, OrbitIterType _end)
generate clust_basis for all equivalent clusters in
BasisSet _construct_prototype_basis(OrbitType const &_orbit, std::vector< DoFKey > const &local_keys, std::vector< DoFKey > const &global_keys, Index max_poly_order) const
std::vector< BSetOrbit > m_bset_tree
Collection of all cluster orbits (are we keeping this?)
ClexBasisSpecs const & basis_set_specs() const
SymGroupRepID add_representation(const SymGroupRep &new_rep) const
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
const MasterSymGroup & master_group() const
SymGroupRep const * rep_ptr() const
SymGroupRep is an alternative representation of a SymGroup for something other than real space....
SymGroupRepHandle RemoteHandle
static SymGroupRepID identity(Index dim)
Static function to construct an ID for identity representations.
BasisSet construct_proto_dof_basis(OrbitType const &_orbit, BasisSet::ArgList const &site_dof_sets)
SymGroupRep permuted_direct_sum_rep(const SymGroupRep &permute_rep, const std::vector< SymGroupRep const * > &sum_reps)
BasisSet direct_sum(BasisSet::ArgList const &_subs)
INDEX_TYPE Index
For long integer indexing:
T max(const T &A, const T &B)
Index _orbit_max_poly_order(OrbitType const &orbit, BasisFunctionSpecs const &basis_function_specs)
allow basis_function_specs to specify max_poly_order by branch, orbit, etc.
Specify how to construct basis functions.
MaxPolyOrder global_max_poly_order
std::map< OrbitBranchSize, MaxPolyOrder > orbit_branch_max_poly_order
std::vector< DoFKey > dof_keys
Which DoF types to include in the basis functions.
BasisFunctionSpecs basis_function_specs