SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / src / gromacs / nbnxm / opencl / nbnxm_ocl_kernels.clh
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014,2016,2018 by the GROMACS development team.
5  * Copyright (c) 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.
9  *
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.
14  *
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.
19  *
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.
24  *
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.
32  *
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.
35  */
36
37 /*! \internal \file
38  *  This header has the sole purpose of generating kernels for the combinations of
39  *  supported electrostatics types (cut-off, reaction-field, analytical and
40  *  tabulated Ewald) and VDW types (cut-off + V shift, LJ-Ewald with
41  *  geometric or Lorentz-Berthelot combination rule, F switch, V switch).
42  *
43  *  The Ewald kernels have twin-range cut-off versions with rcoul != rvdw which
44  *  require an extra distance check to enable  PP-PME load balancing
45  *  (otherwise, by default rcoul == rvdw).
46  *
47  *  NOTE: No include fence as it is meant to be included multiple times.
48  */
49
50 #include "nbnxm_ocl_kernel_utils.clh"
51
52 /* Analytical plain cut-off electrostatics kernels
53  */
54 #define EL_CUTOFF
55
56 /* cut-off + V shift LJ */
57 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJ##y
58 #include "nbnxm_ocl_kernel.clh"
59 #undef NB_KERNEL_FUNC_NAME
60 /* cut-off + V shift LJ w geometric combination rules */
61 #define LJ_COMB_GEOM
62 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJCombGeom##y
63 #include "nbnxm_ocl_kernel.clh"
64 #undef LJ_COMB_GEOM
65 #undef NB_KERNEL_FUNC_NAME
66 /* cut-off + V shift LJ w LB combination rules */
67 #define LJ_COMB_LB
68 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJCombLB##y
69 #include "nbnxm_ocl_kernel.clh"
70 #undef LJ_COMB_LB
71 #undef NB_KERNEL_FUNC_NAME
72 /* LJ-Ewald w geometric combination rules */
73 #define LJ_EWALD_COMB_GEOM
74 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJEwCombGeom##y
75 #include "nbnxm_ocl_kernel.clh"
76 #undef LJ_EWALD_COMB_GEOM
77 #undef NB_KERNEL_FUNC_NAME
78 /* LJ-Ewald w LB combination rules */
79 #define LJ_EWALD_COMB_LB
80 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJEwCombLB##y
81 #include "nbnxm_ocl_kernel.clh"
82 #undef LJ_EWALD_COMB_LB
83 #undef NB_KERNEL_FUNC_NAME
84 /* F switch LJ */
85 #define LJ_FORCE_SWITCH
86 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJFsw##y
87 #include "nbnxm_ocl_kernel.clh"
88 #undef LJ_FORCE_SWITCH
89 #undef NB_KERNEL_FUNC_NAME
90 /* V switch LJ */
91 #define LJ_POT_SWITCH
92 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecCut_VdwLJPsw##y
93 #include "nbnxm_ocl_kernel.clh"
94 #undef LJ_POT_SWITCH
95 #undef NB_KERNEL_FUNC_NAME
96
97 #undef EL_CUTOFF
98
99
100 /* Analytical reaction-field kernels
101  */
102 #define EL_RF
103
104 /* cut-off + V shift LJ */
105 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJ##y
106 #include "nbnxm_ocl_kernel.clh"
107 #undef NB_KERNEL_FUNC_NAME
108 /* cut-off + V shift LJ w geometric combination rules */
109 #define LJ_COMB_GEOM
110 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJCombGeom##y
111 #include "nbnxm_ocl_kernel.clh"
112 #undef LJ_COMB_GEOM
113 #undef NB_KERNEL_FUNC_NAME
114 /* cut-off + V shift LJ w LB combination rules */
115 #define LJ_COMB_LB
116 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJCombLB##y
117 #include "nbnxm_ocl_kernel.clh"
118 #undef LJ_COMB_LB
119 #undef NB_KERNEL_FUNC_NAME
120 /* LJ-Ewald w geometric combination rules */
121 #define LJ_EWALD_COMB_GEOM
122 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJEwCombGeom##y
123 #include "nbnxm_ocl_kernel.clh"
124 #undef LJ_EWALD_COMB_GEOM
125 #undef NB_KERNEL_FUNC_NAME
126 /* LJ-Ewald w LB combination rules */
127 #define LJ_EWALD_COMB_LB
128 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJEwCombLB##y
129 #include "nbnxm_ocl_kernel.clh"
130 #undef LJ_EWALD_COMB_LB
131 #undef NB_KERNEL_FUNC_NAME
132 /* F switch LJ */
133 #define LJ_FORCE_SWITCH
134 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJFsw##y
135 #include "nbnxm_ocl_kernel.clh"
136 #undef LJ_FORCE_SWITCH
137 #undef NB_KERNEL_FUNC_NAME
138 /* V switch LJ */
139 #define LJ_POT_SWITCH
140 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecRF_VdwLJPsw##y
141 #include "nbnxm_ocl_kernel.clh"
142 #undef LJ_POT_SWITCH
143 #undef NB_KERNEL_FUNC_NAME
144
145 #undef EL_RF
146
147
148 /* Analytical Ewald interaction kernels
149  */
150 #define EL_EWALD_ANA
151
152 /* cut-off + V shift LJ */
153 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJ##y
154 #include "nbnxm_ocl_kernel.clh"
155 #undef NB_KERNEL_FUNC_NAME
156 /* cut-off + V shift LJ w geometric combination rules */
157 #define LJ_COMB_GEOM
158 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJCombGeom##y
159 #include "nbnxm_ocl_kernel.clh"
160 #undef LJ_COMB_GEOM
161 #undef NB_KERNEL_FUNC_NAME
162 /* cut-off + V shift LJ w LB combination rules */
163 #define LJ_COMB_LB
164 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJCombLB##y
165 #include "nbnxm_ocl_kernel.clh"
166 #undef LJ_COMB_LB
167 #undef NB_KERNEL_FUNC_NAME
168 /* LJ-Ewald w geometric combination rules */
169 #define LJ_EWALD_COMB_GEOM
170 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJEwCombGeom##y
171 #include "nbnxm_ocl_kernel.clh"
172 #undef LJ_EWALD_COMB_GEOM
173 #undef NB_KERNEL_FUNC_NAME
174 /* LJ-Ewald w LB combination rules */
175 #define LJ_EWALD_COMB_LB
176 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJEwCombLB##y
177 #include "nbnxm_ocl_kernel.clh"
178 #undef LJ_EWALD_COMB_LB
179 #undef NB_KERNEL_FUNC_NAME
180 /* F switch LJ */
181 #define LJ_FORCE_SWITCH
182 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJFsw##y
183 #include "nbnxm_ocl_kernel.clh"
184 #undef LJ_FORCE_SWITCH
185 #undef NB_KERNEL_FUNC_NAME
186 /* V switch LJ */
187 #define LJ_POT_SWITCH
188 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEw_VdwLJPsw##y
189 #include "nbnxm_ocl_kernel.clh"
190 #undef LJ_POT_SWITCH
191 #undef NB_KERNEL_FUNC_NAME
192
193 #undef EL_EWALD_ANA
194
195
196 /* Analytical Ewald interaction kernels with twin-range cut-off
197  */
198 #define EL_EWALD_ANA
199 #define VDW_CUTOFF_CHECK
200
201 /* cut-off + V shift LJ */
202 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJ##y
203 #include "nbnxm_ocl_kernel.clh"
204 #undef NB_KERNEL_FUNC_NAME
205 /* cut-off + V shift LJ w geometric combination rules */
206 #define LJ_COMB_GEOM
207 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJCombGeom##y
208 #include "nbnxm_ocl_kernel.clh"
209 #undef LJ_COMB_GEOM
210 #undef NB_KERNEL_FUNC_NAME
211 /* cut-off + V shift LJ w LB combination rules */
212 #define LJ_COMB_LB
213 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJCombLB##y
214 #include "nbnxm_ocl_kernel.clh"
215 #undef LJ_COMB_LB
216 #undef NB_KERNEL_FUNC_NAME
217 /* LJ-Ewald w geometric combination rules */
218 #define LJ_EWALD_COMB_GEOM
219 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJEwCombGeom##y
220 #include "nbnxm_ocl_kernel.clh"
221 #undef LJ_EWALD_COMB_GEOM
222 #undef NB_KERNEL_FUNC_NAME
223 /* LJ-Ewald w LB combination rules */
224 #define LJ_EWALD_COMB_LB
225 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJEwCombLB##y
226 #include "nbnxm_ocl_kernel.clh"
227 #undef LJ_EWALD_COMB_LB
228 #undef NB_KERNEL_FUNC_NAME
229 /* F switch LJ */
230 #define LJ_FORCE_SWITCH
231 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJFsw##y
232 #include "nbnxm_ocl_kernel.clh"
233 #undef LJ_FORCE_SWITCH
234 #undef NB_KERNEL_FUNC_NAME
235 /* V switch LJ */
236 #define LJ_POT_SWITCH
237 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwTwinCut_VdwLJPsw##y
238 #include "nbnxm_ocl_kernel.clh"
239 #undef LJ_POT_SWITCH
240 #undef NB_KERNEL_FUNC_NAME
241
242 #undef EL_EWALD_ANA
243 #undef VDW_CUTOFF_CHECK
244
245
246 /* Tabulated Ewald interaction kernels */
247 #define EL_EWALD_TAB
248
249 /* cut-off + V shift LJ */
250 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJ##y
251 #include "nbnxm_ocl_kernel.clh"
252 #undef NB_KERNEL_FUNC_NAME
253 /* cut-off + V shift LJ w geometric combination rules */
254 #define LJ_COMB_GEOM
255 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJCombGeom##y
256 #include "nbnxm_ocl_kernel.clh"
257 #undef LJ_COMB_GEOM
258 #undef NB_KERNEL_FUNC_NAME
259 /* cut-off + V shift LJ w LB combination rules */
260 #define LJ_COMB_LB
261 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJCombLB##y
262 #include "nbnxm_ocl_kernel.clh"
263 #undef LJ_COMB_LB
264 #undef NB_KERNEL_FUNC_NAME
265 /* LJ-Ewald w geometric combination rules */
266 #define LJ_EWALD_COMB_GEOM
267 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJEwCombGeom##y
268 #include "nbnxm_ocl_kernel.clh"
269 #undef LJ_EWALD_COMB_GEOM
270 #undef NB_KERNEL_FUNC_NAME
271 /* LJ-Ewald w LB combination rules */
272 #define LJ_EWALD_COMB_LB
273 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJEwCombLB##y
274 #include "nbnxm_ocl_kernel.clh"
275 #undef LJ_EWALD_COMB_LB
276 #undef NB_KERNEL_FUNC_NAME
277 /* F switch LJ */
278 #define LJ_FORCE_SWITCH
279 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJFsw##y
280 #include "nbnxm_ocl_kernel.clh"
281 #undef LJ_FORCE_SWITCH
282 #undef NB_KERNEL_FUNC_NAME
283 /* V switch LJ */
284 #define LJ_POT_SWITCH
285 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTab_VdwLJPsw##y
286 #include "nbnxm_ocl_kernel.clh"
287 #undef LJ_POT_SWITCH
288 #undef NB_KERNEL_FUNC_NAME
289
290 #undef EL_EWALD_TAB
291
292
293 /* Tabulated Ewald interaction kernels with twin-range cut-off */
294 #define EL_EWALD_TAB
295 #define VDW_CUTOFF_CHECK
296
297 /* cut-off + V shift LJ */
298 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwinCut_VdwLJ##y
299 #include "nbnxm_ocl_kernel.clh"
300 #undef NB_KERNEL_FUNC_NAME
301 /* cut-off + V shift LJ w geometric combination rules */
302 #define LJ_COMB_GEOM
303 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwin_VdwLJCombGeom##y
304 #include "nbnxm_ocl_kernel.clh"
305 #undef LJ_COMB_GEOM
306 #undef NB_KERNEL_FUNC_NAME
307 /* cut-off + V shift LJ w LB combination rules */
308 #define LJ_COMB_LB
309 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwin_VdwLJCombLB##y
310 #include "nbnxm_ocl_kernel.clh"
311 #undef LJ_COMB_LB
312 #undef NB_KERNEL_FUNC_NAME
313 /* LJ-Ewald w geometric combination rules */
314 #define LJ_EWALD_COMB_GEOM
315 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwinCut_VdwLJEwCombGeom##y
316 #include "nbnxm_ocl_kernel.clh"
317 #undef LJ_EWALD_COMB_GEOM
318 #undef NB_KERNEL_FUNC_NAME
319 /* LJ-Ewald w LB combination rules */
320 #define LJ_EWALD_COMB_LB
321 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwinCut_VdwLJEwCombLB##y
322 #include "nbnxm_ocl_kernel.clh"
323 #undef LJ_EWALD_COMB_LB
324 #undef NB_KERNEL_FUNC_NAME
325 /* F switch LJ */
326 #define LJ_FORCE_SWITCH
327 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwinCut_VdwLJFsw##y
328 #include "nbnxm_ocl_kernel.clh"
329 #undef LJ_FORCE_SWITCH
330 #undef NB_KERNEL_FUNC_NAME
331 /* V switch LJ */
332 #define LJ_POT_SWITCH
333 #define NB_KERNEL_FUNC_NAME(x, y) x##_ElecEwQSTabTwinCut_VdwLJPsw##y
334 #include "nbnxm_ocl_kernel.clh"
335 #undef LJ_POT_SWITCH
336 #undef NB_KERNEL_FUNC_NAME
337
338 #undef EL_EWALD_TAB
339 #undef VDW_CUTOFF_CHECK