mcpele  1.0.0
The Monte Carlo Python Energy Landscape Explorer
mcpele/adaptive_takestep.h
00001 #ifndef _MCPELE_ADAPTIVE_TAKESTEP_H__
00002 #define _MCPELE_ADAPTIVE_TAKESTEP_H__
00003 
00004 #include "mcpele/mc.h"
00005 
00006 namespace mcpele {
00007 
00008 class AdaptiveTakeStep : public TakeStep {
00009 protected:
00010     std::shared_ptr<TakeStep> m_ts;
00011     size_t m_interval;
00012     size_t m_total_steps;
00013     size_t m_accepted_steps;
00014     const double m_factor;
00015     const double m_min_acceptance_ratio;
00016     const double m_max_acceptance_ratio;
00017 public:
00018     virtual ~AdaptiveTakeStep() {}
00019     AdaptiveTakeStep(std::shared_ptr<TakeStep> ts, const size_t interval=100,
00020             const double factor=0.9, const double min_acceptance_ratio=0.2,
00021             const double max_acceptance_ratio=0.5);
00022     void displace(pele::Array<double> &coords, MC * mc) { m_ts->displace(coords, mc); }
00023     void report(pele::Array<double>& old_coords, const double old_energy,
00024             pele::Array<double>& new_coords, const double new_energy,
00025             const bool success, MC* mc);
00026     double get_min_acceptance_ratio() const { return m_min_acceptance_ratio; }
00027     double get_max_acceptance_ratio() const { return m_max_acceptance_ratio; }
00028 };
00029 
00030 } // namespace mcpele
00031 
00032 #endif // #ifndef _MCPELE_ADAPTIVE_TAKESTEP_H__
 All Classes Namespaces Functions Variables Typedefs