From 9a3ac761533801a27a3fae20409a4b434c92d6a8 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Mon, 16 Sep 2024 16:09:40 +0200 Subject: [PATCH 1/2] Now the forces from LWALLS should be correct (and maybe also the energies) --- src/bias/LWalls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bias/LWalls.cpp b/src/bias/LWalls.cpp index 5e6834234a..fad2ac0947 100644 --- a/src/bias/LWalls.cpp +++ b/src/bias/LWalls.cpp @@ -133,7 +133,7 @@ void LWalls::calculate() { if( lscale < 0.) { const double k=kappa[i]; const double exponent=exp[i]; - double power = std::pow( lscale, exponent ); + double power = std::pow( -lscale, exponent ); f = -( k / epsilon ) * exponent * power / lscale; ene += k * power; totf2 += f * f; From 4d5ab403a162f2ba0ef6b67ac67b31655a61fa00 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Tue, 17 Sep 2024 11:35:14 +0200 Subject: [PATCH 2/2] now the documentation reflects the code better --- src/bias/LWalls.cpp | 6 ++++++ src/bias/UWalls.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/bias/LWalls.cpp b/src/bias/LWalls.cpp index fad2ac0947..dc39572687 100644 --- a/src/bias/LWalls.cpp +++ b/src/bias/LWalls.cpp @@ -35,10 +35,16 @@ The restraining potential starts acting on the system when the value of the CV i minus an offset \f$o_i\f$ (OFFSET). The expression for the bias due to the wall is given by: +for UPPER_WALLS: \f$ \sum_i {k_i}((x_i-a_i+o_i)/s_i)^e_i \f$ +for LOWER_WALLS: +\f$ + \sum_i {k_i}|(x_i-a_i-o_i)/s_i|^e_i +\f$ + \f$k_i\f$ (KAPPA) is an energy constant in internal unit of the code, \f$s_i\f$ (EPS) a rescaling factor and \f$e_i\f$ (EXP) the exponent determining the power law. By default: EXP = 2, EPS = 1.0, OFFSET = 0. diff --git a/src/bias/UWalls.cpp b/src/bias/UWalls.cpp index 0abc063f9e..357b1c3b5a 100644 --- a/src/bias/UWalls.cpp +++ b/src/bias/UWalls.cpp @@ -35,10 +35,16 @@ The restraining potential starts acting on the system when the value of the CV i minus an offset \f$o_i\f$ (OFFSET). The expression for the bias due to the wall is given by: +for UPPER_WALLS: \f$ \sum_i {k_i}((x_i-a_i+o_i)/s_i)^e_i \f$ +for LOWER_WALLS: +\f$ + \sum_i {k_i}|(x_i-a_i-o_i)/s_i|^e_i +\f$ + \f$k_i\f$ (KAPPA) is an energy constant in internal unit of the code, \f$s_i\f$ (EPS) a rescaling factor and \f$e_i\f$ (EXP) the exponent determining the power law. By default: EXP = 2, EPS = 1.0, OFFSET = 0.