-
Notifications
You must be signed in to change notification settings - Fork 61
Fix: Implement numerically safe switching function #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
replacing function and derivative with order 1 Taylor expansions around indeterminate form 0/0 for original expression fixes #903
to encompass complete region where Taylor expansion is more regular than original expression.
|
How about using the second-order derivatives (the same as the PLUMED code)? Let The limitation of the second-order derivative is calculated by the following maxima code (thanks for Gemini!): The calculation of the derivative should be also straight forward: |
giacomofiorin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me already with the order 1 (the interval is tiny).
src/colvarcomp_coordnums.cpp
Outdated
| cvm::real const ed2_r = (cvm::real) ed2; | ||
|
|
||
| // Function value: 1st-order Taylor expansion around l2 = 1 | ||
| cvm::real const func_no_pairlist = (std::abs(h) < eps_l2) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Years ago, we had to wrap all the STL math functions because of some exotic platforms where VMD was being built.
It doesn't seem much of an issue any more, and few instances of unwrapped functions got undetected. I'll fix them in this branch, but we could perhaps consider removing those wrappers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on removing them.
(until we conclude that current compilers are no longer exhibiting the issues previously encountered on some VMD platforms)
6b9a1ac to
cba9116
Compare
|
I attach my experiment results with cutoff = 6.0 and second-order Taylor expansion here:
My test code can be found in https://godbolt.org/z/fnjnKoTqd. |




replacing function and derivative with order 1 Taylor expansions around indeterminate form 0/0 for original expression
fixes #903