Fix component for libcudart
[alexxy/gromacs.git] / src / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_c.c
1 /*
2  * Note: this file was generated by the Gromacs c kernel generator.
3  *
4  *                This source code is part of
5  *
6  *                 G   R   O   M   A   C   S
7  *
8  * Copyright (c) 2001-2012, The GROMACS Development Team
9  *
10  * Gromacs is a library for molecular simulation and trajectory analysis,
11  * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12  * a full list of developers and information, check out http://www.gromacs.org
13  *
14  * This program is free software; you can redistribute it and/or modify it under
15  * the terms of the GNU Lesser General Public License as published by the Free
16  * Software Foundation; either version 2 of the License, or (at your option) any
17  * later version.
18  *
19  * To help fund GROMACS development, we humbly ask that you cite
20  * the papers people have written on it - you can find them on the website.
21  */
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <math.h>
27
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
30 #include "vec.h"
31 #include "nrnb.h"
32
33 /*
34  * Gromacs nonbonded kernel:   nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_VF_c
35  * Electrostatics interaction: ReactionField
36  * VdW interaction:            LennardJones
37  * Geometry:                   Water3-Particle
38  * Calculate force/pot:        PotentialAndForce
39  */
40 void
41 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_VF_c
42                     (t_nblist * gmx_restrict                nlist,
43                      rvec * gmx_restrict                    xx,
44                      rvec * gmx_restrict                    ff,
45                      t_forcerec * gmx_restrict              fr,
46                      t_mdatoms * gmx_restrict               mdatoms,
47                      nb_kernel_data_t * gmx_restrict        kernel_data,
48                      t_nrnb * gmx_restrict                  nrnb)
49 {
50     int              i_shift_offset,i_coord_offset,j_coord_offset;
51     int              j_index_start,j_index_end;
52     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
55     real             *shiftvec,*fshift,*x,*f;
56     int              vdwioffset0;
57     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
58     int              vdwioffset1;
59     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
60     int              vdwioffset2;
61     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
62     int              vdwjidx0;
63     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
64     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
65     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
66     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
67     real             velec,felec,velecsum,facel,crf,krf,krf2;
68     real             *charge;
69     int              nvdwtype;
70     real             rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
71     int              *vdwtype;
72     real             *vdwparam;
73
74     x                = xx[0];
75     f                = ff[0];
76
77     nri              = nlist->nri;
78     iinr             = nlist->iinr;
79     jindex           = nlist->jindex;
80     jjnr             = nlist->jjnr;
81     shiftidx         = nlist->shift;
82     gid              = nlist->gid;
83     shiftvec         = fr->shift_vec[0];
84     fshift           = fr->fshift[0];
85     facel            = fr->epsfac;
86     charge           = mdatoms->chargeA;
87     krf              = fr->ic->k_rf;
88     krf2             = krf*2.0;
89     crf              = fr->ic->c_rf;
90     nvdwtype         = fr->ntype;
91     vdwparam         = fr->nbfp;
92     vdwtype          = mdatoms->typeA;
93
94     /* Setup water-specific parameters */
95     inr              = nlist->iinr[0];
96     iq0              = facel*charge[inr+0];
97     iq1              = facel*charge[inr+1];
98     iq2              = facel*charge[inr+2];
99     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
100
101     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
102     rcutoff          = fr->rcoulomb;
103     rcutoff2         = rcutoff*rcutoff;
104
105     sh_vdw_invrcut6  = fr->ic->sh_invrc6;
106     rvdw             = fr->rvdw;
107
108     outeriter        = 0;
109     inneriter        = 0;
110
111     /* Start outer loop over neighborlists */
112     for(iidx=0; iidx<nri; iidx++)
113     {
114         /* Load shift vector for this list */
115         i_shift_offset   = DIM*shiftidx[iidx];
116         shX              = shiftvec[i_shift_offset+XX];
117         shY              = shiftvec[i_shift_offset+YY];
118         shZ              = shiftvec[i_shift_offset+ZZ];
119
120         /* Load limits for loop over neighbors */
121         j_index_start    = jindex[iidx];
122         j_index_end      = jindex[iidx+1];
123
124         /* Get outer coordinate index */
125         inr              = iinr[iidx];
126         i_coord_offset   = DIM*inr;
127
128         /* Load i particle coords and add shift vector */
129         ix0              = shX + x[i_coord_offset+DIM*0+XX];
130         iy0              = shY + x[i_coord_offset+DIM*0+YY];
131         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
132         ix1              = shX + x[i_coord_offset+DIM*1+XX];
133         iy1              = shY + x[i_coord_offset+DIM*1+YY];
134         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
135         ix2              = shX + x[i_coord_offset+DIM*2+XX];
136         iy2              = shY + x[i_coord_offset+DIM*2+YY];
137         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
138
139         fix0             = 0.0;
140         fiy0             = 0.0;
141         fiz0             = 0.0;
142         fix1             = 0.0;
143         fiy1             = 0.0;
144         fiz1             = 0.0;
145         fix2             = 0.0;
146         fiy2             = 0.0;
147         fiz2             = 0.0;
148
149         /* Reset potential sums */
150         velecsum         = 0.0;
151         vvdwsum          = 0.0;
152
153         /* Start inner kernel loop */
154         for(jidx=j_index_start; jidx<j_index_end; jidx++)
155         {
156             /* Get j neighbor index, and coordinate index */
157             jnr              = jjnr[jidx];
158             j_coord_offset   = DIM*jnr;
159
160             /* load j atom coordinates */
161             jx0              = x[j_coord_offset+DIM*0+XX];
162             jy0              = x[j_coord_offset+DIM*0+YY];
163             jz0              = x[j_coord_offset+DIM*0+ZZ];
164
165             /* Calculate displacement vector */
166             dx00             = ix0 - jx0;
167             dy00             = iy0 - jy0;
168             dz00             = iz0 - jz0;
169             dx10             = ix1 - jx0;
170             dy10             = iy1 - jy0;
171             dz10             = iz1 - jz0;
172             dx20             = ix2 - jx0;
173             dy20             = iy2 - jy0;
174             dz20             = iz2 - jz0;
175
176             /* Calculate squared distance and things based on it */
177             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
178             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
179             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
180
181             rinv00           = gmx_invsqrt(rsq00);
182             rinv10           = gmx_invsqrt(rsq10);
183             rinv20           = gmx_invsqrt(rsq20);
184
185             rinvsq00         = rinv00*rinv00;
186             rinvsq10         = rinv10*rinv10;
187             rinvsq20         = rinv20*rinv20;
188
189             /* Load parameters for j particles */
190             jq0              = charge[jnr+0];
191             vdwjidx0         = 2*vdwtype[jnr+0];
192
193             /**************************
194              * CALCULATE INTERACTIONS *
195              **************************/
196
197             if (rsq00<rcutoff2)
198             {
199
200             qq00             = iq0*jq0;
201             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
202             c12_00           = vdwparam[vdwioffset0+vdwjidx0+1];
203
204             /* REACTION-FIELD ELECTROSTATICS */
205             velec            = qq00*(rinv00+krf*rsq00-crf);
206             felec            = qq00*(rinv00*rinvsq00-krf2);
207
208             /* LENNARD-JONES DISPERSION/REPULSION */
209
210             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
211             vvdw6            = c6_00*rinvsix;
212             vvdw12           = c12_00*rinvsix*rinvsix;
213             vvdw             = (vvdw12 - c12_00*sh_vdw_invrcut6*sh_vdw_invrcut6)*(1.0/12.0) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0);
214             fvdw             = (vvdw12-vvdw6)*rinvsq00;
215
216             /* Update potential sums from outer loop */
217             velecsum        += velec;
218             vvdwsum         += vvdw;
219
220             fscal            = felec+fvdw;
221
222             /* Calculate temporary vectorial force */
223             tx               = fscal*dx00;
224             ty               = fscal*dy00;
225             tz               = fscal*dz00;
226
227             /* Update vectorial force */
228             fix0            += tx;
229             fiy0            += ty;
230             fiz0            += tz;
231             f[j_coord_offset+DIM*0+XX] -= tx;
232             f[j_coord_offset+DIM*0+YY] -= ty;
233             f[j_coord_offset+DIM*0+ZZ] -= tz;
234
235             }
236
237             /**************************
238              * CALCULATE INTERACTIONS *
239              **************************/
240
241             if (rsq10<rcutoff2)
242             {
243
244             qq10             = iq1*jq0;
245
246             /* REACTION-FIELD ELECTROSTATICS */
247             velec            = qq10*(rinv10+krf*rsq10-crf);
248             felec            = qq10*(rinv10*rinvsq10-krf2);
249
250             /* Update potential sums from outer loop */
251             velecsum        += velec;
252
253             fscal            = felec;
254
255             /* Calculate temporary vectorial force */
256             tx               = fscal*dx10;
257             ty               = fscal*dy10;
258             tz               = fscal*dz10;
259
260             /* Update vectorial force */
261             fix1            += tx;
262             fiy1            += ty;
263             fiz1            += tz;
264             f[j_coord_offset+DIM*0+XX] -= tx;
265             f[j_coord_offset+DIM*0+YY] -= ty;
266             f[j_coord_offset+DIM*0+ZZ] -= tz;
267
268             }
269
270             /**************************
271              * CALCULATE INTERACTIONS *
272              **************************/
273
274             if (rsq20<rcutoff2)
275             {
276
277             qq20             = iq2*jq0;
278
279             /* REACTION-FIELD ELECTROSTATICS */
280             velec            = qq20*(rinv20+krf*rsq20-crf);
281             felec            = qq20*(rinv20*rinvsq20-krf2);
282
283             /* Update potential sums from outer loop */
284             velecsum        += velec;
285
286             fscal            = felec;
287
288             /* Calculate temporary vectorial force */
289             tx               = fscal*dx20;
290             ty               = fscal*dy20;
291             tz               = fscal*dz20;
292
293             /* Update vectorial force */
294             fix2            += tx;
295             fiy2            += ty;
296             fiz2            += tz;
297             f[j_coord_offset+DIM*0+XX] -= tx;
298             f[j_coord_offset+DIM*0+YY] -= ty;
299             f[j_coord_offset+DIM*0+ZZ] -= tz;
300
301             }
302
303             /* Inner loop uses 113 flops */
304         }
305         /* End of innermost loop */
306
307         tx = ty = tz = 0;
308         f[i_coord_offset+DIM*0+XX] += fix0;
309         f[i_coord_offset+DIM*0+YY] += fiy0;
310         f[i_coord_offset+DIM*0+ZZ] += fiz0;
311         tx                         += fix0;
312         ty                         += fiy0;
313         tz                         += fiz0;
314         f[i_coord_offset+DIM*1+XX] += fix1;
315         f[i_coord_offset+DIM*1+YY] += fiy1;
316         f[i_coord_offset+DIM*1+ZZ] += fiz1;
317         tx                         += fix1;
318         ty                         += fiy1;
319         tz                         += fiz1;
320         f[i_coord_offset+DIM*2+XX] += fix2;
321         f[i_coord_offset+DIM*2+YY] += fiy2;
322         f[i_coord_offset+DIM*2+ZZ] += fiz2;
323         tx                         += fix2;
324         ty                         += fiy2;
325         tz                         += fiz2;
326         fshift[i_shift_offset+XX]  += tx;
327         fshift[i_shift_offset+YY]  += ty;
328         fshift[i_shift_offset+ZZ]  += tz;
329
330         ggid                        = gid[iidx];
331         /* Update potential energies */
332         kernel_data->energygrp_elec[ggid] += velecsum;
333         kernel_data->energygrp_vdw[ggid] += vvdwsum;
334
335         /* Increment number of inner iterations */
336         inneriter                  += j_index_end - j_index_start;
337
338         /* Outer loop uses 32 flops */
339     }
340
341     /* Increment number of outer iterations */
342     outeriter        += nri;
343
344     /* Update outer/inner flops */
345
346     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*113);
347 }
348 /*
349  * Gromacs nonbonded kernel:   nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_c
350  * Electrostatics interaction: ReactionField
351  * VdW interaction:            LennardJones
352  * Geometry:                   Water3-Particle
353  * Calculate force/pot:        Force
354  */
355 void
356 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_c
357                     (t_nblist * gmx_restrict                nlist,
358                      rvec * gmx_restrict                    xx,
359                      rvec * gmx_restrict                    ff,
360                      t_forcerec * gmx_restrict              fr,
361                      t_mdatoms * gmx_restrict               mdatoms,
362                      nb_kernel_data_t * gmx_restrict        kernel_data,
363                      t_nrnb * gmx_restrict                  nrnb)
364 {
365     int              i_shift_offset,i_coord_offset,j_coord_offset;
366     int              j_index_start,j_index_end;
367     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
368     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
369     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
370     real             *shiftvec,*fshift,*x,*f;
371     int              vdwioffset0;
372     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
373     int              vdwioffset1;
374     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
375     int              vdwioffset2;
376     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
377     int              vdwjidx0;
378     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
379     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
380     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
381     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
382     real             velec,felec,velecsum,facel,crf,krf,krf2;
383     real             *charge;
384     int              nvdwtype;
385     real             rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
386     int              *vdwtype;
387     real             *vdwparam;
388
389     x                = xx[0];
390     f                = ff[0];
391
392     nri              = nlist->nri;
393     iinr             = nlist->iinr;
394     jindex           = nlist->jindex;
395     jjnr             = nlist->jjnr;
396     shiftidx         = nlist->shift;
397     gid              = nlist->gid;
398     shiftvec         = fr->shift_vec[0];
399     fshift           = fr->fshift[0];
400     facel            = fr->epsfac;
401     charge           = mdatoms->chargeA;
402     krf              = fr->ic->k_rf;
403     krf2             = krf*2.0;
404     crf              = fr->ic->c_rf;
405     nvdwtype         = fr->ntype;
406     vdwparam         = fr->nbfp;
407     vdwtype          = mdatoms->typeA;
408
409     /* Setup water-specific parameters */
410     inr              = nlist->iinr[0];
411     iq0              = facel*charge[inr+0];
412     iq1              = facel*charge[inr+1];
413     iq2              = facel*charge[inr+2];
414     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
415
416     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
417     rcutoff          = fr->rcoulomb;
418     rcutoff2         = rcutoff*rcutoff;
419
420     sh_vdw_invrcut6  = fr->ic->sh_invrc6;
421     rvdw             = fr->rvdw;
422
423     outeriter        = 0;
424     inneriter        = 0;
425
426     /* Start outer loop over neighborlists */
427     for(iidx=0; iidx<nri; iidx++)
428     {
429         /* Load shift vector for this list */
430         i_shift_offset   = DIM*shiftidx[iidx];
431         shX              = shiftvec[i_shift_offset+XX];
432         shY              = shiftvec[i_shift_offset+YY];
433         shZ              = shiftvec[i_shift_offset+ZZ];
434
435         /* Load limits for loop over neighbors */
436         j_index_start    = jindex[iidx];
437         j_index_end      = jindex[iidx+1];
438
439         /* Get outer coordinate index */
440         inr              = iinr[iidx];
441         i_coord_offset   = DIM*inr;
442
443         /* Load i particle coords and add shift vector */
444         ix0              = shX + x[i_coord_offset+DIM*0+XX];
445         iy0              = shY + x[i_coord_offset+DIM*0+YY];
446         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
447         ix1              = shX + x[i_coord_offset+DIM*1+XX];
448         iy1              = shY + x[i_coord_offset+DIM*1+YY];
449         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
450         ix2              = shX + x[i_coord_offset+DIM*2+XX];
451         iy2              = shY + x[i_coord_offset+DIM*2+YY];
452         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
453
454         fix0             = 0.0;
455         fiy0             = 0.0;
456         fiz0             = 0.0;
457         fix1             = 0.0;
458         fiy1             = 0.0;
459         fiz1             = 0.0;
460         fix2             = 0.0;
461         fiy2             = 0.0;
462         fiz2             = 0.0;
463
464         /* Start inner kernel loop */
465         for(jidx=j_index_start; jidx<j_index_end; jidx++)
466         {
467             /* Get j neighbor index, and coordinate index */
468             jnr              = jjnr[jidx];
469             j_coord_offset   = DIM*jnr;
470
471             /* load j atom coordinates */
472             jx0              = x[j_coord_offset+DIM*0+XX];
473             jy0              = x[j_coord_offset+DIM*0+YY];
474             jz0              = x[j_coord_offset+DIM*0+ZZ];
475
476             /* Calculate displacement vector */
477             dx00             = ix0 - jx0;
478             dy00             = iy0 - jy0;
479             dz00             = iz0 - jz0;
480             dx10             = ix1 - jx0;
481             dy10             = iy1 - jy0;
482             dz10             = iz1 - jz0;
483             dx20             = ix2 - jx0;
484             dy20             = iy2 - jy0;
485             dz20             = iz2 - jz0;
486
487             /* Calculate squared distance and things based on it */
488             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
489             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
490             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
491
492             rinv00           = gmx_invsqrt(rsq00);
493             rinv10           = gmx_invsqrt(rsq10);
494             rinv20           = gmx_invsqrt(rsq20);
495
496             rinvsq00         = rinv00*rinv00;
497             rinvsq10         = rinv10*rinv10;
498             rinvsq20         = rinv20*rinv20;
499
500             /* Load parameters for j particles */
501             jq0              = charge[jnr+0];
502             vdwjidx0         = 2*vdwtype[jnr+0];
503
504             /**************************
505              * CALCULATE INTERACTIONS *
506              **************************/
507
508             if (rsq00<rcutoff2)
509             {
510
511             qq00             = iq0*jq0;
512             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
513             c12_00           = vdwparam[vdwioffset0+vdwjidx0+1];
514
515             /* REACTION-FIELD ELECTROSTATICS */
516             felec            = qq00*(rinv00*rinvsq00-krf2);
517
518             /* LENNARD-JONES DISPERSION/REPULSION */
519
520             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
521             fvdw             = (c12_00*rinvsix-c6_00)*rinvsix*rinvsq00;
522
523             fscal            = felec+fvdw;
524
525             /* Calculate temporary vectorial force */
526             tx               = fscal*dx00;
527             ty               = fscal*dy00;
528             tz               = fscal*dz00;
529
530             /* Update vectorial force */
531             fix0            += tx;
532             fiy0            += ty;
533             fiz0            += tz;
534             f[j_coord_offset+DIM*0+XX] -= tx;
535             f[j_coord_offset+DIM*0+YY] -= ty;
536             f[j_coord_offset+DIM*0+ZZ] -= tz;
537
538             }
539
540             /**************************
541              * CALCULATE INTERACTIONS *
542              **************************/
543
544             if (rsq10<rcutoff2)
545             {
546
547             qq10             = iq1*jq0;
548
549             /* REACTION-FIELD ELECTROSTATICS */
550             felec            = qq10*(rinv10*rinvsq10-krf2);
551
552             fscal            = felec;
553
554             /* Calculate temporary vectorial force */
555             tx               = fscal*dx10;
556             ty               = fscal*dy10;
557             tz               = fscal*dz10;
558
559             /* Update vectorial force */
560             fix1            += tx;
561             fiy1            += ty;
562             fiz1            += tz;
563             f[j_coord_offset+DIM*0+XX] -= tx;
564             f[j_coord_offset+DIM*0+YY] -= ty;
565             f[j_coord_offset+DIM*0+ZZ] -= tz;
566
567             }
568
569             /**************************
570              * CALCULATE INTERACTIONS *
571              **************************/
572
573             if (rsq20<rcutoff2)
574             {
575
576             qq20             = iq2*jq0;
577
578             /* REACTION-FIELD ELECTROSTATICS */
579             felec            = qq20*(rinv20*rinvsq20-krf2);
580
581             fscal            = felec;
582
583             /* Calculate temporary vectorial force */
584             tx               = fscal*dx20;
585             ty               = fscal*dy20;
586             tz               = fscal*dz20;
587
588             /* Update vectorial force */
589             fix2            += tx;
590             fiy2            += ty;
591             fiz2            += tz;
592             f[j_coord_offset+DIM*0+XX] -= tx;
593             f[j_coord_offset+DIM*0+YY] -= ty;
594             f[j_coord_offset+DIM*0+ZZ] -= tz;
595
596             }
597
598             /* Inner loop uses 88 flops */
599         }
600         /* End of innermost loop */
601
602         tx = ty = tz = 0;
603         f[i_coord_offset+DIM*0+XX] += fix0;
604         f[i_coord_offset+DIM*0+YY] += fiy0;
605         f[i_coord_offset+DIM*0+ZZ] += fiz0;
606         tx                         += fix0;
607         ty                         += fiy0;
608         tz                         += fiz0;
609         f[i_coord_offset+DIM*1+XX] += fix1;
610         f[i_coord_offset+DIM*1+YY] += fiy1;
611         f[i_coord_offset+DIM*1+ZZ] += fiz1;
612         tx                         += fix1;
613         ty                         += fiy1;
614         tz                         += fiz1;
615         f[i_coord_offset+DIM*2+XX] += fix2;
616         f[i_coord_offset+DIM*2+YY] += fiy2;
617         f[i_coord_offset+DIM*2+ZZ] += fiz2;
618         tx                         += fix2;
619         ty                         += fiy2;
620         tz                         += fiz2;
621         fshift[i_shift_offset+XX]  += tx;
622         fshift[i_shift_offset+YY]  += ty;
623         fshift[i_shift_offset+ZZ]  += tz;
624
625         /* Increment number of inner iterations */
626         inneriter                  += j_index_end - j_index_start;
627
628         /* Outer loop uses 30 flops */
629     }
630
631     /* Increment number of outer iterations */
632     outeriter        += nri;
633
634     /* Update outer/inner flops */
635
636     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*88);
637 }