| 1 | // -*- c++ -*-cxx . . $ `<file>/src/external/colvars/colvarbias_restraint.h`/ |
| 2 | |
| 3 | // This file is part of the Collective Variables module (Colvars). |
| 4 | // The original version of Colvars and its updates are located at: |
| 5 | // https://github.com/Colvars/colvars |
| 6 | // Please update all Colvars source files before making any changes. |
| 7 | // If you wish to distribute your changes, please submit them to the |
| 8 | // Colvars repository at GitHub. |
| 9 | |
| 10 | #ifndef COLVARBIAS_RESTRAINT_H |
| 11 | #define COLVARBIAS_RESTRAINT_Hcxx . . $ `src/external/colvars/colvarbias_restraint.h:11:9`! |
| 12 | |
| 13 | #include "colvarbias.h"cxx . . $ `<file>/src/external/colvars/colvarbias.h`/ |
| 14 | |
| 15 | #ifdef _MSC_VER |
| 16 | #pragma warning(push) |
| 17 | #pragma warning(disable : 4250) // Silence diamond inheritance warning |
| 18 | #endif |
| 19 | |
| 20 | /// \brief Most general definition of a colvar restraint: |
| 21 | /// see derived classes for specific types |
| 22 | /// (implementation of \link colvarbias \endlink) |
| 23 | class colvarbias_restraintcxx . . $ colvarbias_restraint# |
| 24 | : public virtual colvarbiascxx . . $ colvarbias#, |
| 25 | public virtual colvarbias_ticxx . . $ colvarbias_ti# |
| 26 | { |
| 27 | |
| 28 | public: |
| 29 | |
| 30 | /// Retrieve colvar values and calculate their biasing forces |
| 31 | virtual int updatecxx . . $ colvarbias_restraint#update(b126dc7c1de90089).(); |
| 32 | |
| 33 | /// Load new configuration - force constant and/or centers only |
| 34 | virtual int change_configurationcxx . . $ colvarbias_restraint#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const & /* conf */) { return COLVARS_NOT_IMPLEMENTEDcxx . . $ `$anonymous_namespace_src/external/colvars/colvarbias_restraint.cpp`/COLVARS_NOT_IMPLEMENTED.; } |
| 35 | |
| 36 | /// Calculate change in energy from using alternate configuration |
| 37 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# energy_differencecxx . . $ colvarbias_restraint#energy_difference(610a939d150cc19e).(stdcxx . . $ std/::stringcxx . . $ std/string# const & /* conf */) { return 0.0; } |
| 38 | |
| 39 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint#get_state_params(fcf7e9886c190261).() const; |
| 40 | virtual int set_state_paramscxx . . $ colvarbias_restraint#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 41 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 42 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 43 | |
| 44 | /// \brief Constructor |
| 45 | colvarbias_restraintcxx . . $ colvarbias_restraint#colvarbias_restraint(85c52e162fed56f9).(char const *key); |
| 46 | |
| 47 | virtual int initcxx . . $ colvarbias_restraint#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 48 | virtual ~cxx . . $ colvarbias_restraint#`~colvarbias_restraint`(ced63f7c635d850d).colvarbias_restraintcxx . . $ colvarbias_restraint#(); |
| 49 | |
| 50 | |
| 51 | protected: |
| 52 | |
| 53 | /// \brief Potential function for the i-th colvar |
| 54 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# restraint_potentialcxx . . $ colvarbias_restraint#restraint_potential(14f2d1c4d23ae1d7).(size_t i) const = 0; |
| 55 | |
| 56 | /// \brief Force function for the i-th colvar |
| 57 | virtual colvarvaluecxx . . $ colvarvalue# const restraint_forcecxx . . $ colvarbias_restraint#restraint_force(7a2b002cab749383).(size_t i) const = 0; |
| 58 | |
| 59 | /// \brief Derivative of the potential function with respect to the force constant |
| 60 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# d_restraint_potential_dkcxx . . $ colvarbias_restraint#d_restraint_potential_dk(14f2d1c4d23ae1d7).(size_t i) const = 0; |
| 61 | }; |
| 62 | |
| 63 | |
| 64 | /// Definition and parsing of the restraint centers |
| 65 | class colvarbias_restraint_centerscxx . . $ colvarbias_restraint_centers# |
| 66 | : public virtual colvarbias_restraintcxx . . $ colvarbias_restraint# |
| 67 | { |
| 68 | public: |
| 69 | |
| 70 | colvarbias_restraint_centerscxx . . $ colvarbias_restraint_centers#colvarbias_restraint_centers(85c52e162fed56f9).(char const *key); |
| 71 | virtual int initcxx . . $ colvarbias_restraint_centers#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 72 | virtual int change_configurationcxx . . $ colvarbias_restraint_centers#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 73 | |
| 74 | protected: |
| 75 | |
| 76 | /// \brief Restraint centers |
| 77 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> colvar_centerscxx . . $ colvarbias_restraint_centers#colvar_centers.; |
| 78 | }; |
| 79 | |
| 80 | |
| 81 | /// Definition and parsing of the force constant |
| 82 | class colvarbias_restraint_kcxx . . $ colvarbias_restraint_k# |
| 83 | : public virtual colvarbias_restraintcxx . . $ colvarbias_restraint# |
| 84 | { |
| 85 | public: |
| 86 | |
| 87 | colvarbias_restraint_kcxx . . $ colvarbias_restraint_k#colvarbias_restraint_k(85c52e162fed56f9).(char const *key); |
| 88 | virtual int initcxx . . $ colvarbias_restraint_k#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 89 | virtual int change_configurationcxx . . $ colvarbias_restraint_k#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 90 | |
| 91 | protected: |
| 92 | |
| 93 | /// \brief Restraint force constant |
| 94 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# force_kcxx . . $ colvarbias_restraint_k#force_k.; |
| 95 | |
| 96 | /// \brief Whether the force constant should be positive |
| 97 | bool check_positive_kcxx . . $ colvarbias_restraint_k#check_positive_k.; |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | /// Options to change the restraint configuration over time (shared between centers and k moving) |
| 102 | class colvarbias_restraint_movingcxx . . $ colvarbias_restraint_moving# |
| 103 | : public virtual colvarbias_restraintcxx . . $ colvarbias_restraint#, |
| 104 | public virtual colvarparsecxx . . $ colvarparse#, |
| 105 | public virtual colvardepscxx . . $ colvardeps# { |
| 106 | public: |
| 107 | |
| 108 | colvarbias_restraint_movingcxx . . $ colvarbias_restraint_moving#colvarbias_restraint_moving(85c52e162fed56f9).(char const *key) |
| 109 | : colvarbiascxx . . $ colvarbias#colvarbias(85c52e162fed56f9).(key), |
| 110 | colvarbias_ticxx . . $ colvarbias_ti#(key), |
| 111 | colvarbias_restraintcxx . . $ colvarbias_restraint#(key) {} |
| 112 | // Note: despite the diamond inheritance, most of this function gets only executed once |
| 113 | virtual int initcxx . . $ colvarbias_restraint_moving#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 114 | virtual int updatecxx . . $ colvarbias_restraint_moving#update(b126dc7c1de90089).() override; |
| 115 | virtual int change_configurationcxx . . $ colvarbias_restraint_moving#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const & /* conf */) override { return COLVARS_NOT_IMPLEMENTEDcxx . . $ `$anonymous_namespace_src/external/colvars/colvarmodule.cpp`/COLVARS_NOT_IMPLEMENTED.; } |
| 116 | |
| 117 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_moving#get_state_params(fcf7e9886c190261).() const override; |
| 118 | virtual int set_state_paramscxx . . $ colvarbias_restraint_moving#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 119 | |
| 120 | protected: |
| 121 | |
| 122 | /// \brief Moving target? |
| 123 | bool b_chg_centerscxx . . $ colvarbias_restraint_moving#b_chg_centers. = false; |
| 124 | |
| 125 | /// \brief Changing force constant? |
| 126 | bool b_chg_force_kcxx . . $ colvarbias_restraint_moving#b_chg_force_k. = false; |
| 127 | |
| 128 | /// \brief Changing wall locations? |
| 129 | bool b_chg_wallscxx . . $ colvarbias_restraint_moving#b_chg_walls. = false; |
| 130 | |
| 131 | /// @brief Update the force constant by interpolating between initial and target |
| 132 | virtual void update_kcxx . . $ colvarbias_restraint_moving#update_k(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# /* lambda */) {} |
| 133 | /// @brief Update the centers by interpolating between initial and target |
| 134 | virtual void update_centerscxx . . $ colvarbias_restraint_moving#update_centers(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# /* lambda */) {} |
| 135 | /// @brief Update the walls by interpolating between initial and target |
| 136 | virtual void update_wallscxx . . $ colvarbias_restraint_moving#update_walls(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# /* lambda */) {} |
| 137 | /// \brief Compute the derivative of the free energy wrt lambda due to changing k |
| 138 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_kcxx . . $ colvarbias_restraint_moving#dU_dlambda_k(21b6c25e127938e2).() const { return 0.0; } |
| 139 | /// \brief Compute the derivative of the free energy wrt lambda due to changing centers |
| 140 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_centerscxx . . $ colvarbias_restraint_moving#dU_dlambda_centers(21b6c25e127938e2).() const { return 0.0; } |
| 141 | /// \brief Compute the derivative of the free energy wrt lambda due to changing walls |
| 142 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_wallscxx . . $ colvarbias_restraint_moving#dU_dlambda_walls(21b6c25e127938e2).() const { return 0.0; } |
| 143 | |
| 144 | /// \brief Perform decoupling of the restraint? If yes, lambda goes from 1 to 0 |
| 145 | bool b_decouplingcxx . . $ colvarbias_restraint_moving#b_decoupling.; |
| 146 | |
| 147 | /// \brief Number of stages over which to perform the change |
| 148 | /// If zero, perform a continuous change |
| 149 | /// First step is ignored, then steps within each run of target_nsteps |
| 150 | /// count for one stage. |
| 151 | int target_nstagescxx . . $ colvarbias_restraint_moving#target_nstages. = 0; |
| 152 | |
| 153 | /// \brief Number of current stage of the perturbation |
| 154 | /// Starts at 0, goes up to target_nstages during the perturbation |
| 155 | int stagecxx . . $ colvarbias_restraint_moving#stage. = 0; |
| 156 | |
| 157 | /// \brief Accumulating restraint FE derivative wrt lambda |
| 158 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dA_dlambdacxx . . $ colvarbias_restraint_moving#dA_dlambda. = 0.0; |
| 159 | |
| 160 | /// \brief Update the stage number based on the current step |
| 161 | /// Note: this is idempotent so multiple calls are safe |
| 162 | inline void update_stagecxx . . $ colvarbias_restraint_moving#update_stage(49f6e7a06ebc5aa8).() { |
| 163 | stagecxx . . $ colvarbias_restraint_moving#stage. = (cvmcxx . . $ cvm#::step_absolutecxx . . $ colvarmodule#step_absolute(a5d9f2bf8849668d).() - first_stepcxx . . $ colvarbias_restraint_moving#first_step.) / target_nstepscxx . . $ colvarbias_restraint_moving#target_nsteps.; |
| 164 | if (stagecxx . . $ colvarbias_restraint_moving#stage. > target_nstagescxx . . $ colvarbias_restraint_moving#target_nstages.) { |
| 165 | stagecxx . . $ colvarbias_restraint_moving#stage. = target_nstagescxx . . $ colvarbias_restraint_moving#target_nstages.; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /// \brief Get lambda value for the current stage |
| 170 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# current_lambdacxx . . $ colvarbias_restraint_moving#current_lambda(21b6c25e127938e2).() const; |
| 171 | |
| 172 | /// \brief Lambda-schedule for custom varying force constant |
| 173 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real#> lambda_schedulecxx . . $ colvarbias_restraint_moving#lambda_schedule.; |
| 174 | |
| 175 | /// \brief Number of steps required to reach the target force constant |
| 176 | /// or restraint centers |
| 177 | cvmcxx . . $ cvm#::step_numbercxx . . $ colvarmodule#step_number# target_nstepscxx . . $ colvarbias_restraint_moving#target_nsteps. = 0L; |
| 178 | |
| 179 | /// \brief Equilibration steps for restraint FE calculation through TI |
| 180 | cvmcxx . . $ cvm#::step_numbercxx . . $ colvarmodule#step_number# target_equil_stepscxx . . $ colvarbias_restraint_moving#target_equil_steps. = 0L; |
| 181 | |
| 182 | /// \brief Timestep at which the restraint starts moving |
| 183 | cvmcxx . . $ cvm#::step_numbercxx . . $ colvarmodule#step_number# first_stepcxx . . $ colvarbias_restraint_moving#first_step. = 0L; |
| 184 | |
| 185 | /// \brief Accumulated work (computed when outputAccumulatedWork == true) |
| 186 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# acc_workcxx . . $ colvarbias_restraint_moving#acc_work. = 0.0; |
| 187 | }; |
| 188 | |
| 189 | |
| 190 | /// Options to change the restraint centers over time |
| 191 | class colvarbias_restraint_centers_movingcxx . . $ colvarbias_restraint_centers_moving# |
| 192 | : public virtual colvarbias_restraint_centerscxx . . $ colvarbias_restraint_centers#, |
| 193 | public virtual colvarbias_restraint_movingcxx . . $ colvarbias_restraint_moving# |
| 194 | { |
| 195 | public: |
| 196 | |
| 197 | colvarbias_restraint_centers_movingcxx . . $ colvarbias_restraint_centers_moving#colvarbias_restraint_centers_moving(85c52e162fed56f9).(char const *key); |
| 198 | virtual int initcxx . . $ colvarbias_restraint_centers_moving#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 199 | virtual int change_configurationcxx . . $ colvarbias_restraint_centers_moving#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const & /* conf */) override { return COLVARS_NOT_IMPLEMENTEDcxx . . $ `$anonymous_namespace_src/external/colvars/colvarbias_abmd.cpp`/COLVARS_NOT_IMPLEMENTED.; } |
| 200 | |
| 201 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_centers_moving#get_state_params(fcf7e9886c190261).() const override; |
| 202 | virtual int set_state_paramscxx . . $ colvarbias_restraint_centers_moving#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 203 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_centers_moving#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 204 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_centers_moving#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 205 | |
| 206 | protected: |
| 207 | |
| 208 | /// \brief New restraint centers |
| 209 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> target_centerscxx . . $ colvarbias_restraint_centers_moving#target_centers.; |
| 210 | |
| 211 | /// \brief Initial value of the restraint centers |
| 212 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> initial_centerscxx . . $ colvarbias_restraint_centers_moving#initial_centers.; |
| 213 | |
| 214 | /// \brief Increment of the restraint centers at each step |
| 215 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> centers_incrcxx . . $ colvarbias_restraint_centers_moving#centers_incr.; |
| 216 | |
| 217 | /// \brief Update the centers by interpolating between initial and target |
| 218 | void update_centerscxx . . $ colvarbias_restraint_centers_moving#update_centers(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lambda) override; |
| 219 | |
| 220 | /// \brief Compute the derivative of the free energy wrt lambda due to changing centers |
| 221 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_centerscxx . . $ colvarbias_restraint_centers_moving#dU_dlambda_centers(21b6c25e127938e2).() const override; |
| 222 | |
| 223 | /// Whether to write the current restraint centers to the trajectory file |
| 224 | bool b_output_centerscxx . . $ colvarbias_restraint_centers_moving#b_output_centers.; |
| 225 | |
| 226 | /// Update the accumulated work |
| 227 | int update_acc_workcxx . . $ colvarbias_restraint_centers_moving#update_acc_work(b126dc7c1de90089).(); |
| 228 | }; |
| 229 | |
| 230 | |
| 231 | /// Options to change the restraint force constant over time |
| 232 | class colvarbias_restraint_k_movingcxx . . $ colvarbias_restraint_k_moving# |
| 233 | : public virtual colvarbias_restraint_kcxx . . $ colvarbias_restraint_k#, |
| 234 | public virtual colvarbias_restraint_movingcxx . . $ colvarbias_restraint_moving# |
| 235 | { |
| 236 | public: |
| 237 | |
| 238 | colvarbias_restraint_k_movingcxx . . $ colvarbias_restraint_k_moving#colvarbias_restraint_k_moving(85c52e162fed56f9).(char const *key); |
| 239 | virtual int initcxx . . $ colvarbias_restraint_k_moving#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 240 | virtual int change_configurationcxx . . $ colvarbias_restraint_k_moving#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const & /* conf */) override { return COLVARS_NOT_IMPLEMENTEDcxx . . $ `$anonymous_namespace_src/external/colvars/colvarbias_restraint.cpp`/COLVARS_NOT_IMPLEMENTED.; } |
| 241 | |
| 242 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_k_moving#get_state_params(fcf7e9886c190261).() const override; |
| 243 | virtual int set_state_paramscxx . . $ colvarbias_restraint_k_moving#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 244 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_k_moving#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 245 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_k_moving#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 246 | |
| 247 | protected: |
| 248 | |
| 249 | /// \brief Restraint force constant (target value at lambda = 1) |
| 250 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# target_force_kcxx . . $ colvarbias_restraint_k_moving#target_force_k.; |
| 251 | |
| 252 | /// \brief Restraint force constant at lambda = 0 |
| 253 | /// (generally starting value, but is final value in the decoupling case) |
| 254 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# starting_force_kcxx . . $ colvarbias_restraint_k_moving#starting_force_k.; |
| 255 | |
| 256 | /// \brief Exponent for varying the force constant |
| 257 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lambda_expcxx . . $ colvarbias_restraint_k_moving#lambda_exp.; |
| 258 | |
| 259 | /// \brief Increment of the force constant at each step |
| 260 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# force_k_incrcxx . . $ colvarbias_restraint_k_moving#force_k_incr.; |
| 261 | |
| 262 | /// \brief Update the force constant by interpolating between initial and target |
| 263 | void update_kcxx . . $ colvarbias_restraint_k_moving#update_k(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lambda) override; |
| 264 | |
| 265 | /// \brief Compute the derivative of the free energy wrt lambda due to changing k |
| 266 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_kcxx . . $ colvarbias_restraint_k_moving#dU_dlambda_k(21b6c25e127938e2).() const override; |
| 267 | |
| 268 | /// Update the accumulated work |
| 269 | int update_acc_workcxx . . $ colvarbias_restraint_k_moving#update_acc_work(b126dc7c1de90089).(); |
| 270 | }; |
| 271 | |
| 272 | |
| 273 | /// \brief Harmonic bias restraint |
| 274 | /// (implementation of \link colvarbias_restraint \endlink) |
| 275 | class colvarbias_restraint_harmoniccxx . . $ colvarbias_restraint_harmonic# |
| 276 | : public colvarbias_restraint_centers_movingcxx . . $ colvarbias_restraint_centers_moving#, |
| 277 | public colvarbias_restraint_k_movingcxx . . $ colvarbias_restraint_k_moving# |
| 278 | { |
| 279 | public: |
| 280 | colvarbias_restraint_harmoniccxx . . $ colvarbias_restraint_harmonic#colvarbias_restraint_harmonic(85c52e162fed56f9).(char const *key); |
| 281 | virtual int initcxx . . $ colvarbias_restraint_harmonic#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 282 | virtual int updatecxx . . $ colvarbias_restraint_harmonic#update(b126dc7c1de90089).(); |
| 283 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_harmonic#get_state_params(fcf7e9886c190261).() const; |
| 284 | virtual int set_state_paramscxx . . $ colvarbias_restraint_harmonic#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 285 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_harmonic#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 286 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_harmonic#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 287 | virtual int change_configurationcxx . . $ colvarbias_restraint_harmonic#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 288 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# energy_differencecxx . . $ colvarbias_restraint_harmonic#energy_difference(610a939d150cc19e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 289 | |
| 290 | protected: |
| 291 | |
| 292 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# restraint_potentialcxx . . $ colvarbias_restraint_harmonic#restraint_potential(14f2d1c4d23ae1d7).(size_t i) const; |
| 293 | virtual colvarvaluecxx . . $ colvarvalue# const restraint_forcecxx . . $ colvarbias_restraint_harmonic#restraint_force(7a2b002cab749383).(size_t i) const; |
| 294 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# d_restraint_potential_dkcxx . . $ colvarbias_restraint_harmonic#d_restraint_potential_dk(14f2d1c4d23ae1d7).(size_t i) const; |
| 295 | }; |
| 296 | |
| 297 | |
| 298 | /// \brief Wall restraint |
| 299 | /// (implementation of \link colvarbias_restraint \endlink) |
| 300 | class colvarbias_restraint_harmonic_wallscxx . . $ colvarbias_restraint_harmonic_walls# |
| 301 | : public colvarbias_restraint_k_movingcxx . . $ colvarbias_restraint_k_moving# |
| 302 | { |
| 303 | public: |
| 304 | |
| 305 | colvarbias_restraint_harmonic_wallscxx . . $ colvarbias_restraint_harmonic_walls#colvarbias_restraint_harmonic_walls(85c52e162fed56f9).(char const *key); |
| 306 | virtual int initcxx . . $ colvarbias_restraint_harmonic_walls#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 307 | virtual int updatecxx . . $ colvarbias_restraint_harmonic_walls#update(b126dc7c1de90089).() override; |
| 308 | virtual int update_acc_workcxx . . $ colvarbias_restraint_harmonic_walls#update_acc_work(b126dc7c1de90089).(); |
| 309 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_harmonic_walls#get_state_params(fcf7e9886c190261).() const override; |
| 310 | virtual int set_state_paramscxx . . $ colvarbias_restraint_harmonic_walls#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 311 | virtual int change_configurationcxx . . $ colvarbias_restraint_harmonic_walls#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf) override; |
| 312 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_harmonic_walls#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 313 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_harmonic_walls#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os) override; |
| 314 | |
| 315 | protected: |
| 316 | |
| 317 | /// \brief Location of the lower walls |
| 318 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> lower_wallscxx . . $ colvarbias_restraint_harmonic_walls#lower_walls.; |
| 319 | |
| 320 | /// \brief Location of the upper walls |
| 321 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> upper_wallscxx . . $ colvarbias_restraint_harmonic_walls#upper_walls.; |
| 322 | |
| 323 | /// \brief If both walls are defined, use this k for the lower |
| 324 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lower_wall_kcxx . . $ colvarbias_restraint_harmonic_walls#lower_wall_k.; |
| 325 | |
| 326 | /// \brief If both walls are defined, use this k for the upper |
| 327 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# upper_wall_kcxx . . $ colvarbias_restraint_harmonic_walls#upper_wall_k.; |
| 328 | |
| 329 | /// \brief Location of the target lower wall, for moving the wall |
| 330 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> target_lower_wallscxx . . $ colvarbias_restraint_harmonic_walls#target_lower_walls.; |
| 331 | |
| 332 | /// \brief Initial value of the lower walls |
| 333 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> initial_lower_wallscxx . . $ colvarbias_restraint_harmonic_walls#initial_lower_walls.; |
| 334 | |
| 335 | /// \brief Increment of the lower walls at each step |
| 336 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> lower_walls_incrcxx . . $ colvarbias_restraint_harmonic_walls#lower_walls_incr.; |
| 337 | |
| 338 | /// \brief Location of the target upper wall, for moving the wall |
| 339 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> target_upper_wallscxx . . $ colvarbias_restraint_harmonic_walls#target_upper_walls.; |
| 340 | |
| 341 | /// \brief Initial value of upper lower walls |
| 342 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> initial_upper_wallscxx . . $ colvarbias_restraint_harmonic_walls#initial_upper_walls.; |
| 343 | |
| 344 | /// \brief Increment of the upper walls at each step |
| 345 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<colvarvaluecxx . . $ colvarvalue#> upper_walls_incrcxx . . $ colvarbias_restraint_harmonic_walls#upper_walls_incr.; |
| 346 | |
| 347 | /// \brief Signed distance to relevant wall (lower if below, upper if above) |
| 348 | /// In PBC, only sees the closer of the two walls |
| 349 | /// If negative, relates to lower wall - if positive, to upper wall |
| 350 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# colvar_distancecxx . . $ colvarbias_restraint_harmonic_walls#colvar_distance(14f2d1c4d23ae1d7).(size_t i) const; |
| 351 | |
| 352 | /// \brief Update the walls by interpolating between initial and target |
| 353 | void update_wallscxx . . $ colvarbias_restraint_harmonic_walls#update_walls(ba8836b59fb42830).(cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lambda) override; |
| 354 | |
| 355 | /// \brief Compute the derivative of the free energy wrt lambda due to changing walls |
| 356 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# dU_dlambda_wallscxx . . $ colvarbias_restraint_harmonic_walls#dU_dlambda_walls(21b6c25e127938e2).() const override; |
| 357 | |
| 358 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# restraint_potentialcxx . . $ colvarbias_restraint_harmonic_walls#restraint_potential(14f2d1c4d23ae1d7).(size_t i) const override; |
| 359 | virtual colvarvaluecxx . . $ colvarvalue# const restraint_forcecxx . . $ colvarbias_restraint_harmonic_walls#restraint_force(7a2b002cab749383).(size_t i) const override; |
| 360 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# d_restraint_potential_dkcxx . . $ colvarbias_restraint_harmonic_walls#d_restraint_potential_dk(14f2d1c4d23ae1d7).(size_t i) const override; |
| 361 | }; |
| 362 | |
| 363 | |
| 364 | /// \brief Linear bias restraint |
| 365 | /// (implementation of \link colvarbias_restraint \endlink) |
| 366 | class colvarbias_restraint_linearcxx . . $ colvarbias_restraint_linear# |
| 367 | : public colvarbias_restraint_centers_movingcxx . . $ colvarbias_restraint_centers_moving#, |
| 368 | public colvarbias_restraint_k_movingcxx . . $ colvarbias_restraint_k_moving# |
| 369 | { |
| 370 | |
| 371 | public: |
| 372 | colvarbias_restraint_linearcxx . . $ colvarbias_restraint_linear#colvarbias_restraint_linear(85c52e162fed56f9).(char const *key); |
| 373 | virtual int initcxx . . $ colvarbias_restraint_linear#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 374 | virtual int updatecxx . . $ colvarbias_restraint_linear#update(b126dc7c1de90089).(); |
| 375 | virtual int change_configurationcxx . . $ colvarbias_restraint_linear#change_configuration(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 376 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# energy_differencecxx . . $ colvarbias_restraint_linear#energy_difference(610a939d150cc19e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 377 | |
| 378 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# const get_state_paramscxx . . $ colvarbias_restraint_linear#get_state_params(fcf7e9886c190261).() const; |
| 379 | virtual int set_state_paramscxx . . $ colvarbias_restraint_linear#set_state_params(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 380 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_linear#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 381 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_linear#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 382 | |
| 383 | protected: |
| 384 | |
| 385 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# restraint_potentialcxx . . $ colvarbias_restraint_linear#restraint_potential(14f2d1c4d23ae1d7).(size_t i) const; |
| 386 | virtual colvarvaluecxx . . $ colvarvalue# const restraint_forcecxx . . $ colvarbias_restraint_linear#restraint_force(7a2b002cab749383).(size_t i) const; |
| 387 | virtual cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# d_restraint_potential_dkcxx . . $ colvarbias_restraint_linear#d_restraint_potential_dk(14f2d1c4d23ae1d7).(size_t i) const; |
| 388 | }; |
| 389 | |
| 390 | |
| 391 | /// Restrain the 1D histogram of a set of variables (or of a multidimensional one) |
| 392 | // TODO this could be reimplemented more cleanly as a derived class of both restraint and histogram |
| 393 | class colvarbias_restraint_histogramcxx . . $ colvarbias_restraint_histogram# : public colvarbiascxx . . $ colvarbias# { |
| 394 | |
| 395 | public: |
| 396 | |
| 397 | colvarbias_restraint_histogramcxx . . $ colvarbias_restraint_histogram#colvarbias_restraint_histogram(85c52e162fed56f9).(char const *key); |
| 398 | int initcxx . . $ colvarbias_restraint_histogram#init(7787e0c995c81e02).(stdcxx . . $ std/::stringcxx . . $ std/string# const &conf); |
| 399 | ~cxx . . $ colvarbias_restraint_histogram#`~colvarbias_restraint_histogram`(ced63f7c635d850d).colvarbias_restraint_histogramcxx . . $ colvarbias_restraint_histogram#(); |
| 400 | |
| 401 | virtual int updatecxx . . $ colvarbias_restraint_histogram#update(b126dc7c1de90089).(); |
| 402 | |
| 403 | virtual int write_output_filescxx . . $ colvarbias_restraint_histogram#write_output_files(b126dc7c1de90089).(); |
| 404 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_traj_labelcxx . . $ colvarbias_restraint_histogram#write_traj_label(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 405 | virtual stdcxx . . $ std/::ostreamcxx . . $ std/ostream# & write_trajcxx . . $ colvarbias_restraint_histogram#write_traj(f33a862e9c1098ca).(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &os); |
| 406 | |
| 407 | protected: |
| 408 | |
| 409 | /// Probability density |
| 410 | cvmcxx . . $ cvm#::vector1dcxx . . $ colvarmodule#vector1d#<cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real#> pcxx . . $ colvarbias_restraint_histogram#p.; |
| 411 | |
| 412 | /// Reference probability density |
| 413 | cvmcxx . . $ cvm#::vector1dcxx . . $ colvarmodule#vector1d#<cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real#> ref_pcxx . . $ colvarbias_restraint_histogram#ref_p.; |
| 414 | |
| 415 | /// Difference between probability density and reference |
| 416 | cvmcxx . . $ cvm#::vector1dcxx . . $ colvarmodule#vector1d#<cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real#> p_diffcxx . . $ colvarbias_restraint_histogram#p_diff.; |
| 417 | |
| 418 | /// Lower boundary of the grid |
| 419 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# lower_boundarycxx . . $ colvarbias_restraint_histogram#lower_boundary.; |
| 420 | |
| 421 | /// Upper boundary of the grid |
| 422 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# upper_boundarycxx . . $ colvarbias_restraint_histogram#upper_boundary.; |
| 423 | |
| 424 | /// Resolution of the grid |
| 425 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# widthcxx . . $ colvarbias_restraint_histogram#width.; |
| 426 | |
| 427 | /// Width of the Gaussians |
| 428 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# gaussian_widthcxx . . $ colvarbias_restraint_histogram#gaussian_width.; |
| 429 | |
| 430 | /// Restraint force constant |
| 431 | cvmcxx . . $ cvm#::realcxx . . $ colvarmodule#real# force_kcxx . . $ colvarbias_restraint_histogram#force_k.; |
| 432 | |
| 433 | /// Write the histogram to a file |
| 434 | bool b_write_histogramcxx . . $ colvarbias_restraint_histogram#b_write_histogram.; |
| 435 | }; |
| 436 | |
| 437 | #ifdef _MSC_VER |
| 438 | #pragma warning(pop) |
| 439 | #endif |
| 440 | |
| 441 | #endif |