<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-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<br>
      <br>
      On 10/28/2017 07:16 AM, Pavel Panchekha wrote:<br>
    </div>
    <blockquote
cite="mid:CAE4=OQ-TbMZOHNx3Ozjh_FLM0mKUbZhw_D1MnHKPMJuN7DqpTA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <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_3853295731210088818gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">—Pavel Panchekha</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </body>
</html>