<div dir="ltr">Hi,<div><br></div><div>This isn&#39;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&#39;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 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 href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>    <a href="http://folding.bmc.uu.se" rel="noreferrer" target="_blank">http://folding.bmc.uu.se</a><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/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a 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 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 href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div>