2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2016,2017 by the GROMACS development team.
5 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
37 #include "gromacs/gpu_utils/cuda_arch_utils.cuh"
40 * This header has the sole purpose of generating kernels for the combinations of
41 * supported electrostatics types (cut-off, reaction-field, analytical and
42 * tabulated Ewald) and VDW types (cut-off + V shift, LJ-Ewald with
43 * geometric or Lorentz-Berthelot combination rule, F switch, V switch).
45 * The Ewald kernels have twin-range cut-off versions with rcoul != rvdw which
46 * require an extra distance check to enable PP-PME load balancing
47 * (otherwise, by default rcoul == rvdw).
49 * NOTE: No include fence as it is meant to be included multiple times.
51 * \author Szilárd Páll <pall.szilard@gmail.com>
52 * \author Berk Hess <hess@kth.se>
53 * \ingroup module_nbnxm
56 /* Analytical plain cut-off electrostatics kernels
60 /* cut-off + V shift LJ */
61 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJ##__VA_ARGS__
62 #include "nbnxm_cuda_kernel.cuh"
63 #undef NB_KERNEL_FUNC_NAME
64 /* cut-off + V shift LJ w geometric combination rules */
66 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJCombGeom##__VA_ARGS__
67 #include "nbnxm_cuda_kernel.cuh"
69 #undef NB_KERNEL_FUNC_NAME
70 /* cut-off + V shift LJ w LB combination rules */
72 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJCombLB##__VA_ARGS__
73 #include "nbnxm_cuda_kernel.cuh"
75 #undef NB_KERNEL_FUNC_NAME
76 /* LJ-Ewald w geometric combination rules */
77 #define LJ_EWALD_COMB_GEOM
78 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJEwCombGeom##__VA_ARGS__
79 #include "nbnxm_cuda_kernel.cuh"
80 #undef LJ_EWALD_COMB_GEOM
81 #undef NB_KERNEL_FUNC_NAME
82 /* LJ-Ewald w LB combination rules */
83 #define LJ_EWALD_COMB_LB
84 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJEwCombLB##__VA_ARGS__
85 #include "nbnxm_cuda_kernel.cuh"
86 #undef LJ_EWALD_COMB_LB
87 #undef NB_KERNEL_FUNC_NAME
89 #define LJ_FORCE_SWITCH
90 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJFsw##__VA_ARGS__
91 #include "nbnxm_cuda_kernel.cuh"
92 #undef LJ_FORCE_SWITCH
93 #undef NB_KERNEL_FUNC_NAME
96 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecCut_VdwLJPsw##__VA_ARGS__
97 #include "nbnxm_cuda_kernel.cuh"
99 #undef NB_KERNEL_FUNC_NAME
104 /* Analytical reaction-field kernels
108 /* cut-off + V shift LJ */
109 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJ##__VA_ARGS__
110 #include "nbnxm_cuda_kernel.cuh"
111 #undef NB_KERNEL_FUNC_NAME
112 /* cut-off + V shift LJ w geometric combination rules */
114 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJCombGeom##__VA_ARGS__
115 #include "nbnxm_cuda_kernel.cuh"
117 #undef NB_KERNEL_FUNC_NAME
118 /* cut-off + V shift LJ w LB combination rules */
120 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJCombLB##__VA_ARGS__
121 #include "nbnxm_cuda_kernel.cuh"
123 #undef NB_KERNEL_FUNC_NAME
124 /* LJ-Ewald w geometric combination rules */
125 #define LJ_EWALD_COMB_GEOM
126 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJEwCombGeom##__VA_ARGS__
127 #include "nbnxm_cuda_kernel.cuh"
128 #undef LJ_EWALD_COMB_GEOM
129 #undef NB_KERNEL_FUNC_NAME
130 /* LJ-Ewald w LB combination rules */
131 #define LJ_EWALD_COMB_LB
132 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJEwCombLB##__VA_ARGS__
133 #include "nbnxm_cuda_kernel.cuh"
134 #undef LJ_EWALD_COMB_LB
135 #undef NB_KERNEL_FUNC_NAME
137 #define LJ_FORCE_SWITCH
138 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJFsw##__VA_ARGS__
139 #include "nbnxm_cuda_kernel.cuh"
140 #undef LJ_FORCE_SWITCH
141 #undef NB_KERNEL_FUNC_NAME
143 #define LJ_POT_SWITCH
144 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecRF_VdwLJPsw##__VA_ARGS__
145 #include "nbnxm_cuda_kernel.cuh"
147 #undef NB_KERNEL_FUNC_NAME
152 /* Analytical Ewald interaction kernels
156 /* cut-off + V shift LJ */
157 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJ##__VA_ARGS__
158 #include "nbnxm_cuda_kernel.cuh"
159 #undef NB_KERNEL_FUNC_NAME
160 /* cut-off + V shift LJ w geometric combination rules */
162 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJCombGeom##__VA_ARGS__
163 #include "nbnxm_cuda_kernel.cuh"
165 #undef NB_KERNEL_FUNC_NAME
166 /* cut-off + V shift LJ w LB combination rules */
168 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJCombLB##__VA_ARGS__
169 #include "nbnxm_cuda_kernel.cuh"
171 #undef NB_KERNEL_FUNC_NAME
172 /* LJ-Ewald w geometric combination rules */
173 #define LJ_EWALD_COMB_GEOM
174 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJEwCombGeom##__VA_ARGS__
175 #include "nbnxm_cuda_kernel.cuh"
176 #undef LJ_EWALD_COMB_GEOM
177 #undef NB_KERNEL_FUNC_NAME
178 /* LJ-Ewald w LB combination rules */
179 #define LJ_EWALD_COMB_LB
180 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJEwCombLB##__VA_ARGS__
181 #include "nbnxm_cuda_kernel.cuh"
182 #undef LJ_EWALD_COMB_LB
183 #undef NB_KERNEL_FUNC_NAME
185 #define LJ_FORCE_SWITCH
186 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJFsw##__VA_ARGS__
187 #include "nbnxm_cuda_kernel.cuh"
188 #undef LJ_FORCE_SWITCH
189 #undef NB_KERNEL_FUNC_NAME
191 #define LJ_POT_SWITCH
192 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEw_VdwLJPsw##__VA_ARGS__
193 #include "nbnxm_cuda_kernel.cuh"
195 #undef NB_KERNEL_FUNC_NAME
200 /* Analytical Ewald interaction kernels with twin-range cut-off
203 #define VDW_CUTOFF_CHECK
205 /* cut-off + V shift LJ */
206 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJ##__VA_ARGS__
207 #include "nbnxm_cuda_kernel.cuh"
208 #undef NB_KERNEL_FUNC_NAME
209 /* cut-off + V shift LJ w geometric combination rules */
211 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJCombGeom##__VA_ARGS__
212 #include "nbnxm_cuda_kernel.cuh"
214 #undef NB_KERNEL_FUNC_NAME
215 /* cut-off + V shift LJ w LB combination rules */
217 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJCombLB##__VA_ARGS__
218 #include "nbnxm_cuda_kernel.cuh"
220 #undef NB_KERNEL_FUNC_NAME
221 /* LJ-Ewald w geometric combination rules */
222 #define LJ_EWALD_COMB_GEOM
223 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJEwCombGeom##__VA_ARGS__
224 #include "nbnxm_cuda_kernel.cuh"
225 #undef LJ_EWALD_COMB_GEOM
226 #undef NB_KERNEL_FUNC_NAME
227 /* LJ-Ewald w LB combination rules */
228 #define LJ_EWALD_COMB_LB
229 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJEwCombLB##__VA_ARGS__
230 #include "nbnxm_cuda_kernel.cuh"
231 #undef LJ_EWALD_COMB_LB
232 #undef NB_KERNEL_FUNC_NAME
234 #define LJ_FORCE_SWITCH
235 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJFsw##__VA_ARGS__
236 #include "nbnxm_cuda_kernel.cuh"
237 #undef LJ_FORCE_SWITCH
238 #undef NB_KERNEL_FUNC_NAME
240 #define LJ_POT_SWITCH
241 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwTwinCut_VdwLJPsw##__VA_ARGS__
242 #include "nbnxm_cuda_kernel.cuh"
244 #undef NB_KERNEL_FUNC_NAME
247 #undef VDW_CUTOFF_CHECK
250 /* Tabulated Ewald interaction kernels */
253 /* cut-off + V shift LJ */
254 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJ##__VA_ARGS__
255 #include "nbnxm_cuda_kernel.cuh"
256 #undef NB_KERNEL_FUNC_NAME
257 /* cut-off + V shift LJ w geometric combination rules */
259 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJCombGeom##__VA_ARGS__
260 #include "nbnxm_cuda_kernel.cuh"
262 #undef NB_KERNEL_FUNC_NAME
263 /* cut-off + V shift LJ w LB combination rules */
265 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJCombLB##__VA_ARGS__
266 #include "nbnxm_cuda_kernel.cuh"
268 #undef NB_KERNEL_FUNC_NAME
269 /* LJ-Ewald w geometric combination rules */
270 #define LJ_EWALD_COMB_GEOM
271 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJEwCombGeom##__VA_ARGS__
272 #include "nbnxm_cuda_kernel.cuh"
273 #undef LJ_EWALD_COMB_GEOM
274 #undef NB_KERNEL_FUNC_NAME
275 /* LJ-Ewald w LB combination rules */
276 #define LJ_EWALD_COMB_LB
277 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJEwCombLB##__VA_ARGS__
278 #include "nbnxm_cuda_kernel.cuh"
279 #undef LJ_EWALD_COMB_LB
280 #undef NB_KERNEL_FUNC_NAME
282 #define LJ_FORCE_SWITCH
283 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJFsw##__VA_ARGS__
284 #include "nbnxm_cuda_kernel.cuh"
285 #undef LJ_FORCE_SWITCH
286 #undef NB_KERNEL_FUNC_NAME
288 #define LJ_POT_SWITCH
289 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTab_VdwLJPsw##__VA_ARGS__
290 #include "nbnxm_cuda_kernel.cuh"
292 #undef NB_KERNEL_FUNC_NAME
297 /* Tabulated Ewald interaction kernels with twin-range cut-off */
299 #define VDW_CUTOFF_CHECK
301 /* cut-off + V shift LJ */
302 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJ##__VA_ARGS__
303 #include "nbnxm_cuda_kernel.cuh"
304 #undef NB_KERNEL_FUNC_NAME
305 /* cut-off + V shift LJ w geometric combination rules */
307 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJCombGeom##__VA_ARGS__
308 #include "nbnxm_cuda_kernel.cuh"
310 #undef NB_KERNEL_FUNC_NAME
311 /* cut-off + V shift LJ w LB combination rules */
313 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJCombLB##__VA_ARGS__
314 #include "nbnxm_cuda_kernel.cuh"
316 #undef NB_KERNEL_FUNC_NAME
317 /* LJ-Ewald w geometric combination rules */
318 #define LJ_EWALD_COMB_GEOM
319 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJEwCombGeom##__VA_ARGS__
320 #include "nbnxm_cuda_kernel.cuh"
321 #undef LJ_EWALD_COMB_GEOM
322 #undef NB_KERNEL_FUNC_NAME
323 /* LJ-Ewald w LB combination rules */
324 #define LJ_EWALD_COMB_LB
325 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJEwCombLB##__VA_ARGS__
326 #include "nbnxm_cuda_kernel.cuh"
327 #undef LJ_EWALD_COMB_LB
328 #undef NB_KERNEL_FUNC_NAME
330 #define LJ_FORCE_SWITCH
331 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJFsw##__VA_ARGS__
332 #include "nbnxm_cuda_kernel.cuh"
333 #undef LJ_FORCE_SWITCH
334 #undef NB_KERNEL_FUNC_NAME
336 #define LJ_POT_SWITCH
337 #define NB_KERNEL_FUNC_NAME(x, ...) x##_ElecEwQSTabTwinCut_VdwLJPsw##__VA_ARGS__
338 #include "nbnxm_cuda_kernel.cuh"
340 #undef NB_KERNEL_FUNC_NAME
343 #undef VDW_CUTOFF_CHECK