Merge 'release-4-6' into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecCSTab_VdwNone_GeomW4W4_c.c
1 /*
2  * Note: this file was generated by the Gromacs c kernel generator.
3  *
4  *                This source code is part of
5  *
6  *                 G   R   O   M   A   C   S
7  *
8  * Copyright (c) 2001-2012, The GROMACS Development Team
9  *
10  * Gromacs is a library for molecular simulation and trajectory analysis,
11  * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12  * a full list of developers and information, check out http://www.gromacs.org
13  *
14  * This program is free software; you can redistribute it and/or modify it under
15  * the terms of the GNU Lesser General Public License as published by the Free
16  * Software Foundation; either version 2 of the License, or (at your option) any
17  * later version.
18  *
19  * To help fund GROMACS development, we humbly ask that you cite
20  * the papers people have written on it - you can find them on the website.
21  */
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <math.h>
27
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
30 #include "vec.h"
31 #include "nrnb.h"
32
33 /*
34  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomW4W4_VF_c
35  * Electrostatics interaction: CubicSplineTable
36  * VdW interaction:            None
37  * Geometry:                   Water4-Water4
38  * Calculate force/pot:        PotentialAndForce
39  */
40 void
41 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_VF_c
42                     (t_nblist * gmx_restrict                nlist,
43                      rvec * gmx_restrict                    xx,
44                      rvec * gmx_restrict                    ff,
45                      t_forcerec * gmx_restrict              fr,
46                      t_mdatoms * gmx_restrict               mdatoms,
47                      nb_kernel_data_t * gmx_restrict        kernel_data,
48                      t_nrnb * gmx_restrict                  nrnb)
49 {
50     int              i_shift_offset,i_coord_offset,j_coord_offset;
51     int              j_index_start,j_index_end;
52     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
55     real             *shiftvec,*fshift,*x,*f;
56     int              vdwioffset1;
57     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
58     int              vdwioffset2;
59     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
60     int              vdwioffset3;
61     real             ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
62     int              vdwjidx1;
63     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
64     int              vdwjidx2;
65     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
66     int              vdwjidx3;
67     real             jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
68     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
69     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
70     real             dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
71     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
72     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
73     real             dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
74     real             dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
75     real             dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
76     real             dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
77     real             velec,felec,velecsum,facel,crf,krf,krf2;
78     real             *charge;
79     int              vfitab;
80     real             rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
81     real             *vftab;
82
83     x                = xx[0];
84     f                = ff[0];
85
86     nri              = nlist->nri;
87     iinr             = nlist->iinr;
88     jindex           = nlist->jindex;
89     jjnr             = nlist->jjnr;
90     shiftidx         = nlist->shift;
91     gid              = nlist->gid;
92     shiftvec         = fr->shift_vec[0];
93     fshift           = fr->fshift[0];
94     facel            = fr->epsfac;
95     charge           = mdatoms->chargeA;
96
97     vftab            = kernel_data->table_elec->data;
98     vftabscale       = kernel_data->table_elec->scale;
99
100     /* Setup water-specific parameters */
101     inr              = nlist->iinr[0];
102     iq1              = facel*charge[inr+1];
103     iq2              = facel*charge[inr+2];
104     iq3              = facel*charge[inr+3];
105
106     jq1              = charge[inr+1];
107     jq2              = charge[inr+2];
108     jq3              = charge[inr+3];
109     qq11             = iq1*jq1;
110     qq12             = iq1*jq2;
111     qq13             = iq1*jq3;
112     qq21             = iq2*jq1;
113     qq22             = iq2*jq2;
114     qq23             = iq2*jq3;
115     qq31             = iq3*jq1;
116     qq32             = iq3*jq2;
117     qq33             = iq3*jq3;
118
119     outeriter        = 0;
120     inneriter        = 0;
121
122     /* Start outer loop over neighborlists */
123     for(iidx=0; iidx<nri; iidx++)
124     {
125         /* Load shift vector for this list */
126         i_shift_offset   = DIM*shiftidx[iidx];
127         shX              = shiftvec[i_shift_offset+XX];
128         shY              = shiftvec[i_shift_offset+YY];
129         shZ              = shiftvec[i_shift_offset+ZZ];
130
131         /* Load limits for loop over neighbors */
132         j_index_start    = jindex[iidx];
133         j_index_end      = jindex[iidx+1];
134
135         /* Get outer coordinate index */
136         inr              = iinr[iidx];
137         i_coord_offset   = DIM*inr;
138
139         /* Load i particle coords and add shift vector */
140         ix1              = shX + x[i_coord_offset+DIM*1+XX];
141         iy1              = shY + x[i_coord_offset+DIM*1+YY];
142         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
143         ix2              = shX + x[i_coord_offset+DIM*2+XX];
144         iy2              = shY + x[i_coord_offset+DIM*2+YY];
145         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
146         ix3              = shX + x[i_coord_offset+DIM*3+XX];
147         iy3              = shY + x[i_coord_offset+DIM*3+YY];
148         iz3              = shZ + x[i_coord_offset+DIM*3+ZZ];
149
150         fix1             = 0.0;
151         fiy1             = 0.0;
152         fiz1             = 0.0;
153         fix2             = 0.0;
154         fiy2             = 0.0;
155         fiz2             = 0.0;
156         fix3             = 0.0;
157         fiy3             = 0.0;
158         fiz3             = 0.0;
159
160         /* Reset potential sums */
161         velecsum         = 0.0;
162
163         /* Start inner kernel loop */
164         for(jidx=j_index_start; jidx<j_index_end; jidx++)
165         {
166             /* Get j neighbor index, and coordinate index */
167             jnr              = jjnr[jidx];
168             j_coord_offset   = DIM*jnr;
169
170             /* load j atom coordinates */
171             jx1              = x[j_coord_offset+DIM*1+XX];
172             jy1              = x[j_coord_offset+DIM*1+YY];
173             jz1              = x[j_coord_offset+DIM*1+ZZ];
174             jx2              = x[j_coord_offset+DIM*2+XX];
175             jy2              = x[j_coord_offset+DIM*2+YY];
176             jz2              = x[j_coord_offset+DIM*2+ZZ];
177             jx3              = x[j_coord_offset+DIM*3+XX];
178             jy3              = x[j_coord_offset+DIM*3+YY];
179             jz3              = x[j_coord_offset+DIM*3+ZZ];
180
181             /* Calculate displacement vector */
182             dx11             = ix1 - jx1;
183             dy11             = iy1 - jy1;
184             dz11             = iz1 - jz1;
185             dx12             = ix1 - jx2;
186             dy12             = iy1 - jy2;
187             dz12             = iz1 - jz2;
188             dx13             = ix1 - jx3;
189             dy13             = iy1 - jy3;
190             dz13             = iz1 - jz3;
191             dx21             = ix2 - jx1;
192             dy21             = iy2 - jy1;
193             dz21             = iz2 - jz1;
194             dx22             = ix2 - jx2;
195             dy22             = iy2 - jy2;
196             dz22             = iz2 - jz2;
197             dx23             = ix2 - jx3;
198             dy23             = iy2 - jy3;
199             dz23             = iz2 - jz3;
200             dx31             = ix3 - jx1;
201             dy31             = iy3 - jy1;
202             dz31             = iz3 - jz1;
203             dx32             = ix3 - jx2;
204             dy32             = iy3 - jy2;
205             dz32             = iz3 - jz2;
206             dx33             = ix3 - jx3;
207             dy33             = iy3 - jy3;
208             dz33             = iz3 - jz3;
209
210             /* Calculate squared distance and things based on it */
211             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
212             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
213             rsq13            = dx13*dx13+dy13*dy13+dz13*dz13;
214             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
215             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
216             rsq23            = dx23*dx23+dy23*dy23+dz23*dz23;
217             rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
218             rsq32            = dx32*dx32+dy32*dy32+dz32*dz32;
219             rsq33            = dx33*dx33+dy33*dy33+dz33*dz33;
220
221             rinv11           = gmx_invsqrt(rsq11);
222             rinv12           = gmx_invsqrt(rsq12);
223             rinv13           = gmx_invsqrt(rsq13);
224             rinv21           = gmx_invsqrt(rsq21);
225             rinv22           = gmx_invsqrt(rsq22);
226             rinv23           = gmx_invsqrt(rsq23);
227             rinv31           = gmx_invsqrt(rsq31);
228             rinv32           = gmx_invsqrt(rsq32);
229             rinv33           = gmx_invsqrt(rsq33);
230
231             /**************************
232              * CALCULATE INTERACTIONS *
233              **************************/
234
235             r11              = rsq11*rinv11;
236
237             /* Calculate table index by multiplying r with table scale and truncate to integer */
238             rt               = r11*vftabscale;
239             vfitab           = rt;
240             vfeps            = rt-vfitab;
241             vfitab           = 1*4*vfitab;
242
243             /* CUBIC SPLINE TABLE ELECTROSTATICS */
244             Y                = vftab[vfitab];
245             F                = vftab[vfitab+1];
246             Geps             = vfeps*vftab[vfitab+2];
247             Heps2            = vfeps*vfeps*vftab[vfitab+3];
248             Fp               = F+Geps+Heps2;
249             VV               = Y+vfeps*Fp;
250             velec            = qq11*VV;
251             FF               = Fp+Geps+2.0*Heps2;
252             felec            = -qq11*FF*vftabscale*rinv11;
253
254             /* Update potential sums from outer loop */
255             velecsum        += velec;
256
257             fscal            = felec;
258
259             /* Calculate temporary vectorial force */
260             tx               = fscal*dx11;
261             ty               = fscal*dy11;
262             tz               = fscal*dz11;
263
264             /* Update vectorial force */
265             fix1            += tx;
266             fiy1            += ty;
267             fiz1            += tz;
268             f[j_coord_offset+DIM*1+XX] -= tx;
269             f[j_coord_offset+DIM*1+YY] -= ty;
270             f[j_coord_offset+DIM*1+ZZ] -= tz;
271
272             /**************************
273              * CALCULATE INTERACTIONS *
274              **************************/
275
276             r12              = rsq12*rinv12;
277
278             /* Calculate table index by multiplying r with table scale and truncate to integer */
279             rt               = r12*vftabscale;
280             vfitab           = rt;
281             vfeps            = rt-vfitab;
282             vfitab           = 1*4*vfitab;
283
284             /* CUBIC SPLINE TABLE ELECTROSTATICS */
285             Y                = vftab[vfitab];
286             F                = vftab[vfitab+1];
287             Geps             = vfeps*vftab[vfitab+2];
288             Heps2            = vfeps*vfeps*vftab[vfitab+3];
289             Fp               = F+Geps+Heps2;
290             VV               = Y+vfeps*Fp;
291             velec            = qq12*VV;
292             FF               = Fp+Geps+2.0*Heps2;
293             felec            = -qq12*FF*vftabscale*rinv12;
294
295             /* Update potential sums from outer loop */
296             velecsum        += velec;
297
298             fscal            = felec;
299
300             /* Calculate temporary vectorial force */
301             tx               = fscal*dx12;
302             ty               = fscal*dy12;
303             tz               = fscal*dz12;
304
305             /* Update vectorial force */
306             fix1            += tx;
307             fiy1            += ty;
308             fiz1            += tz;
309             f[j_coord_offset+DIM*2+XX] -= tx;
310             f[j_coord_offset+DIM*2+YY] -= ty;
311             f[j_coord_offset+DIM*2+ZZ] -= tz;
312
313             /**************************
314              * CALCULATE INTERACTIONS *
315              **************************/
316
317             r13              = rsq13*rinv13;
318
319             /* Calculate table index by multiplying r with table scale and truncate to integer */
320             rt               = r13*vftabscale;
321             vfitab           = rt;
322             vfeps            = rt-vfitab;
323             vfitab           = 1*4*vfitab;
324
325             /* CUBIC SPLINE TABLE ELECTROSTATICS */
326             Y                = vftab[vfitab];
327             F                = vftab[vfitab+1];
328             Geps             = vfeps*vftab[vfitab+2];
329             Heps2            = vfeps*vfeps*vftab[vfitab+3];
330             Fp               = F+Geps+Heps2;
331             VV               = Y+vfeps*Fp;
332             velec            = qq13*VV;
333             FF               = Fp+Geps+2.0*Heps2;
334             felec            = -qq13*FF*vftabscale*rinv13;
335
336             /* Update potential sums from outer loop */
337             velecsum        += velec;
338
339             fscal            = felec;
340
341             /* Calculate temporary vectorial force */
342             tx               = fscal*dx13;
343             ty               = fscal*dy13;
344             tz               = fscal*dz13;
345
346             /* Update vectorial force */
347             fix1            += tx;
348             fiy1            += ty;
349             fiz1            += tz;
350             f[j_coord_offset+DIM*3+XX] -= tx;
351             f[j_coord_offset+DIM*3+YY] -= ty;
352             f[j_coord_offset+DIM*3+ZZ] -= tz;
353
354             /**************************
355              * CALCULATE INTERACTIONS *
356              **************************/
357
358             r21              = rsq21*rinv21;
359
360             /* Calculate table index by multiplying r with table scale and truncate to integer */
361             rt               = r21*vftabscale;
362             vfitab           = rt;
363             vfeps            = rt-vfitab;
364             vfitab           = 1*4*vfitab;
365
366             /* CUBIC SPLINE TABLE ELECTROSTATICS */
367             Y                = vftab[vfitab];
368             F                = vftab[vfitab+1];
369             Geps             = vfeps*vftab[vfitab+2];
370             Heps2            = vfeps*vfeps*vftab[vfitab+3];
371             Fp               = F+Geps+Heps2;
372             VV               = Y+vfeps*Fp;
373             velec            = qq21*VV;
374             FF               = Fp+Geps+2.0*Heps2;
375             felec            = -qq21*FF*vftabscale*rinv21;
376
377             /* Update potential sums from outer loop */
378             velecsum        += velec;
379
380             fscal            = felec;
381
382             /* Calculate temporary vectorial force */
383             tx               = fscal*dx21;
384             ty               = fscal*dy21;
385             tz               = fscal*dz21;
386
387             /* Update vectorial force */
388             fix2            += tx;
389             fiy2            += ty;
390             fiz2            += tz;
391             f[j_coord_offset+DIM*1+XX] -= tx;
392             f[j_coord_offset+DIM*1+YY] -= ty;
393             f[j_coord_offset+DIM*1+ZZ] -= tz;
394
395             /**************************
396              * CALCULATE INTERACTIONS *
397              **************************/
398
399             r22              = rsq22*rinv22;
400
401             /* Calculate table index by multiplying r with table scale and truncate to integer */
402             rt               = r22*vftabscale;
403             vfitab           = rt;
404             vfeps            = rt-vfitab;
405             vfitab           = 1*4*vfitab;
406
407             /* CUBIC SPLINE TABLE ELECTROSTATICS */
408             Y                = vftab[vfitab];
409             F                = vftab[vfitab+1];
410             Geps             = vfeps*vftab[vfitab+2];
411             Heps2            = vfeps*vfeps*vftab[vfitab+3];
412             Fp               = F+Geps+Heps2;
413             VV               = Y+vfeps*Fp;
414             velec            = qq22*VV;
415             FF               = Fp+Geps+2.0*Heps2;
416             felec            = -qq22*FF*vftabscale*rinv22;
417
418             /* Update potential sums from outer loop */
419             velecsum        += velec;
420
421             fscal            = felec;
422
423             /* Calculate temporary vectorial force */
424             tx               = fscal*dx22;
425             ty               = fscal*dy22;
426             tz               = fscal*dz22;
427
428             /* Update vectorial force */
429             fix2            += tx;
430             fiy2            += ty;
431             fiz2            += tz;
432             f[j_coord_offset+DIM*2+XX] -= tx;
433             f[j_coord_offset+DIM*2+YY] -= ty;
434             f[j_coord_offset+DIM*2+ZZ] -= tz;
435
436             /**************************
437              * CALCULATE INTERACTIONS *
438              **************************/
439
440             r23              = rsq23*rinv23;
441
442             /* Calculate table index by multiplying r with table scale and truncate to integer */
443             rt               = r23*vftabscale;
444             vfitab           = rt;
445             vfeps            = rt-vfitab;
446             vfitab           = 1*4*vfitab;
447
448             /* CUBIC SPLINE TABLE ELECTROSTATICS */
449             Y                = vftab[vfitab];
450             F                = vftab[vfitab+1];
451             Geps             = vfeps*vftab[vfitab+2];
452             Heps2            = vfeps*vfeps*vftab[vfitab+3];
453             Fp               = F+Geps+Heps2;
454             VV               = Y+vfeps*Fp;
455             velec            = qq23*VV;
456             FF               = Fp+Geps+2.0*Heps2;
457             felec            = -qq23*FF*vftabscale*rinv23;
458
459             /* Update potential sums from outer loop */
460             velecsum        += velec;
461
462             fscal            = felec;
463
464             /* Calculate temporary vectorial force */
465             tx               = fscal*dx23;
466             ty               = fscal*dy23;
467             tz               = fscal*dz23;
468
469             /* Update vectorial force */
470             fix2            += tx;
471             fiy2            += ty;
472             fiz2            += tz;
473             f[j_coord_offset+DIM*3+XX] -= tx;
474             f[j_coord_offset+DIM*3+YY] -= ty;
475             f[j_coord_offset+DIM*3+ZZ] -= tz;
476
477             /**************************
478              * CALCULATE INTERACTIONS *
479              **************************/
480
481             r31              = rsq31*rinv31;
482
483             /* Calculate table index by multiplying r with table scale and truncate to integer */
484             rt               = r31*vftabscale;
485             vfitab           = rt;
486             vfeps            = rt-vfitab;
487             vfitab           = 1*4*vfitab;
488
489             /* CUBIC SPLINE TABLE ELECTROSTATICS */
490             Y                = vftab[vfitab];
491             F                = vftab[vfitab+1];
492             Geps             = vfeps*vftab[vfitab+2];
493             Heps2            = vfeps*vfeps*vftab[vfitab+3];
494             Fp               = F+Geps+Heps2;
495             VV               = Y+vfeps*Fp;
496             velec            = qq31*VV;
497             FF               = Fp+Geps+2.0*Heps2;
498             felec            = -qq31*FF*vftabscale*rinv31;
499
500             /* Update potential sums from outer loop */
501             velecsum        += velec;
502
503             fscal            = felec;
504
505             /* Calculate temporary vectorial force */
506             tx               = fscal*dx31;
507             ty               = fscal*dy31;
508             tz               = fscal*dz31;
509
510             /* Update vectorial force */
511             fix3            += tx;
512             fiy3            += ty;
513             fiz3            += tz;
514             f[j_coord_offset+DIM*1+XX] -= tx;
515             f[j_coord_offset+DIM*1+YY] -= ty;
516             f[j_coord_offset+DIM*1+ZZ] -= tz;
517
518             /**************************
519              * CALCULATE INTERACTIONS *
520              **************************/
521
522             r32              = rsq32*rinv32;
523
524             /* Calculate table index by multiplying r with table scale and truncate to integer */
525             rt               = r32*vftabscale;
526             vfitab           = rt;
527             vfeps            = rt-vfitab;
528             vfitab           = 1*4*vfitab;
529
530             /* CUBIC SPLINE TABLE ELECTROSTATICS */
531             Y                = vftab[vfitab];
532             F                = vftab[vfitab+1];
533             Geps             = vfeps*vftab[vfitab+2];
534             Heps2            = vfeps*vfeps*vftab[vfitab+3];
535             Fp               = F+Geps+Heps2;
536             VV               = Y+vfeps*Fp;
537             velec            = qq32*VV;
538             FF               = Fp+Geps+2.0*Heps2;
539             felec            = -qq32*FF*vftabscale*rinv32;
540
541             /* Update potential sums from outer loop */
542             velecsum        += velec;
543
544             fscal            = felec;
545
546             /* Calculate temporary vectorial force */
547             tx               = fscal*dx32;
548             ty               = fscal*dy32;
549             tz               = fscal*dz32;
550
551             /* Update vectorial force */
552             fix3            += tx;
553             fiy3            += ty;
554             fiz3            += tz;
555             f[j_coord_offset+DIM*2+XX] -= tx;
556             f[j_coord_offset+DIM*2+YY] -= ty;
557             f[j_coord_offset+DIM*2+ZZ] -= tz;
558
559             /**************************
560              * CALCULATE INTERACTIONS *
561              **************************/
562
563             r33              = rsq33*rinv33;
564
565             /* Calculate table index by multiplying r with table scale and truncate to integer */
566             rt               = r33*vftabscale;
567             vfitab           = rt;
568             vfeps            = rt-vfitab;
569             vfitab           = 1*4*vfitab;
570
571             /* CUBIC SPLINE TABLE ELECTROSTATICS */
572             Y                = vftab[vfitab];
573             F                = vftab[vfitab+1];
574             Geps             = vfeps*vftab[vfitab+2];
575             Heps2            = vfeps*vfeps*vftab[vfitab+3];
576             Fp               = F+Geps+Heps2;
577             VV               = Y+vfeps*Fp;
578             velec            = qq33*VV;
579             FF               = Fp+Geps+2.0*Heps2;
580             felec            = -qq33*FF*vftabscale*rinv33;
581
582             /* Update potential sums from outer loop */
583             velecsum        += velec;
584
585             fscal            = felec;
586
587             /* Calculate temporary vectorial force */
588             tx               = fscal*dx33;
589             ty               = fscal*dy33;
590             tz               = fscal*dz33;
591
592             /* Update vectorial force */
593             fix3            += tx;
594             fiy3            += ty;
595             fiz3            += tz;
596             f[j_coord_offset+DIM*3+XX] -= tx;
597             f[j_coord_offset+DIM*3+YY] -= ty;
598             f[j_coord_offset+DIM*3+ZZ] -= tz;
599
600             /* Inner loop uses 369 flops */
601         }
602         /* End of innermost loop */
603
604         tx = ty = tz = 0;
605         f[i_coord_offset+DIM*1+XX] += fix1;
606         f[i_coord_offset+DIM*1+YY] += fiy1;
607         f[i_coord_offset+DIM*1+ZZ] += fiz1;
608         tx                         += fix1;
609         ty                         += fiy1;
610         tz                         += fiz1;
611         f[i_coord_offset+DIM*2+XX] += fix2;
612         f[i_coord_offset+DIM*2+YY] += fiy2;
613         f[i_coord_offset+DIM*2+ZZ] += fiz2;
614         tx                         += fix2;
615         ty                         += fiy2;
616         tz                         += fiz2;
617         f[i_coord_offset+DIM*3+XX] += fix3;
618         f[i_coord_offset+DIM*3+YY] += fiy3;
619         f[i_coord_offset+DIM*3+ZZ] += fiz3;
620         tx                         += fix3;
621         ty                         += fiy3;
622         tz                         += fiz3;
623         fshift[i_shift_offset+XX]  += tx;
624         fshift[i_shift_offset+YY]  += ty;
625         fshift[i_shift_offset+ZZ]  += tz;
626
627         ggid                        = gid[iidx];
628         /* Update potential energies */
629         kernel_data->energygrp_elec[ggid] += velecsum;
630
631         /* Increment number of inner iterations */
632         inneriter                  += j_index_end - j_index_start;
633
634         /* Outer loop uses 31 flops */
635     }
636
637     /* Increment number of outer iterations */
638     outeriter        += nri;
639
640     /* Update outer/inner flops */
641
642     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*369);
643 }
644 /*
645  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomW4W4_F_c
646  * Electrostatics interaction: CubicSplineTable
647  * VdW interaction:            None
648  * Geometry:                   Water4-Water4
649  * Calculate force/pot:        Force
650  */
651 void
652 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_F_c
653                     (t_nblist * gmx_restrict                nlist,
654                      rvec * gmx_restrict                    xx,
655                      rvec * gmx_restrict                    ff,
656                      t_forcerec * gmx_restrict              fr,
657                      t_mdatoms * gmx_restrict               mdatoms,
658                      nb_kernel_data_t * gmx_restrict        kernel_data,
659                      t_nrnb * gmx_restrict                  nrnb)
660 {
661     int              i_shift_offset,i_coord_offset,j_coord_offset;
662     int              j_index_start,j_index_end;
663     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
664     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
665     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
666     real             *shiftvec,*fshift,*x,*f;
667     int              vdwioffset1;
668     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
669     int              vdwioffset2;
670     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
671     int              vdwioffset3;
672     real             ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
673     int              vdwjidx1;
674     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
675     int              vdwjidx2;
676     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
677     int              vdwjidx3;
678     real             jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
679     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
680     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
681     real             dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
682     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
683     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
684     real             dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
685     real             dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
686     real             dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
687     real             dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
688     real             velec,felec,velecsum,facel,crf,krf,krf2;
689     real             *charge;
690     int              vfitab;
691     real             rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
692     real             *vftab;
693
694     x                = xx[0];
695     f                = ff[0];
696
697     nri              = nlist->nri;
698     iinr             = nlist->iinr;
699     jindex           = nlist->jindex;
700     jjnr             = nlist->jjnr;
701     shiftidx         = nlist->shift;
702     gid              = nlist->gid;
703     shiftvec         = fr->shift_vec[0];
704     fshift           = fr->fshift[0];
705     facel            = fr->epsfac;
706     charge           = mdatoms->chargeA;
707
708     vftab            = kernel_data->table_elec->data;
709     vftabscale       = kernel_data->table_elec->scale;
710
711     /* Setup water-specific parameters */
712     inr              = nlist->iinr[0];
713     iq1              = facel*charge[inr+1];
714     iq2              = facel*charge[inr+2];
715     iq3              = facel*charge[inr+3];
716
717     jq1              = charge[inr+1];
718     jq2              = charge[inr+2];
719     jq3              = charge[inr+3];
720     qq11             = iq1*jq1;
721     qq12             = iq1*jq2;
722     qq13             = iq1*jq3;
723     qq21             = iq2*jq1;
724     qq22             = iq2*jq2;
725     qq23             = iq2*jq3;
726     qq31             = iq3*jq1;
727     qq32             = iq3*jq2;
728     qq33             = iq3*jq3;
729
730     outeriter        = 0;
731     inneriter        = 0;
732
733     /* Start outer loop over neighborlists */
734     for(iidx=0; iidx<nri; iidx++)
735     {
736         /* Load shift vector for this list */
737         i_shift_offset   = DIM*shiftidx[iidx];
738         shX              = shiftvec[i_shift_offset+XX];
739         shY              = shiftvec[i_shift_offset+YY];
740         shZ              = shiftvec[i_shift_offset+ZZ];
741
742         /* Load limits for loop over neighbors */
743         j_index_start    = jindex[iidx];
744         j_index_end      = jindex[iidx+1];
745
746         /* Get outer coordinate index */
747         inr              = iinr[iidx];
748         i_coord_offset   = DIM*inr;
749
750         /* Load i particle coords and add shift vector */
751         ix1              = shX + x[i_coord_offset+DIM*1+XX];
752         iy1              = shY + x[i_coord_offset+DIM*1+YY];
753         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
754         ix2              = shX + x[i_coord_offset+DIM*2+XX];
755         iy2              = shY + x[i_coord_offset+DIM*2+YY];
756         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
757         ix3              = shX + x[i_coord_offset+DIM*3+XX];
758         iy3              = shY + x[i_coord_offset+DIM*3+YY];
759         iz3              = shZ + x[i_coord_offset+DIM*3+ZZ];
760
761         fix1             = 0.0;
762         fiy1             = 0.0;
763         fiz1             = 0.0;
764         fix2             = 0.0;
765         fiy2             = 0.0;
766         fiz2             = 0.0;
767         fix3             = 0.0;
768         fiy3             = 0.0;
769         fiz3             = 0.0;
770
771         /* Start inner kernel loop */
772         for(jidx=j_index_start; jidx<j_index_end; jidx++)
773         {
774             /* Get j neighbor index, and coordinate index */
775             jnr              = jjnr[jidx];
776             j_coord_offset   = DIM*jnr;
777
778             /* load j atom coordinates */
779             jx1              = x[j_coord_offset+DIM*1+XX];
780             jy1              = x[j_coord_offset+DIM*1+YY];
781             jz1              = x[j_coord_offset+DIM*1+ZZ];
782             jx2              = x[j_coord_offset+DIM*2+XX];
783             jy2              = x[j_coord_offset+DIM*2+YY];
784             jz2              = x[j_coord_offset+DIM*2+ZZ];
785             jx3              = x[j_coord_offset+DIM*3+XX];
786             jy3              = x[j_coord_offset+DIM*3+YY];
787             jz3              = x[j_coord_offset+DIM*3+ZZ];
788
789             /* Calculate displacement vector */
790             dx11             = ix1 - jx1;
791             dy11             = iy1 - jy1;
792             dz11             = iz1 - jz1;
793             dx12             = ix1 - jx2;
794             dy12             = iy1 - jy2;
795             dz12             = iz1 - jz2;
796             dx13             = ix1 - jx3;
797             dy13             = iy1 - jy3;
798             dz13             = iz1 - jz3;
799             dx21             = ix2 - jx1;
800             dy21             = iy2 - jy1;
801             dz21             = iz2 - jz1;
802             dx22             = ix2 - jx2;
803             dy22             = iy2 - jy2;
804             dz22             = iz2 - jz2;
805             dx23             = ix2 - jx3;
806             dy23             = iy2 - jy3;
807             dz23             = iz2 - jz3;
808             dx31             = ix3 - jx1;
809             dy31             = iy3 - jy1;
810             dz31             = iz3 - jz1;
811             dx32             = ix3 - jx2;
812             dy32             = iy3 - jy2;
813             dz32             = iz3 - jz2;
814             dx33             = ix3 - jx3;
815             dy33             = iy3 - jy3;
816             dz33             = iz3 - jz3;
817
818             /* Calculate squared distance and things based on it */
819             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
820             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
821             rsq13            = dx13*dx13+dy13*dy13+dz13*dz13;
822             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
823             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
824             rsq23            = dx23*dx23+dy23*dy23+dz23*dz23;
825             rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
826             rsq32            = dx32*dx32+dy32*dy32+dz32*dz32;
827             rsq33            = dx33*dx33+dy33*dy33+dz33*dz33;
828
829             rinv11           = gmx_invsqrt(rsq11);
830             rinv12           = gmx_invsqrt(rsq12);
831             rinv13           = gmx_invsqrt(rsq13);
832             rinv21           = gmx_invsqrt(rsq21);
833             rinv22           = gmx_invsqrt(rsq22);
834             rinv23           = gmx_invsqrt(rsq23);
835             rinv31           = gmx_invsqrt(rsq31);
836             rinv32           = gmx_invsqrt(rsq32);
837             rinv33           = gmx_invsqrt(rsq33);
838
839             /**************************
840              * CALCULATE INTERACTIONS *
841              **************************/
842
843             r11              = rsq11*rinv11;
844
845             /* Calculate table index by multiplying r with table scale and truncate to integer */
846             rt               = r11*vftabscale;
847             vfitab           = rt;
848             vfeps            = rt-vfitab;
849             vfitab           = 1*4*vfitab;
850
851             /* CUBIC SPLINE TABLE ELECTROSTATICS */
852             F                = vftab[vfitab+1];
853             Geps             = vfeps*vftab[vfitab+2];
854             Heps2            = vfeps*vfeps*vftab[vfitab+3];
855             Fp               = F+Geps+Heps2;
856             FF               = Fp+Geps+2.0*Heps2;
857             felec            = -qq11*FF*vftabscale*rinv11;
858
859             fscal            = felec;
860
861             /* Calculate temporary vectorial force */
862             tx               = fscal*dx11;
863             ty               = fscal*dy11;
864             tz               = fscal*dz11;
865
866             /* Update vectorial force */
867             fix1            += tx;
868             fiy1            += ty;
869             fiz1            += tz;
870             f[j_coord_offset+DIM*1+XX] -= tx;
871             f[j_coord_offset+DIM*1+YY] -= ty;
872             f[j_coord_offset+DIM*1+ZZ] -= tz;
873
874             /**************************
875              * CALCULATE INTERACTIONS *
876              **************************/
877
878             r12              = rsq12*rinv12;
879
880             /* Calculate table index by multiplying r with table scale and truncate to integer */
881             rt               = r12*vftabscale;
882             vfitab           = rt;
883             vfeps            = rt-vfitab;
884             vfitab           = 1*4*vfitab;
885
886             /* CUBIC SPLINE TABLE ELECTROSTATICS */
887             F                = vftab[vfitab+1];
888             Geps             = vfeps*vftab[vfitab+2];
889             Heps2            = vfeps*vfeps*vftab[vfitab+3];
890             Fp               = F+Geps+Heps2;
891             FF               = Fp+Geps+2.0*Heps2;
892             felec            = -qq12*FF*vftabscale*rinv12;
893
894             fscal            = felec;
895
896             /* Calculate temporary vectorial force */
897             tx               = fscal*dx12;
898             ty               = fscal*dy12;
899             tz               = fscal*dz12;
900
901             /* Update vectorial force */
902             fix1            += tx;
903             fiy1            += ty;
904             fiz1            += tz;
905             f[j_coord_offset+DIM*2+XX] -= tx;
906             f[j_coord_offset+DIM*2+YY] -= ty;
907             f[j_coord_offset+DIM*2+ZZ] -= tz;
908
909             /**************************
910              * CALCULATE INTERACTIONS *
911              **************************/
912
913             r13              = rsq13*rinv13;
914
915             /* Calculate table index by multiplying r with table scale and truncate to integer */
916             rt               = r13*vftabscale;
917             vfitab           = rt;
918             vfeps            = rt-vfitab;
919             vfitab           = 1*4*vfitab;
920
921             /* CUBIC SPLINE TABLE ELECTROSTATICS */
922             F                = vftab[vfitab+1];
923             Geps             = vfeps*vftab[vfitab+2];
924             Heps2            = vfeps*vfeps*vftab[vfitab+3];
925             Fp               = F+Geps+Heps2;
926             FF               = Fp+Geps+2.0*Heps2;
927             felec            = -qq13*FF*vftabscale*rinv13;
928
929             fscal            = felec;
930
931             /* Calculate temporary vectorial force */
932             tx               = fscal*dx13;
933             ty               = fscal*dy13;
934             tz               = fscal*dz13;
935
936             /* Update vectorial force */
937             fix1            += tx;
938             fiy1            += ty;
939             fiz1            += tz;
940             f[j_coord_offset+DIM*3+XX] -= tx;
941             f[j_coord_offset+DIM*3+YY] -= ty;
942             f[j_coord_offset+DIM*3+ZZ] -= tz;
943
944             /**************************
945              * CALCULATE INTERACTIONS *
946              **************************/
947
948             r21              = rsq21*rinv21;
949
950             /* Calculate table index by multiplying r with table scale and truncate to integer */
951             rt               = r21*vftabscale;
952             vfitab           = rt;
953             vfeps            = rt-vfitab;
954             vfitab           = 1*4*vfitab;
955
956             /* CUBIC SPLINE TABLE ELECTROSTATICS */
957             F                = vftab[vfitab+1];
958             Geps             = vfeps*vftab[vfitab+2];
959             Heps2            = vfeps*vfeps*vftab[vfitab+3];
960             Fp               = F+Geps+Heps2;
961             FF               = Fp+Geps+2.0*Heps2;
962             felec            = -qq21*FF*vftabscale*rinv21;
963
964             fscal            = felec;
965
966             /* Calculate temporary vectorial force */
967             tx               = fscal*dx21;
968             ty               = fscal*dy21;
969             tz               = fscal*dz21;
970
971             /* Update vectorial force */
972             fix2            += tx;
973             fiy2            += ty;
974             fiz2            += tz;
975             f[j_coord_offset+DIM*1+XX] -= tx;
976             f[j_coord_offset+DIM*1+YY] -= ty;
977             f[j_coord_offset+DIM*1+ZZ] -= tz;
978
979             /**************************
980              * CALCULATE INTERACTIONS *
981              **************************/
982
983             r22              = rsq22*rinv22;
984
985             /* Calculate table index by multiplying r with table scale and truncate to integer */
986             rt               = r22*vftabscale;
987             vfitab           = rt;
988             vfeps            = rt-vfitab;
989             vfitab           = 1*4*vfitab;
990
991             /* CUBIC SPLINE TABLE ELECTROSTATICS */
992             F                = vftab[vfitab+1];
993             Geps             = vfeps*vftab[vfitab+2];
994             Heps2            = vfeps*vfeps*vftab[vfitab+3];
995             Fp               = F+Geps+Heps2;
996             FF               = Fp+Geps+2.0*Heps2;
997             felec            = -qq22*FF*vftabscale*rinv22;
998
999             fscal            = felec;
1000
1001             /* Calculate temporary vectorial force */
1002             tx               = fscal*dx22;
1003             ty               = fscal*dy22;
1004             tz               = fscal*dz22;
1005
1006             /* Update vectorial force */
1007             fix2            += tx;
1008             fiy2            += ty;
1009             fiz2            += tz;
1010             f[j_coord_offset+DIM*2+XX] -= tx;
1011             f[j_coord_offset+DIM*2+YY] -= ty;
1012             f[j_coord_offset+DIM*2+ZZ] -= tz;
1013
1014             /**************************
1015              * CALCULATE INTERACTIONS *
1016              **************************/
1017
1018             r23              = rsq23*rinv23;
1019
1020             /* Calculate table index by multiplying r with table scale and truncate to integer */
1021             rt               = r23*vftabscale;
1022             vfitab           = rt;
1023             vfeps            = rt-vfitab;
1024             vfitab           = 1*4*vfitab;
1025
1026             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1027             F                = vftab[vfitab+1];
1028             Geps             = vfeps*vftab[vfitab+2];
1029             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1030             Fp               = F+Geps+Heps2;
1031             FF               = Fp+Geps+2.0*Heps2;
1032             felec            = -qq23*FF*vftabscale*rinv23;
1033
1034             fscal            = felec;
1035
1036             /* Calculate temporary vectorial force */
1037             tx               = fscal*dx23;
1038             ty               = fscal*dy23;
1039             tz               = fscal*dz23;
1040
1041             /* Update vectorial force */
1042             fix2            += tx;
1043             fiy2            += ty;
1044             fiz2            += tz;
1045             f[j_coord_offset+DIM*3+XX] -= tx;
1046             f[j_coord_offset+DIM*3+YY] -= ty;
1047             f[j_coord_offset+DIM*3+ZZ] -= tz;
1048
1049             /**************************
1050              * CALCULATE INTERACTIONS *
1051              **************************/
1052
1053             r31              = rsq31*rinv31;
1054
1055             /* Calculate table index by multiplying r with table scale and truncate to integer */
1056             rt               = r31*vftabscale;
1057             vfitab           = rt;
1058             vfeps            = rt-vfitab;
1059             vfitab           = 1*4*vfitab;
1060
1061             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1062             F                = vftab[vfitab+1];
1063             Geps             = vfeps*vftab[vfitab+2];
1064             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1065             Fp               = F+Geps+Heps2;
1066             FF               = Fp+Geps+2.0*Heps2;
1067             felec            = -qq31*FF*vftabscale*rinv31;
1068
1069             fscal            = felec;
1070
1071             /* Calculate temporary vectorial force */
1072             tx               = fscal*dx31;
1073             ty               = fscal*dy31;
1074             tz               = fscal*dz31;
1075
1076             /* Update vectorial force */
1077             fix3            += tx;
1078             fiy3            += ty;
1079             fiz3            += tz;
1080             f[j_coord_offset+DIM*1+XX] -= tx;
1081             f[j_coord_offset+DIM*1+YY] -= ty;
1082             f[j_coord_offset+DIM*1+ZZ] -= tz;
1083
1084             /**************************
1085              * CALCULATE INTERACTIONS *
1086              **************************/
1087
1088             r32              = rsq32*rinv32;
1089
1090             /* Calculate table index by multiplying r with table scale and truncate to integer */
1091             rt               = r32*vftabscale;
1092             vfitab           = rt;
1093             vfeps            = rt-vfitab;
1094             vfitab           = 1*4*vfitab;
1095
1096             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1097             F                = vftab[vfitab+1];
1098             Geps             = vfeps*vftab[vfitab+2];
1099             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1100             Fp               = F+Geps+Heps2;
1101             FF               = Fp+Geps+2.0*Heps2;
1102             felec            = -qq32*FF*vftabscale*rinv32;
1103
1104             fscal            = felec;
1105
1106             /* Calculate temporary vectorial force */
1107             tx               = fscal*dx32;
1108             ty               = fscal*dy32;
1109             tz               = fscal*dz32;
1110
1111             /* Update vectorial force */
1112             fix3            += tx;
1113             fiy3            += ty;
1114             fiz3            += tz;
1115             f[j_coord_offset+DIM*2+XX] -= tx;
1116             f[j_coord_offset+DIM*2+YY] -= ty;
1117             f[j_coord_offset+DIM*2+ZZ] -= tz;
1118
1119             /**************************
1120              * CALCULATE INTERACTIONS *
1121              **************************/
1122
1123             r33              = rsq33*rinv33;
1124
1125             /* Calculate table index by multiplying r with table scale and truncate to integer */
1126             rt               = r33*vftabscale;
1127             vfitab           = rt;
1128             vfeps            = rt-vfitab;
1129             vfitab           = 1*4*vfitab;
1130
1131             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1132             F                = vftab[vfitab+1];
1133             Geps             = vfeps*vftab[vfitab+2];
1134             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1135             Fp               = F+Geps+Heps2;
1136             FF               = Fp+Geps+2.0*Heps2;
1137             felec            = -qq33*FF*vftabscale*rinv33;
1138
1139             fscal            = felec;
1140
1141             /* Calculate temporary vectorial force */
1142             tx               = fscal*dx33;
1143             ty               = fscal*dy33;
1144             tz               = fscal*dz33;
1145
1146             /* Update vectorial force */
1147             fix3            += tx;
1148             fiy3            += ty;
1149             fiz3            += tz;
1150             f[j_coord_offset+DIM*3+XX] -= tx;
1151             f[j_coord_offset+DIM*3+YY] -= ty;
1152             f[j_coord_offset+DIM*3+ZZ] -= tz;
1153
1154             /* Inner loop uses 333 flops */
1155         }
1156         /* End of innermost loop */
1157
1158         tx = ty = tz = 0;
1159         f[i_coord_offset+DIM*1+XX] += fix1;
1160         f[i_coord_offset+DIM*1+YY] += fiy1;
1161         f[i_coord_offset+DIM*1+ZZ] += fiz1;
1162         tx                         += fix1;
1163         ty                         += fiy1;
1164         tz                         += fiz1;
1165         f[i_coord_offset+DIM*2+XX] += fix2;
1166         f[i_coord_offset+DIM*2+YY] += fiy2;
1167         f[i_coord_offset+DIM*2+ZZ] += fiz2;
1168         tx                         += fix2;
1169         ty                         += fiy2;
1170         tz                         += fiz2;
1171         f[i_coord_offset+DIM*3+XX] += fix3;
1172         f[i_coord_offset+DIM*3+YY] += fiy3;
1173         f[i_coord_offset+DIM*3+ZZ] += fiz3;
1174         tx                         += fix3;
1175         ty                         += fiy3;
1176         tz                         += fiz3;
1177         fshift[i_shift_offset+XX]  += tx;
1178         fshift[i_shift_offset+YY]  += ty;
1179         fshift[i_shift_offset+ZZ]  += tz;
1180
1181         /* Increment number of inner iterations */
1182         inneriter                  += j_index_end - j_index_start;
1183
1184         /* Outer loop uses 30 flops */
1185     }
1186
1187     /* Increment number of outer iterations */
1188     outeriter        += nri;
1189
1190     /* Update outer/inner flops */
1191
1192     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*333);
1193 }