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