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