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