| version 1.4 | version 1.5 |
|---|
| |
| * | * |
| */ | */ |
| | |
| colvarbias_alb::colvarbias_alb(std::string const &conf, char const *key) : | colvarbias_alb::colvarbias_alb(char const *key) |
| colvarbias(conf, key), update_calls(0), b_equilibration(true) { | : colvarbias(key), update_calls(0), b_equilibration(true) |
| | { |
| | } |
| | |
| | |
| | int colvarbias_alb::init(std::string const &conf) |
| | { |
| | colvarbias::init(conf); |
| | |
| | provide(f_cvb_history_dependent); |
| | |
| size_t i; | size_t i; |
| | |
| // get the initial restraint centers | // get the initial restraint centers |
| |
| current_coupling.resize(colvars.size()); | current_coupling.resize(colvars.size()); |
| coupling_rate.resize(colvars.size()); | coupling_rate.resize(colvars.size()); |
| | |
| | enable(f_cvb_apply_force); |
| | |
| for (i = 0; i < colvars.size(); i++) { | for (i = 0; i < colvars.size(); i++) { |
| colvar_centers[i].type(colvars[i]->value()); | colvar_centers[i].type(colvars[i]->value()); |
| |
| //we split the time between updating and equilibrating | //we split the time between updating and equilibrating |
| update_freq /= 2; | update_freq /= 2; |
| | |
| if (update_freq == 0) | if (update_freq <= 1) |
| cvm::fatal_error("Error: must set updateFrequency to greater than 2.\n"); | cvm::fatal_error("Error: must set updateFrequency to greater than 2.\n"); |
| | |
| | enable(f_cvb_history_dependent); |
| | |
| get_keyval(conf, "outputCenters", b_output_centers, false); | get_keyval(conf, "outputCenters", b_output_centers, false); |
| get_keyval(conf, "outputGradient", b_output_grad, false); | get_keyval(conf, "outputGradient", b_output_grad, false); |
| get_keyval(conf, "outputCoupling", b_output_coupling, true); | get_keyval(conf, "outputCoupling", b_output_coupling, true); |
| |
| } | } |
| } | } |
| | |
| | |
| | |
| if (!get_keyval(conf, "rateMax", max_coupling_rate, max_coupling_rate)) { | if (!get_keyval(conf, "rateMax", max_coupling_rate, max_coupling_rate)) { |
| //set to default | //set to default |
| for (i = 0; i < colvars.size(); i++) { | for (i = 0; i < colvars.size(); i++) { |
| |
| if (cvm::debug()) | if (cvm::debug()) |
| cvm::log(" bias.\n"); | cvm::log(" bias.\n"); |
| | |
| | return COLVARS_OK; |
| } | } |
| | |
| colvarbias_alb::~colvarbias_alb() { | |
| | |
| | colvarbias_alb::~colvarbias_alb() |
| | { |
| if (cvm::n_rest_biases > 0) | if (cvm::n_rest_biases > 0) |
| cvm::n_rest_biases -= 1; | cvm::n_rest_biases -= 1; |
| | |
| } | } |
| | |
| cvm::real colvarbias_alb::update() { | |
| | int colvarbias_alb::update() |
| | { |
| | |
| bias_energy = 0.0; | bias_energy = 0.0; |
| update_calls++; | update_calls++; |
| |
| if (cvm::debug()) | if (cvm::debug()) |
| cvm::log("Updating the adaptive linear bias \""+this->name+"\".\n"); | cvm::log("Updating the adaptive linear bias \""+this->name+"\".\n"); |
| | |
| | |
| | |
| | |
| //log the moments of the CVs | //log the moments of the CVs |
| // Force and energy calculation | // Force and energy calculation |
| bool finished_equil_flag = 1; | bool finished_equil_flag = 1; |
| |
| | |
| } | } |
| | |
| return bias_energy; | return COLVARS_OK; |
| | |
| } | } |
| | |
| | |
| |
| } | } |
| | |
| | |
| cvm::real colvarbias_alb::restraint_potential(cvm::real k, const colvar* x, const colvarvalue &xcenter) const | cvm::real colvarbias_alb::restraint_potential(cvm::real k, |
| | colvar const *x, |
| | colvarvalue const &xcenter) const |
| { | { |
| return k * (x->value() - xcenter); | return k * (x->value() - xcenter); |
| } | } |
| | |
| colvarvalue colvarbias_alb::restraint_force(cvm::real k, const colvar* x, const colvarvalue &xcenter) const | |
| | colvarvalue colvarbias_alb::restraint_force(cvm::real k, |
| | colvar const *x, |
| | colvarvalue const &xcenter) const |
| { | { |
| return k; | return k; |
| } | } |
| | |
| cvm::real colvarbias_alb::restraint_convert_k(cvm::real k, cvm::real dist_measure) const | |
| | cvm::real colvarbias_alb::restraint_convert_k(cvm::real k, |
| | cvm::real dist_measure) const |
| { | { |
| return k / dist_measure; | return k / dist_measure; |
| } | } |