<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>
      I tried to explain that this doesn't work. If rsq is GMX_REAL_MIN
      you still get overflows during later operations.<br>
      For float you can do:<br>
      invr = invsqrt(r2 + 1e-38)<br>
      <br>
      Berk<br>
      <br>
      On 2016-03-23 14:06, Mark Abraham wrote:<br>
    </div>
    <blockquote
cite="mid:CAMNuMAS_mahcRHVxz_nVa8f8Z56mEmAE9260RWSuMB0Lj4KeEw@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>This isn't related to using tables per se, but rather with
          using potentials that lack singularities that prevent r=0 in
          practice. I think such kernels should rather use an approach
          like that we use for exclusions:</div>
        <div><br>
        </div>
        <div>rsqmod = (rsq == 0) ? smallnumber : rsq;</div>
        <div>rinv = invsqrt(rsqmod);</div>
        <div>rinv = (rsq == 0) ? 0 : rinv;</div>
        <div><br>
        </div>
        <div>and maybe a mask on energies also.</div>
        <div><br>
        </div>
        <div>gmx::sqrt in the SIMD module is also an option that
          implements the same kind of conditionality, but doesn't solve
          the need to have a functional rinv.</div>
        <div><br>
        </div>
        <div>Mark</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Wed, Mar 23, 2016 at 1:42 PM David van der
          Spoel &lt;<a moz-do-not-send="true"
            href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>&gt;
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">On 23/03/16
          13:31, Berk Hess wrote:<br>
          &gt; Hi,<br>
          &gt;<br>
          &gt; But avoiding the inversion is not possible, since you
          need to multiply<br>
          &gt; the scaling force by the normalized distance vector.<br>
          The force should be zero at r=0 for symmetry reasons and hence
          the code<br>
          should not crash.<br>
          &gt;<br>
          &gt; Berk<br>
          &gt;<br>
          &gt; On 2016-03-23 13:00, David van der Spoel wrote:<br>
          &gt;&gt; Hi,<br>
          &gt;&gt;<br>
          &gt;&gt; In all versions of gromacs the distance between two
          nonbonded atoms is<br>
          &gt;&gt; computed as<br>
          &gt;&gt;             rinv00           = gmx_invsqrt(rsq00);<br>
          &gt;&gt;             r00              = rsq00*rinv00;<br>
          &gt;&gt;<br>
          &gt;&gt; This is fine when we use Lennard Jones and Coulomb,
          but not when using<br>
          &gt;&gt; table potentials which do not necessarily have
          singularities at r = 0.<br>
          &gt;&gt; I would therefore propose to replace the statements
          by a normal sqrt<br>
          &gt;&gt; in all innerloops using tables.<br>
          &gt;&gt;<br>
          &gt;&gt; Thoughts?<br>
          &gt;<br>
          <br>
          <br>
          --<br>
          David van der Spoel, Ph.D., Professor of Biology<br>
          Dept. of Cell &amp; Molec. Biol., Uppsala University.<br>
          Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205.<br>
          <a moz-do-not-send="true" href="mailto:spoel@xray.bmc.uu.se"
            target="_blank">spoel@xray.bmc.uu.se</a>    <a
            moz-do-not-send="true" href="http://folding.bmc.uu.se"
            rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://folding.bmc.uu.se">http://folding.bmc.uu.se</a></a><br>
          --<br>
          Gromacs Developers mailing list<br>
          <br>
          * Please search the archive at <a moz-do-not-send="true"
            href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List"
            rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a>
          before posting!<br>
          <br>
          * Can't post? Read <a moz-do-not-send="true"
            href="http://www.gromacs.org/Support/Mailing_Lists"
            rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
          <br>
          * For (un)subscribe requests visit<br>
          <a moz-do-not-send="true"
href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers"
            rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a>
          or send a mail to <a moz-do-not-send="true"
            href="mailto:gmx-developers-request@gromacs.org"
            target="_blank">gmx-developers-request@gromacs.org</a>.<br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </body>
</html>