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