File: | gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwLJEw_GeomW4W4_c.c |
Location: | line 797, column 5 |
Description: | Value stored to 'sh_lj_ewald' is never read |
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 | * Note: this file was generated by the GROMACS c kernel generator. |
37 | */ |
38 | #ifdef HAVE_CONFIG_H1 |
39 | #include <config.h> |
40 | #endif |
41 | |
42 | #include <math.h> |
43 | |
44 | #include "../nb_kernel.h" |
45 | #include "types/simple.h" |
46 | #include "gromacs/math/vec.h" |
47 | #include "nrnb.h" |
48 | |
49 | /* |
50 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwLJEw_GeomW4W4_VF_c |
51 | * Electrostatics interaction: Ewald |
52 | * VdW interaction: LJEwald |
53 | * Geometry: Water4-Water4 |
54 | * Calculate force/pot: PotentialAndForce |
55 | */ |
56 | void |
57 | nb_kernel_ElecEw_VdwLJEw_GeomW4W4_VF_c |
58 | (t_nblist * gmx_restrict__restrict nlist, |
59 | rvec * gmx_restrict__restrict xx, |
60 | rvec * gmx_restrict__restrict ff, |
61 | t_forcerec * gmx_restrict__restrict fr, |
62 | t_mdatoms * gmx_restrict__restrict mdatoms, |
63 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
64 | t_nrnb * gmx_restrict__restrict nrnb) |
65 | { |
66 | int i_shift_offset,i_coord_offset,j_coord_offset; |
67 | int j_index_start,j_index_end; |
68 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
69 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
70 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
71 | real *shiftvec,*fshift,*x,*f; |
72 | int vdwioffset0; |
73 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
74 | int vdwioffset1; |
75 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
76 | int vdwioffset2; |
77 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
78 | int vdwioffset3; |
79 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
80 | int vdwjidx0; |
81 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
82 | int vdwjidx1; |
83 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
84 | int vdwjidx2; |
85 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
86 | int vdwjidx3; |
87 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
88 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
89 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
90 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
91 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
92 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
93 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
94 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
95 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
96 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
97 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
98 | real velec,felec,velecsum,facel,crf,krf,krf2; |
99 | real *charge; |
100 | int nvdwtype; |
101 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
102 | int *vdwtype; |
103 | real *vdwparam; |
104 | real c6grid_00; |
105 | real c6grid_11; |
106 | real c6grid_12; |
107 | real c6grid_13; |
108 | real c6grid_21; |
109 | real c6grid_22; |
110 | real c6grid_23; |
111 | real c6grid_31; |
112 | real c6grid_32; |
113 | real c6grid_33; |
114 | real ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,sh_lj_ewald; |
115 | real *vdwgridparam; |
116 | int ewitab; |
117 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
118 | real *ewtab; |
119 | |
120 | x = xx[0]; |
121 | f = ff[0]; |
122 | |
123 | nri = nlist->nri; |
124 | iinr = nlist->iinr; |
125 | jindex = nlist->jindex; |
126 | jjnr = nlist->jjnr; |
127 | shiftidx = nlist->shift; |
128 | gid = nlist->gid; |
129 | shiftvec = fr->shift_vec[0]; |
130 | fshift = fr->fshift[0]; |
131 | facel = fr->epsfac; |
132 | charge = mdatoms->chargeA; |
133 | nvdwtype = fr->ntype; |
134 | vdwparam = fr->nbfp; |
135 | vdwtype = mdatoms->typeA; |
136 | vdwgridparam = fr->ljpme_c6grid; |
137 | ewclj = fr->ewaldcoeff_lj; |
138 | sh_lj_ewald = fr->ic->sh_lj_ewald; |
139 | ewclj2 = ewclj*ewclj; |
140 | ewclj6 = ewclj2*ewclj2*ewclj2; |
141 | |
142 | sh_ewald = fr->ic->sh_ewald; |
143 | ewtab = fr->ic->tabq_coul_FDV0; |
144 | ewtabscale = fr->ic->tabq_scale; |
145 | ewtabhalfspace = 0.5/ewtabscale; |
146 | |
147 | /* Setup water-specific parameters */ |
148 | inr = nlist->iinr[0]; |
149 | iq1 = facel*charge[inr+1]; |
150 | iq2 = facel*charge[inr+2]; |
151 | iq3 = facel*charge[inr+3]; |
152 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
153 | |
154 | jq1 = charge[inr+1]; |
155 | jq2 = charge[inr+2]; |
156 | jq3 = charge[inr+3]; |
157 | vdwjidx0 = 2*vdwtype[inr+0]; |
158 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
159 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
160 | c6grid_00 = vdwgridparam[vdwioffset0+vdwjidx0]; |
161 | qq11 = iq1*jq1; |
162 | qq12 = iq1*jq2; |
163 | qq13 = iq1*jq3; |
164 | qq21 = iq2*jq1; |
165 | qq22 = iq2*jq2; |
166 | qq23 = iq2*jq3; |
167 | qq31 = iq3*jq1; |
168 | qq32 = iq3*jq2; |
169 | qq33 = iq3*jq3; |
170 | |
171 | outeriter = 0; |
172 | inneriter = 0; |
173 | |
174 | /* Start outer loop over neighborlists */ |
175 | for(iidx=0; iidx<nri; iidx++) |
176 | { |
177 | /* Load shift vector for this list */ |
178 | i_shift_offset = DIM3*shiftidx[iidx]; |
179 | shX = shiftvec[i_shift_offset+XX0]; |
180 | shY = shiftvec[i_shift_offset+YY1]; |
181 | shZ = shiftvec[i_shift_offset+ZZ2]; |
182 | |
183 | /* Load limits for loop over neighbors */ |
184 | j_index_start = jindex[iidx]; |
185 | j_index_end = jindex[iidx+1]; |
186 | |
187 | /* Get outer coordinate index */ |
188 | inr = iinr[iidx]; |
189 | i_coord_offset = DIM3*inr; |
190 | |
191 | /* Load i particle coords and add shift vector */ |
192 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
193 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
194 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
195 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
196 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
197 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
198 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
199 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
200 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
201 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
202 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
203 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
204 | |
205 | fix0 = 0.0; |
206 | fiy0 = 0.0; |
207 | fiz0 = 0.0; |
208 | fix1 = 0.0; |
209 | fiy1 = 0.0; |
210 | fiz1 = 0.0; |
211 | fix2 = 0.0; |
212 | fiy2 = 0.0; |
213 | fiz2 = 0.0; |
214 | fix3 = 0.0; |
215 | fiy3 = 0.0; |
216 | fiz3 = 0.0; |
217 | |
218 | /* Reset potential sums */ |
219 | velecsum = 0.0; |
220 | vvdwsum = 0.0; |
221 | |
222 | /* Start inner kernel loop */ |
223 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
224 | { |
225 | /* Get j neighbor index, and coordinate index */ |
226 | jnr = jjnr[jidx]; |
227 | j_coord_offset = DIM3*jnr; |
228 | |
229 | /* load j atom coordinates */ |
230 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
231 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
232 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
233 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
234 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
235 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
236 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
237 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
238 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
239 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
240 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
241 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
242 | |
243 | /* Calculate displacement vector */ |
244 | dx00 = ix0 - jx0; |
245 | dy00 = iy0 - jy0; |
246 | dz00 = iz0 - jz0; |
247 | dx11 = ix1 - jx1; |
248 | dy11 = iy1 - jy1; |
249 | dz11 = iz1 - jz1; |
250 | dx12 = ix1 - jx2; |
251 | dy12 = iy1 - jy2; |
252 | dz12 = iz1 - jz2; |
253 | dx13 = ix1 - jx3; |
254 | dy13 = iy1 - jy3; |
255 | dz13 = iz1 - jz3; |
256 | dx21 = ix2 - jx1; |
257 | dy21 = iy2 - jy1; |
258 | dz21 = iz2 - jz1; |
259 | dx22 = ix2 - jx2; |
260 | dy22 = iy2 - jy2; |
261 | dz22 = iz2 - jz2; |
262 | dx23 = ix2 - jx3; |
263 | dy23 = iy2 - jy3; |
264 | dz23 = iz2 - jz3; |
265 | dx31 = ix3 - jx1; |
266 | dy31 = iy3 - jy1; |
267 | dz31 = iz3 - jz1; |
268 | dx32 = ix3 - jx2; |
269 | dy32 = iy3 - jy2; |
270 | dz32 = iz3 - jz2; |
271 | dx33 = ix3 - jx3; |
272 | dy33 = iy3 - jy3; |
273 | dz33 = iz3 - jz3; |
274 | |
275 | /* Calculate squared distance and things based on it */ |
276 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
277 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
278 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
279 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
280 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
281 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
282 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
283 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
284 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
285 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
286 | |
287 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
288 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
289 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
290 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
291 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
292 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
293 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
294 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
295 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
296 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
297 | |
298 | rinvsq00 = rinv00*rinv00; |
299 | rinvsq11 = rinv11*rinv11; |
300 | rinvsq12 = rinv12*rinv12; |
301 | rinvsq13 = rinv13*rinv13; |
302 | rinvsq21 = rinv21*rinv21; |
303 | rinvsq22 = rinv22*rinv22; |
304 | rinvsq23 = rinv23*rinv23; |
305 | rinvsq31 = rinv31*rinv31; |
306 | rinvsq32 = rinv32*rinv32; |
307 | rinvsq33 = rinv33*rinv33; |
308 | |
309 | /************************** |
310 | * CALCULATE INTERACTIONS * |
311 | **************************/ |
312 | |
313 | r00 = rsq00*rinv00; |
314 | |
315 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
316 | ewcljrsq = ewclj2*rsq00; |
317 | exponent = exp(-ewcljrsq); |
318 | poly = exponent*(1.0 + ewcljrsq + ewcljrsq*ewcljrsq*0.5); |
319 | vvdw6 = (c6_00-c6grid_00*(1.0-poly))*rinvsix; |
320 | vvdw12 = c12_00*rinvsix*rinvsix; |
321 | vvdw = vvdw12*(1.0/12.0) - vvdw6*(1.0/6.0); |
322 | fvdw = (vvdw12 - vvdw6 - c6grid_00*(1.0/6.0)*exponent*ewclj6)*rinvsq00; |
323 | |
324 | /* Update potential sums from outer loop */ |
325 | vvdwsum += vvdw; |
326 | |
327 | fscal = fvdw; |
328 | |
329 | /* Calculate temporary vectorial force */ |
330 | tx = fscal*dx00; |
331 | ty = fscal*dy00; |
332 | tz = fscal*dz00; |
333 | |
334 | /* Update vectorial force */ |
335 | fix0 += tx; |
336 | fiy0 += ty; |
337 | fiz0 += tz; |
338 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
339 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
340 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
341 | |
342 | /************************** |
343 | * CALCULATE INTERACTIONS * |
344 | **************************/ |
345 | |
346 | r11 = rsq11*rinv11; |
347 | |
348 | /* EWALD ELECTROSTATICS */ |
349 | |
350 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
351 | ewrt = r11*ewtabscale; |
352 | ewitab = ewrt; |
353 | eweps = ewrt-ewitab; |
354 | ewitab = 4*ewitab; |
355 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
356 | velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
357 | felec = qq11*rinv11*(rinvsq11-felec); |
358 | |
359 | /* Update potential sums from outer loop */ |
360 | velecsum += velec; |
361 | |
362 | fscal = felec; |
363 | |
364 | /* Calculate temporary vectorial force */ |
365 | tx = fscal*dx11; |
366 | ty = fscal*dy11; |
367 | tz = fscal*dz11; |
368 | |
369 | /* Update vectorial force */ |
370 | fix1 += tx; |
371 | fiy1 += ty; |
372 | fiz1 += tz; |
373 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
374 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
375 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
376 | |
377 | /************************** |
378 | * CALCULATE INTERACTIONS * |
379 | **************************/ |
380 | |
381 | r12 = rsq12*rinv12; |
382 | |
383 | /* EWALD ELECTROSTATICS */ |
384 | |
385 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
386 | ewrt = r12*ewtabscale; |
387 | ewitab = ewrt; |
388 | eweps = ewrt-ewitab; |
389 | ewitab = 4*ewitab; |
390 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
391 | velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
392 | felec = qq12*rinv12*(rinvsq12-felec); |
393 | |
394 | /* Update potential sums from outer loop */ |
395 | velecsum += velec; |
396 | |
397 | fscal = felec; |
398 | |
399 | /* Calculate temporary vectorial force */ |
400 | tx = fscal*dx12; |
401 | ty = fscal*dy12; |
402 | tz = fscal*dz12; |
403 | |
404 | /* Update vectorial force */ |
405 | fix1 += tx; |
406 | fiy1 += ty; |
407 | fiz1 += tz; |
408 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
409 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
410 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
411 | |
412 | /************************** |
413 | * CALCULATE INTERACTIONS * |
414 | **************************/ |
415 | |
416 | r13 = rsq13*rinv13; |
417 | |
418 | /* EWALD ELECTROSTATICS */ |
419 | |
420 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
421 | ewrt = r13*ewtabscale; |
422 | ewitab = ewrt; |
423 | eweps = ewrt-ewitab; |
424 | ewitab = 4*ewitab; |
425 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
426 | velec = qq13*(rinv13-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
427 | felec = qq13*rinv13*(rinvsq13-felec); |
428 | |
429 | /* Update potential sums from outer loop */ |
430 | velecsum += velec; |
431 | |
432 | fscal = felec; |
433 | |
434 | /* Calculate temporary vectorial force */ |
435 | tx = fscal*dx13; |
436 | ty = fscal*dy13; |
437 | tz = fscal*dz13; |
438 | |
439 | /* Update vectorial force */ |
440 | fix1 += tx; |
441 | fiy1 += ty; |
442 | fiz1 += tz; |
443 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
444 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
445 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
446 | |
447 | /************************** |
448 | * CALCULATE INTERACTIONS * |
449 | **************************/ |
450 | |
451 | r21 = rsq21*rinv21; |
452 | |
453 | /* EWALD ELECTROSTATICS */ |
454 | |
455 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
456 | ewrt = r21*ewtabscale; |
457 | ewitab = ewrt; |
458 | eweps = ewrt-ewitab; |
459 | ewitab = 4*ewitab; |
460 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
461 | velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
462 | felec = qq21*rinv21*(rinvsq21-felec); |
463 | |
464 | /* Update potential sums from outer loop */ |
465 | velecsum += velec; |
466 | |
467 | fscal = felec; |
468 | |
469 | /* Calculate temporary vectorial force */ |
470 | tx = fscal*dx21; |
471 | ty = fscal*dy21; |
472 | tz = fscal*dz21; |
473 | |
474 | /* Update vectorial force */ |
475 | fix2 += tx; |
476 | fiy2 += ty; |
477 | fiz2 += tz; |
478 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
479 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
480 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
481 | |
482 | /************************** |
483 | * CALCULATE INTERACTIONS * |
484 | **************************/ |
485 | |
486 | r22 = rsq22*rinv22; |
487 | |
488 | /* EWALD ELECTROSTATICS */ |
489 | |
490 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
491 | ewrt = r22*ewtabscale; |
492 | ewitab = ewrt; |
493 | eweps = ewrt-ewitab; |
494 | ewitab = 4*ewitab; |
495 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
496 | velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
497 | felec = qq22*rinv22*(rinvsq22-felec); |
498 | |
499 | /* Update potential sums from outer loop */ |
500 | velecsum += velec; |
501 | |
502 | fscal = felec; |
503 | |
504 | /* Calculate temporary vectorial force */ |
505 | tx = fscal*dx22; |
506 | ty = fscal*dy22; |
507 | tz = fscal*dz22; |
508 | |
509 | /* Update vectorial force */ |
510 | fix2 += tx; |
511 | fiy2 += ty; |
512 | fiz2 += tz; |
513 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
514 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
515 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
516 | |
517 | /************************** |
518 | * CALCULATE INTERACTIONS * |
519 | **************************/ |
520 | |
521 | r23 = rsq23*rinv23; |
522 | |
523 | /* EWALD ELECTROSTATICS */ |
524 | |
525 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
526 | ewrt = r23*ewtabscale; |
527 | ewitab = ewrt; |
528 | eweps = ewrt-ewitab; |
529 | ewitab = 4*ewitab; |
530 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
531 | velec = qq23*(rinv23-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
532 | felec = qq23*rinv23*(rinvsq23-felec); |
533 | |
534 | /* Update potential sums from outer loop */ |
535 | velecsum += velec; |
536 | |
537 | fscal = felec; |
538 | |
539 | /* Calculate temporary vectorial force */ |
540 | tx = fscal*dx23; |
541 | ty = fscal*dy23; |
542 | tz = fscal*dz23; |
543 | |
544 | /* Update vectorial force */ |
545 | fix2 += tx; |
546 | fiy2 += ty; |
547 | fiz2 += tz; |
548 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
549 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
550 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
551 | |
552 | /************************** |
553 | * CALCULATE INTERACTIONS * |
554 | **************************/ |
555 | |
556 | r31 = rsq31*rinv31; |
557 | |
558 | /* EWALD ELECTROSTATICS */ |
559 | |
560 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
561 | ewrt = r31*ewtabscale; |
562 | ewitab = ewrt; |
563 | eweps = ewrt-ewitab; |
564 | ewitab = 4*ewitab; |
565 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
566 | velec = qq31*(rinv31-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
567 | felec = qq31*rinv31*(rinvsq31-felec); |
568 | |
569 | /* Update potential sums from outer loop */ |
570 | velecsum += velec; |
571 | |
572 | fscal = felec; |
573 | |
574 | /* Calculate temporary vectorial force */ |
575 | tx = fscal*dx31; |
576 | ty = fscal*dy31; |
577 | tz = fscal*dz31; |
578 | |
579 | /* Update vectorial force */ |
580 | fix3 += tx; |
581 | fiy3 += ty; |
582 | fiz3 += tz; |
583 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
584 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
585 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
586 | |
587 | /************************** |
588 | * CALCULATE INTERACTIONS * |
589 | **************************/ |
590 | |
591 | r32 = rsq32*rinv32; |
592 | |
593 | /* EWALD ELECTROSTATICS */ |
594 | |
595 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
596 | ewrt = r32*ewtabscale; |
597 | ewitab = ewrt; |
598 | eweps = ewrt-ewitab; |
599 | ewitab = 4*ewitab; |
600 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
601 | velec = qq32*(rinv32-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
602 | felec = qq32*rinv32*(rinvsq32-felec); |
603 | |
604 | /* Update potential sums from outer loop */ |
605 | velecsum += velec; |
606 | |
607 | fscal = felec; |
608 | |
609 | /* Calculate temporary vectorial force */ |
610 | tx = fscal*dx32; |
611 | ty = fscal*dy32; |
612 | tz = fscal*dz32; |
613 | |
614 | /* Update vectorial force */ |
615 | fix3 += tx; |
616 | fiy3 += ty; |
617 | fiz3 += tz; |
618 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
619 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
620 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
621 | |
622 | /************************** |
623 | * CALCULATE INTERACTIONS * |
624 | **************************/ |
625 | |
626 | r33 = rsq33*rinv33; |
627 | |
628 | /* EWALD ELECTROSTATICS */ |
629 | |
630 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
631 | ewrt = r33*ewtabscale; |
632 | ewitab = ewrt; |
633 | eweps = ewrt-ewitab; |
634 | ewitab = 4*ewitab; |
635 | felec = ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
636 | velec = qq33*(rinv33-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec))); |
637 | felec = qq33*rinv33*(rinvsq33-felec); |
638 | |
639 | /* Update potential sums from outer loop */ |
640 | velecsum += velec; |
641 | |
642 | fscal = felec; |
643 | |
644 | /* Calculate temporary vectorial force */ |
645 | tx = fscal*dx33; |
646 | ty = fscal*dy33; |
647 | tz = fscal*dz33; |
648 | |
649 | /* Update vectorial force */ |
650 | fix3 += tx; |
651 | fiy3 += ty; |
652 | fiz3 += tz; |
653 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
654 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
655 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
656 | |
657 | /* Inner loop uses 409 flops */ |
658 | } |
659 | /* End of innermost loop */ |
660 | |
661 | tx = ty = tz = 0; |
662 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
663 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
664 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
665 | tx += fix0; |
666 | ty += fiy0; |
667 | tz += fiz0; |
668 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
669 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
670 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
671 | tx += fix1; |
672 | ty += fiy1; |
673 | tz += fiz1; |
674 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
675 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
676 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
677 | tx += fix2; |
678 | ty += fiy2; |
679 | tz += fiz2; |
680 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
681 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
682 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
683 | tx += fix3; |
684 | ty += fiy3; |
685 | tz += fiz3; |
686 | fshift[i_shift_offset+XX0] += tx; |
687 | fshift[i_shift_offset+YY1] += ty; |
688 | fshift[i_shift_offset+ZZ2] += tz; |
689 | |
690 | ggid = gid[iidx]; |
691 | /* Update potential energies */ |
692 | kernel_data->energygrp_elec[ggid] += velecsum; |
693 | kernel_data->energygrp_vdw[ggid] += vvdwsum; |
694 | |
695 | /* Increment number of inner iterations */ |
696 | inneriter += j_index_end - j_index_start; |
697 | |
698 | /* Outer loop uses 41 flops */ |
699 | } |
700 | |
701 | /* Increment number of outer iterations */ |
702 | outeriter += nri; |
703 | |
704 | /* Update outer/inner flops */ |
705 | |
706 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*409)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_VF] += outeriter*41 + inneriter*409; |
707 | } |
708 | /* |
709 | * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwLJEw_GeomW4W4_F_c |
710 | * Electrostatics interaction: Ewald |
711 | * VdW interaction: LJEwald |
712 | * Geometry: Water4-Water4 |
713 | * Calculate force/pot: Force |
714 | */ |
715 | void |
716 | nb_kernel_ElecEw_VdwLJEw_GeomW4W4_F_c |
717 | (t_nblist * gmx_restrict__restrict nlist, |
718 | rvec * gmx_restrict__restrict xx, |
719 | rvec * gmx_restrict__restrict ff, |
720 | t_forcerec * gmx_restrict__restrict fr, |
721 | t_mdatoms * gmx_restrict__restrict mdatoms, |
722 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data, |
723 | t_nrnb * gmx_restrict__restrict nrnb) |
724 | { |
725 | int i_shift_offset,i_coord_offset,j_coord_offset; |
726 | int j_index_start,j_index_end; |
727 | int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter; |
728 | real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2; |
729 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
730 | real *shiftvec,*fshift,*x,*f; |
731 | int vdwioffset0; |
732 | real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
733 | int vdwioffset1; |
734 | real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
735 | int vdwioffset2; |
736 | real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
737 | int vdwioffset3; |
738 | real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
739 | int vdwjidx0; |
740 | real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
741 | int vdwjidx1; |
742 | real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
743 | int vdwjidx2; |
744 | real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
745 | int vdwjidx3; |
746 | real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
747 | real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00; |
748 | real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11; |
749 | real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12; |
750 | real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13; |
751 | real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21; |
752 | real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22; |
753 | real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23; |
754 | real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31; |
755 | real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32; |
756 | real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33; |
757 | real velec,felec,velecsum,facel,crf,krf,krf2; |
758 | real *charge; |
759 | int nvdwtype; |
760 | real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6; |
761 | int *vdwtype; |
762 | real *vdwparam; |
763 | real c6grid_00; |
764 | real c6grid_11; |
765 | real c6grid_12; |
766 | real c6grid_13; |
767 | real c6grid_21; |
768 | real c6grid_22; |
769 | real c6grid_23; |
770 | real c6grid_31; |
771 | real c6grid_32; |
772 | real c6grid_33; |
773 | real ewclj,ewclj2,ewclj6,ewcljrsq,poly,exponent,sh_lj_ewald; |
774 | real *vdwgridparam; |
775 | int ewitab; |
776 | real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace; |
777 | real *ewtab; |
778 | |
779 | x = xx[0]; |
780 | f = ff[0]; |
781 | |
782 | nri = nlist->nri; |
783 | iinr = nlist->iinr; |
784 | jindex = nlist->jindex; |
785 | jjnr = nlist->jjnr; |
786 | shiftidx = nlist->shift; |
787 | gid = nlist->gid; |
788 | shiftvec = fr->shift_vec[0]; |
789 | fshift = fr->fshift[0]; |
790 | facel = fr->epsfac; |
791 | charge = mdatoms->chargeA; |
792 | nvdwtype = fr->ntype; |
793 | vdwparam = fr->nbfp; |
794 | vdwtype = mdatoms->typeA; |
795 | vdwgridparam = fr->ljpme_c6grid; |
796 | ewclj = fr->ewaldcoeff_lj; |
797 | sh_lj_ewald = fr->ic->sh_lj_ewald; |
Value stored to 'sh_lj_ewald' is never read | |
798 | ewclj2 = ewclj*ewclj; |
799 | ewclj6 = ewclj2*ewclj2*ewclj2; |
800 | |
801 | sh_ewald = fr->ic->sh_ewald; |
802 | ewtab = fr->ic->tabq_coul_F; |
803 | ewtabscale = fr->ic->tabq_scale; |
804 | ewtabhalfspace = 0.5/ewtabscale; |
805 | |
806 | /* Setup water-specific parameters */ |
807 | inr = nlist->iinr[0]; |
808 | iq1 = facel*charge[inr+1]; |
809 | iq2 = facel*charge[inr+2]; |
810 | iq3 = facel*charge[inr+3]; |
811 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
812 | |
813 | jq1 = charge[inr+1]; |
814 | jq2 = charge[inr+2]; |
815 | jq3 = charge[inr+3]; |
816 | vdwjidx0 = 2*vdwtype[inr+0]; |
817 | c6_00 = vdwparam[vdwioffset0+vdwjidx0]; |
818 | c12_00 = vdwparam[vdwioffset0+vdwjidx0+1]; |
819 | c6grid_00 = vdwgridparam[vdwioffset0+vdwjidx0]; |
820 | qq11 = iq1*jq1; |
821 | qq12 = iq1*jq2; |
822 | qq13 = iq1*jq3; |
823 | qq21 = iq2*jq1; |
824 | qq22 = iq2*jq2; |
825 | qq23 = iq2*jq3; |
826 | qq31 = iq3*jq1; |
827 | qq32 = iq3*jq2; |
828 | qq33 = iq3*jq3; |
829 | |
830 | outeriter = 0; |
831 | inneriter = 0; |
832 | |
833 | /* Start outer loop over neighborlists */ |
834 | for(iidx=0; iidx<nri; iidx++) |
835 | { |
836 | /* Load shift vector for this list */ |
837 | i_shift_offset = DIM3*shiftidx[iidx]; |
838 | shX = shiftvec[i_shift_offset+XX0]; |
839 | shY = shiftvec[i_shift_offset+YY1]; |
840 | shZ = shiftvec[i_shift_offset+ZZ2]; |
841 | |
842 | /* Load limits for loop over neighbors */ |
843 | j_index_start = jindex[iidx]; |
844 | j_index_end = jindex[iidx+1]; |
845 | |
846 | /* Get outer coordinate index */ |
847 | inr = iinr[iidx]; |
848 | i_coord_offset = DIM3*inr; |
849 | |
850 | /* Load i particle coords and add shift vector */ |
851 | ix0 = shX + x[i_coord_offset+DIM3*0+XX0]; |
852 | iy0 = shY + x[i_coord_offset+DIM3*0+YY1]; |
853 | iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2]; |
854 | ix1 = shX + x[i_coord_offset+DIM3*1+XX0]; |
855 | iy1 = shY + x[i_coord_offset+DIM3*1+YY1]; |
856 | iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2]; |
857 | ix2 = shX + x[i_coord_offset+DIM3*2+XX0]; |
858 | iy2 = shY + x[i_coord_offset+DIM3*2+YY1]; |
859 | iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2]; |
860 | ix3 = shX + x[i_coord_offset+DIM3*3+XX0]; |
861 | iy3 = shY + x[i_coord_offset+DIM3*3+YY1]; |
862 | iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2]; |
863 | |
864 | fix0 = 0.0; |
865 | fiy0 = 0.0; |
866 | fiz0 = 0.0; |
867 | fix1 = 0.0; |
868 | fiy1 = 0.0; |
869 | fiz1 = 0.0; |
870 | fix2 = 0.0; |
871 | fiy2 = 0.0; |
872 | fiz2 = 0.0; |
873 | fix3 = 0.0; |
874 | fiy3 = 0.0; |
875 | fiz3 = 0.0; |
876 | |
877 | /* Start inner kernel loop */ |
878 | for(jidx=j_index_start; jidx<j_index_end; jidx++) |
879 | { |
880 | /* Get j neighbor index, and coordinate index */ |
881 | jnr = jjnr[jidx]; |
882 | j_coord_offset = DIM3*jnr; |
883 | |
884 | /* load j atom coordinates */ |
885 | jx0 = x[j_coord_offset+DIM3*0+XX0]; |
886 | jy0 = x[j_coord_offset+DIM3*0+YY1]; |
887 | jz0 = x[j_coord_offset+DIM3*0+ZZ2]; |
888 | jx1 = x[j_coord_offset+DIM3*1+XX0]; |
889 | jy1 = x[j_coord_offset+DIM3*1+YY1]; |
890 | jz1 = x[j_coord_offset+DIM3*1+ZZ2]; |
891 | jx2 = x[j_coord_offset+DIM3*2+XX0]; |
892 | jy2 = x[j_coord_offset+DIM3*2+YY1]; |
893 | jz2 = x[j_coord_offset+DIM3*2+ZZ2]; |
894 | jx3 = x[j_coord_offset+DIM3*3+XX0]; |
895 | jy3 = x[j_coord_offset+DIM3*3+YY1]; |
896 | jz3 = x[j_coord_offset+DIM3*3+ZZ2]; |
897 | |
898 | /* Calculate displacement vector */ |
899 | dx00 = ix0 - jx0; |
900 | dy00 = iy0 - jy0; |
901 | dz00 = iz0 - jz0; |
902 | dx11 = ix1 - jx1; |
903 | dy11 = iy1 - jy1; |
904 | dz11 = iz1 - jz1; |
905 | dx12 = ix1 - jx2; |
906 | dy12 = iy1 - jy2; |
907 | dz12 = iz1 - jz2; |
908 | dx13 = ix1 - jx3; |
909 | dy13 = iy1 - jy3; |
910 | dz13 = iz1 - jz3; |
911 | dx21 = ix2 - jx1; |
912 | dy21 = iy2 - jy1; |
913 | dz21 = iz2 - jz1; |
914 | dx22 = ix2 - jx2; |
915 | dy22 = iy2 - jy2; |
916 | dz22 = iz2 - jz2; |
917 | dx23 = ix2 - jx3; |
918 | dy23 = iy2 - jy3; |
919 | dz23 = iz2 - jz3; |
920 | dx31 = ix3 - jx1; |
921 | dy31 = iy3 - jy1; |
922 | dz31 = iz3 - jz1; |
923 | dx32 = ix3 - jx2; |
924 | dy32 = iy3 - jy2; |
925 | dz32 = iz3 - jz2; |
926 | dx33 = ix3 - jx3; |
927 | dy33 = iy3 - jy3; |
928 | dz33 = iz3 - jz3; |
929 | |
930 | /* Calculate squared distance and things based on it */ |
931 | rsq00 = dx00*dx00+dy00*dy00+dz00*dz00; |
932 | rsq11 = dx11*dx11+dy11*dy11+dz11*dz11; |
933 | rsq12 = dx12*dx12+dy12*dy12+dz12*dz12; |
934 | rsq13 = dx13*dx13+dy13*dy13+dz13*dz13; |
935 | rsq21 = dx21*dx21+dy21*dy21+dz21*dz21; |
936 | rsq22 = dx22*dx22+dy22*dy22+dz22*dz22; |
937 | rsq23 = dx23*dx23+dy23*dy23+dz23*dz23; |
938 | rsq31 = dx31*dx31+dy31*dy31+dz31*dz31; |
939 | rsq32 = dx32*dx32+dy32*dy32+dz32*dz32; |
940 | rsq33 = dx33*dx33+dy33*dy33+dz33*dz33; |
941 | |
942 | rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00); |
943 | rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11); |
944 | rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12); |
945 | rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13); |
946 | rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21); |
947 | rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22); |
948 | rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23); |
949 | rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31); |
950 | rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32); |
951 | rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33); |
952 | |
953 | rinvsq00 = rinv00*rinv00; |
954 | rinvsq11 = rinv11*rinv11; |
955 | rinvsq12 = rinv12*rinv12; |
956 | rinvsq13 = rinv13*rinv13; |
957 | rinvsq21 = rinv21*rinv21; |
958 | rinvsq22 = rinv22*rinv22; |
959 | rinvsq23 = rinv23*rinv23; |
960 | rinvsq31 = rinv31*rinv31; |
961 | rinvsq32 = rinv32*rinv32; |
962 | rinvsq33 = rinv33*rinv33; |
963 | |
964 | /************************** |
965 | * CALCULATE INTERACTIONS * |
966 | **************************/ |
967 | |
968 | r00 = rsq00*rinv00; |
969 | |
970 | rinvsix = rinvsq00*rinvsq00*rinvsq00; |
971 | ewcljrsq = ewclj2*rsq00; |
972 | exponent = exp(-ewcljrsq); |
973 | poly = exponent*(1.0 + ewcljrsq + ewcljrsq*ewcljrsq*0.5); |
974 | fvdw = (((c12_00*rinvsix - c6_00 + c6grid_00*(1.0-poly))*rinvsix) - c6grid_00*(1.0/6.0)*exponent*ewclj6)*rinvsq00; |
975 | |
976 | fscal = fvdw; |
977 | |
978 | /* Calculate temporary vectorial force */ |
979 | tx = fscal*dx00; |
980 | ty = fscal*dy00; |
981 | tz = fscal*dz00; |
982 | |
983 | /* Update vectorial force */ |
984 | fix0 += tx; |
985 | fiy0 += ty; |
986 | fiz0 += tz; |
987 | f[j_coord_offset+DIM3*0+XX0] -= tx; |
988 | f[j_coord_offset+DIM3*0+YY1] -= ty; |
989 | f[j_coord_offset+DIM3*0+ZZ2] -= tz; |
990 | |
991 | /************************** |
992 | * CALCULATE INTERACTIONS * |
993 | **************************/ |
994 | |
995 | r11 = rsq11*rinv11; |
996 | |
997 | /* EWALD ELECTROSTATICS */ |
998 | |
999 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1000 | ewrt = r11*ewtabscale; |
1001 | ewitab = ewrt; |
1002 | eweps = ewrt-ewitab; |
1003 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1004 | felec = qq11*rinv11*(rinvsq11-felec); |
1005 | |
1006 | fscal = felec; |
1007 | |
1008 | /* Calculate temporary vectorial force */ |
1009 | tx = fscal*dx11; |
1010 | ty = fscal*dy11; |
1011 | tz = fscal*dz11; |
1012 | |
1013 | /* Update vectorial force */ |
1014 | fix1 += tx; |
1015 | fiy1 += ty; |
1016 | fiz1 += tz; |
1017 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1018 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1019 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1020 | |
1021 | /************************** |
1022 | * CALCULATE INTERACTIONS * |
1023 | **************************/ |
1024 | |
1025 | r12 = rsq12*rinv12; |
1026 | |
1027 | /* EWALD ELECTROSTATICS */ |
1028 | |
1029 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1030 | ewrt = r12*ewtabscale; |
1031 | ewitab = ewrt; |
1032 | eweps = ewrt-ewitab; |
1033 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1034 | felec = qq12*rinv12*(rinvsq12-felec); |
1035 | |
1036 | fscal = felec; |
1037 | |
1038 | /* Calculate temporary vectorial force */ |
1039 | tx = fscal*dx12; |
1040 | ty = fscal*dy12; |
1041 | tz = fscal*dz12; |
1042 | |
1043 | /* Update vectorial force */ |
1044 | fix1 += tx; |
1045 | fiy1 += ty; |
1046 | fiz1 += tz; |
1047 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1048 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1049 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1050 | |
1051 | /************************** |
1052 | * CALCULATE INTERACTIONS * |
1053 | **************************/ |
1054 | |
1055 | r13 = rsq13*rinv13; |
1056 | |
1057 | /* EWALD ELECTROSTATICS */ |
1058 | |
1059 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1060 | ewrt = r13*ewtabscale; |
1061 | ewitab = ewrt; |
1062 | eweps = ewrt-ewitab; |
1063 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1064 | felec = qq13*rinv13*(rinvsq13-felec); |
1065 | |
1066 | fscal = felec; |
1067 | |
1068 | /* Calculate temporary vectorial force */ |
1069 | tx = fscal*dx13; |
1070 | ty = fscal*dy13; |
1071 | tz = fscal*dz13; |
1072 | |
1073 | /* Update vectorial force */ |
1074 | fix1 += tx; |
1075 | fiy1 += ty; |
1076 | fiz1 += tz; |
1077 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1078 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1079 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1080 | |
1081 | /************************** |
1082 | * CALCULATE INTERACTIONS * |
1083 | **************************/ |
1084 | |
1085 | r21 = rsq21*rinv21; |
1086 | |
1087 | /* EWALD ELECTROSTATICS */ |
1088 | |
1089 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1090 | ewrt = r21*ewtabscale; |
1091 | ewitab = ewrt; |
1092 | eweps = ewrt-ewitab; |
1093 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1094 | felec = qq21*rinv21*(rinvsq21-felec); |
1095 | |
1096 | fscal = felec; |
1097 | |
1098 | /* Calculate temporary vectorial force */ |
1099 | tx = fscal*dx21; |
1100 | ty = fscal*dy21; |
1101 | tz = fscal*dz21; |
1102 | |
1103 | /* Update vectorial force */ |
1104 | fix2 += tx; |
1105 | fiy2 += ty; |
1106 | fiz2 += tz; |
1107 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1108 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1109 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1110 | |
1111 | /************************** |
1112 | * CALCULATE INTERACTIONS * |
1113 | **************************/ |
1114 | |
1115 | r22 = rsq22*rinv22; |
1116 | |
1117 | /* EWALD ELECTROSTATICS */ |
1118 | |
1119 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1120 | ewrt = r22*ewtabscale; |
1121 | ewitab = ewrt; |
1122 | eweps = ewrt-ewitab; |
1123 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1124 | felec = qq22*rinv22*(rinvsq22-felec); |
1125 | |
1126 | fscal = felec; |
1127 | |
1128 | /* Calculate temporary vectorial force */ |
1129 | tx = fscal*dx22; |
1130 | ty = fscal*dy22; |
1131 | tz = fscal*dz22; |
1132 | |
1133 | /* Update vectorial force */ |
1134 | fix2 += tx; |
1135 | fiy2 += ty; |
1136 | fiz2 += tz; |
1137 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1138 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1139 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1140 | |
1141 | /************************** |
1142 | * CALCULATE INTERACTIONS * |
1143 | **************************/ |
1144 | |
1145 | r23 = rsq23*rinv23; |
1146 | |
1147 | /* EWALD ELECTROSTATICS */ |
1148 | |
1149 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1150 | ewrt = r23*ewtabscale; |
1151 | ewitab = ewrt; |
1152 | eweps = ewrt-ewitab; |
1153 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1154 | felec = qq23*rinv23*(rinvsq23-felec); |
1155 | |
1156 | fscal = felec; |
1157 | |
1158 | /* Calculate temporary vectorial force */ |
1159 | tx = fscal*dx23; |
1160 | ty = fscal*dy23; |
1161 | tz = fscal*dz23; |
1162 | |
1163 | /* Update vectorial force */ |
1164 | fix2 += tx; |
1165 | fiy2 += ty; |
1166 | fiz2 += tz; |
1167 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1168 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1169 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1170 | |
1171 | /************************** |
1172 | * CALCULATE INTERACTIONS * |
1173 | **************************/ |
1174 | |
1175 | r31 = rsq31*rinv31; |
1176 | |
1177 | /* EWALD ELECTROSTATICS */ |
1178 | |
1179 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1180 | ewrt = r31*ewtabscale; |
1181 | ewitab = ewrt; |
1182 | eweps = ewrt-ewitab; |
1183 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1184 | felec = qq31*rinv31*(rinvsq31-felec); |
1185 | |
1186 | fscal = felec; |
1187 | |
1188 | /* Calculate temporary vectorial force */ |
1189 | tx = fscal*dx31; |
1190 | ty = fscal*dy31; |
1191 | tz = fscal*dz31; |
1192 | |
1193 | /* Update vectorial force */ |
1194 | fix3 += tx; |
1195 | fiy3 += ty; |
1196 | fiz3 += tz; |
1197 | f[j_coord_offset+DIM3*1+XX0] -= tx; |
1198 | f[j_coord_offset+DIM3*1+YY1] -= ty; |
1199 | f[j_coord_offset+DIM3*1+ZZ2] -= tz; |
1200 | |
1201 | /************************** |
1202 | * CALCULATE INTERACTIONS * |
1203 | **************************/ |
1204 | |
1205 | r32 = rsq32*rinv32; |
1206 | |
1207 | /* EWALD ELECTROSTATICS */ |
1208 | |
1209 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1210 | ewrt = r32*ewtabscale; |
1211 | ewitab = ewrt; |
1212 | eweps = ewrt-ewitab; |
1213 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1214 | felec = qq32*rinv32*(rinvsq32-felec); |
1215 | |
1216 | fscal = felec; |
1217 | |
1218 | /* Calculate temporary vectorial force */ |
1219 | tx = fscal*dx32; |
1220 | ty = fscal*dy32; |
1221 | tz = fscal*dz32; |
1222 | |
1223 | /* Update vectorial force */ |
1224 | fix3 += tx; |
1225 | fiy3 += ty; |
1226 | fiz3 += tz; |
1227 | f[j_coord_offset+DIM3*2+XX0] -= tx; |
1228 | f[j_coord_offset+DIM3*2+YY1] -= ty; |
1229 | f[j_coord_offset+DIM3*2+ZZ2] -= tz; |
1230 | |
1231 | /************************** |
1232 | * CALCULATE INTERACTIONS * |
1233 | **************************/ |
1234 | |
1235 | r33 = rsq33*rinv33; |
1236 | |
1237 | /* EWALD ELECTROSTATICS */ |
1238 | |
1239 | /* Calculate Ewald table index by multiplying r with scale and truncate to integer */ |
1240 | ewrt = r33*ewtabscale; |
1241 | ewitab = ewrt; |
1242 | eweps = ewrt-ewitab; |
1243 | felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1]; |
1244 | felec = qq33*rinv33*(rinvsq33-felec); |
1245 | |
1246 | fscal = felec; |
1247 | |
1248 | /* Calculate temporary vectorial force */ |
1249 | tx = fscal*dx33; |
1250 | ty = fscal*dy33; |
1251 | tz = fscal*dz33; |
1252 | |
1253 | /* Update vectorial force */ |
1254 | fix3 += tx; |
1255 | fiy3 += ty; |
1256 | fiz3 += tz; |
1257 | f[j_coord_offset+DIM3*3+XX0] -= tx; |
1258 | f[j_coord_offset+DIM3*3+YY1] -= ty; |
1259 | f[j_coord_offset+DIM3*3+ZZ2] -= tz; |
1260 | |
1261 | /* Inner loop uses 341 flops */ |
1262 | } |
1263 | /* End of innermost loop */ |
1264 | |
1265 | tx = ty = tz = 0; |
1266 | f[i_coord_offset+DIM3*0+XX0] += fix0; |
1267 | f[i_coord_offset+DIM3*0+YY1] += fiy0; |
1268 | f[i_coord_offset+DIM3*0+ZZ2] += fiz0; |
1269 | tx += fix0; |
1270 | ty += fiy0; |
1271 | tz += fiz0; |
1272 | f[i_coord_offset+DIM3*1+XX0] += fix1; |
1273 | f[i_coord_offset+DIM3*1+YY1] += fiy1; |
1274 | f[i_coord_offset+DIM3*1+ZZ2] += fiz1; |
1275 | tx += fix1; |
1276 | ty += fiy1; |
1277 | tz += fiz1; |
1278 | f[i_coord_offset+DIM3*2+XX0] += fix2; |
1279 | f[i_coord_offset+DIM3*2+YY1] += fiy2; |
1280 | f[i_coord_offset+DIM3*2+ZZ2] += fiz2; |
1281 | tx += fix2; |
1282 | ty += fiy2; |
1283 | tz += fiz2; |
1284 | f[i_coord_offset+DIM3*3+XX0] += fix3; |
1285 | f[i_coord_offset+DIM3*3+YY1] += fiy3; |
1286 | f[i_coord_offset+DIM3*3+ZZ2] += fiz3; |
1287 | tx += fix3; |
1288 | ty += fiy3; |
1289 | tz += fiz3; |
1290 | fshift[i_shift_offset+XX0] += tx; |
1291 | fshift[i_shift_offset+YY1] += ty; |
1292 | fshift[i_shift_offset+ZZ2] += tz; |
1293 | |
1294 | /* Increment number of inner iterations */ |
1295 | inneriter += j_index_end - j_index_start; |
1296 | |
1297 | /* Outer loop uses 39 flops */ |
1298 | } |
1299 | |
1300 | /* Increment number of outer iterations */ |
1301 | outeriter += nri; |
1302 | |
1303 | /* Update outer/inner flops */ |
1304 | |
1305 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*341)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_F] += outeriter*39 + inneriter *341; |
1306 | } |