Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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 #include "gmxpre.h"
39
40 #include "config.h"
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
51  * Electrostatics interaction: CubicSplineTable
52  * VdW interaction:            None
53  * Geometry:                   Water3-Water3
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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              vdwioffset0;
73     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
74     int              vdwioffset1;
75     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
76     int              vdwioffset2;
77     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
78     int              vdwjidx0;
79     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
80     int              vdwjidx1;
81     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
82     int              vdwjidx2;
83     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
84     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85     real             dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86     real             dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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     iq0              = facel*charge[inr+0];
119     iq1              = facel*charge[inr+1];
120     iq2              = facel*charge[inr+2];
121
122     jq0              = charge[inr+0];
123     jq1              = charge[inr+1];
124     jq2              = charge[inr+2];
125     qq00             = iq0*jq0;
126     qq01             = iq0*jq1;
127     qq02             = iq0*jq2;
128     qq10             = iq1*jq0;
129     qq11             = iq1*jq1;
130     qq12             = iq1*jq2;
131     qq20             = iq2*jq0;
132     qq21             = iq2*jq1;
133     qq22             = iq2*jq2;
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         ix0              = shX + x[i_coord_offset+DIM*0+XX];
157         iy0              = shY + x[i_coord_offset+DIM*0+YY];
158         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
159         ix1              = shX + x[i_coord_offset+DIM*1+XX];
160         iy1              = shY + x[i_coord_offset+DIM*1+YY];
161         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
162         ix2              = shX + x[i_coord_offset+DIM*2+XX];
163         iy2              = shY + x[i_coord_offset+DIM*2+YY];
164         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
165
166         fix0             = 0.0;
167         fiy0             = 0.0;
168         fiz0             = 0.0;
169         fix1             = 0.0;
170         fiy1             = 0.0;
171         fiz1             = 0.0;
172         fix2             = 0.0;
173         fiy2             = 0.0;
174         fiz2             = 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             jx0              = x[j_coord_offset+DIM*0+XX];
188             jy0              = x[j_coord_offset+DIM*0+YY];
189             jz0              = x[j_coord_offset+DIM*0+ZZ];
190             jx1              = x[j_coord_offset+DIM*1+XX];
191             jy1              = x[j_coord_offset+DIM*1+YY];
192             jz1              = x[j_coord_offset+DIM*1+ZZ];
193             jx2              = x[j_coord_offset+DIM*2+XX];
194             jy2              = x[j_coord_offset+DIM*2+YY];
195             jz2              = x[j_coord_offset+DIM*2+ZZ];
196
197             /* Calculate displacement vector */
198             dx00             = ix0 - jx0;
199             dy00             = iy0 - jy0;
200             dz00             = iz0 - jz0;
201             dx01             = ix0 - jx1;
202             dy01             = iy0 - jy1;
203             dz01             = iz0 - jz1;
204             dx02             = ix0 - jx2;
205             dy02             = iy0 - jy2;
206             dz02             = iz0 - jz2;
207             dx10             = ix1 - jx0;
208             dy10             = iy1 - jy0;
209             dz10             = iz1 - jz0;
210             dx11             = ix1 - jx1;
211             dy11             = iy1 - jy1;
212             dz11             = iz1 - jz1;
213             dx12             = ix1 - jx2;
214             dy12             = iy1 - jy2;
215             dz12             = iz1 - jz2;
216             dx20             = ix2 - jx0;
217             dy20             = iy2 - jy0;
218             dz20             = iz2 - jz0;
219             dx21             = ix2 - jx1;
220             dy21             = iy2 - jy1;
221             dz21             = iz2 - jz1;
222             dx22             = ix2 - jx2;
223             dy22             = iy2 - jy2;
224             dz22             = iz2 - jz2;
225
226             /* Calculate squared distance and things based on it */
227             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
228             rsq01            = dx01*dx01+dy01*dy01+dz01*dz01;
229             rsq02            = dx02*dx02+dy02*dy02+dz02*dz02;
230             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
231             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
232             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
233             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
234             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
235             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
236
237             rinv00           = gmx_invsqrt(rsq00);
238             rinv01           = gmx_invsqrt(rsq01);
239             rinv02           = gmx_invsqrt(rsq02);
240             rinv10           = gmx_invsqrt(rsq10);
241             rinv11           = gmx_invsqrt(rsq11);
242             rinv12           = gmx_invsqrt(rsq12);
243             rinv20           = gmx_invsqrt(rsq20);
244             rinv21           = gmx_invsqrt(rsq21);
245             rinv22           = gmx_invsqrt(rsq22);
246
247             /**************************
248              * CALCULATE INTERACTIONS *
249              **************************/
250
251             r00              = rsq00*rinv00;
252
253             /* Calculate table index by multiplying r with table scale and truncate to integer */
254             rt               = r00*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            = qq00*VV;
267             FF               = Fp+Geps+2.0*Heps2;
268             felec            = -qq00*FF*vftabscale*rinv00;
269
270             /* Update potential sums from outer loop */
271             velecsum        += velec;
272
273             fscal            = felec;
274
275             /* Calculate temporary vectorial force */
276             tx               = fscal*dx00;
277             ty               = fscal*dy00;
278             tz               = fscal*dz00;
279
280             /* Update vectorial force */
281             fix0            += tx;
282             fiy0            += ty;
283             fiz0            += tz;
284             f[j_coord_offset+DIM*0+XX] -= tx;
285             f[j_coord_offset+DIM*0+YY] -= ty;
286             f[j_coord_offset+DIM*0+ZZ] -= tz;
287
288             /**************************
289              * CALCULATE INTERACTIONS *
290              **************************/
291
292             r01              = rsq01*rinv01;
293
294             /* Calculate table index by multiplying r with table scale and truncate to integer */
295             rt               = r01*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            = qq01*VV;
308             FF               = Fp+Geps+2.0*Heps2;
309             felec            = -qq01*FF*vftabscale*rinv01;
310
311             /* Update potential sums from outer loop */
312             velecsum        += velec;
313
314             fscal            = felec;
315
316             /* Calculate temporary vectorial force */
317             tx               = fscal*dx01;
318             ty               = fscal*dy01;
319             tz               = fscal*dz01;
320
321             /* Update vectorial force */
322             fix0            += tx;
323             fiy0            += ty;
324             fiz0            += tz;
325             f[j_coord_offset+DIM*1+XX] -= tx;
326             f[j_coord_offset+DIM*1+YY] -= ty;
327             f[j_coord_offset+DIM*1+ZZ] -= tz;
328
329             /**************************
330              * CALCULATE INTERACTIONS *
331              **************************/
332
333             r02              = rsq02*rinv02;
334
335             /* Calculate table index by multiplying r with table scale and truncate to integer */
336             rt               = r02*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            = qq02*VV;
349             FF               = Fp+Geps+2.0*Heps2;
350             felec            = -qq02*FF*vftabscale*rinv02;
351
352             /* Update potential sums from outer loop */
353             velecsum        += velec;
354
355             fscal            = felec;
356
357             /* Calculate temporary vectorial force */
358             tx               = fscal*dx02;
359             ty               = fscal*dy02;
360             tz               = fscal*dz02;
361
362             /* Update vectorial force */
363             fix0            += tx;
364             fiy0            += ty;
365             fiz0            += tz;
366             f[j_coord_offset+DIM*2+XX] -= tx;
367             f[j_coord_offset+DIM*2+YY] -= ty;
368             f[j_coord_offset+DIM*2+ZZ] -= tz;
369
370             /**************************
371              * CALCULATE INTERACTIONS *
372              **************************/
373
374             r10              = rsq10*rinv10;
375
376             /* Calculate table index by multiplying r with table scale and truncate to integer */
377             rt               = r10*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            = qq10*VV;
390             FF               = Fp+Geps+2.0*Heps2;
391             felec            = -qq10*FF*vftabscale*rinv10;
392
393             /* Update potential sums from outer loop */
394             velecsum        += velec;
395
396             fscal            = felec;
397
398             /* Calculate temporary vectorial force */
399             tx               = fscal*dx10;
400             ty               = fscal*dy10;
401             tz               = fscal*dz10;
402
403             /* Update vectorial force */
404             fix1            += tx;
405             fiy1            += ty;
406             fiz1            += tz;
407             f[j_coord_offset+DIM*0+XX] -= tx;
408             f[j_coord_offset+DIM*0+YY] -= ty;
409             f[j_coord_offset+DIM*0+ZZ] -= tz;
410
411             /**************************
412              * CALCULATE INTERACTIONS *
413              **************************/
414
415             r11              = rsq11*rinv11;
416
417             /* Calculate table index by multiplying r with table scale and truncate to integer */
418             rt               = r11*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            = qq11*VV;
431             FF               = Fp+Geps+2.0*Heps2;
432             felec            = -qq11*FF*vftabscale*rinv11;
433
434             /* Update potential sums from outer loop */
435             velecsum        += velec;
436
437             fscal            = felec;
438
439             /* Calculate temporary vectorial force */
440             tx               = fscal*dx11;
441             ty               = fscal*dy11;
442             tz               = fscal*dz11;
443
444             /* Update vectorial force */
445             fix1            += tx;
446             fiy1            += ty;
447             fiz1            += tz;
448             f[j_coord_offset+DIM*1+XX] -= tx;
449             f[j_coord_offset+DIM*1+YY] -= ty;
450             f[j_coord_offset+DIM*1+ZZ] -= tz;
451
452             /**************************
453              * CALCULATE INTERACTIONS *
454              **************************/
455
456             r12              = rsq12*rinv12;
457
458             /* Calculate table index by multiplying r with table scale and truncate to integer */
459             rt               = r12*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            = qq12*VV;
472             FF               = Fp+Geps+2.0*Heps2;
473             felec            = -qq12*FF*vftabscale*rinv12;
474
475             /* Update potential sums from outer loop */
476             velecsum        += velec;
477
478             fscal            = felec;
479
480             /* Calculate temporary vectorial force */
481             tx               = fscal*dx12;
482             ty               = fscal*dy12;
483             tz               = fscal*dz12;
484
485             /* Update vectorial force */
486             fix1            += tx;
487             fiy1            += ty;
488             fiz1            += tz;
489             f[j_coord_offset+DIM*2+XX] -= tx;
490             f[j_coord_offset+DIM*2+YY] -= ty;
491             f[j_coord_offset+DIM*2+ZZ] -= tz;
492
493             /**************************
494              * CALCULATE INTERACTIONS *
495              **************************/
496
497             r20              = rsq20*rinv20;
498
499             /* Calculate table index by multiplying r with table scale and truncate to integer */
500             rt               = r20*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            = qq20*VV;
513             FF               = Fp+Geps+2.0*Heps2;
514             felec            = -qq20*FF*vftabscale*rinv20;
515
516             /* Update potential sums from outer loop */
517             velecsum        += velec;
518
519             fscal            = felec;
520
521             /* Calculate temporary vectorial force */
522             tx               = fscal*dx20;
523             ty               = fscal*dy20;
524             tz               = fscal*dz20;
525
526             /* Update vectorial force */
527             fix2            += tx;
528             fiy2            += ty;
529             fiz2            += tz;
530             f[j_coord_offset+DIM*0+XX] -= tx;
531             f[j_coord_offset+DIM*0+YY] -= ty;
532             f[j_coord_offset+DIM*0+ZZ] -= tz;
533
534             /**************************
535              * CALCULATE INTERACTIONS *
536              **************************/
537
538             r21              = rsq21*rinv21;
539
540             /* Calculate table index by multiplying r with table scale and truncate to integer */
541             rt               = r21*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            = qq21*VV;
554             FF               = Fp+Geps+2.0*Heps2;
555             felec            = -qq21*FF*vftabscale*rinv21;
556
557             /* Update potential sums from outer loop */
558             velecsum        += velec;
559
560             fscal            = felec;
561
562             /* Calculate temporary vectorial force */
563             tx               = fscal*dx21;
564             ty               = fscal*dy21;
565             tz               = fscal*dz21;
566
567             /* Update vectorial force */
568             fix2            += tx;
569             fiy2            += ty;
570             fiz2            += tz;
571             f[j_coord_offset+DIM*1+XX] -= tx;
572             f[j_coord_offset+DIM*1+YY] -= ty;
573             f[j_coord_offset+DIM*1+ZZ] -= tz;
574
575             /**************************
576              * CALCULATE INTERACTIONS *
577              **************************/
578
579             r22              = rsq22*rinv22;
580
581             /* Calculate table index by multiplying r with table scale and truncate to integer */
582             rt               = r22*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            = qq22*VV;
595             FF               = Fp+Geps+2.0*Heps2;
596             felec            = -qq22*FF*vftabscale*rinv22;
597
598             /* Update potential sums from outer loop */
599             velecsum        += velec;
600
601             fscal            = felec;
602
603             /* Calculate temporary vectorial force */
604             tx               = fscal*dx22;
605             ty               = fscal*dy22;
606             tz               = fscal*dz22;
607
608             /* Update vectorial force */
609             fix2            += tx;
610             fiy2            += ty;
611             fiz2            += tz;
612             f[j_coord_offset+DIM*2+XX] -= tx;
613             f[j_coord_offset+DIM*2+YY] -= ty;
614             f[j_coord_offset+DIM*2+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*0+XX] += fix0;
622         f[i_coord_offset+DIM*0+YY] += fiy0;
623         f[i_coord_offset+DIM*0+ZZ] += fiz0;
624         tx                         += fix0;
625         ty                         += fiy0;
626         tz                         += fiz0;
627         f[i_coord_offset+DIM*1+XX] += fix1;
628         f[i_coord_offset+DIM*1+YY] += fiy1;
629         f[i_coord_offset+DIM*1+ZZ] += fiz1;
630         tx                         += fix1;
631         ty                         += fiy1;
632         tz                         += fiz1;
633         f[i_coord_offset+DIM*2+XX] += fix2;
634         f[i_coord_offset+DIM*2+YY] += fiy2;
635         f[i_coord_offset+DIM*2+ZZ] += fiz2;
636         tx                         += fix2;
637         ty                         += fiy2;
638         tz                         += fiz2;
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_W3W3_VF,outeriter*31 + inneriter*369);
659 }
660 /*
661  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
662  * Electrostatics interaction: CubicSplineTable
663  * VdW interaction:            None
664  * Geometry:                   Water3-Water3
665  * Calculate force/pot:        Force
666  */
667 void
668 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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              vdwioffset0;
684     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
685     int              vdwioffset1;
686     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
687     int              vdwioffset2;
688     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
689     int              vdwjidx0;
690     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
691     int              vdwjidx1;
692     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
693     int              vdwjidx2;
694     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
695     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
696     real             dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
697     real             dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
698     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
699     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
700     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
701     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
702     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
703     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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     iq0              = facel*charge[inr+0];
730     iq1              = facel*charge[inr+1];
731     iq2              = facel*charge[inr+2];
732
733     jq0              = charge[inr+0];
734     jq1              = charge[inr+1];
735     jq2              = charge[inr+2];
736     qq00             = iq0*jq0;
737     qq01             = iq0*jq1;
738     qq02             = iq0*jq2;
739     qq10             = iq1*jq0;
740     qq11             = iq1*jq1;
741     qq12             = iq1*jq2;
742     qq20             = iq2*jq0;
743     qq21             = iq2*jq1;
744     qq22             = iq2*jq2;
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         ix0              = shX + x[i_coord_offset+DIM*0+XX];
768         iy0              = shY + x[i_coord_offset+DIM*0+YY];
769         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
770         ix1              = shX + x[i_coord_offset+DIM*1+XX];
771         iy1              = shY + x[i_coord_offset+DIM*1+YY];
772         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
773         ix2              = shX + x[i_coord_offset+DIM*2+XX];
774         iy2              = shY + x[i_coord_offset+DIM*2+YY];
775         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
776
777         fix0             = 0.0;
778         fiy0             = 0.0;
779         fiz0             = 0.0;
780         fix1             = 0.0;
781         fiy1             = 0.0;
782         fiz1             = 0.0;
783         fix2             = 0.0;
784         fiy2             = 0.0;
785         fiz2             = 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             jx0              = x[j_coord_offset+DIM*0+XX];
796             jy0              = x[j_coord_offset+DIM*0+YY];
797             jz0              = x[j_coord_offset+DIM*0+ZZ];
798             jx1              = x[j_coord_offset+DIM*1+XX];
799             jy1              = x[j_coord_offset+DIM*1+YY];
800             jz1              = x[j_coord_offset+DIM*1+ZZ];
801             jx2              = x[j_coord_offset+DIM*2+XX];
802             jy2              = x[j_coord_offset+DIM*2+YY];
803             jz2              = x[j_coord_offset+DIM*2+ZZ];
804
805             /* Calculate displacement vector */
806             dx00             = ix0 - jx0;
807             dy00             = iy0 - jy0;
808             dz00             = iz0 - jz0;
809             dx01             = ix0 - jx1;
810             dy01             = iy0 - jy1;
811             dz01             = iz0 - jz1;
812             dx02             = ix0 - jx2;
813             dy02             = iy0 - jy2;
814             dz02             = iz0 - jz2;
815             dx10             = ix1 - jx0;
816             dy10             = iy1 - jy0;
817             dz10             = iz1 - jz0;
818             dx11             = ix1 - jx1;
819             dy11             = iy1 - jy1;
820             dz11             = iz1 - jz1;
821             dx12             = ix1 - jx2;
822             dy12             = iy1 - jy2;
823             dz12             = iz1 - jz2;
824             dx20             = ix2 - jx0;
825             dy20             = iy2 - jy0;
826             dz20             = iz2 - jz0;
827             dx21             = ix2 - jx1;
828             dy21             = iy2 - jy1;
829             dz21             = iz2 - jz1;
830             dx22             = ix2 - jx2;
831             dy22             = iy2 - jy2;
832             dz22             = iz2 - jz2;
833
834             /* Calculate squared distance and things based on it */
835             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
836             rsq01            = dx01*dx01+dy01*dy01+dz01*dz01;
837             rsq02            = dx02*dx02+dy02*dy02+dz02*dz02;
838             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
839             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
840             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
841             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
842             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
843             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
844
845             rinv00           = gmx_invsqrt(rsq00);
846             rinv01           = gmx_invsqrt(rsq01);
847             rinv02           = gmx_invsqrt(rsq02);
848             rinv10           = gmx_invsqrt(rsq10);
849             rinv11           = gmx_invsqrt(rsq11);
850             rinv12           = gmx_invsqrt(rsq12);
851             rinv20           = gmx_invsqrt(rsq20);
852             rinv21           = gmx_invsqrt(rsq21);
853             rinv22           = gmx_invsqrt(rsq22);
854
855             /**************************
856              * CALCULATE INTERACTIONS *
857              **************************/
858
859             r00              = rsq00*rinv00;
860
861             /* Calculate table index by multiplying r with table scale and truncate to integer */
862             rt               = r00*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            = -qq00*FF*vftabscale*rinv00;
874
875             fscal            = felec;
876
877             /* Calculate temporary vectorial force */
878             tx               = fscal*dx00;
879             ty               = fscal*dy00;
880             tz               = fscal*dz00;
881
882             /* Update vectorial force */
883             fix0            += tx;
884             fiy0            += ty;
885             fiz0            += tz;
886             f[j_coord_offset+DIM*0+XX] -= tx;
887             f[j_coord_offset+DIM*0+YY] -= ty;
888             f[j_coord_offset+DIM*0+ZZ] -= tz;
889
890             /**************************
891              * CALCULATE INTERACTIONS *
892              **************************/
893
894             r01              = rsq01*rinv01;
895
896             /* Calculate table index by multiplying r with table scale and truncate to integer */
897             rt               = r01*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            = -qq01*FF*vftabscale*rinv01;
909
910             fscal            = felec;
911
912             /* Calculate temporary vectorial force */
913             tx               = fscal*dx01;
914             ty               = fscal*dy01;
915             tz               = fscal*dz01;
916
917             /* Update vectorial force */
918             fix0            += tx;
919             fiy0            += ty;
920             fiz0            += tz;
921             f[j_coord_offset+DIM*1+XX] -= tx;
922             f[j_coord_offset+DIM*1+YY] -= ty;
923             f[j_coord_offset+DIM*1+ZZ] -= tz;
924
925             /**************************
926              * CALCULATE INTERACTIONS *
927              **************************/
928
929             r02              = rsq02*rinv02;
930
931             /* Calculate table index by multiplying r with table scale and truncate to integer */
932             rt               = r02*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            = -qq02*FF*vftabscale*rinv02;
944
945             fscal            = felec;
946
947             /* Calculate temporary vectorial force */
948             tx               = fscal*dx02;
949             ty               = fscal*dy02;
950             tz               = fscal*dz02;
951
952             /* Update vectorial force */
953             fix0            += tx;
954             fiy0            += ty;
955             fiz0            += tz;
956             f[j_coord_offset+DIM*2+XX] -= tx;
957             f[j_coord_offset+DIM*2+YY] -= ty;
958             f[j_coord_offset+DIM*2+ZZ] -= tz;
959
960             /**************************
961              * CALCULATE INTERACTIONS *
962              **************************/
963
964             r10              = rsq10*rinv10;
965
966             /* Calculate table index by multiplying r with table scale and truncate to integer */
967             rt               = r10*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            = -qq10*FF*vftabscale*rinv10;
979
980             fscal            = felec;
981
982             /* Calculate temporary vectorial force */
983             tx               = fscal*dx10;
984             ty               = fscal*dy10;
985             tz               = fscal*dz10;
986
987             /* Update vectorial force */
988             fix1            += tx;
989             fiy1            += ty;
990             fiz1            += tz;
991             f[j_coord_offset+DIM*0+XX] -= tx;
992             f[j_coord_offset+DIM*0+YY] -= ty;
993             f[j_coord_offset+DIM*0+ZZ] -= tz;
994
995             /**************************
996              * CALCULATE INTERACTIONS *
997              **************************/
998
999             r11              = rsq11*rinv11;
1000
1001             /* Calculate table index by multiplying r with table scale and truncate to integer */
1002             rt               = r11*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            = -qq11*FF*vftabscale*rinv11;
1014
1015             fscal            = felec;
1016
1017             /* Calculate temporary vectorial force */
1018             tx               = fscal*dx11;
1019             ty               = fscal*dy11;
1020             tz               = fscal*dz11;
1021
1022             /* Update vectorial force */
1023             fix1            += tx;
1024             fiy1            += ty;
1025             fiz1            += tz;
1026             f[j_coord_offset+DIM*1+XX] -= tx;
1027             f[j_coord_offset+DIM*1+YY] -= ty;
1028             f[j_coord_offset+DIM*1+ZZ] -= tz;
1029
1030             /**************************
1031              * CALCULATE INTERACTIONS *
1032              **************************/
1033
1034             r12              = rsq12*rinv12;
1035
1036             /* Calculate table index by multiplying r with table scale and truncate to integer */
1037             rt               = r12*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            = -qq12*FF*vftabscale*rinv12;
1049
1050             fscal            = felec;
1051
1052             /* Calculate temporary vectorial force */
1053             tx               = fscal*dx12;
1054             ty               = fscal*dy12;
1055             tz               = fscal*dz12;
1056
1057             /* Update vectorial force */
1058             fix1            += tx;
1059             fiy1            += ty;
1060             fiz1            += tz;
1061             f[j_coord_offset+DIM*2+XX] -= tx;
1062             f[j_coord_offset+DIM*2+YY] -= ty;
1063             f[j_coord_offset+DIM*2+ZZ] -= tz;
1064
1065             /**************************
1066              * CALCULATE INTERACTIONS *
1067              **************************/
1068
1069             r20              = rsq20*rinv20;
1070
1071             /* Calculate table index by multiplying r with table scale and truncate to integer */
1072             rt               = r20*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            = -qq20*FF*vftabscale*rinv20;
1084
1085             fscal            = felec;
1086
1087             /* Calculate temporary vectorial force */
1088             tx               = fscal*dx20;
1089             ty               = fscal*dy20;
1090             tz               = fscal*dz20;
1091
1092             /* Update vectorial force */
1093             fix2            += tx;
1094             fiy2            += ty;
1095             fiz2            += tz;
1096             f[j_coord_offset+DIM*0+XX] -= tx;
1097             f[j_coord_offset+DIM*0+YY] -= ty;
1098             f[j_coord_offset+DIM*0+ZZ] -= tz;
1099
1100             /**************************
1101              * CALCULATE INTERACTIONS *
1102              **************************/
1103
1104             r21              = rsq21*rinv21;
1105
1106             /* Calculate table index by multiplying r with table scale and truncate to integer */
1107             rt               = r21*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            = -qq21*FF*vftabscale*rinv21;
1119
1120             fscal            = felec;
1121
1122             /* Calculate temporary vectorial force */
1123             tx               = fscal*dx21;
1124             ty               = fscal*dy21;
1125             tz               = fscal*dz21;
1126
1127             /* Update vectorial force */
1128             fix2            += tx;
1129             fiy2            += ty;
1130             fiz2            += tz;
1131             f[j_coord_offset+DIM*1+XX] -= tx;
1132             f[j_coord_offset+DIM*1+YY] -= ty;
1133             f[j_coord_offset+DIM*1+ZZ] -= tz;
1134
1135             /**************************
1136              * CALCULATE INTERACTIONS *
1137              **************************/
1138
1139             r22              = rsq22*rinv22;
1140
1141             /* Calculate table index by multiplying r with table scale and truncate to integer */
1142             rt               = r22*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            = -qq22*FF*vftabscale*rinv22;
1154
1155             fscal            = felec;
1156
1157             /* Calculate temporary vectorial force */
1158             tx               = fscal*dx22;
1159             ty               = fscal*dy22;
1160             tz               = fscal*dz22;
1161
1162             /* Update vectorial force */
1163             fix2            += tx;
1164             fiy2            += ty;
1165             fiz2            += tz;
1166             f[j_coord_offset+DIM*2+XX] -= tx;
1167             f[j_coord_offset+DIM*2+YY] -= ty;
1168             f[j_coord_offset+DIM*2+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*0+XX] += fix0;
1176         f[i_coord_offset+DIM*0+YY] += fiy0;
1177         f[i_coord_offset+DIM*0+ZZ] += fiz0;
1178         tx                         += fix0;
1179         ty                         += fiy0;
1180         tz                         += fiz0;
1181         f[i_coord_offset+DIM*1+XX] += fix1;
1182         f[i_coord_offset+DIM*1+YY] += fiy1;
1183         f[i_coord_offset+DIM*1+ZZ] += fiz1;
1184         tx                         += fix1;
1185         ty                         += fiy1;
1186         tz                         += fiz1;
1187         f[i_coord_offset+DIM*2+XX] += fix2;
1188         f[i_coord_offset+DIM*2+YY] += fiy2;
1189         f[i_coord_offset+DIM*2+ZZ] += fiz2;
1190         tx                         += fix2;
1191         ty                         += fiy2;
1192         tz                         += fiz2;
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_W3W3_F,outeriter*30 + inneriter*333);
1209 }