Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecCoul_VdwBham_GeomW3P1_c.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS c kernel generator.
37  */
38 #include "gmxpre.h"
39
40 #include "config.h"
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwBham_GeomW3P1_VF_c
51  * Electrostatics interaction: Coulomb
52  * VdW interaction:            Buckingham
53  * Geometry:                   Water3-Particle
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecCoul_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     nvdwtype         = fr->ntype;
104     vdwparam         = fr->nbfp;
105     vdwtype          = mdatoms->typeA;
106
107     /* Setup water-specific parameters */
108     inr              = nlist->iinr[0];
109     iq0              = facel*charge[inr+0];
110     iq1              = facel*charge[inr+1];
111     iq2              = facel*charge[inr+2];
112     vdwioffset0      = 3*nvdwtype*vdwtype[inr+0];
113
114     outeriter        = 0;
115     inneriter        = 0;
116
117     /* Start outer loop over neighborlists */
118     for(iidx=0; iidx<nri; iidx++)
119     {
120         /* Load shift vector for this list */
121         i_shift_offset   = DIM*shiftidx[iidx];
122         shX              = shiftvec[i_shift_offset+XX];
123         shY              = shiftvec[i_shift_offset+YY];
124         shZ              = shiftvec[i_shift_offset+ZZ];
125
126         /* Load limits for loop over neighbors */
127         j_index_start    = jindex[iidx];
128         j_index_end      = jindex[iidx+1];
129
130         /* Get outer coordinate index */
131         inr              = iinr[iidx];
132         i_coord_offset   = DIM*inr;
133
134         /* Load i particle coords and add shift vector */
135         ix0              = shX + x[i_coord_offset+DIM*0+XX];
136         iy0              = shY + x[i_coord_offset+DIM*0+YY];
137         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
138         ix1              = shX + x[i_coord_offset+DIM*1+XX];
139         iy1              = shY + x[i_coord_offset+DIM*1+YY];
140         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
141         ix2              = shX + x[i_coord_offset+DIM*2+XX];
142         iy2              = shY + x[i_coord_offset+DIM*2+YY];
143         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
144
145         fix0             = 0.0;
146         fiy0             = 0.0;
147         fiz0             = 0.0;
148         fix1             = 0.0;
149         fiy1             = 0.0;
150         fiz1             = 0.0;
151         fix2             = 0.0;
152         fiy2             = 0.0;
153         fiz2             = 0.0;
154
155         /* Reset potential sums */
156         velecsum         = 0.0;
157         vvdwsum          = 0.0;
158
159         /* Start inner kernel loop */
160         for(jidx=j_index_start; jidx<j_index_end; jidx++)
161         {
162             /* Get j neighbor index, and coordinate index */
163             jnr              = jjnr[jidx];
164             j_coord_offset   = DIM*jnr;
165
166             /* load j atom coordinates */
167             jx0              = x[j_coord_offset+DIM*0+XX];
168             jy0              = x[j_coord_offset+DIM*0+YY];
169             jz0              = x[j_coord_offset+DIM*0+ZZ];
170
171             /* Calculate displacement vector */
172             dx00             = ix0 - jx0;
173             dy00             = iy0 - jy0;
174             dz00             = iz0 - jz0;
175             dx10             = ix1 - jx0;
176             dy10             = iy1 - jy0;
177             dz10             = iz1 - jz0;
178             dx20             = ix2 - jx0;
179             dy20             = iy2 - jy0;
180             dz20             = iz2 - jz0;
181
182             /* Calculate squared distance and things based on it */
183             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
184             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
185             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
186
187             rinv00           = gmx_invsqrt(rsq00);
188             rinv10           = gmx_invsqrt(rsq10);
189             rinv20           = gmx_invsqrt(rsq20);
190
191             rinvsq00         = rinv00*rinv00;
192             rinvsq10         = rinv10*rinv10;
193             rinvsq20         = rinv20*rinv20;
194
195             /* Load parameters for j particles */
196             jq0              = charge[jnr+0];
197             vdwjidx0         = 3*vdwtype[jnr+0];
198
199             /**************************
200              * CALCULATE INTERACTIONS *
201              **************************/
202
203             r00              = rsq00*rinv00;
204
205             qq00             = iq0*jq0;
206             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
207             cexp1_00         = vdwparam[vdwioffset0+vdwjidx0+1];
208             cexp2_00         = vdwparam[vdwioffset0+vdwjidx0+2];
209
210             /* COULOMB ELECTROSTATICS */
211             velec            = qq00*rinv00;
212             felec            = velec*rinvsq00;
213
214             /* BUCKINGHAM DISPERSION/REPULSION */
215             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
216             vvdw6            = c6_00*rinvsix;
217             br               = cexp2_00*r00;
218             vvdwexp          = cexp1_00*exp(-br);
219             vvdw             = vvdwexp - vvdw6*(1.0/6.0);
220             fvdw             = (br*vvdwexp-vvdw6)*rinvsq00;
221
222             /* Update potential sums from outer loop */
223             velecsum        += velec;
224             vvdwsum         += vvdw;
225
226             fscal            = felec+fvdw;
227
228             /* Calculate temporary vectorial force */
229             tx               = fscal*dx00;
230             ty               = fscal*dy00;
231             tz               = fscal*dz00;
232
233             /* Update vectorial force */
234             fix0            += tx;
235             fiy0            += ty;
236             fiz0            += tz;
237             f[j_coord_offset+DIM*0+XX] -= tx;
238             f[j_coord_offset+DIM*0+YY] -= ty;
239             f[j_coord_offset+DIM*0+ZZ] -= tz;
240
241             /**************************
242              * CALCULATE INTERACTIONS *
243              **************************/
244
245             qq10             = iq1*jq0;
246
247             /* COULOMB ELECTROSTATICS */
248             velec            = qq10*rinv10;
249             felec            = velec*rinvsq10;
250
251             /* Update potential sums from outer loop */
252             velecsum        += velec;
253
254             fscal            = felec;
255
256             /* Calculate temporary vectorial force */
257             tx               = fscal*dx10;
258             ty               = fscal*dy10;
259             tz               = fscal*dz10;
260
261             /* Update vectorial force */
262             fix1            += tx;
263             fiy1            += ty;
264             fiz1            += tz;
265             f[j_coord_offset+DIM*0+XX] -= tx;
266             f[j_coord_offset+DIM*0+YY] -= ty;
267             f[j_coord_offset+DIM*0+ZZ] -= tz;
268
269             /**************************
270              * CALCULATE INTERACTIONS *
271              **************************/
272
273             qq20             = iq2*jq0;
274
275             /* COULOMB ELECTROSTATICS */
276             velec            = qq20*rinv20;
277             felec            = velec*rinvsq20;
278
279             /* Update potential sums from outer loop */
280             velecsum        += velec;
281
282             fscal            = felec;
283
284             /* Calculate temporary vectorial force */
285             tx               = fscal*dx20;
286             ty               = fscal*dy20;
287             tz               = fscal*dz20;
288
289             /* Update vectorial force */
290             fix2            += tx;
291             fiy2            += ty;
292             fiz2            += tz;
293             f[j_coord_offset+DIM*0+XX] -= tx;
294             f[j_coord_offset+DIM*0+YY] -= ty;
295             f[j_coord_offset+DIM*0+ZZ] -= tz;
296
297             /* Inner loop uses 123 flops */
298         }
299         /* End of innermost loop */
300
301         tx = ty = tz = 0;
302         f[i_coord_offset+DIM*0+XX] += fix0;
303         f[i_coord_offset+DIM*0+YY] += fiy0;
304         f[i_coord_offset+DIM*0+ZZ] += fiz0;
305         tx                         += fix0;
306         ty                         += fiy0;
307         tz                         += fiz0;
308         f[i_coord_offset+DIM*1+XX] += fix1;
309         f[i_coord_offset+DIM*1+YY] += fiy1;
310         f[i_coord_offset+DIM*1+ZZ] += fiz1;
311         tx                         += fix1;
312         ty                         += fiy1;
313         tz                         += fiz1;
314         f[i_coord_offset+DIM*2+XX] += fix2;
315         f[i_coord_offset+DIM*2+YY] += fiy2;
316         f[i_coord_offset+DIM*2+ZZ] += fiz2;
317         tx                         += fix2;
318         ty                         += fiy2;
319         tz                         += fiz2;
320         fshift[i_shift_offset+XX]  += tx;
321         fshift[i_shift_offset+YY]  += ty;
322         fshift[i_shift_offset+ZZ]  += tz;
323
324         ggid                        = gid[iidx];
325         /* Update potential energies */
326         kernel_data->energygrp_elec[ggid] += velecsum;
327         kernel_data->energygrp_vdw[ggid] += vvdwsum;
328
329         /* Increment number of inner iterations */
330         inneriter                  += j_index_end - j_index_start;
331
332         /* Outer loop uses 32 flops */
333     }
334
335     /* Increment number of outer iterations */
336     outeriter        += nri;
337
338     /* Update outer/inner flops */
339
340     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*123);
341 }
342 /*
343  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwBham_GeomW3P1_F_c
344  * Electrostatics interaction: Coulomb
345  * VdW interaction:            Buckingham
346  * Geometry:                   Water3-Particle
347  * Calculate force/pot:        Force
348  */
349 void
350 nb_kernel_ElecCoul_VdwBham_GeomW3P1_F_c
351                     (t_nblist                    * gmx_restrict       nlist,
352                      rvec                        * gmx_restrict          xx,
353                      rvec                        * gmx_restrict          ff,
354                      t_forcerec                  * gmx_restrict          fr,
355                      t_mdatoms                   * gmx_restrict     mdatoms,
356                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
357                      t_nrnb                      * gmx_restrict        nrnb)
358 {
359     int              i_shift_offset,i_coord_offset,j_coord_offset;
360     int              j_index_start,j_index_end;
361     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
362     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
363     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
364     real             *shiftvec,*fshift,*x,*f;
365     int              vdwioffset0;
366     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
367     int              vdwioffset1;
368     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
369     int              vdwioffset2;
370     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
371     int              vdwjidx0;
372     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
373     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
374     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
375     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
376     real             velec,felec,velecsum,facel,crf,krf,krf2;
377     real             *charge;
378     int              nvdwtype;
379     real             rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
380     int              *vdwtype;
381     real             *vdwparam;
382
383     x                = xx[0];
384     f                = ff[0];
385
386     nri              = nlist->nri;
387     iinr             = nlist->iinr;
388     jindex           = nlist->jindex;
389     jjnr             = nlist->jjnr;
390     shiftidx         = nlist->shift;
391     gid              = nlist->gid;
392     shiftvec         = fr->shift_vec[0];
393     fshift           = fr->fshift[0];
394     facel            = fr->epsfac;
395     charge           = mdatoms->chargeA;
396     nvdwtype         = fr->ntype;
397     vdwparam         = fr->nbfp;
398     vdwtype          = mdatoms->typeA;
399
400     /* Setup water-specific parameters */
401     inr              = nlist->iinr[0];
402     iq0              = facel*charge[inr+0];
403     iq1              = facel*charge[inr+1];
404     iq2              = facel*charge[inr+2];
405     vdwioffset0      = 3*nvdwtype*vdwtype[inr+0];
406
407     outeriter        = 0;
408     inneriter        = 0;
409
410     /* Start outer loop over neighborlists */
411     for(iidx=0; iidx<nri; iidx++)
412     {
413         /* Load shift vector for this list */
414         i_shift_offset   = DIM*shiftidx[iidx];
415         shX              = shiftvec[i_shift_offset+XX];
416         shY              = shiftvec[i_shift_offset+YY];
417         shZ              = shiftvec[i_shift_offset+ZZ];
418
419         /* Load limits for loop over neighbors */
420         j_index_start    = jindex[iidx];
421         j_index_end      = jindex[iidx+1];
422
423         /* Get outer coordinate index */
424         inr              = iinr[iidx];
425         i_coord_offset   = DIM*inr;
426
427         /* Load i particle coords and add shift vector */
428         ix0              = shX + x[i_coord_offset+DIM*0+XX];
429         iy0              = shY + x[i_coord_offset+DIM*0+YY];
430         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
431         ix1              = shX + x[i_coord_offset+DIM*1+XX];
432         iy1              = shY + x[i_coord_offset+DIM*1+YY];
433         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
434         ix2              = shX + x[i_coord_offset+DIM*2+XX];
435         iy2              = shY + x[i_coord_offset+DIM*2+YY];
436         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
437
438         fix0             = 0.0;
439         fiy0             = 0.0;
440         fiz0             = 0.0;
441         fix1             = 0.0;
442         fiy1             = 0.0;
443         fiz1             = 0.0;
444         fix2             = 0.0;
445         fiy2             = 0.0;
446         fiz2             = 0.0;
447
448         /* Start inner kernel loop */
449         for(jidx=j_index_start; jidx<j_index_end; jidx++)
450         {
451             /* Get j neighbor index, and coordinate index */
452             jnr              = jjnr[jidx];
453             j_coord_offset   = DIM*jnr;
454
455             /* load j atom coordinates */
456             jx0              = x[j_coord_offset+DIM*0+XX];
457             jy0              = x[j_coord_offset+DIM*0+YY];
458             jz0              = x[j_coord_offset+DIM*0+ZZ];
459
460             /* Calculate displacement vector */
461             dx00             = ix0 - jx0;
462             dy00             = iy0 - jy0;
463             dz00             = iz0 - jz0;
464             dx10             = ix1 - jx0;
465             dy10             = iy1 - jy0;
466             dz10             = iz1 - jz0;
467             dx20             = ix2 - jx0;
468             dy20             = iy2 - jy0;
469             dz20             = iz2 - jz0;
470
471             /* Calculate squared distance and things based on it */
472             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
473             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
474             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
475
476             rinv00           = gmx_invsqrt(rsq00);
477             rinv10           = gmx_invsqrt(rsq10);
478             rinv20           = gmx_invsqrt(rsq20);
479
480             rinvsq00         = rinv00*rinv00;
481             rinvsq10         = rinv10*rinv10;
482             rinvsq20         = rinv20*rinv20;
483
484             /* Load parameters for j particles */
485             jq0              = charge[jnr+0];
486             vdwjidx0         = 3*vdwtype[jnr+0];
487
488             /**************************
489              * CALCULATE INTERACTIONS *
490              **************************/
491
492             r00              = rsq00*rinv00;
493
494             qq00             = iq0*jq0;
495             c6_00            = vdwparam[vdwioffset0+vdwjidx0];
496             cexp1_00         = vdwparam[vdwioffset0+vdwjidx0+1];
497             cexp2_00         = vdwparam[vdwioffset0+vdwjidx0+2];
498
499             /* COULOMB ELECTROSTATICS */
500             velec            = qq00*rinv00;
501             felec            = velec*rinvsq00;
502
503             /* BUCKINGHAM DISPERSION/REPULSION */
504             rinvsix          = rinvsq00*rinvsq00*rinvsq00;
505             vvdw6            = c6_00*rinvsix;
506             br               = cexp2_00*r00;
507             vvdwexp          = cexp1_00*exp(-br);
508             fvdw             = (br*vvdwexp-vvdw6)*rinvsq00;
509
510             fscal            = felec+fvdw;
511
512             /* Calculate temporary vectorial force */
513             tx               = fscal*dx00;
514             ty               = fscal*dy00;
515             tz               = fscal*dz00;
516
517             /* Update vectorial force */
518             fix0            += tx;
519             fiy0            += ty;
520             fiz0            += tz;
521             f[j_coord_offset+DIM*0+XX] -= tx;
522             f[j_coord_offset+DIM*0+YY] -= ty;
523             f[j_coord_offset+DIM*0+ZZ] -= tz;
524
525             /**************************
526              * CALCULATE INTERACTIONS *
527              **************************/
528
529             qq10             = iq1*jq0;
530
531             /* COULOMB ELECTROSTATICS */
532             velec            = qq10*rinv10;
533             felec            = velec*rinvsq10;
534
535             fscal            = felec;
536
537             /* Calculate temporary vectorial force */
538             tx               = fscal*dx10;
539             ty               = fscal*dy10;
540             tz               = fscal*dz10;
541
542             /* Update vectorial force */
543             fix1            += tx;
544             fiy1            += ty;
545             fiz1            += tz;
546             f[j_coord_offset+DIM*0+XX] -= tx;
547             f[j_coord_offset+DIM*0+YY] -= ty;
548             f[j_coord_offset+DIM*0+ZZ] -= tz;
549
550             /**************************
551              * CALCULATE INTERACTIONS *
552              **************************/
553
554             qq20             = iq2*jq0;
555
556             /* COULOMB ELECTROSTATICS */
557             velec            = qq20*rinv20;
558             felec            = velec*rinvsq20;
559
560             fscal            = felec;
561
562             /* Calculate temporary vectorial force */
563             tx               = fscal*dx20;
564             ty               = fscal*dy20;
565             tz               = fscal*dz20;
566
567             /* Update vectorial force */
568             fix2            += tx;
569             fiy2            += ty;
570             fiz2            += tz;
571             f[j_coord_offset+DIM*0+XX] -= tx;
572             f[j_coord_offset+DIM*0+YY] -= ty;
573             f[j_coord_offset+DIM*0+ZZ] -= tz;
574
575             /* Inner loop uses 117 flops */
576         }
577         /* End of innermost loop */
578
579         tx = ty = tz = 0;
580         f[i_coord_offset+DIM*0+XX] += fix0;
581         f[i_coord_offset+DIM*0+YY] += fiy0;
582         f[i_coord_offset+DIM*0+ZZ] += fiz0;
583         tx                         += fix0;
584         ty                         += fiy0;
585         tz                         += fiz0;
586         f[i_coord_offset+DIM*1+XX] += fix1;
587         f[i_coord_offset+DIM*1+YY] += fiy1;
588         f[i_coord_offset+DIM*1+ZZ] += fiz1;
589         tx                         += fix1;
590         ty                         += fiy1;
591         tz                         += fiz1;
592         f[i_coord_offset+DIM*2+XX] += fix2;
593         f[i_coord_offset+DIM*2+YY] += fiy2;
594         f[i_coord_offset+DIM*2+ZZ] += fiz2;
595         tx                         += fix2;
596         ty                         += fiy2;
597         tz                         += fiz2;
598         fshift[i_shift_offset+XX]  += tx;
599         fshift[i_shift_offset+YY]  += ty;
600         fshift[i_shift_offset+ZZ]  += tz;
601
602         /* Increment number of inner iterations */
603         inneriter                  += j_index_end - j_index_start;
604
605         /* Outer loop uses 30 flops */
606     }
607
608     /* Increment number of outer iterations */
609     outeriter        += nri;
610
611     /* Update outer/inner flops */
612
613     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*117);
614 }