diff --git a/lib/README b/lib/README index 84895ba92da140e3cab6529805d7c52d2b61d33d..98f4cbef17352edbd08a08e29d1c347f35f842ae 100644 --- a/lib/README +++ b/lib/README @@ -13,6 +13,8 @@ atc atomistic-to-continuum methods, USER-ATC package from Reese Jones, Jeremy Templeton, Jon Zimmerman (Sandia) awpmd antisymmetrized wave packet molecular dynamics, AWPMD package from Ilya Valuev (JIHT RAS) +colvars collective variable module (Metadynamics, ABF and more) + from Giacomo Fiorin and Jerome Henin (ICMS, Temple U) cuda NVIDIA GPU routines, USER-CUDA package from Christian Trott (U Tech Ilmenau) gpu graphical processor (GPU) routines, GPU package diff --git a/lib/colvars/colvarcomp.h b/lib/colvars/colvarcomp.h index fd58983c00ebe3d46f47aac79ef5be296a6cc4c5..93278400f99eaf6a6237f5d89f9c651c7a9754bc 100644 --- a/lib/colvars/colvarcomp.h +++ b/lib/colvars/colvarcomp.h @@ -1223,7 +1223,8 @@ inline void colvar::spin_angle::wrap (colvarvalue &x) const inline cvm::real colvar::TYPE::dist2 (colvarvalue const &x1, \ colvarvalue const &x2) const \ { \ - return std::pow (x1.real_value - x2.real_value, int (2)); \ + const cvm::real tmp = x1.real_value - x2.real_value; \ + return tmp*tmp; \ } \ \ inline colvarvalue colvar::TYPE::dist2_lgrad (colvarvalue const &x1, \ diff --git a/lib/colvars/colvarvalue.h b/lib/colvars/colvarvalue.h index 42085bae5a569c04be6be792f265fe895e311787..d78c082af8f6d980dbf35897c6f4f3e6d1fdbfa6 100644 --- a/lib/colvars/colvarvalue.h +++ b/lib/colvars/colvarvalue.h @@ -636,13 +636,17 @@ inline cvm::real colvarvalue::dist2 (colvarvalue const &x2) const colvarvalue::check_types (*this, x2); switch (this->value_type) { - case colvarvalue::type_scalar: - return std::pow (this->real_value - x2.real_value, int (2)); + case colvarvalue::type_scalar: { + const cvm::real tmp = this->real_value - x2.real_value; + return tmp*tmp; + } case colvarvalue::type_vector: return (this->rvector_value - x2.rvector_value).norm2(); - case colvarvalue::type_unitvector: + case colvarvalue::type_unitvector: { // angle between (*this) and x2 is the distance - return std::pow (std::acos (this->rvector_value * x2.rvector_value), int (2)); + const cvm::real tmp = std::acos (this->rvector_value * x2.rvector_value); + return tmp*tmp; + } case colvarvalue::type_quaternion: // angle between (*this) and x2 is the distance, the quaternion // object has it implemented internally