Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEw_VdwLJ_GeomW4W4_c.c
Location:line 125, column 5
Description:Value stored to 'sh_ewald' is never read

Annotated Source Code

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