00001 #ifndef COLVARBIAS_H
00002 #define COLVARBIAS_H
00003
00004 #include "colvar.h"
00005 #include "colvarparse.h"
00006
00007
00009 class colvarbias : public colvarparse {
00010 public:
00011
00013 int id;
00014
00016 std::string name;
00017
00019 void add_colvar (std::string const &cv_name);
00020
00023 virtual cvm::real update() = 0;
00024
00026 virtual void change_configuration(std::string const &conf);
00027
00029 virtual cvm::real energy_difference(std::string const &conf);
00030
00032 virtual inline void analyse() {}
00033
00035 void communicate_forces();
00036
00041 colvarbias (std::string const &conf, char const *key);
00042
00044 colvarbias();
00045
00047 virtual inline ~colvarbias() {}
00048
00050 virtual std::istream & read_restart (std::istream &is) = 0;
00051
00053 virtual std::ostream & write_restart (std::ostream &os) = 0;
00054
00055 protected:
00056
00060 std::vector<colvar *> colvars;
00061
00063 std::vector<colvarvalue> colvar_forces;
00064
00067 cvm::real bias_energy;
00068
00071 bool has_data;
00072
00073 };
00074
00075
00078 class colvarbias_harmonic : public colvarbias {
00079
00080 public:
00081
00083 virtual cvm::real update();
00084
00086 virtual void change_configuration(std::string const &conf);
00087
00089 virtual cvm::real energy_difference(std::string const &conf);
00090
00092 virtual std::istream & read_restart (std::istream &is);
00093
00095 virtual std::ostream & write_restart (std::ostream &os);
00096
00098 colvarbias_harmonic (std::string const &conf, char const *key);
00099
00101 virtual inline ~colvarbias_harmonic() {}
00102
00103
00104 protected:
00105
00107 std::vector<colvarvalue> colvar_centers;
00108
00110 std::vector<colvarvalue> colvar_centers_raw;
00111
00113 cvm::real force_k;
00114
00116 bool b_chg_centers;
00117
00119 bool b_chg_force_k;
00120
00122 cvm::real target_force_k;
00123
00125 cvm::real target_equil_steps;
00126
00128 cvm::real starting_force_k;
00129
00131 std::vector<cvm::real> lambda_schedule;
00132
00134 std::vector<colvarvalue> target_centers;
00135
00138 std::vector<colvarvalue> centers_incr;
00139
00141 cvm::real force_k_exp;
00142
00145 size_t target_nsteps;
00146
00149 int target_nstages;
00150
00152 int stage;
00153
00156 cvm::real restraint_FE;
00157 };
00158
00159
00160 #endif
00161
00162
00163
00164
00165
00166
00167