CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ConfigDoF.hh
Go to the documentation of this file.
1 #ifndef ConfigDoF_HH
2 #define ConfigDoF_HH
3 
4 #include <vector>
5 
8 #include "casm/global/eigen.hh"
9 
10 namespace CASM {
11 
12 class PermuteIterator;
13 class SymGroupRepID;
14 class SymOp;
15 
63 // },
89 // },
117 class ConfigDoF {
118  public:
119  // Can treat as a Eigen::VectorXd
120  // typedef displacement_matrix_t::ColXpr displacement_t;
121  // typedef displacement_matrix_t::ConstColXpr const_displacement_t;
122 
129  template <typename GlobalInfoContainerType, typename LocalInfoContainerType>
130  ConfigDoF(Index _N_sublat, Index _N_vol,
131  GlobalInfoContainerType const &global_dof_info,
132  LocalInfoContainerType const &local_dof_info,
133  std::vector<SymGroupRepID> const &occ_symrep_IDs, double _tol);
134 
136  Index size() const;
137 
139  Index n_vol() const;
140 
142  Index n_sublat() const;
143 
145  double tol() const;
146 
148  void setZero();
149 
151  int &occ(Index i);
152 
154  const int &occ(Index i) const;
155 
157  void set_occupation(Eigen::Ref<const Eigen::VectorXi> const &_occupation);
158 
160  Eigen::VectorXi const &occupation() const;
161 
162  bool has_occupation() const;
163 
164  std::map<DoFKey, GlobalContinuousConfigDoFValues> const &global_dofs() const;
165 
166  GlobalContinuousConfigDoFValues const &global_dof(DoFKey const &_key) const;
167 
169 
170  bool has_global_dof(DoFKey const &_key) const;
171 
173  void set_global_dof(DoFKey const &_key,
174  Eigen::Ref<const Eigen::VectorXd> const &_val);
175 
176  std::map<DoFKey, LocalContinuousConfigDoFValues> const &local_dofs() const;
177 
178  LocalContinuousConfigDoFValues const &local_dof(DoFKey const &_key) const;
179 
181 
182  bool has_local_dof(DoFKey const &_key) const;
183 
185  void set_local_dof(DoFKey const &_key,
186  Eigen::Ref<const Eigen::MatrixXd> const &_val);
187 
190  ConfigDoF &apply_sym(PermuteIterator const &it);
191 
194  ConfigDoF &apply_sym_no_permute(SymOp const &_op);
195 
196  void swap(ConfigDoF &RHS);
197 
198  private:
199  // ***DON'T FORGET: If you add something here, also update ConfigDoF::swap!!
200 
202 
203  std::map<std::string, GlobalContinuousConfigDoFValues> m_global_dofs;
204 
205  std::map<std::string, LocalContinuousConfigDoFValues> m_local_dofs;
206 
210  mutable double m_tol;
211 };
212 
213 void swap(ConfigDoF &A, ConfigDoF &B);
214 
215 inline void reset_properties(ConfigDoF &_dof) { return; }
216 
217 } // namespace CASM
218 
219 #endif
Index size() const
Number of sites in the ConfigDoF.
Definition: ConfigDoF.cc:11
ConfigDoF(Index _N_sublat, Index _N_vol, GlobalInfoContainerType const &global_dof_info, LocalInfoContainerType const &local_dof_info, std::vector< SymGroupRepID > const &occ_symrep_IDs, double _tol)
std::map< DoFKey, LocalContinuousConfigDoFValues > const & local_dofs() const
Definition: ConfigDoF.cc:119
void set_global_dof(DoFKey const &_key, Eigen::Ref< const Eigen::VectorXd > const &_val)
Set global continuous DoF values.
Definition: ConfigDoF.cc:99
void swap(ConfigDoF &RHS)
Definition: ConfigDoF.cc:253
Index n_vol() const
Integer volume of ConfigDoF.
Definition: ConfigDoF.cc:14
std::map< DoFKey, GlobalContinuousConfigDoFValues > const & global_dofs() const
Definition: ConfigDoF.cc:65
bool has_local_dof(DoFKey const &_key) const
Definition: ConfigDoF.cc:143
LocalDiscreteConfigDoFValues m_occupation
Definition: ConfigDoF.hh:201
bool has_occupation() const
Definition: ConfigDoF.cc:60
Index n_sublat() const
Number of sublattices in ConfigDoF.
Definition: ConfigDoF.cc:17
ConfigDoF & apply_sym_no_permute(SymOp const &_op)
Definition: ConfigDoF.cc:220
void setZero()
Set all DoF values to zero.
Definition: ConfigDoF.cc:23
void set_local_dof(DoFKey const &_key, Eigen::Ref< const Eigen::MatrixXd > const &_val)
Set local continuous DoF values.
Definition: ConfigDoF.cc:154
bool has_global_dof(DoFKey const &_key) const
Definition: ConfigDoF.cc:88
GlobalContinuousConfigDoFValues const & global_dof(DoFKey const &_key) const
Definition: ConfigDoF.cc:69
Eigen::VectorXi const & occupation() const
Const reference occupation values.
Definition: ConfigDoF.cc:56
ConfigDoF & apply_sym(PermuteIterator const &it)
Definition: ConfigDoF.cc:182
double tol() const
Tolerance for comparison of continuous DoF values.
Definition: ConfigDoF.cc:20
int & occ(Index i)
Reference occupation value on site i.
Definition: ConfigDoF.cc:34
std::map< std::string, LocalContinuousConfigDoFValues > m_local_dofs
Definition: ConfigDoF.hh:205
LocalContinuousConfigDoFValues const & local_dof(DoFKey const &_key) const
Definition: ConfigDoF.cc:124
void set_occupation(Eigen::Ref< const Eigen::VectorXi > const &_occupation)
Set occupation values.
Definition: ConfigDoF.cc:43
std::map< std::string, GlobalContinuousConfigDoFValues > m_global_dofs
Definition: ConfigDoF.hh:203
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
Main CASM namespace.
Definition: APICommand.hh:8
void swap(ConfigDoF &A, ConfigDoF &B)
Definition: ConfigDoF.cc:260
void reset_properties(ConfigType &config)
Definition: Calculable.cc:147
std::string DoFKey
Definition: DoFDecl.hh:7
std::map< DoFKey, std::vector< CASM::DoFSetInfo > > local_dof_info(Structure const &_struc)
Definition: Structure.cc:395
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
std::map< DoFKey, CASM::DoFSetInfo > global_dof_info(Structure const &_struc)
Definition: Structure.cc:384