mcpele
1.0.0
The Monte Carlo Python Energy Landscape Explorer
|
00001 #ifndef _MCPELE_RANDOM_COORDS_DISPLACEMENT_H__ 00002 #define _MCPELE_RANDOM_COORDS_DISPLACEMENT_H__ 00003 00004 #include <random> 00005 00006 #include "mc.h" 00007 00008 namespace mcpele { 00009 00016 class RandomCoordsDisplacement : public TakeStep { 00017 protected: 00018 size_t m_seed; 00019 std::mt19937_64 m_generator; 00020 std::uniform_real_distribution<double> m_real_distribution; 00021 double m_stepsize; 00022 size_t m_count; 00023 public: 00024 RandomCoordsDisplacement(const size_t rseed, const double stepsize=1); 00025 virtual ~RandomCoordsDisplacement() {} 00026 virtual void displace(pele::Array<double>& coords, MC* mc) =0; 00027 size_t get_seed() const {return m_seed;} 00028 void set_generator_seed(const size_t inp) { m_generator.seed(inp); } 00029 double expected_mean() const { return 0; } 00030 double get_stepsize() const { return m_stepsize; } 00034 double expected_variance(const double ss) const { return ss * ss / static_cast<double>(12); } 00035 void increase_acceptance(const double factor) { m_stepsize *= factor; } 00036 void decrease_acceptance(const double factor) { m_stepsize /= factor; } 00037 size_t get_count() const { return m_count; } 00038 }; 00039 00040 class RandomCoordsDisplacementAll : public RandomCoordsDisplacement { 00041 public: 00042 RandomCoordsDisplacementAll(const size_t rseed, const double stepsize=1); 00043 virtual ~RandomCoordsDisplacementAll() {} 00044 virtual void displace(pele::Array<double>& coords, MC* mc); 00045 }; 00046 00047 class RandomCoordsDisplacementSingle : public RandomCoordsDisplacement { 00048 size_t m_nparticles, m_ndim, m_rand_particle; 00049 std::uniform_int_distribution<size_t> m_int_distribution; 00050 public: 00051 RandomCoordsDisplacementSingle(const size_t rseed, const size_t nparticles, const size_t ndim, const double stepsize=1); 00052 virtual ~RandomCoordsDisplacementSingle() {} 00053 virtual void displace(pele::Array<double>& coords, MC* mc); 00054 size_t get_rand_particle(){return m_rand_particle;} //dangerous function, should be used only for testing purposes 00055 }; 00056 00057 } // namespace mcpele 00058 00059 #endif // #ifndef _MCPELE_RANDOM_COORDS_DISPLACEMENT_H__