<link rel="self" href="http://redmine.gromacs.org/issues/2771.atom"/>
<link rel="alternate" href="http://redmine.gromacs.org/"/>
<id>http://redmine.gromacs.org/</id>
<icon>http://redmine.gromacs.org/favicon.ico?1402403081</icon>
<updated>2018-11-20T13:52:08Z</updated>
<author>
<name>GROMACS development</name>
</author>
<entry>
<title>GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=189742018-11-20T13:52:08ZErik Lindahlerik@kth.se
<ul></ul><p>This problem is actually quite a bit harder than it might appear at first sight, and has to do with the fundamental problem of calculating numerical derivatives.</p>
<p>In the previous (and current...) versions of GROMACS, we mostly just fudge it and used a 2-point derivative approximation, initially with the length equal to sqrt(EPS), but then we increased this do be able to handle coordinates with values up to O(10) at least.</p>
<p>I looked into this a bit when designing the new table classes, where we use higher-order approximations. This is described in more detail e.g. at</p>
<p><a class="external" href="https://en.wikipedia.org/wiki/Numerical_differentiation">https://en.wikipedia.org/wiki/Numerical_differentiation</a></p>
<p>Briefly, the challenge is to handle the balance between finite precision biting us when the interval is too small, vs. the formula/approximation error biting us when it is too large - but on top of this it's also easy to get problems with compilers "optimizing" away some of the careful logic and cause errors anyway.</p>
<p>I <strong>think</strong> it might be a good solution to always pick h=sqrt(eps)*x, where x is the coordinate value, but we'll have to do this carefully to make sure it's both consistent between our different minimizers, and test it both on large and small systems close to and far away from minima.</p>
<p>... which in turn means it might not be a small/trivial fix, so if we want that in release-2019, it has to be ready the next week or two :-)</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=189752018-11-20T15:11:19ZDavid van der Spoelspoel@xray.bmc.uu.se
<ul></ul><p>Thanks for looking into this.</p>
<p>I guess that would have to combined with a minimum coordinate value of e.g. 1 pm as well, something like:</p>
<p>h = sqrt(eps) * std::max(fabs(x), 0.001)</p>
<p>I could add a couple of tests to begin with and then implement this.</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=189762018-11-20T15:30:01ZDavid van der Spoelspoel@xray.bmc.uu.se
<ul></ul><p>In order to clarify the connection to shell minimization: there is a precision issue there that the change in coordinates in shell minimization proceeds using Hooke's law F = k dx. This is implemented using the following:<br />1) compute F on all shells<br />2) compute dx = F / k<br />3) update x by dx.</p>
<p>Since k is typically large, e.g. 400000 in the Charmm polarizable force field, a force that is considered small enough for usage in normal mode analysis (1e-3) would give dx = 2.5e-9 nm, but since F and dx are vectors, the dx[m], m in XX,YY,ZZ, will be smaller and precision problems may occur.</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=189772018-11-20T16:19:18ZErik Lindahlerik@kth.se
<ul></ul><p>David van der Spoel wrote:</p>
<blockquote>
<p>h = sqrt(eps) * std::max(fabs(x), 0.001)</p>
</blockquote>
<p>No, the spacing for the 2-point approximation of a derivative should never be set only based on the function value, and 0.001*sqrt(eps) will be way too small.</p>
<p>In summary:</p>
<p>1. To handle the rounding (precision) error, you cannot go below x*sqrt(eps). This problem is not merely due to one addition (then it would rather be eps without the square root), but the properties of the quadratic form of the function close to the minimum, which makes it way more sensitive (as I explained earlier in <a class="external" href="https://redmine.gromacs.org/issues/2641">https://redmine.gromacs.org/issues/2641</a> ).</p>
<p>2. To handle the formula/secant error (this is where the function value is important), you need to derive the proper formulae (depending on the approximation # points) based on the quotient between the function value and second derivative, but that itself gets very complex close to a local minimum.</p>
<p>It is not possible to solve them both by simply picking a value, and "fixing" it by looking at specific numbers for one case will just mean we cause problems for the other case.</p>
<p>I wasn't lying when I said it isn't trivial - if it was, I would already have fixed the corner cases of the table generation code ;-)</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=189792018-11-20T16:36:46ZDavid van der Spoelspoel@xray.bmc.uu.se
<ul></ul><p>I wasn't accusing you of lying :)</p>
<p>In fact we may be able to do slightly better than we are in NMA at no cost, since we have the force at the minimum as well. In that manner we could determine the F' from three points, but whether it will lead to practical improvement is another matter.</p>
<p>The more I think about it, the more I think that the real problem for normal modes of shells is not the exact value of h, but what I wrote in comment 4. That is, the force is not reproducible enough because of precision issues minimizing shells. The reason why we are seeing this now is that we have not used the code like this. It would be great not to have to code an analytical Hessian ;)</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=190362018-11-23T14:07:21ZGerrit Code Review Botadmin@gromacs.org
<ul></ul><p>Gerrit received a related patchset '3' for Issue <a class="issue tracker-3 status-1 priority-4 priority-default" title="Task: Size independent Hessian for normal mode analysis (New)" href="http://redmine.gromacs.org/issues/2771">#2771</a>.<br />Uploader: David van der Spoel (<a class="email" href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>)<br />Change-Id: regressiontests~master~I046a5069f24ef65077690838ff6f5ec9e2a88573<br />Gerrit URL: <a class="external" href="https://gerrit.gromacs.org/8743">https://gerrit.gromacs.org/8743</a></p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=190422018-11-23T21:11:20ZGerrit Code Review Botadmin@gromacs.org
<ul></ul><p>Gerrit received a related patchset '1' for Issue <a class="issue tracker-3 status-1 priority-4 priority-default" title="Task: Size independent Hessian for normal mode analysis (New)" href="http://redmine.gromacs.org/issues/2771">#2771</a>.<br />Uploader: David van der Spoel (<a class="email" href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>)<br />Change-Id: gromacs~master~Ifb44841b36be5076fe8d77d5982876f881fdc69b<br />Gerrit URL: <a class="external" href="https://gerrit.gromacs.org/8747">https://gerrit.gromacs.org/8747</a></p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=191472018-12-01T08:00:54ZDavid van der Spoelspoel@xray.bmc.uu.se
<ul></ul><p>Once the first testing patch is in, all the normal mode analysis tests will be moved from the regression tests to the core code and removed from the regression tests.</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=191552018-12-03T12:39:46ZPaul Bauer
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Task</i></li><li><strong>Target version</strong> changed from <i>2019</i> to <i>2020</i></li><li><strong>Affected version</strong> deleted (<del><i>2018</i></del>)</li></ul><p>I changed this to 2020, because I don't think this will happen in time for 2019 and would also mean some substantial changes that we shouldn't risk.</p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=192202018-12-08T18:55:36ZGerrit Code Review Botadmin@gromacs.org
<ul></ul><p>Gerrit received a related patchset '1' for Issue <a class="issue tracker-3 status-1 priority-4 priority-default" title="Task: Size independent Hessian for normal mode analysis (New)" href="http://redmine.gromacs.org/issues/2771">#2771</a>.<br />Uploader: David van der Spoel (<a class="email" href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>)<br />Change-Id: gromacs~master~Ice2e4423d8f48f1656aaa296e9207fda3bc4d233<br />Gerrit URL: <a class="external" href="https://gerrit.gromacs.org/8795">https://gerrit.gromacs.org/8795</a></p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=192212018-12-08T19:06:34ZGerrit Code Review Botadmin@gromacs.org
<ul></ul><p>Gerrit received a related patchset '1' for Issue <a class="issue tracker-3 status-1 priority-4 priority-default" title="Task: Size independent Hessian for normal mode analysis (New)" href="http://redmine.gromacs.org/issues/2771">#2771</a>.<br />Uploader: David van der Spoel (<a class="email" href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>)<br />Change-Id: regressiontests~master~I82df371feeabc40a0951bf21afa09a50c08e045f<br />Gerrit URL: <a class="external" href="https://gerrit.gromacs.org/8796">https://gerrit.gromacs.org/8796</a></p> GROMACS - Task #2771: Size independent Hessian for normal mode analysishttp://redmine.gromacs.org/issues/2771?journal_id=225452019-12-28T09:50:47ZPaul Bauer
<ul><li><strong>Target version</strong> changed from <i>2020</i> to <i>future</i></li></ul>