CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ConfigEnumRandomLocal.hh
Go to the documentation of this file.
1 #ifndef CASM_ConfigEnumRandomLocal
2 #define CASM_ConfigEnumRandomLocal
3 
4 #include <functional>
5 
9 #include "casm/external/MersenneTwister/MersenneTwister.h"
11 
12 class MTRand;
13 
14 namespace CASM {
15 
16 class ConfigEnumInput;
17 
27  ConfigEnumRandomLocalParams(MTRand &_mtrand, DoFKey _dof_key, Index _n_config,
28  double _mag, bool _normal_distribution);
29 
31  MTRand &mtrand;
32 
38 
41 
43  double mag;
44 
47 };
48 
50 class ConfigEnumRandomLocal : public InputEnumeratorBase<Configuration> {
51  // -- Required members -------------------
52 
53  public:
54  ConfigEnumRandomLocal(ConfigEnumInput const &_in_config,
55  ConfigEnumRandomLocalParams const &params);
56 
57  ConfigEnumRandomLocal(ConfigEnumInput const &_in_config,
58  DoFKey const &_dof_key, Index _n_config, double _mag,
59  bool _normal, MTRand &_mtrand);
60 
61  std::string name() const override;
62 
63  static const std::string enumerator_name;
64 
65  private:
67  void increment() override;
68 
69  // -- Unique -------------------
70 
71  void randomize();
72 
73  // Key of DoF being perturbed
75 
76  // Number of configurations to be enumerated
78 
80 
81  // Pseudo-random number generator
82  MTRand &m_mtrand;
83 
84  // std deviation of normal distribution
85  // max magnitude if uniform distribution
86  double m_mag;
87 
88  // true if normally distributed
89  // false if uniformly distributed
90  bool m_normal;
91 
92  // true if dof is unit vector
93  // false otherwise
95 
96  // Sites on which enumeration is being performed
97  std::vector<Index> m_site_selection;
98 
99  // Dimension of DoF at each selected site
100  std::vector<Index> m_dof_dims;
101 
103 };
104 
106 } // namespace CASM
107 
108 #endif
Enumerate random values for continuous degrees of freedom.
std::string name() const override
Derived enumerators must implement name, via ENUM_MEMBERS.
notstd::cloneable_ptr< Configuration > m_current
static const std::string enumerator_name
LocalContinuousConfigDoFValues * m_dof_vals
void increment() override
Implements increment.
std::vector< Index > m_site_selection
ConfigEnumRandomLocal(ConfigEnumInput const &_in_config, ConfigEnumRandomLocalParams const &params)
Base class for implementing specialized input enumerators.
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
Main CASM namespace.
Definition: APICommand.hh:8
std::string DoFKey
Definition: DoFDecl.hh:7
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Parameters controlling ConfigEnumRandomLocal.
Index n_config
Number of random configurations to generate.
MTRand & mtrand
Random number generator.
double mag
Magnitude used to scale random vector at each site.
bool normal_distribution
True if using "normal" distribution, else using "uniform" distribution.
ConfigEnumRandomLocalParams(MTRand &_mtrand, DoFKey _dof_key, Index _n_config, double _mag, bool _normal_distribution)