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