mcpele  1.0.0
The Monte Carlo Python Energy Landscape Explorer
record_energy_histogram.cpp
00001 #include "mcpele/record_energy_histogram.h"
00002 
00003 using pele::Array;
00004 
00005 namespace mcpele {
00006 
00007 RecordEnergyHistogram::RecordEnergyHistogram(const double min, const double max, const double bin, const size_t eqsteps)
00008     : m_hist(min, max, bin),
00009       m_eqsteps(eqsteps),
00010       m_count(0)
00011     {}
00012 
00013 void RecordEnergyHistogram::action(Array<double> &coords, double energy, bool accepted, MC* mc)
00014 {
00015     m_count = mc->get_iterations_count();
00016     if (m_count > m_eqsteps){
00017         m_hist.add_entry(energy);
00018     }
00019 }
00020 
00021 pele::Array<double> RecordEnergyHistogram::get_histogram() const
00022 {
00023     std::vector<double> vecdata(m_hist.get_vecdata());
00024     pele::Array<double> histogram(vecdata);
00025     return histogram.copy();
00026 }
00027 
00028 } // namespace mcpele
 All Classes Namespaces Functions Variables Typedefs