CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
SuperConfigEnum.hh
Go to the documentation of this file.
1 #ifndef CASM_SuperConfigEnum
2 #define CASM_SuperConfigEnum
3 
7 #include "casm/clex/Supercell.hh"
8 
9 extern "C" {
11 }
12 
13 namespace CASM {
14 
26  class SuperConfigEnum : public InputEnumeratorBase<Configuration> {
27 
28  // -- Required members -------------------
29 
30  public:
31 
33  template<typename ConfigIterator>
34  SuperConfigEnum(Supercell &_target_scel,
35  ConfigIterator _begin,
36  ConfigIterator _end);
37 
39  template<typename ConfigIterator>
40  SuperConfigEnum(Supercell &_target_scel,
41  ConfigIterator _begin,
42  ConfigIterator _end,
45 
46  std::string name() const override {
47  return enumerator_name;
48  }
49 
50  static const std::string enumerator_name;
51  static const std::string interface_help;
52  static int run(PrimClex &primclex, const jsonParser &kwargs, const Completer::EnumOption &enum_opt);
53 
54 
55  // -- Unique -------------------
56 
58  const std::vector<Configuration> &sub_config() const {
59  return m_sub_config;
60  }
61 
67  const Array<int> &counter() const {
68  return m_counter();
69  }
70 
75  const PrimGrid &prim_grid() const {
76  return *m_prim_grid;
77  }
78 
79  private:
80 
81  // -- Required members -------------------
82 
84  void increment() override;
85 
86 
87  // -- Unique -------------------
88 
90  void _init();
91 
93  bool _check_current() const;
94 
97  return m_target_scel;
98  }
99 
102  return *m_sub_scel;
103  }
104 
106  std::vector<Configuration> &_sub_config() {
107  return m_sub_config;
108  }
109 
112  return *m_prim_grid;
113  }
114 
118  void _fill(const Array<int> &counter_val, Configuration &config);
119 
120  const PermuteIterator &_perm_begin() const {
121  return m_perm_begin;
122  }
123  const PermuteIterator &_perm_end() const {
124  return m_perm_end;
125  }
126 
127 
130 
132  std::vector<Configuration> m_sub_config;
133 
135 
136  // All sub_config use the same supercell
138 
141 
143 
146 
148  std::vector<std::vector<Index> > m_index_map;
149 
150  bool m_has_occ;
152 
153  };
154 
157  template<typename ConfigIterator>
159  ConfigIterator _begin,
160  ConfigIterator _end) :
161  SuperConfigEnum(_target_scel,
162  _begin,
163  _end,
164  _target_scel.permute_begin(),
165  _target_scel.permute_end()) {}
166 
169  template<typename ConfigIterator>
171  ConfigIterator _begin,
172  ConfigIterator _end,
173  PermuteIterator _perm_begin,
174  PermuteIterator _perm_end) :
175  m_target_scel(_target_scel),
176  m_sub_config(_begin, _end),
177  m_perm_begin(_perm_begin),
178  m_perm_end(_perm_end) {
179 
180  _init();
181 
182  }
183 
184 }
185 
186 #endif
SuperConfigEnum(Supercell &_target_scel, ConfigIterator _begin, ConfigIterator _end)
Constructor, using all Supercell permutations.
CASM::EnumInterfaceBase * make_SuperConfigEnum_interface()
A Counter allows looping over many incrementing variables in one loop.
Definition: Counter.hh:71
const PermuteIterator & _perm_begin() const
std::vector< std::vector< Index > > m_index_map
m_current->occ(m_index_map[i][j]) = m_sub_scel[i].occ(j)
PrimClex * primclex
Definition: settings.cc:101
const std::vector< Configuration > & sub_config() const
Access the sub-configurations.
Base class for implementing specialized input enumerators.
Base class for generic use of enumerators that may be accessed through the API.
Definition: Enumerator.hh:418
PermuteIterator m_perm_end
notstd::cloneable_ptr< Configuration > m_current
The 'current' Configuration.
Main CASM namespace.
Definition: complete.cpp:8
Counter< Array< int > > m_counter
Given a selection of Configurations, enumerate all tilings into some supercell.
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:37
const PermuteIterator & _perm_end() const
bool _check_current() const
Returns true if current() satisifies requested conditions.
static const std::string enumerator_name
std::string name() const override
Derived enumerators must implement name, via ENUM_MEMBERS.
Supercell & m_target_scel
The supercell being filled.
void _init()
Used by constructor.
std::vector< Configuration > & _sub_config()
Access the sub-configurations.
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
void increment() override
Implement increment.
std::vector< Configuration > m_sub_config
A vector containing each possible sub_config.
PermuteIterator m_perm_begin
Supercell & _sub_supercell()
Access the sub-config supercell.
const Array< int > & counter() const
Access the current value of the counter.
PrimGrid & _prim_grid()
Access the PrimGrid.
void _fill(const Array< int > &counter_val, Configuration &config)
static int run(PrimClex &primclex, const jsonParser &kwargs, const Completer::EnumOption &enum_opt)
const PrimGrid & prim_grid() const
Access the PrimGrid.
Supercell & _target_supercell()
Access the super-config supercell.
static const std::string interface_help
A Configuration represents the values of all degrees of freedom in a Supercell.
notstd::cloneable_ptr< PrimGrid > m_prim_grid
A PrimGrid that tiles thes sub_scel into the ref_scel.