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