| version 1.5 | version 1.6 |
|---|
| |
| } | } |
| force_k = starting_force_k + (target_force_k - starting_force_k) | force_k = starting_force_k + (target_force_k - starting_force_k) |
| * std::pow(lambda, force_k_exp); | * std::pow(lambda, force_k_exp); |
| cvm::log("Restraint " + this->name + ", stage " + | cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage) |
| cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda)); | + " : lambda = " + cvm::to_str(lambda) |
| cvm::log("Setting force constant to " + cvm::to_str(force_k)); | + ", k = " + cvm::to_str(force_k)); |
| } | } |
| | |
| // TI calculation: estimate free energy derivative | // TI calculation: estimate free energy derivative |
| |
| if (cvm::step_absolute() % target_nsteps == 0 && | if (cvm::step_absolute() % target_nsteps == 0 && |
| cvm::step_absolute() > 0) { | cvm::step_absolute() > 0) { |
| | |
| cvm::log("Lambda= " + cvm::to_str(lambda) + " dA/dLambda= " | cvm::log("Restraint " + this->name + " Lambda= " |
| | + cvm::to_str(lambda) + " dA/dLambda= " |
| + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps))); | + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps))); |
| | |
| // ...and move on to the next one | // ...and move on to the next one |
| |
| } | } |
| force_k = starting_force_k + (target_force_k - starting_force_k) | force_k = starting_force_k + (target_force_k - starting_force_k) |
| * std::pow(lambda, force_k_exp); | * std::pow(lambda, force_k_exp); |
| cvm::log("Restraint " + this->name + ", stage " + | cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage) |
| cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda)); | + " : lambda = " + cvm::to_str(lambda) |
| cvm::log("Setting force constant to " + cvm::to_str(force_k)); | + ", k = " + cvm::to_str(force_k)); |
| } | } |
| } | } |
| | |
| |
| colvarbias_restraint_moving(key), | colvarbias_restraint_moving(key), |
| colvarbias_restraint_k_moving(key) | colvarbias_restraint_k_moving(key) |
| { | { |
| | lower_wall_k = 0.0; |
| | upper_wall_k = 0.0; |
| } | } |
| | |
| | |
| |
| colvarbias_restraint_moving::init(conf); | colvarbias_restraint_moving::init(conf); |
| colvarbias_restraint_k_moving::init(conf); | colvarbias_restraint_k_moving::init(conf); |
| | |
| | get_keyval(conf, "lowerWallConstant", lower_wall_k, |
| | (lower_wall_k > 0.0) ? lower_wall_k : force_k); |
| | get_keyval(conf, "upperWallConstant", upper_wall_k, |
| | (upper_wall_k > 0.0) ? upper_wall_k : force_k); |
| | |
| provide(f_cvb_scalar_variables); | provide(f_cvb_scalar_variables); |
| enable(f_cvb_scalar_variables); | enable(f_cvb_scalar_variables); |
| | |
| |
| INPUT_ERROR); | INPUT_ERROR); |
| } | } |
| } | } |
| | if (lower_wall_k * upper_wall_k == 0.0) { |
| | cvm::error("Error: lowerWallConstant and upperWallConstant, " |
| | "when defined, must both be positive.\n", |
| | INPUT_ERROR); |
| | return INPUT_ERROR; |
| | } |
| | force_k = lower_wall_k * upper_wall_k; |
| | // transform the two constants to relative values |
| | // (allow changing both via force_k) |
| | lower_wall_k /= force_k; |
| | upper_wall_k /= force_k; |
| } | } |
| | |
| for (i = 0; i < num_variables(); i++) { | for (i = 0; i < num_variables(); i++) { |
| |
| cvm::real colvarbias_restraint_harmonic_walls::restraint_potential(size_t i) const | cvm::real colvarbias_restraint_harmonic_walls::restraint_potential(size_t i) const |
| { | { |
| cvm::real const dist = colvar_distance(i); | cvm::real const dist = colvar_distance(i); |
| return 0.5 * force_k / (variables(i)->width * variables(i)->width) * | cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k; |
| | return 0.5 * force_k * scale / (variables(i)->width * variables(i)->width) * |
| dist * dist; | dist * dist; |
| } | } |
| | |
| |
| colvarvalue const colvarbias_restraint_harmonic_walls::restraint_force(size_t i) const | colvarvalue const colvarbias_restraint_harmonic_walls::restraint_force(size_t i) const |
| { | { |
| cvm::real const dist = colvar_distance(i); | cvm::real const dist = colvar_distance(i); |
| return - force_k / (variables(i)->width * variables(i)->width) * dist; | cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k; |
| | return - force_k * scale / (variables(i)->width * variables(i)->width) * dist; |
| } | } |
| | |
| | |
| cvm::real colvarbias_restraint_harmonic_walls::d_restraint_potential_dk(size_t i) const | cvm::real colvarbias_restraint_harmonic_walls::d_restraint_potential_dk(size_t i) const |
| { | { |
| cvm::real const dist = colvar_distance(i); | cvm::real const dist = colvar_distance(i); |
| return 0.5 / (variables(i)->width * variables(i)->width) * | cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k; |
| | return 0.5 * scale / (variables(i)->width * variables(i)->width) * |
| dist * dist; | dist * dist; |
| } | } |
| | |