Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / mdlib / nbnxn_cuda / nbnxn_cuda_kernels.cuh
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, 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.
8  *
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.
13  *
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.
18  *
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.
23  *
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.
31  *
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.
34  */
35
36 /*! \internal \file
37  *  This header has the sole purpose of generating kernels for the combinations of
38  *  supported electrostatics types (cut-off, reaction-field, analytical and
39  *  tabulated Ewald) and VDW types (cut-off + V shift, LJ-Ewald with
40  *  geometric or Lorentz-Berthelot combination rule, F switch, V switch).
41  *
42  *  The Ewald kernels have twin-range cut-off versions with rcoul != rvdw which
43  *  require an extra distance check to enable  PP-PME load balancing
44  *  (otherwise, by default rcoul == rvdw).
45  *
46  *  NOTE: No include fence as it is meant to be included multiple times.
47  */
48
49 /* Analytical plain cut-off electrostatics kernels
50  */
51 #define EL_CUTOFF
52
53 /* cut-off + V shift LJ */
54 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJ ## __VA_ARGS__
55 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
56 #undef NB_KERNEL_FUNC_NAME
57 /* LJ-Ewald w geometric combination rules */
58 #define LJ_EWALD_COMB_GEOM
59 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJEwCombGeom ## __VA_ARGS__
60 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
61 #undef LJ_EWALD_COMB_GEOM
62 #undef NB_KERNEL_FUNC_NAME
63 /* LJ-Ewald w LB combination rules */
64 #define LJ_EWALD_COMB_LB
65 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJEwCombLB ## __VA_ARGS__
66 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
67 #undef LJ_EWALD_COMB_LB
68 #undef NB_KERNEL_FUNC_NAME
69 /* F switch LJ */
70 #define LJ_FORCE_SWITCH
71 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJFsw ## __VA_ARGS__
72 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
73 #undef LJ_FORCE_SWITCH
74 #undef NB_KERNEL_FUNC_NAME
75 /* V switch LJ */
76 #define LJ_POT_SWITCH
77 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecCut_VdwLJPsw ## __VA_ARGS__
78 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
79 #undef LJ_POT_SWITCH
80 #undef NB_KERNEL_FUNC_NAME
81
82 #undef EL_CUTOFF
83
84
85 /* Analytical reaction-field kernels
86  */
87 #define EL_RF
88
89 /* cut-off + V shift LJ */
90 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJ ## __VA_ARGS__
91 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
92 #undef NB_KERNEL_FUNC_NAME
93 /* LJ-Ewald w geometric combination rules */
94 #define LJ_EWALD_COMB_GEOM
95 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJEwCombGeom ## __VA_ARGS__
96 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
97 #undef LJ_EWALD_COMB_GEOM
98 #undef NB_KERNEL_FUNC_NAME
99 /* LJ-Ewald w LB combination rules */
100 #define LJ_EWALD_COMB_LB
101 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJEwCombLB ## __VA_ARGS__
102 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
103 #undef LJ_EWALD_COMB_LB
104 #undef NB_KERNEL_FUNC_NAME
105 /* F switch LJ */
106 #define LJ_FORCE_SWITCH
107 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJFsw ## __VA_ARGS__
108 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
109 #undef LJ_FORCE_SWITCH
110 #undef NB_KERNEL_FUNC_NAME
111 /* V switch LJ */
112 #define LJ_POT_SWITCH
113 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecRF_VdwLJPsw ## __VA_ARGS__
114 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
115 #undef LJ_POT_SWITCH
116 #undef NB_KERNEL_FUNC_NAME
117
118 #undef EL_RF
119
120
121 /* Analytical Ewald interaction kernels
122  */
123 #define EL_EWALD_ANA
124
125 /* cut-off + V shift LJ */
126 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJ ## __VA_ARGS__
127 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
128 #undef NB_KERNEL_FUNC_NAME
129 /* LJ-Ewald w geometric combination rules */
130 #define LJ_EWALD_COMB_GEOM
131 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJEwCombGeom ## __VA_ARGS__
132 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
133 #undef LJ_EWALD_COMB_GEOM
134 #undef NB_KERNEL_FUNC_NAME
135 /* LJ-Ewald w LB combination rules */
136 #define LJ_EWALD_COMB_LB
137 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJEwCombLB ## __VA_ARGS__
138 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
139 #undef LJ_EWALD_COMB_LB
140 #undef NB_KERNEL_FUNC_NAME
141 /* F switch LJ */
142 #define LJ_FORCE_SWITCH
143 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJFsw ## __VA_ARGS__
144 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
145 #undef LJ_FORCE_SWITCH
146 #undef NB_KERNEL_FUNC_NAME
147 /* V switch LJ */
148 #define LJ_POT_SWITCH
149 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEw_VdwLJPsw ## __VA_ARGS__
150 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
151 #undef LJ_POT_SWITCH
152 #undef NB_KERNEL_FUNC_NAME
153
154 #undef EL_EWALD_ANA
155
156
157 /* Analytical Ewald interaction kernels with twin-range cut-off
158  */
159 #define EL_EWALD_ANA
160 #define VDW_CUTOFF_CHECK
161
162 /* cut-off + V shift LJ */
163 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJ ## __VA_ARGS__
164 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
165 #undef NB_KERNEL_FUNC_NAME
166 /* LJ-Ewald w geometric combination rules */
167 #define LJ_EWALD_COMB_GEOM
168 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJEwCombGeom ## __VA_ARGS__
169 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
170 #undef LJ_EWALD_COMB_GEOM
171 #undef NB_KERNEL_FUNC_NAME
172 /* LJ-Ewald w LB combination rules */
173 #define LJ_EWALD_COMB_LB
174 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJEwCombLB ## __VA_ARGS__
175 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
176 #undef LJ_EWALD_COMB_LB
177 #undef NB_KERNEL_FUNC_NAME
178 /* F switch LJ */
179 #define LJ_FORCE_SWITCH
180 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJFsw ## __VA_ARGS__
181 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
182 #undef LJ_FORCE_SWITCH
183 #undef NB_KERNEL_FUNC_NAME
184 /* V switch LJ */
185 #define LJ_POT_SWITCH
186 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwTwinCut_VdwLJPsw ## __VA_ARGS__
187 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
188 #undef LJ_POT_SWITCH
189 #undef NB_KERNEL_FUNC_NAME
190
191 #undef EL_EWALD_ANA
192 #undef VDW_CUTOFF_CHECK
193
194
195 /* Tabulated Ewald interaction kernels */
196 #define EL_EWALD_TAB
197
198 /* cut-off + V shift LJ */
199 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJ ## __VA_ARGS__
200 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
201 #undef NB_KERNEL_FUNC_NAME
202 /* LJ-Ewald w geometric combination rules */
203 #define LJ_EWALD_COMB_GEOM
204 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJEwCombGeom ## __VA_ARGS__
205 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
206 #undef LJ_EWALD_COMB_GEOM
207 #undef NB_KERNEL_FUNC_NAME
208 /* LJ-Ewald w LB combination rules */
209 #define LJ_EWALD_COMB_LB
210 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJEwCombLB ## __VA_ARGS__
211 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
212 #undef LJ_EWALD_COMB_LB
213 #undef NB_KERNEL_FUNC_NAME
214 /* F switch LJ */
215 #define LJ_FORCE_SWITCH
216 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJFsw ## __VA_ARGS__
217 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
218 #undef LJ_FORCE_SWITCH
219 #undef NB_KERNEL_FUNC_NAME
220 /* V switch LJ */
221 #define LJ_POT_SWITCH
222 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTab_VdwLJPsw ## __VA_ARGS__
223 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
224 #undef LJ_POT_SWITCH
225 #undef NB_KERNEL_FUNC_NAME
226
227 #undef EL_EWALD_TAB
228
229
230 /* Tabulated Ewald interaction kernels with twin-range cut-off */
231 #define EL_EWALD_TAB
232 #define VDW_CUTOFF_CHECK
233
234 /* cut-off + V shift LJ */
235 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJ ## __VA_ARGS__
236 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
237 #undef NB_KERNEL_FUNC_NAME
238 /* LJ-Ewald w geometric combination rules */
239 #define LJ_EWALD_COMB_GEOM
240 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJEwCombGeom ## __VA_ARGS__
241 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
242 #undef LJ_EWALD_COMB_GEOM
243 #undef NB_KERNEL_FUNC_NAME
244 /* LJ-Ewald w LB combination rules */
245 #define LJ_EWALD_COMB_LB
246 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJEwCombLB ## __VA_ARGS__
247 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
248 #undef LJ_EWALD_COMB_LB
249 #undef NB_KERNEL_FUNC_NAME
250 /* F switch LJ */
251 #define LJ_FORCE_SWITCH
252 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJFsw ## __VA_ARGS__
253 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
254 #undef LJ_FORCE_SWITCH
255 #undef NB_KERNEL_FUNC_NAME
256 /* V switch LJ */
257 #define LJ_POT_SWITCH
258 #define NB_KERNEL_FUNC_NAME(x, ...) x ## _ElecEwQSTabTwinCut_VdwLJPsw ## __VA_ARGS__
259 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh"
260 #undef LJ_POT_SWITCH
261 #undef NB_KERNEL_FUNC_NAME
262
263 #undef EL_EWALD_TAB
264 #undef VDW_CUTOFF_CHECK