[gmx-developers] Dihedral angle numerical accuracy

Pavel Panchekha me at pavpanchekha.com
Sun Oct 29 00:01:30 CEST 2017


Berk, thank you for the reply. The quality of the GROMACS source code is
clear from reading it.

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?

I've noticed that earlier versions of GROMACS used a slightly different
formula to compute *dih_angle* (using *acos* instead of *atan2*). Did the
switch cause any known changes in behavior?

—Pavel Panchekha

On Sat, Oct 28, 2017 at 1:06 AM, Berk Hess <hess at kth.se> wrote:

> Hi,
>
> 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.
>
> 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.
>
> Cheers,
>
> Berk
>
>
> On 10/28/2017 07:16 AM, Pavel Panchekha wrote:
>
> Hello,
>
> 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 *bonded.c*, at line
> 1569 (in GROMACS 5.1.4).
>
> I wonder if it is possible for the *sign* 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 *dih_angle* affect GROMACS's results?
>
> 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?
>
> —Pavel Panchekha
>
>
>
>
> --
> Gromacs Developers mailing list
>
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-developers_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20171028/fa9eb71f/attachment.html>


More information about the gromacs.org_gmx-developers mailing list