[gmx-developers] Use of invsqrt with tables
Berk Hess
hess at kth.se
Wed Mar 23 14:12:46 CET 2016
Hi,
I tried to explain that this doesn't work. If rsq is GMX_REAL_MIN you
still get overflows during later operations.
For float you can do:
invr = invsqrt(r2 + 1e-38)
Berk
On 2016-03-23 14:06, Mark Abraham wrote:
> Hi,
>
> 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:
>
> rsqmod = (rsq == 0) ? smallnumber : rsq;
> rinv = invsqrt(rsqmod);
> rinv = (rsq == 0) ? 0 : rinv;
>
> and maybe a mask on energies also.
>
> 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.
>
> Mark
>
> On Wed, Mar 23, 2016 at 1:42 PM David van der Spoel
> <spoel at xray.bmc.uu.se <mailto:spoel at xray.bmc.uu.se>> wrote:
>
> On 23/03/16 13:31, Berk Hess wrote:
> > Hi,
> >
> > But avoiding the inversion is not possible, since you need to
> multiply
> > the scaling force by the normalized distance vector.
> The force should be zero at r=0 for symmetry reasons and hence the
> code
> should not crash.
> >
> > Berk
> >
> > On 2016-03-23 13:00, David van der Spoel wrote:
> >> Hi,
> >>
> >> In all versions of gromacs the distance between two nonbonded
> atoms is
> >> computed as
> >> rinv00 = gmx_invsqrt(rsq00);
> >> r00 = rsq00*rinv00;
> >>
> >> This is fine when we use Lennard Jones and Coulomb, but not
> when using
> >> table potentials which do not necessarily have singularities at
> r = 0.
> >> I would therefore propose to replace the statements by a normal
> sqrt
> >> in all innerloops using tables.
> >>
> >> Thoughts?
> >
>
>
> --
> David van der Spoel, Ph.D., Professor of Biology
> Dept. of Cell & Molec. Biol., Uppsala University.
> Box 596, 75124 Uppsala, Sweden. Phone: +46184714205.
> spoel at xray.bmc.uu.se <mailto:spoel at xray.bmc.uu.se>
> http://folding.bmc.uu.se
> --
> 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
> <mailto: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/20160323/c8902a9a/attachment-0001.html>
More information about the gromacs.org_gmx-developers
mailing list