mcpele  1.0.0
The Monte Carlo Python Energy Landscape Explorer
mcpele/record_pair_dist_histogram.h
00001 #ifndef _MCPELE_RECORD_PAIR_DIST_HISTOGRAM_H__
00002 #define _MCPELE_RECORD_PAIR_DIST_HISTOGRAM_H__
00003 
00004 #include "mc.h"
00005 #include "pair_dist_histogram.h"
00006 
00007 namespace mcpele {
00008 
00026 template<size_t BOXDIM>
00027 class RecordPairDistHistogram : public Action {
00028 private:
00029     mcpele::PairDistHistogram<BOXDIM> m_hist_gr;
00030     const size_t m_eqsteps;
00031     const size_t m_record_every;
00032 public:
00033     RecordPairDistHistogram(pele::Array<double> boxvector, const size_t nr_bins, const size_t eqsteps, const size_t record_every)
00034         : m_hist_gr(boxvector, nr_bins),
00035           m_eqsteps(eqsteps),
00036           m_record_every(record_every)
00037     {}
00038     virtual ~RecordPairDistHistogram() {}
00039     virtual void action(pele::Array<double>& coords, double energy, bool accepted, MC* mc)
00040     {
00041         const size_t count = mc->get_iterations_count();
00042         if (count > m_eqsteps) {
00043             if (count % m_record_every == 0) {
00044                 m_hist_gr.add_configuration(coords);
00045             }
00046         }
00047     }
00048     size_t get_eqsteps() const
00049     {
00050         return m_eqsteps;
00051     }
00052     pele::Array<double> get_hist_r() const
00053     {
00054         std::vector<double> vecdata(m_hist_gr.get_vecdata_r());
00055         return pele::Array<double>(vecdata).copy();
00056     }
00057     pele::Array<double> get_hist_gr(const double number_density, const size_t nr_particles) const
00058     {
00059         std::vector<double> vecdata(m_hist_gr.get_vecdata_gr(number_density, nr_particles));
00060         return pele::Array<double>(vecdata).copy();
00061     }
00062 };
00063 
00064 } // namespace mcpele
00065 
00066 #endif // #ifndef _MCPELE_RECORD_PAIR_DIST_HISTOGRAM_H__
 All Classes Namespaces Functions Variables Typedefs