| version 1.26 | version 1.27 |
|---|
| |
| // For a periodic colvar, both walls may be applicable at the same time | // For a periodic colvar, both walls may be applicable at the same time |
| // in which case we pick the closer one | // in which case we pick the closer one |
| if ( (!is_enabled(f_cv_upper_wall)) || | if ( (!is_enabled(f_cv_upper_wall)) || |
| (this->dist2(x, lower_wall) < this->dist2(x, upper_wall)) ) { | (this->dist2(x_reported, lower_wall) < this->dist2(x_reported, upper_wall)) ) { |
| | |
| cvm::real const grad = this->dist2_lgrad(x, lower_wall); | cvm::real const grad = this->dist2_lgrad(x_reported, lower_wall); |
| if (grad < 0.0) { | if (grad < 0.0) { |
| fw = -0.5 * lower_wall_k * grad; | fw = -0.5 * lower_wall_k * grad; |
| f += fw; | f += fw; |
| |
| | |
| } else { | } else { |
| | |
| cvm::real const grad = this->dist2_lgrad(x, upper_wall); | cvm::real const grad = this->dist2_lgrad(x_reported, upper_wall); |
| if (grad > 0.0) { | if (grad > 0.0) { |
| fw = -0.5 * upper_wall_k * grad; | fw = -0.5 * upper_wall_k * grad; |
| f += fw; | f += fw; |
| |
| // atoms only feel the harmonic force | // atoms only feel the harmonic force |
| // fr: bias force on extended variable (without harmonic spring), for output in trajectory | // fr: bias force on extended variable (without harmonic spring), for output in trajectory |
| // f_ext: total force on extended variable (including harmonic spring) | // f_ext: total force on extended variable (including harmonic spring) |
| // f: - initially, external biasing force | // f: - initially, external biasing force (including wall forces) |
| // - after this code block, colvar force to be applied to atomic coordinates, ie. spring force | // - after this code block, colvar force to be applied to atomic coordinates, ie. spring force |
| fr = f; | fr = f; |
| f_ext = f + (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x); | f_ext = f + (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x); |