Remove no-inline-max-size and suppress remark
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecRF_VdwBham_GeomW3P1_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_VdwBham_GeomW3P1_VF_c
51  * Electrostatics interaction: ReactionField
52  * VdW interaction:            Buckingham
53  * Geometry:                   Water3-Particle
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecRF_VdwBham_GeomW3P1_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              vdwjidx0;
79     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
80     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
81     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
82     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
83     real             velec,felec,velecsum,facel,crf,krf,krf2;
84     real             *charge;
85     int              nvdwtype;
86     real             rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
87     int              *vdwtype;
88     real             *vdwparam;
89
90     x                = xx[0];
91     f                = ff[0];
92
93     nri              = nlist->nri;
94     iinr             = nlist->iinr;
95     jindex           = nlist->jindex;
96     jjnr             = nlist->jjnr;
97     shiftidx         = nlist->shift;
98     gid              = nlist->gid;
99     shiftvec         = fr->shift_vec[0];
100     fshift           = fr->fshift[0];
101     facel            = fr->epsfac;
102     charge           = mdatoms->chargeA;
103     krf              = fr->ic->k_rf;
104     krf2             = krf*2.0;
105     crf              = fr->ic->c_rf;
106     nvdwtype         = fr->ntype;
107     vdwparam         = fr->nbfp;
108     vdwtype          = mdatoms->typeA;
109
110     /* Setup water-specific parameters */
111     inr              = nlist->iinr[0];
112     iq0              = facel*charge[inr+0];
113     iq1              = facel*charge[inr+1];
114     iq2              = facel*charge[inr+2];
115     vdwioffset0      = 3*nvdwtype*vdwtype[inr+0];
116
117     outeriter        = 0;
118     inneriter        = 0;
119
120     /* Start outer loop over neighborlists */
121     for(iidx=0; iidx<nri; iidx++)
122     {
123         /* Load shift vector for this list */
124         i_shift_offset   = DIM*shiftidx[iidx];
125         shX              = shiftvec[i_shift_offset+XX];
126         shY              = shiftvec[i_shift_offset+YY];
127         shZ              = shiftvec[i_shift_offset+ZZ];
128
129         /* Load limits for loop over neighbors */
130         j_index_start    = jindex[iidx];
131         j_index_end      = jindex[iidx+1];
132
133         /* Get outer coordinate index */
134         inr              = iinr[iidx];
135         i_coord_offset   = DIM*inr;
136
137         /* Load i particle coords and add shift vector */
138         ix0              = shX + x[i_coord_offset+DIM*0+XX];
139         iy0              = shY + x[i_coord_offset+DIM*0+YY];
140         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
141         ix1              = shX + x[i_coord_offset+DIM*1+XX];
142         iy1              = shY + x[i_coord_offset+DIM*1+YY];
143         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
144         ix2              = shX + x[i_coord_offset+DIM*2+XX];
145         iy2              = shY + x[i_coord_offset+DIM*2+YY];
146         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
147
148         fix0             = 0.0;
149         fiy0             = 0.0;
150         fiz0             = 0.0;
151         fix1             = 0.0;
152         fiy1             = 0.0;
153         fiz1             = 0.0;
154         fix2             = 0.0;
155         fiy2             = 0.0;
156         fiz2             = 0.0;
157
158         /* Reset potential sums */
159         velecsum         = 0.0;
160         vvdwsum          = 0.0;
161
162         /* Start inner kernel loop */
163         for(jidx=j_index_start; jidx<j_index_end; jidx++)
164         {
165             /* Get j neighbor index, and coordinate index */
166             jnr              = jjnr[jidx];
167             j_coord_offset   = DIM*jnr;
168
169             /* load j atom coordinates */
170             jx0              = x[j_coord_offset+DIM*0+XX];
171             jy0              = x[j_coord_offset+DIM*0+YY];
172             jz0              = x[j_coord_offset+DIM*0+ZZ];
173
174             /* Calculate displacement vector */
175             dx00             = ix0 - jx0;
176             dy00             = iy0 - jy0;
177             dz00             = iz0 - jz0;
178             dx10             = ix1 - jx0;
179             dy10             = iy1 - jy0;
180             dz10             = iz1 - jz0;
181             dx20             = ix2 - jx0;
182             dy20             = iy2 - jy0;
183             dz20             = iz2 - jz0;
184
185             /* Calculate squared distance and things based on it */
186             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
187             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
188             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
189
190             rinv00           = gmx_invsqrt(rsq00);
191             rinv10           = gmx_invsqrt(rsq10);
192             rinv20           = gmx_invsqrt(rsq20);
193
194             rinvsq00         = rinv00*rinv00;
195             rinvsq10         = rinv10*rinv10;
196             rinvsq20         = rinv20*rinv20;
197
198             /* Load parameters for j particles */
199             jq0              = charge[jnr+0];
200             vdwjidx0         = 3*vdwtype[jnr+0];
201
202             /**************************
203              * CALCULATE INTERACTIONS *
204              **************************/
205
206             r00              = rsq00*rinv00;
207
208             qq00             = iq0*jq0;
209             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
210             cexp1_00         = vdwparam[vdwioffset0+vdwjidx0+1];
211             cexp2_00         = vdwparam[vdwioffset0+vdwjidx0+2];
212
213             /* REACTION-FIELD ELECTROSTATICS */
214             velec            = qq00*(rinv00+krf*rsq00-crf);
215             felec            = qq00*(rinv00*rinvsq00-krf2);
216
217             /* BUCKINGHAM DISPERSION/REPULSION */
218             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
219             vvdw6            = c6_00*rinvsix;
220             br               = cexp2_00*r00;
221             vvdwexp          = cexp1_00*exp(-br);
222             vvdw             = vvdwexp - vvdw6*(1.0/6.0);
223             fvdw             = (br*vvdwexp-vvdw6)*rinvsq00;
224
225             /* Update potential sums from outer loop */
226             velecsum        += velec;
227             vvdwsum         += vvdw;
228
229             fscal            = felec+fvdw;
230
231             /* Calculate temporary vectorial force */
232             tx               = fscal*dx00;
233             ty               = fscal*dy00;
234             tz               = fscal*dz00;
235
236             /* Update vectorial force */
237             fix0            += tx;
238             fiy0            += ty;
239             fiz0            += tz;
240             f[j_coord_offset+DIM*0+XX] -= tx;
241             f[j_coord_offset+DIM*0+YY] -= ty;
242             f[j_coord_offset+DIM*0+ZZ] -= tz;
243
244             /**************************
245              * CALCULATE INTERACTIONS *
246              **************************/
247
248             qq10             = iq1*jq0;
249
250             /* REACTION-FIELD ELECTROSTATICS */
251             velec            = qq10*(rinv10+krf*rsq10-crf);
252             felec            = qq10*(rinv10*rinvsq10-krf2);
253
254             /* Update potential sums from outer loop */
255             velecsum        += velec;
256
257             fscal            = felec;
258
259             /* Calculate temporary vectorial force */
260             tx               = fscal*dx10;
261             ty               = fscal*dy10;
262             tz               = fscal*dz10;
263
264             /* Update vectorial force */
265             fix1            += tx;
266             fiy1            += ty;
267             fiz1            += tz;
268             f[j_coord_offset+DIM*0+XX] -= tx;
269             f[j_coord_offset+DIM*0+YY] -= ty;
270             f[j_coord_offset+DIM*0+ZZ] -= tz;
271
272             /**************************
273              * CALCULATE INTERACTIONS *
274              **************************/
275
276             qq20             = iq2*jq0;
277
278             /* REACTION-FIELD ELECTROSTATICS */
279             velec            = qq20*(rinv20+krf*rsq20-crf);
280             felec            = qq20*(rinv20*rinvsq20-krf2);
281
282             /* Update potential sums from outer loop */
283             velecsum        += velec;
284
285             fscal            = felec;
286
287             /* Calculate temporary vectorial force */
288             tx               = fscal*dx20;
289             ty               = fscal*dy20;
290             tz               = fscal*dz20;
291
292             /* Update vectorial force */
293             fix2            += tx;
294             fiy2            += ty;
295             fiz2            += tz;
296             f[j_coord_offset+DIM*0+XX] -= tx;
297             f[j_coord_offset+DIM*0+YY] -= ty;
298             f[j_coord_offset+DIM*0+ZZ] -= tz;
299
300             /* Inner loop uses 135 flops */
301         }
302         /* End of innermost loop */
303
304         tx = ty = tz = 0;
305         f[i_coord_offset+DIM*0+XX] += fix0;
306         f[i_coord_offset+DIM*0+YY] += fiy0;
307         f[i_coord_offset+DIM*0+ZZ] += fiz0;
308         tx                         += fix0;
309         ty                         += fiy0;
310         tz                         += fiz0;
311         f[i_coord_offset+DIM*1+XX] += fix1;
312         f[i_coord_offset+DIM*1+YY] += fiy1;
313         f[i_coord_offset+DIM*1+ZZ] += fiz1;
314         tx                         += fix1;
315         ty                         += fiy1;
316         tz                         += fiz1;
317         f[i_coord_offset+DIM*2+XX] += fix2;
318         f[i_coord_offset+DIM*2+YY] += fiy2;
319         f[i_coord_offset+DIM*2+ZZ] += fiz2;
320         tx                         += fix2;
321         ty                         += fiy2;
322         tz                         += fiz2;
323         fshift[i_shift_offset+XX]  += tx;
324         fshift[i_shift_offset+YY]  += ty;
325         fshift[i_shift_offset+ZZ]  += tz;
326
327         ggid                        = gid[iidx];
328         /* Update potential energies */
329         kernel_data->energygrp_elec[ggid] += velecsum;
330         kernel_data->energygrp_vdw[ggid] += vvdwsum;
331
332         /* Increment number of inner iterations */
333         inneriter                  += j_index_end - j_index_start;
334
335         /* Outer loop uses 32 flops */
336     }
337
338     /* Increment number of outer iterations */
339     outeriter        += nri;
340
341     /* Update outer/inner flops */
342
343     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*135);
344 }
345 /*
346  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwBham_GeomW3P1_F_c
347  * Electrostatics interaction: ReactionField
348  * VdW interaction:            Buckingham
349  * Geometry:                   Water3-Particle
350  * Calculate force/pot:        Force
351  */
352 void
353 nb_kernel_ElecRF_VdwBham_GeomW3P1_F_c
354                     (t_nblist                    * gmx_restrict       nlist,
355                      rvec                        * gmx_restrict          xx,
356                      rvec                        * gmx_restrict          ff,
357                      t_forcerec                  * gmx_restrict          fr,
358                      t_mdatoms                   * gmx_restrict     mdatoms,
359                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
360                      t_nrnb                      * gmx_restrict        nrnb)
361 {
362     int              i_shift_offset,i_coord_offset,j_coord_offset;
363     int              j_index_start,j_index_end;
364     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
365     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
366     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
367     real             *shiftvec,*fshift,*x,*f;
368     int              vdwioffset0;
369     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
370     int              vdwioffset1;
371     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
372     int              vdwioffset2;
373     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
374     int              vdwjidx0;
375     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
376     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
377     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
378     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
379     real             velec,felec,velecsum,facel,crf,krf,krf2;
380     real             *charge;
381     int              nvdwtype;
382     real             rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
383     int              *vdwtype;
384     real             *vdwparam;
385
386     x                = xx[0];
387     f                = ff[0];
388
389     nri              = nlist->nri;
390     iinr             = nlist->iinr;
391     jindex           = nlist->jindex;
392     jjnr             = nlist->jjnr;
393     shiftidx         = nlist->shift;
394     gid              = nlist->gid;
395     shiftvec         = fr->shift_vec[0];
396     fshift           = fr->fshift[0];
397     facel            = fr->epsfac;
398     charge           = mdatoms->chargeA;
399     krf              = fr->ic->k_rf;
400     krf2             = krf*2.0;
401     crf              = fr->ic->c_rf;
402     nvdwtype         = fr->ntype;
403     vdwparam         = fr->nbfp;
404     vdwtype          = mdatoms->typeA;
405
406     /* Setup water-specific parameters */
407     inr              = nlist->iinr[0];
408     iq0              = facel*charge[inr+0];
409     iq1              = facel*charge[inr+1];
410     iq2              = facel*charge[inr+2];
411     vdwioffset0      = 3*nvdwtype*vdwtype[inr+0];
412
413     outeriter        = 0;
414     inneriter        = 0;
415
416     /* Start outer loop over neighborlists */
417     for(iidx=0; iidx<nri; iidx++)
418     {
419         /* Load shift vector for this list */
420         i_shift_offset   = DIM*shiftidx[iidx];
421         shX              = shiftvec[i_shift_offset+XX];
422         shY              = shiftvec[i_shift_offset+YY];
423         shZ              = shiftvec[i_shift_offset+ZZ];
424
425         /* Load limits for loop over neighbors */
426         j_index_start    = jindex[iidx];
427         j_index_end      = jindex[iidx+1];
428
429         /* Get outer coordinate index */
430         inr              = iinr[iidx];
431         i_coord_offset   = DIM*inr;
432
433         /* Load i particle coords and add shift vector */
434         ix0              = shX + x[i_coord_offset+DIM*0+XX];
435         iy0              = shY + x[i_coord_offset+DIM*0+YY];
436         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
437         ix1              = shX + x[i_coord_offset+DIM*1+XX];
438         iy1              = shY + x[i_coord_offset+DIM*1+YY];
439         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
440         ix2              = shX + x[i_coord_offset+DIM*2+XX];
441         iy2              = shY + x[i_coord_offset+DIM*2+YY];
442         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
443
444         fix0             = 0.0;
445         fiy0             = 0.0;
446         fiz0             = 0.0;
447         fix1             = 0.0;
448         fiy1             = 0.0;
449         fiz1             = 0.0;
450         fix2             = 0.0;
451         fiy2             = 0.0;
452         fiz2             = 0.0;
453
454         /* Start inner kernel loop */
455         for(jidx=j_index_start; jidx<j_index_end; jidx++)
456         {
457             /* Get j neighbor index, and coordinate index */
458             jnr              = jjnr[jidx];
459             j_coord_offset   = DIM*jnr;
460
461             /* load j atom coordinates */
462             jx0              = x[j_coord_offset+DIM*0+XX];
463             jy0              = x[j_coord_offset+DIM*0+YY];
464             jz0              = x[j_coord_offset+DIM*0+ZZ];
465
466             /* Calculate displacement vector */
467             dx00             = ix0 - jx0;
468             dy00             = iy0 - jy0;
469             dz00             = iz0 - jz0;
470             dx10             = ix1 - jx0;
471             dy10             = iy1 - jy0;
472             dz10             = iz1 - jz0;
473             dx20             = ix2 - jx0;
474             dy20             = iy2 - jy0;
475             dz20             = iz2 - jz0;
476
477             /* Calculate squared distance and things based on it */
478             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
479             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
480             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
481
482             rinv00           = gmx_invsqrt(rsq00);
483             rinv10           = gmx_invsqrt(rsq10);
484             rinv20           = gmx_invsqrt(rsq20);
485
486             rinvsq00         = rinv00*rinv00;
487             rinvsq10         = rinv10*rinv10;
488             rinvsq20         = rinv20*rinv20;
489
490             /* Load parameters for j particles */
491             jq0              = charge[jnr+0];
492             vdwjidx0         = 3*vdwtype[jnr+0];
493
494             /**************************
495              * CALCULATE INTERACTIONS *
496              **************************/
497
498             r00              = rsq00*rinv00;
499
500             qq00             = iq0*jq0;
501             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
502             cexp1_00         = vdwparam[vdwioffset0+vdwjidx0+1];
503             cexp2_00         = vdwparam[vdwioffset0+vdwjidx0+2];
504
505             /* REACTION-FIELD ELECTROSTATICS */
506             felec            = qq00*(rinv00*rinvsq00-krf2);
507
508             /* BUCKINGHAM DISPERSION/REPULSION */
509             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
510             vvdw6            = c6_00*rinvsix;
511             br               = cexp2_00*r00;
512             vvdwexp          = cexp1_00*exp(-br);
513             fvdw             = (br*vvdwexp-vvdw6)*rinvsq00;
514
515             fscal            = felec+fvdw;
516
517             /* Calculate temporary vectorial force */
518             tx               = fscal*dx00;
519             ty               = fscal*dy00;
520             tz               = fscal*dz00;
521
522             /* Update vectorial force */
523             fix0            += tx;
524             fiy0            += ty;
525             fiz0            += tz;
526             f[j_coord_offset+DIM*0+XX] -= tx;
527             f[j_coord_offset+DIM*0+YY] -= ty;
528             f[j_coord_offset+DIM*0+ZZ] -= tz;
529
530             /**************************
531              * CALCULATE INTERACTIONS *
532              **************************/
533
534             qq10             = iq1*jq0;
535
536             /* REACTION-FIELD ELECTROSTATICS */
537             felec            = qq10*(rinv10*rinvsq10-krf2);
538
539             fscal            = felec;
540
541             /* Calculate temporary vectorial force */
542             tx               = fscal*dx10;
543             ty               = fscal*dy10;
544             tz               = fscal*dz10;
545
546             /* Update vectorial force */
547             fix1            += tx;
548             fiy1            += ty;
549             fiz1            += tz;
550             f[j_coord_offset+DIM*0+XX] -= tx;
551             f[j_coord_offset+DIM*0+YY] -= ty;
552             f[j_coord_offset+DIM*0+ZZ] -= tz;
553
554             /**************************
555              * CALCULATE INTERACTIONS *
556              **************************/
557
558             qq20             = iq2*jq0;
559
560             /* REACTION-FIELD ELECTROSTATICS */
561             felec            = qq20*(rinv20*rinvsq20-krf2);
562
563             fscal            = felec;
564
565             /* Calculate temporary vectorial force */
566             tx               = fscal*dx20;
567             ty               = fscal*dy20;
568             tz               = fscal*dz20;
569
570             /* Update vectorial force */
571             fix2            += tx;
572             fiy2            += ty;
573             fiz2            += tz;
574             f[j_coord_offset+DIM*0+XX] -= tx;
575             f[j_coord_offset+DIM*0+YY] -= ty;
576             f[j_coord_offset+DIM*0+ZZ] -= tz;
577
578             /* Inner loop uses 117 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         fshift[i_shift_offset+XX]  += tx;
602         fshift[i_shift_offset+YY]  += ty;
603         fshift[i_shift_offset+ZZ]  += tz;
604
605         /* Increment number of inner iterations */
606         inneriter                  += j_index_end - j_index_start;
607
608         /* Outer loop uses 30 flops */
609     }
610
611     /* Increment number of outer iterations */
612     outeriter        += nri;
613
614     /* Update outer/inner flops */
615
616     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*117);
617 }