<div dir="ltr"><div class="gmail_default" style="font-size:small">Berk, thank you for the reply. The quality of the GROMACS source code is clear from reading it.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thank you for explaining that the sign is not used except in computing the angle. Do you know how much error in the angle is acceptable? I am trying some variations on the dihedral angle computation and seeing answers that differ by 1e-8. Could that small a difference possibly matter?<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've noticed that earlier versions of GROMACS used a slightly different formula to compute <u>dih_angle</u> (using <u>acos</u> instead of <u>atan2</u>). Did the switch cause any known changes in behavior?<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">—Pavel Panchekha</div></div></div>
<br><div class="gmail_quote">On Sat, Oct 28, 2017 at 1:06 AM, Berk Hess <span dir="ltr"><<a href="mailto:hess@kth.se" target="_blank">hess@kth.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_3495107603991124129moz-cite-prefix">Hi,<br>
<br>
In molecular dynamics it's rather likely that you hit corner
cases, so we pay a lot of attention to numerical issues when
writing and reviewing code. Therefore it is unlikely that there
are cases that can be improved, but you are welcome to look.<br>
<br>
It is good that you mention the sign in dihedral angle. The return
value is actually never used. The sign is only used to set the
sign of the angle, which switches at angle=0, so there is no
stability issue.<br>
<br>
Cheers,<br>
<br>
Berk<div><div class="h5"><br>
<br>
On 10/28/2017 07:16 AM, Pavel Panchekha wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hello,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I'm a student
at the University of Washington working on numerical accuracy,
and I've been looking into GROMACS as an example of a beloved
and important large numerical program. Browsing through the
code base, I was struck by the computation of the dihedral
angle in <u>bonded.c</u>, at line 1569 (in GROMACS 5.1.4).</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I wonder if
it is possible for the <u>sign</u> variable to get the wrong
value, if the input points are close to one another or have
some other reason to experience cancellation when doing the
cross product. I think this is fixable using an adaptive
algorithm. Could changing the sign of the angle computed by <u>dih_angle</u>
affect GROMACS's results?<br>
</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">More broadly,
has anyone ever had numerical accuracy issues with GROMACS?
Would there be interest in reviewing a patch that improved the
accuracy (for edge case inputs) for the dihedral angle
computation?<br>
</div>
<div class="gmail_default" style="font-size:small"><br clear="all">
</div>
<div>
<div class="m_3495107603991124129m_3853295731210088818gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">—Pavel Panchekha</div>
</div>
</div>
</div>
<br>
<fieldset class="m_3495107603991124129mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</div></div></div>
<br>--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/<wbr>Support/Mailing_Lists/GMX-<wbr>developers_List</a> before posting!<br>
<br>
* Can't post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/<wbr>Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/<wbr>mailman/listinfo/gromacs.org_<wbr>gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@<wbr>gromacs.org</a>.<br></blockquote></div><br></div>