CASM  1.1.0
A Clusters Approach to Statistical Mechanics
SuperConfigEnum.hh
Go to the documentation of this file.
1 #ifndef CASM_SuperConfigEnum
2 #define CASM_SuperConfigEnum
3 
5 #include "casm/clex/Supercell.hh"
10 
11 namespace CASM {
12 
29 class SuperConfigEnum : public InputEnumeratorBase<Configuration> {
30  // -- Required members -------------------
31 
32  public:
34  template <typename ConfigIterator>
35  SuperConfigEnum(Supercell const &_target_scel,
36  ConfigIterator sub_config_begin,
37  ConfigIterator sub_config_end);
38 
39  std::string name() const override;
40 
41  static const std::string enumerator_name;
42 
43  // -- Unique -------------------
44 
46  std::vector<Configuration> const &sub_config() const { return m_sub_config; }
47 
53  Array<int> const &counter() const { return m_counter(); }
54 
55  private:
56  // -- Required members -------------------
57 
59  void increment() override;
60 
61  // -- Unique -------------------
62 
64  void _init();
65 
67  bool _check_current() const;
68 
71 
73  Supercell const &_sub_supercell() const { return *m_sub_scel; }
74 
76  std::vector<Configuration> &_sub_config() { return m_sub_config; }
77 
81  }
82 
86  void _fill(Array<int> const &counter_val, Configuration &config);
87 
90 
92  std::vector<Configuration> m_sub_config;
93 
94  // All sub_config use the same supercell
96 
99 
101 
106 
108  std::vector<std::vector<Index> > m_index_map;
109 };
110 
113 template <typename ConfigIterator>
115  ConfigIterator sub_config_begin,
116  ConfigIterator sub_config_end)
117  : m_target_scel(_target_scel),
118  m_sub_config(sub_config_begin, sub_config_end) {
119  _init();
120 }
121 
122 } // namespace CASM
123 
124 #endif
Basic std::vector like container (deprecated)
Definition: Array.hh:45
A Counter allows looping over many incrementing variables in one loop.
Definition: Counter.hh:109
Base class for implementing specialized input enumerators.
Given a selection of Configurations, enumerate all tilings into some supercell.
xtal::UnitCellIndexConverter & _unitcell_index_converter()
Access the UnitCellIndexConverter.
Supercell const & _sub_supercell() const
Access the sub-config supercell.
Array< int > const & counter() const
Access the current value of the counter.
Counter< Array< int > > m_counter
void increment() override
Implement increment.
Supercell const & m_target_scel
The supercell being filled.
Supercell const & _target_supercell()
Access the super-config supercell.
std::string name() const override
Derived enumerators must implement name, via ENUM_MEMBERS.
notstd::cloneable_ptr< xtal::UnitCellIndexConverter > m_unitcell_index_converter
std::vector< Configuration > & _sub_config()
Access the sub-configurations.
void _fill(Array< int > const &counter_val, Configuration &config)
Supercell const * m_sub_scel
notstd::cloneable_ptr< Configuration > m_current
The 'current' Configuration.
SuperConfigEnum(Supercell const &_target_scel, ConfigIterator sub_config_begin, ConfigIterator sub_config_end)
Constructor, using all Supercell permutations.
bool _check_current() const
Returns true if current() satisifies requested conditions.
std::vector< std::vector< Index > > m_index_map
m_current->occ(m_index_map[i][j]) = m_sub_scel[i].occ(j)
void _init()
Used by constructor.
std::vector< Configuration > const & sub_config() const
Access the sub-configurations.
std::vector< Configuration > m_sub_config
A vector containing each possible sub_config.
static const std::string enumerator_name
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:51
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
ConfigIO::GenericConfigFormatter< jsonParser > config()
Definition: ConfigIO.cc:777
Main CASM namespace.
Definition: APICommand.hh:8