version 1.16 | version 1.17 |
---|
| |
} | } |
| |
| |
| cvm::real colvar::orientation::dist2(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| return x1.quaternion_value.dist2(x2); |
| } |
| |
| |
| colvarvalue colvar::orientation::dist2_lgrad(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| return x1.quaternion_value.dist2_grad(x2); |
| } |
| |
| |
| colvarvalue colvar::orientation::dist2_rgrad(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| return x2.quaternion_value.dist2_grad(x1); |
| } |
| |
| |
| |
colvar::orientation_angle::orientation_angle(std::string const &conf) | colvar::orientation_angle::orientation_angle(std::string const &conf) |
: orientation(conf) | : orientation(conf) |
| |
} | } |
| |
| |
| simple_scalar_dist_functions(orientation_angle) |
| |
| |
| |
colvar::orientation_proj::orientation_proj(std::string const &conf) | colvar::orientation_proj::orientation_proj(std::string const &conf) |
: orientation(conf) | : orientation(conf) |
| |
} | } |
| |
| |
| simple_scalar_dist_functions(orientation_proj) |
| |
| |
| |
colvar::tilt::tilt(std::string const &conf) | colvar::tilt::tilt(std::string const &conf) |
: orientation(conf) | : orientation(conf) |
| |
} | } |
| |
| |
| simple_scalar_dist_functions(tilt) |
| |
| |
| |
colvar::spin_angle::spin_angle(std::string const &conf) | colvar::spin_angle::spin_angle(std::string const &conf) |
: orientation(conf) | : orientation(conf) |
| |
atoms->apply_colvar_force(fw); | atoms->apply_colvar_force(fw); |
} | } |
} | } |
| |
| |
| cvm::real colvar::spin_angle::dist2(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| cvm::real diff = x1.real_value - x2.real_value; |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); |
| return diff * diff; |
| } |
| |
| |
| colvarvalue colvar::spin_angle::dist2_lgrad(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| cvm::real diff = x1.real_value - x2.real_value; |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); |
| return 2.0 * diff; |
| } |
| |
| |
| colvarvalue colvar::spin_angle::dist2_rgrad(colvarvalue const &x1, |
| colvarvalue const &x2) const |
| { |
| cvm::real diff = x1.real_value - x2.real_value; |
| diff = (diff < -180.0 ? diff + 360.0 : (diff > 180.0 ? diff - 360.0 : diff)); |
| return (-2.0) * diff; |
| } |
| |
| |
| void colvar::spin_angle::wrap(colvarvalue &x) const |
| { |
| if ((x.real_value - wrap_center) >= 180.0) { |
| x.real_value -= 360.0; |
| return; |
| } |
| |
| if ((x.real_value - wrap_center) < -180.0) { |
| x.real_value += 360.0; |
| return; |
| } |
| |
| return; |
| } |