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