2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2016,2017,2018,2019, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 #include "gromacs/gpu_utils/cuda_arch_utils.cuh"
39 * This header has the sole purpose of generating kernels for the combinations of
40 * supported electrostatics types (cut-off, reaction-field, analytical and
41 * tabulated Ewald) and VDW types (cut-off + V shift, LJ-Ewald with
42 * geometric or Lorentz-Berthelot combination rule, F switch, V switch).
44 * The Ewald kernels have twin-range cut-off versions with rcoul != rvdw which
45 * require an extra distance check to enable PP-PME load balancing
46 * (otherwise, by default rcoul == rvdw).
48 * NOTE: No include fence as it is meant to be included multiple times.
50 * \author Szilárd Páll <pall.szilard@gmail.com>
51 * \author Berk Hess <hess@kth.se>
52 * \ingroup module_nbnxm
55 /* Analytical plain cut-off electrostatics kernels
59 /* cut-off + V shift LJ */
60 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJ ## __VA_ARGS__
61 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
62 #undef NB_KERNEL_FUNC_NAME
63 /* cut-off + V shift LJ w geometric combination rules */
65 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJCombGeom ## __VA_ARGS__
66 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
68 #undef NB_KERNEL_FUNC_NAME
69 /* cut-off + V shift LJ w LB combination rules */
71 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJCombLB ## __VA_ARGS__
72 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
74 #undef NB_KERNEL_FUNC_NAME
75 /* LJ-Ewald w geometric combination rules */
76 #define LJ_EWALD_COMB_GEOM
77 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJEwCombGeom ## __VA_ARGS__
78 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
79 #undef LJ_EWALD_COMB_GEOM
80 #undef NB_KERNEL_FUNC_NAME
81 /* LJ-Ewald w LB combination rules */
82 #define LJ_EWALD_COMB_LB
83 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJEwCombLB ## __VA_ARGS__
84 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
85 #undef LJ_EWALD_COMB_LB
86 #undef NB_KERNEL_FUNC_NAME
88 #define LJ_FORCE_SWITCH
89 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJFsw ## __VA_ARGS__
90 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
91 #undef LJ_FORCE_SWITCH
92 #undef NB_KERNEL_FUNC_NAME
95 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJPsw ## __VA_ARGS__
96 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
98 #undef NB_KERNEL_FUNC_NAME
103 /* Analytical reaction-field kernels
107 /* cut-off + V shift LJ */
108 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJ ## __VA_ARGS__
109 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
110 #undef NB_KERNEL_FUNC_NAME
111 /* cut-off + V shift LJ w geometric combination rules */
113 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJCombGeom ## __VA_ARGS__
114 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
116 #undef NB_KERNEL_FUNC_NAME
117 /* cut-off + V shift LJ w LB combination rules */
119 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJCombLB ## __VA_ARGS__
120 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
122 #undef NB_KERNEL_FUNC_NAME
123 /* LJ-Ewald w geometric combination rules */
124 #define LJ_EWALD_COMB_GEOM
125 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJEwCombGeom ## __VA_ARGS__
126 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
127 #undef LJ_EWALD_COMB_GEOM
128 #undef NB_KERNEL_FUNC_NAME
129 /* LJ-Ewald w LB combination rules */
130 #define LJ_EWALD_COMB_LB
131 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJEwCombLB ## __VA_ARGS__
132 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
133 #undef LJ_EWALD_COMB_LB
134 #undef NB_KERNEL_FUNC_NAME
136 #define LJ_FORCE_SWITCH
137 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJFsw ## __VA_ARGS__
138 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
139 #undef LJ_FORCE_SWITCH
140 #undef NB_KERNEL_FUNC_NAME
142 #define LJ_POT_SWITCH
143 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJPsw ## __VA_ARGS__
144 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
146 #undef NB_KERNEL_FUNC_NAME
151 /* Analytical Ewald interaction kernels
155 /* cut-off + V shift LJ */
156 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJ ## __VA_ARGS__
157 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
158 #undef NB_KERNEL_FUNC_NAME
159 /* cut-off + V shift LJ w geometric combination rules */
161 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJCombGeom ## __VA_ARGS__
162 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
164 #undef NB_KERNEL_FUNC_NAME
165 /* cut-off + V shift LJ w LB combination rules */
167 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJCombLB ## __VA_ARGS__
168 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
170 #undef NB_KERNEL_FUNC_NAME
171 /* LJ-Ewald w geometric combination rules */
172 #define LJ_EWALD_COMB_GEOM
173 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJEwCombGeom ## __VA_ARGS__
174 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
175 #undef LJ_EWALD_COMB_GEOM
176 #undef NB_KERNEL_FUNC_NAME
177 /* LJ-Ewald w LB combination rules */
178 #define LJ_EWALD_COMB_LB
179 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJEwCombLB ## __VA_ARGS__
180 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
181 #undef LJ_EWALD_COMB_LB
182 #undef NB_KERNEL_FUNC_NAME
184 #define LJ_FORCE_SWITCH
185 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJFsw ## __VA_ARGS__
186 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
187 #undef LJ_FORCE_SWITCH
188 #undef NB_KERNEL_FUNC_NAME
190 #define LJ_POT_SWITCH
191 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJPsw ## __VA_ARGS__
192 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
194 #undef NB_KERNEL_FUNC_NAME
199 /* Analytical Ewald interaction kernels with twin-range cut-off
202 #define VDW_CUTOFF_CHECK
204 /* cut-off + V shift LJ */
205 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJ ## __VA_ARGS__
206 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
207 #undef NB_KERNEL_FUNC_NAME
208 /* cut-off + V shift LJ w geometric combination rules */
210 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJCombGeom ## __VA_ARGS__
211 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
213 #undef NB_KERNEL_FUNC_NAME
214 /* cut-off + V shift LJ w LB combination rules */
216 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJCombLB ## __VA_ARGS__
217 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
219 #undef NB_KERNEL_FUNC_NAME
220 /* LJ-Ewald w geometric combination rules */
221 #define LJ_EWALD_COMB_GEOM
222 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJEwCombGeom ## __VA_ARGS__
223 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
224 #undef LJ_EWALD_COMB_GEOM
225 #undef NB_KERNEL_FUNC_NAME
226 /* LJ-Ewald w LB combination rules */
227 #define LJ_EWALD_COMB_LB
228 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJEwCombLB ## __VA_ARGS__
229 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
230 #undef LJ_EWALD_COMB_LB
231 #undef NB_KERNEL_FUNC_NAME
233 #define LJ_FORCE_SWITCH
234 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJFsw ## __VA_ARGS__
235 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
236 #undef LJ_FORCE_SWITCH
237 #undef NB_KERNEL_FUNC_NAME
239 #define LJ_POT_SWITCH
240 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJPsw ## __VA_ARGS__
241 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
243 #undef NB_KERNEL_FUNC_NAME
246 #undef VDW_CUTOFF_CHECK
249 /* Tabulated Ewald interaction kernels */
252 /* cut-off + V shift LJ */
253 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJ ## __VA_ARGS__
254 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
255 #undef NB_KERNEL_FUNC_NAME
256 /* cut-off + V shift LJ w geometric combination rules */
258 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJCombGeom ## __VA_ARGS__
259 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
261 #undef NB_KERNEL_FUNC_NAME
262 /* cut-off + V shift LJ w LB combination rules */
264 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJCombLB ## __VA_ARGS__
265 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
267 #undef NB_KERNEL_FUNC_NAME
268 /* LJ-Ewald w geometric combination rules */
269 #define LJ_EWALD_COMB_GEOM
270 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJEwCombGeom ## __VA_ARGS__
271 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
272 #undef LJ_EWALD_COMB_GEOM
273 #undef NB_KERNEL_FUNC_NAME
274 /* LJ-Ewald w LB combination rules */
275 #define LJ_EWALD_COMB_LB
276 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJEwCombLB ## __VA_ARGS__
277 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
278 #undef LJ_EWALD_COMB_LB
279 #undef NB_KERNEL_FUNC_NAME
281 #define LJ_FORCE_SWITCH
282 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJFsw ## __VA_ARGS__
283 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
284 #undef LJ_FORCE_SWITCH
285 #undef NB_KERNEL_FUNC_NAME
287 #define LJ_POT_SWITCH
288 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJPsw ## __VA_ARGS__
289 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
291 #undef NB_KERNEL_FUNC_NAME
296 /* Tabulated Ewald interaction kernels with twin-range cut-off */
298 #define VDW_CUTOFF_CHECK
300 /* cut-off + V shift LJ */
301 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJ ## __VA_ARGS__
302 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
303 #undef NB_KERNEL_FUNC_NAME
304 /* cut-off + V shift LJ w geometric combination rules */
306 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJCombGeom ## __VA_ARGS__
307 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
309 #undef NB_KERNEL_FUNC_NAME
310 /* cut-off + V shift LJ w LB combination rules */
312 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJCombLB ## __VA_ARGS__
313 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
315 #undef NB_KERNEL_FUNC_NAME
316 /* LJ-Ewald w geometric combination rules */
317 #define LJ_EWALD_COMB_GEOM
318 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJEwCombGeom ## __VA_ARGS__
319 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
320 #undef LJ_EWALD_COMB_GEOM
321 #undef NB_KERNEL_FUNC_NAME
322 /* LJ-Ewald w LB combination rules */
323 #define LJ_EWALD_COMB_LB
324 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJEwCombLB ## __VA_ARGS__
325 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
326 #undef LJ_EWALD_COMB_LB
327 #undef NB_KERNEL_FUNC_NAME
329 #define LJ_FORCE_SWITCH
330 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJFsw ## __VA_ARGS__
331 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
332 #undef LJ_FORCE_SWITCH
333 #undef NB_KERNEL_FUNC_NAME
335 #define LJ_POT_SWITCH
336 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJPsw ## __VA_ARGS__
337 #include "gromacs/nbnxm/cuda/nbnxm_cuda_kernel.cuh"
339 #undef NB_KERNEL_FUNC_NAME
342 #undef VDW_CUTOFF_CHECK