Avoid numerical overflow with overlapping atoms
commitfcc7c4c4c3891aa2db8cd45904797b5f152e1e6f
authorBerk Hess <hess@kth.se>
Wed, 25 May 2016 13:19:02 +0000 (25 15:19 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 31 May 2016 11:52:58 +0000 (31 13:52 +0200)
tree00bda023efcabe0ceeced42efbbf885fc1f5e1eb
parent41833007e76944090665dae0bc0b4963741bec18
Avoid numerical overflow with overlapping atoms

The verlet kernels did not allow overlapping atoms, even if they were
not interacting (in contrast to the group kernels). Fixed by clamping
the interaction distance so it can not become smaller than ~6e-4
in single and ~1e-18 in double, and when this number is later
multiplied by zero parameters it will not influence forces. The
clamping should never affect normal interactions; we would previously
crash for distances that were this small.
On Haswell, RF and PME kernels get 3% and 1% slower, respectively.
On CUDA, RF and PME kernels get 1% and 2% faster, respectively.

Fixes #1958.

Change-Id: I83b88f0e9ca34dc151a8b907f334a95a1a4301cc
15 files changed:
src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp
src/gromacs/mdlib/nbnxn_consts.h
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_fermi.cuh
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref.cpp
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_jit_support.cpp
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_kernel_amd.clh
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_kernel_nowarp.clh
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_kernel_nvidia.clh