CASM  1.1.0
A Clusters Approach to Statistical Mechanics
Adapter.hh
Go to the documentation of this file.
1 #ifndef BASIS_SET_ADAPTER_HH
2 #define BASIS_SET_ADAPTER_HH
3 
4 #include "casm/basis_set/DoF.hh"
8 
9 namespace CASM {
10 namespace adapter {
11 template <typename ToType, typename FromType>
12 struct Adapter;
13 
19 // TODO: Squash OccupantDoF and DiscreteDoF into a single DiscreteDoF class that
20 // does NOT depend on Molecule (i.e. DiscreteType)
21 template <typename DiscreteType>
22 struct Adapter<OccupantDoF<DiscreteType>, std::vector<DiscreteType>> {
24  const std::vector<xtal::Molecule> &adaptable, SymGroupRepID symrep_ID,
25  int dof_id) {
26  OccupantDoF<DiscreteType> dof(DoFType::occupation().val_traits(), "s",
27  symrep_ID, adaptable);
28  dof.set_ID(dof_id);
29  return dof;
30  }
31 };
32 
36 template <>
39  SymGroupRepID symrep_ID) {
40  CASM::DoFSet adapted_dofset(adaptable.traits(), adaptable.component_names(),
41  {symrep_ID, adaptable.basis()});
42  adapted_dofset.set_sequential_IDs();
43  adapted_dofset.lock_IDs();
44  return adapted_dofset;
45  }
46 };
47 
52 template <>
55  SymGroupRepID symrep_ID, int dof_id) {
56  CASM::DoFSet adapted_dofset(adaptable.traits(), adaptable.component_names(),
57  {symrep_ID, adaptable.basis()},
58  adaptable.excluded_occupants());
59  adapted_dofset.set_ID(dof_id);
60  return adapted_dofset;
61  }
62 };
63 } // namespace adapter
64 } // namespace CASM
65 
66 #endif
void set_ID(Index new_ID)
mutator to set integer ID if it is unlocked
Definition: DoF.hh:151
void set_sequential_IDs()
Definition: DoFSet.cc:67
void lock_IDs()
Locks IDs of components in this DoFSet so they can no longer be updated.
Definition: DoFSet.cc:60
void set_ID(Index _ID)
Definition: DoFSet.hh:213
Type-safe ID object for communicating and accessing Symmetry representation info.
BasicTraits const & traits() const
Returns traits object for the DoF type of this DoFSet.
Definition: DoFSet.hh:60
const std::vector< std::string > & component_names() const
Returns the names of each of the component axes.
Definition: DoFSet.hh:55
const std::unordered_set< std::string > & excluded_occupants() const
Return all occupants that the DoFSet should not be applied to.
Definition: DoFSet.hh:121
DoF_impl::OccupationDoFTraits occupation()
Main CASM namespace.
Definition: APICommand.hh:8
Definition: stream_io.hh:24
CASM::DoFSet operator()(const xtal::DoFSet &adaptable, SymGroupRepID symrep_ID)
Definition: Adapter.hh:38
CASM::DoFSet operator()(const xtal::SiteDoFSet &adaptable, SymGroupRepID symrep_ID, int dof_id)
Definition: Adapter.hh:54
OccupantDoF< DiscreteType > operator()(const std::vector< xtal::Molecule > &adaptable, SymGroupRepID symrep_ID, int dof_id)
Definition: Adapter.hh:23