Skip to content

Commit f80f7b1

Browse files
committed
Change threshold to 1e-7
to encompass complete region where Taylor expansion is more regular than original expression.
1 parent 13d2dbc commit f80f7b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/colvarcomp_coordnums.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
5757

5858
cvm::real const xn = cvm::integer_power(l2, en2);
5959
cvm::real const xd = cvm::integer_power(l2, ed2);
60-
cvm::real const eps = 1.0e-8;
60+
cvm::real const eps_l2 = 1.0e-7;
6161
cvm::real const h = l2 - 1.0;
6262
cvm::real const en2_r = (cvm::real) en2;
6363
cvm::real const ed2_r = (cvm::real) ed2;
6464

6565
// Function value: 1st-order Taylor expansion around l2 = 1
66-
cvm::real const func_no_pairlist = (std::abs(h) < eps) ?
66+
cvm::real const func_no_pairlist = (std::abs(h) < eps_l2) ?
6767
(en2_r / ed2_r) + h * (en2_r * (en2_r - ed2_r) / (2.0 * ed2_r)) :
6868
(1.0 - xn) / (1.0 - xd);
6969

@@ -86,7 +86,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
8686

8787
if (flags & ef_gradients) {
8888
// Logarithmic derivative: 1st-order Taylor expansion around l2 = 1
89-
cvm::real const log_deriv = (std::abs(h) < eps) ?
89+
cvm::real const log_deriv = (std::abs(h) < eps_l2) ?
9090
0.5 * (en2_r - ed2_r) + h * ((en2_r - ed2_r) * (en2_r + ed2_r - 6.0) / 12.0) :
9191
((ed2_r * xd / ((1.0 - xd) * l2)) - (en2_r * xn / ((1.0 - xn) * l2)));
9292

0 commit comments

Comments
 (0)