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