00001
00002
00003
00004
00005 #ifndef COLVARBIAS_ABF_H
00006 #define COLVARBIAS_ABF_H
00007
00008 #include <vector>
00009 #include <list>
00010 #include <sstream>
00011 #include <iomanip>
00012
00013
00014 #include "colvarbias.h"
00015 #include "colvargrid.h"
00016
00017 typedef cvm::real* gradient_t;
00018
00019
00021 class colvarbias_abf : public colvarbias {
00022
00023 public:
00024
00025 colvarbias_abf (std::string const &conf, char const *key);
00026 ~colvarbias_abf ();
00027
00028 void update ();
00029
00030 private:
00031
00033 std::string gradients_out_name;
00034 std::string samples_out_name;
00035 std::string pmf_out_name;
00036
00038 std::vector<std::string> input_prefix;
00039
00040 bool apply_bias;
00041 bool hide_Jacobian;
00042 size_t full_samples;
00043 size_t min_samples;
00045 int output_freq;
00046
00047
00048
00049 std::vector<int> bin, prev_bin;
00050 gradient_t prev_force;
00051
00053 colvar_grid_gradient *gradients;
00055 colvar_grid_count *samples;
00056
00058 void write_gradients_samples ();
00059 std::ofstream gradients_os;
00060 std::ofstream samples_os;
00061 std::ofstream pmf_os;
00062
00064 void read_gradients_samples ();
00065
00066 std::istream& read_restart (std::istream&);
00067 std::ostream& write_restart (std::ostream&);
00068 };
00069
00070
00072 class colvarbias_histogram : public colvarbias {
00073
00074 public:
00075
00076 colvarbias_histogram (std::string const &conf, char const *key);
00077 ~colvarbias_histogram ();
00078
00079 void update ();
00080
00081 private:
00082
00084 colvar_grid_count *grid;
00085 std::vector<int> bin;
00086 std::string out_name;
00087
00088 int output_freq;
00089 void write_grid ();
00090 std::ofstream grid_os;
00091
00092 std::istream& read_restart (std::istream&);
00093 std::ostream& write_restart (std::ostream&);
00094 };
00095
00096 #endif