00001 // -*- c++ -*- 00002 00003 // This file is part of the Collective Variables module (Colvars). 00004 // The original version of Colvars and its updates are located at: 00005 // https://github.com/Colvars/colvars 00006 // Please update all Colvars source files before making any changes. 00007 // If you wish to distribute your changes, please submit them to the 00008 // Colvars repository at GitHub. 00009 00010 #ifndef COLVARBIAS_HISTOGRAM_REWEIGHT_AMD 00011 #define COLVARBIAS_HISTOGRAM_REWEIGHT_AMD 00012 00013 #include "colvarbias_histogram.h" 00014 00017 class colvarbias_reweightaMD : public colvarbias_histogram { 00018 public: 00019 colvarbias_reweightaMD(char const *key); 00020 virtual ~colvarbias_reweightaMD(); 00021 #if (__cplusplus >= 201103L) 00022 virtual int init(std::string const &conf) override; 00023 virtual int update() override; 00024 virtual int write_output_files() override; 00025 #else 00026 virtual int init(std::string const &conf); 00027 virtual int update(); 00028 virtual int write_output_files(); 00029 #endif 00030 00035 void hist_to_pmf( 00036 colvar_grid_scalar* hist, 00037 const colvar_grid_scalar* hist_count) const; 00038 00046 void compute_cumulant_expansion_factor( 00047 const colvar_grid_scalar* hist_dV, 00048 const colvar_grid_scalar* hist_dV_square, 00049 const colvar_grid_scalar* hist_count, 00050 colvar_grid_scalar* cumulant_expansion_factor) const; 00051 00055 virtual int write_exponential_reweighted_pmf( 00056 const std::string& p_output_prefix, bool keep_open = false); 00057 00061 virtual int write_cumulant_expansion_pmf( 00062 const std::string& p_output_prefix, bool keep_open = false); 00063 00067 virtual int write_count( 00068 const std::string& p_output_prefix, bool keep_open = false); 00069 protected: 00071 std::vector<int> previous_bin; 00073 colvarmodule::step_number start_after_steps; 00074 00076 bool b_use_cumulant_expansion; 00077 colvar_grid_scalar* grid_count; 00078 colvar_grid_scalar* grid_dV; 00079 colvar_grid_scalar* grid_dV_square; 00080 00082 size_t history_freq; 00083 bool b_history_files; 00084 00086 bool b_write_gradients; 00087 00089 #if (__cplusplus >= 201103L) 00090 virtual std::istream & read_state_data(std::istream &is) override; 00091 virtual std::ostream & write_state_data(std::ostream &os) override; 00092 #else 00093 virtual std::istream & read_state_data(std::istream &is); 00094 virtual std::ostream & write_state_data(std::ostream &os); 00095 #endif 00096 private: 00098 colvar_grid_scalar *pmf_grid_exp_avg; 00099 colvar_grid_scalar *pmf_grid_cumulant; 00100 colvar_grid_gradient *grad_grid_exp_avg; 00101 colvar_grid_gradient *grad_grid_cumulant; 00102 }; 00103 00104 #endif // COLVARBIAS_HISTOGRAM_REWEIGHT_AMD