Use full path for legacyheaders
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_c / nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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_ElecCSTab_VdwNone_GeomW3W3_VF_c
49  * Electrostatics interaction: CubicSplineTable
50  * VdW interaction:            None
51  * Geometry:                   Water3-Water3
52  * Calculate force/pot:        PotentialAndForce
53  */
54 void
55 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
56                     (t_nblist                    * gmx_restrict       nlist,
57                      rvec                        * gmx_restrict          xx,
58                      rvec                        * gmx_restrict          ff,
59                      t_forcerec                  * gmx_restrict          fr,
60                      t_mdatoms                   * gmx_restrict     mdatoms,
61                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
62                      t_nrnb                      * gmx_restrict        nrnb)
63 {
64     int              i_shift_offset,i_coord_offset,j_coord_offset;
65     int              j_index_start,j_index_end;
66     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
67     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
68     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
69     real             *shiftvec,*fshift,*x,*f;
70     int              vdwioffset0;
71     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
72     int              vdwioffset1;
73     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
74     int              vdwioffset2;
75     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
76     int              vdwjidx0;
77     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
78     int              vdwjidx1;
79     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
80     int              vdwjidx2;
81     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
82     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
83     real             dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
84     real             dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
85     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
86     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
87     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
88     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
89     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
90     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
91     real             velec,felec,velecsum,facel,crf,krf,krf2;
92     real             *charge;
93     int              vfitab;
94     real             rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
95     real             *vftab;
96
97     x                = xx[0];
98     f                = ff[0];
99
100     nri              = nlist->nri;
101     iinr             = nlist->iinr;
102     jindex           = nlist->jindex;
103     jjnr             = nlist->jjnr;
104     shiftidx         = nlist->shift;
105     gid              = nlist->gid;
106     shiftvec         = fr->shift_vec[0];
107     fshift           = fr->fshift[0];
108     facel            = fr->epsfac;
109     charge           = mdatoms->chargeA;
110
111     vftab            = kernel_data->table_elec->data;
112     vftabscale       = kernel_data->table_elec->scale;
113
114     /* Setup water-specific parameters */
115     inr              = nlist->iinr[0];
116     iq0              = facel*charge[inr+0];
117     iq1              = facel*charge[inr+1];
118     iq2              = facel*charge[inr+2];
119
120     jq0              = charge[inr+0];
121     jq1              = charge[inr+1];
122     jq2              = charge[inr+2];
123     qq00             = iq0*jq0;
124     qq01             = iq0*jq1;
125     qq02             = iq0*jq2;
126     qq10             = iq1*jq0;
127     qq11             = iq1*jq1;
128     qq12             = iq1*jq2;
129     qq20             = iq2*jq0;
130     qq21             = iq2*jq1;
131     qq22             = iq2*jq2;
132
133     outeriter        = 0;
134     inneriter        = 0;
135
136     /* Start outer loop over neighborlists */
137     for(iidx=0; iidx<nri; iidx++)
138     {
139         /* Load shift vector for this list */
140         i_shift_offset   = DIM*shiftidx[iidx];
141         shX              = shiftvec[i_shift_offset+XX];
142         shY              = shiftvec[i_shift_offset+YY];
143         shZ              = shiftvec[i_shift_offset+ZZ];
144
145         /* Load limits for loop over neighbors */
146         j_index_start    = jindex[iidx];
147         j_index_end      = jindex[iidx+1];
148
149         /* Get outer coordinate index */
150         inr              = iinr[iidx];
151         i_coord_offset   = DIM*inr;
152
153         /* Load i particle coords and add shift vector */
154         ix0              = shX + x[i_coord_offset+DIM*0+XX];
155         iy0              = shY + x[i_coord_offset+DIM*0+YY];
156         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
157         ix1              = shX + x[i_coord_offset+DIM*1+XX];
158         iy1              = shY + x[i_coord_offset+DIM*1+YY];
159         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
160         ix2              = shX + x[i_coord_offset+DIM*2+XX];
161         iy2              = shY + x[i_coord_offset+DIM*2+YY];
162         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
163
164         fix0             = 0.0;
165         fiy0             = 0.0;
166         fiz0             = 0.0;
167         fix1             = 0.0;
168         fiy1             = 0.0;
169         fiz1             = 0.0;
170         fix2             = 0.0;
171         fiy2             = 0.0;
172         fiz2             = 0.0;
173
174         /* Reset potential sums */
175         velecsum         = 0.0;
176
177         /* Start inner kernel loop */
178         for(jidx=j_index_start; jidx<j_index_end; jidx++)
179         {
180             /* Get j neighbor index, and coordinate index */
181             jnr              = jjnr[jidx];
182             j_coord_offset   = DIM*jnr;
183
184             /* load j atom coordinates */
185             jx0              = x[j_coord_offset+DIM*0+XX];
186             jy0              = x[j_coord_offset+DIM*0+YY];
187             jz0              = x[j_coord_offset+DIM*0+ZZ];
188             jx1              = x[j_coord_offset+DIM*1+XX];
189             jy1              = x[j_coord_offset+DIM*1+YY];
190             jz1              = x[j_coord_offset+DIM*1+ZZ];
191             jx2              = x[j_coord_offset+DIM*2+XX];
192             jy2              = x[j_coord_offset+DIM*2+YY];
193             jz2              = x[j_coord_offset+DIM*2+ZZ];
194
195             /* Calculate displacement vector */
196             dx00             = ix0 - jx0;
197             dy00             = iy0 - jy0;
198             dz00             = iz0 - jz0;
199             dx01             = ix0 - jx1;
200             dy01             = iy0 - jy1;
201             dz01             = iz0 - jz1;
202             dx02             = ix0 - jx2;
203             dy02             = iy0 - jy2;
204             dz02             = iz0 - jz2;
205             dx10             = ix1 - jx0;
206             dy10             = iy1 - jy0;
207             dz10             = iz1 - jz0;
208             dx11             = ix1 - jx1;
209             dy11             = iy1 - jy1;
210             dz11             = iz1 - jz1;
211             dx12             = ix1 - jx2;
212             dy12             = iy1 - jy2;
213             dz12             = iz1 - jz2;
214             dx20             = ix2 - jx0;
215             dy20             = iy2 - jy0;
216             dz20             = iz2 - jz0;
217             dx21             = ix2 - jx1;
218             dy21             = iy2 - jy1;
219             dz21             = iz2 - jz1;
220             dx22             = ix2 - jx2;
221             dy22             = iy2 - jy2;
222             dz22             = iz2 - jz2;
223
224             /* Calculate squared distance and things based on it */
225             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
226             rsq01            = dx01*dx01+dy01*dy01+dz01*dz01;
227             rsq02            = dx02*dx02+dy02*dy02+dz02*dz02;
228             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
229             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
230             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
231             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
232             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
233             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
234
235             rinv00           = gmx_invsqrt(rsq00);
236             rinv01           = gmx_invsqrt(rsq01);
237             rinv02           = gmx_invsqrt(rsq02);
238             rinv10           = gmx_invsqrt(rsq10);
239             rinv11           = gmx_invsqrt(rsq11);
240             rinv12           = gmx_invsqrt(rsq12);
241             rinv20           = gmx_invsqrt(rsq20);
242             rinv21           = gmx_invsqrt(rsq21);
243             rinv22           = gmx_invsqrt(rsq22);
244
245             /**************************
246              * CALCULATE INTERACTIONS *
247              **************************/
248
249             r00              = rsq00*rinv00;
250
251             /* Calculate table index by multiplying r with table scale and truncate to integer */
252             rt               = r00*vftabscale;
253             vfitab           = rt;
254             vfeps            = rt-vfitab;
255             vfitab           = 1*4*vfitab;
256
257             /* CUBIC SPLINE TABLE ELECTROSTATICS */
258             Y                = vftab[vfitab];
259             F                = vftab[vfitab+1];
260             Geps             = vfeps*vftab[vfitab+2];
261             Heps2            = vfeps*vfeps*vftab[vfitab+3];
262             Fp               = F+Geps+Heps2;
263             VV               = Y+vfeps*Fp;
264             velec            = qq00*VV;
265             FF               = Fp+Geps+2.0*Heps2;
266             felec            = -qq00*FF*vftabscale*rinv00;
267
268             /* Update potential sums from outer loop */
269             velecsum        += velec;
270
271             fscal            = felec;
272
273             /* Calculate temporary vectorial force */
274             tx               = fscal*dx00;
275             ty               = fscal*dy00;
276             tz               = fscal*dz00;
277
278             /* Update vectorial force */
279             fix0            += tx;
280             fiy0            += ty;
281             fiz0            += tz;
282             f[j_coord_offset+DIM*0+XX] -= tx;
283             f[j_coord_offset+DIM*0+YY] -= ty;
284             f[j_coord_offset+DIM*0+ZZ] -= tz;
285
286             /**************************
287              * CALCULATE INTERACTIONS *
288              **************************/
289
290             r01              = rsq01*rinv01;
291
292             /* Calculate table index by multiplying r with table scale and truncate to integer */
293             rt               = r01*vftabscale;
294             vfitab           = rt;
295             vfeps            = rt-vfitab;
296             vfitab           = 1*4*vfitab;
297
298             /* CUBIC SPLINE TABLE ELECTROSTATICS */
299             Y                = vftab[vfitab];
300             F                = vftab[vfitab+1];
301             Geps             = vfeps*vftab[vfitab+2];
302             Heps2            = vfeps*vfeps*vftab[vfitab+3];
303             Fp               = F+Geps+Heps2;
304             VV               = Y+vfeps*Fp;
305             velec            = qq01*VV;
306             FF               = Fp+Geps+2.0*Heps2;
307             felec            = -qq01*FF*vftabscale*rinv01;
308
309             /* Update potential sums from outer loop */
310             velecsum        += velec;
311
312             fscal            = felec;
313
314             /* Calculate temporary vectorial force */
315             tx               = fscal*dx01;
316             ty               = fscal*dy01;
317             tz               = fscal*dz01;
318
319             /* Update vectorial force */
320             fix0            += tx;
321             fiy0            += ty;
322             fiz0            += tz;
323             f[j_coord_offset+DIM*1+XX] -= tx;
324             f[j_coord_offset+DIM*1+YY] -= ty;
325             f[j_coord_offset+DIM*1+ZZ] -= tz;
326
327             /**************************
328              * CALCULATE INTERACTIONS *
329              **************************/
330
331             r02              = rsq02*rinv02;
332
333             /* Calculate table index by multiplying r with table scale and truncate to integer */
334             rt               = r02*vftabscale;
335             vfitab           = rt;
336             vfeps            = rt-vfitab;
337             vfitab           = 1*4*vfitab;
338
339             /* CUBIC SPLINE TABLE ELECTROSTATICS */
340             Y                = vftab[vfitab];
341             F                = vftab[vfitab+1];
342             Geps             = vfeps*vftab[vfitab+2];
343             Heps2            = vfeps*vfeps*vftab[vfitab+3];
344             Fp               = F+Geps+Heps2;
345             VV               = Y+vfeps*Fp;
346             velec            = qq02*VV;
347             FF               = Fp+Geps+2.0*Heps2;
348             felec            = -qq02*FF*vftabscale*rinv02;
349
350             /* Update potential sums from outer loop */
351             velecsum        += velec;
352
353             fscal            = felec;
354
355             /* Calculate temporary vectorial force */
356             tx               = fscal*dx02;
357             ty               = fscal*dy02;
358             tz               = fscal*dz02;
359
360             /* Update vectorial force */
361             fix0            += tx;
362             fiy0            += ty;
363             fiz0            += tz;
364             f[j_coord_offset+DIM*2+XX] -= tx;
365             f[j_coord_offset+DIM*2+YY] -= ty;
366             f[j_coord_offset+DIM*2+ZZ] -= tz;
367
368             /**************************
369              * CALCULATE INTERACTIONS *
370              **************************/
371
372             r10              = rsq10*rinv10;
373
374             /* Calculate table index by multiplying r with table scale and truncate to integer */
375             rt               = r10*vftabscale;
376             vfitab           = rt;
377             vfeps            = rt-vfitab;
378             vfitab           = 1*4*vfitab;
379
380             /* CUBIC SPLINE TABLE ELECTROSTATICS */
381             Y                = vftab[vfitab];
382             F                = vftab[vfitab+1];
383             Geps             = vfeps*vftab[vfitab+2];
384             Heps2            = vfeps*vfeps*vftab[vfitab+3];
385             Fp               = F+Geps+Heps2;
386             VV               = Y+vfeps*Fp;
387             velec            = qq10*VV;
388             FF               = Fp+Geps+2.0*Heps2;
389             felec            = -qq10*FF*vftabscale*rinv10;
390
391             /* Update potential sums from outer loop */
392             velecsum        += velec;
393
394             fscal            = felec;
395
396             /* Calculate temporary vectorial force */
397             tx               = fscal*dx10;
398             ty               = fscal*dy10;
399             tz               = fscal*dz10;
400
401             /* Update vectorial force */
402             fix1            += tx;
403             fiy1            += ty;
404             fiz1            += tz;
405             f[j_coord_offset+DIM*0+XX] -= tx;
406             f[j_coord_offset+DIM*0+YY] -= ty;
407             f[j_coord_offset+DIM*0+ZZ] -= tz;
408
409             /**************************
410              * CALCULATE INTERACTIONS *
411              **************************/
412
413             r11              = rsq11*rinv11;
414
415             /* Calculate table index by multiplying r with table scale and truncate to integer */
416             rt               = r11*vftabscale;
417             vfitab           = rt;
418             vfeps            = rt-vfitab;
419             vfitab           = 1*4*vfitab;
420
421             /* CUBIC SPLINE TABLE ELECTROSTATICS */
422             Y                = vftab[vfitab];
423             F                = vftab[vfitab+1];
424             Geps             = vfeps*vftab[vfitab+2];
425             Heps2            = vfeps*vfeps*vftab[vfitab+3];
426             Fp               = F+Geps+Heps2;
427             VV               = Y+vfeps*Fp;
428             velec            = qq11*VV;
429             FF               = Fp+Geps+2.0*Heps2;
430             felec            = -qq11*FF*vftabscale*rinv11;
431
432             /* Update potential sums from outer loop */
433             velecsum        += velec;
434
435             fscal            = felec;
436
437             /* Calculate temporary vectorial force */
438             tx               = fscal*dx11;
439             ty               = fscal*dy11;
440             tz               = fscal*dz11;
441
442             /* Update vectorial force */
443             fix1            += tx;
444             fiy1            += ty;
445             fiz1            += tz;
446             f[j_coord_offset+DIM*1+XX] -= tx;
447             f[j_coord_offset+DIM*1+YY] -= ty;
448             f[j_coord_offset+DIM*1+ZZ] -= tz;
449
450             /**************************
451              * CALCULATE INTERACTIONS *
452              **************************/
453
454             r12              = rsq12*rinv12;
455
456             /* Calculate table index by multiplying r with table scale and truncate to integer */
457             rt               = r12*vftabscale;
458             vfitab           = rt;
459             vfeps            = rt-vfitab;
460             vfitab           = 1*4*vfitab;
461
462             /* CUBIC SPLINE TABLE ELECTROSTATICS */
463             Y                = vftab[vfitab];
464             F                = vftab[vfitab+1];
465             Geps             = vfeps*vftab[vfitab+2];
466             Heps2            = vfeps*vfeps*vftab[vfitab+3];
467             Fp               = F+Geps+Heps2;
468             VV               = Y+vfeps*Fp;
469             velec            = qq12*VV;
470             FF               = Fp+Geps+2.0*Heps2;
471             felec            = -qq12*FF*vftabscale*rinv12;
472
473             /* Update potential sums from outer loop */
474             velecsum        += velec;
475
476             fscal            = felec;
477
478             /* Calculate temporary vectorial force */
479             tx               = fscal*dx12;
480             ty               = fscal*dy12;
481             tz               = fscal*dz12;
482
483             /* Update vectorial force */
484             fix1            += tx;
485             fiy1            += ty;
486             fiz1            += tz;
487             f[j_coord_offset+DIM*2+XX] -= tx;
488             f[j_coord_offset+DIM*2+YY] -= ty;
489             f[j_coord_offset+DIM*2+ZZ] -= tz;
490
491             /**************************
492              * CALCULATE INTERACTIONS *
493              **************************/
494
495             r20              = rsq20*rinv20;
496
497             /* Calculate table index by multiplying r with table scale and truncate to integer */
498             rt               = r20*vftabscale;
499             vfitab           = rt;
500             vfeps            = rt-vfitab;
501             vfitab           = 1*4*vfitab;
502
503             /* CUBIC SPLINE TABLE ELECTROSTATICS */
504             Y                = vftab[vfitab];
505             F                = vftab[vfitab+1];
506             Geps             = vfeps*vftab[vfitab+2];
507             Heps2            = vfeps*vfeps*vftab[vfitab+3];
508             Fp               = F+Geps+Heps2;
509             VV               = Y+vfeps*Fp;
510             velec            = qq20*VV;
511             FF               = Fp+Geps+2.0*Heps2;
512             felec            = -qq20*FF*vftabscale*rinv20;
513
514             /* Update potential sums from outer loop */
515             velecsum        += velec;
516
517             fscal            = felec;
518
519             /* Calculate temporary vectorial force */
520             tx               = fscal*dx20;
521             ty               = fscal*dy20;
522             tz               = fscal*dz20;
523
524             /* Update vectorial force */
525             fix2            += tx;
526             fiy2            += ty;
527             fiz2            += tz;
528             f[j_coord_offset+DIM*0+XX] -= tx;
529             f[j_coord_offset+DIM*0+YY] -= ty;
530             f[j_coord_offset+DIM*0+ZZ] -= tz;
531
532             /**************************
533              * CALCULATE INTERACTIONS *
534              **************************/
535
536             r21              = rsq21*rinv21;
537
538             /* Calculate table index by multiplying r with table scale and truncate to integer */
539             rt               = r21*vftabscale;
540             vfitab           = rt;
541             vfeps            = rt-vfitab;
542             vfitab           = 1*4*vfitab;
543
544             /* CUBIC SPLINE TABLE ELECTROSTATICS */
545             Y                = vftab[vfitab];
546             F                = vftab[vfitab+1];
547             Geps             = vfeps*vftab[vfitab+2];
548             Heps2            = vfeps*vfeps*vftab[vfitab+3];
549             Fp               = F+Geps+Heps2;
550             VV               = Y+vfeps*Fp;
551             velec            = qq21*VV;
552             FF               = Fp+Geps+2.0*Heps2;
553             felec            = -qq21*FF*vftabscale*rinv21;
554
555             /* Update potential sums from outer loop */
556             velecsum        += velec;
557
558             fscal            = felec;
559
560             /* Calculate temporary vectorial force */
561             tx               = fscal*dx21;
562             ty               = fscal*dy21;
563             tz               = fscal*dz21;
564
565             /* Update vectorial force */
566             fix2            += tx;
567             fiy2            += ty;
568             fiz2            += tz;
569             f[j_coord_offset+DIM*1+XX] -= tx;
570             f[j_coord_offset+DIM*1+YY] -= ty;
571             f[j_coord_offset+DIM*1+ZZ] -= tz;
572
573             /**************************
574              * CALCULATE INTERACTIONS *
575              **************************/
576
577             r22              = rsq22*rinv22;
578
579             /* Calculate table index by multiplying r with table scale and truncate to integer */
580             rt               = r22*vftabscale;
581             vfitab           = rt;
582             vfeps            = rt-vfitab;
583             vfitab           = 1*4*vfitab;
584
585             /* CUBIC SPLINE TABLE ELECTROSTATICS */
586             Y                = vftab[vfitab];
587             F                = vftab[vfitab+1];
588             Geps             = vfeps*vftab[vfitab+2];
589             Heps2            = vfeps*vfeps*vftab[vfitab+3];
590             Fp               = F+Geps+Heps2;
591             VV               = Y+vfeps*Fp;
592             velec            = qq22*VV;
593             FF               = Fp+Geps+2.0*Heps2;
594             felec            = -qq22*FF*vftabscale*rinv22;
595
596             /* Update potential sums from outer loop */
597             velecsum        += velec;
598
599             fscal            = felec;
600
601             /* Calculate temporary vectorial force */
602             tx               = fscal*dx22;
603             ty               = fscal*dy22;
604             tz               = fscal*dz22;
605
606             /* Update vectorial force */
607             fix2            += tx;
608             fiy2            += ty;
609             fiz2            += tz;
610             f[j_coord_offset+DIM*2+XX] -= tx;
611             f[j_coord_offset+DIM*2+YY] -= ty;
612             f[j_coord_offset+DIM*2+ZZ] -= tz;
613
614             /* Inner loop uses 369 flops */
615         }
616         /* End of innermost loop */
617
618         tx = ty = tz = 0;
619         f[i_coord_offset+DIM*0+XX] += fix0;
620         f[i_coord_offset+DIM*0+YY] += fiy0;
621         f[i_coord_offset+DIM*0+ZZ] += fiz0;
622         tx                         += fix0;
623         ty                         += fiy0;
624         tz                         += fiz0;
625         f[i_coord_offset+DIM*1+XX] += fix1;
626         f[i_coord_offset+DIM*1+YY] += fiy1;
627         f[i_coord_offset+DIM*1+ZZ] += fiz1;
628         tx                         += fix1;
629         ty                         += fiy1;
630         tz                         += fiz1;
631         f[i_coord_offset+DIM*2+XX] += fix2;
632         f[i_coord_offset+DIM*2+YY] += fiy2;
633         f[i_coord_offset+DIM*2+ZZ] += fiz2;
634         tx                         += fix2;
635         ty                         += fiy2;
636         tz                         += fiz2;
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
645         /* Increment number of inner iterations */
646         inneriter                  += j_index_end - j_index_start;
647
648         /* Outer loop uses 31 flops */
649     }
650
651     /* Increment number of outer iterations */
652     outeriter        += nri;
653
654     /* Update outer/inner flops */
655
656     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*369);
657 }
658 /*
659  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
660  * Electrostatics interaction: CubicSplineTable
661  * VdW interaction:            None
662  * Geometry:                   Water3-Water3
663  * Calculate force/pot:        Force
664  */
665 void
666 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
667                     (t_nblist                    * gmx_restrict       nlist,
668                      rvec                        * gmx_restrict          xx,
669                      rvec                        * gmx_restrict          ff,
670                      t_forcerec                  * gmx_restrict          fr,
671                      t_mdatoms                   * gmx_restrict     mdatoms,
672                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
673                      t_nrnb                      * gmx_restrict        nrnb)
674 {
675     int              i_shift_offset,i_coord_offset,j_coord_offset;
676     int              j_index_start,j_index_end;
677     int              nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
678     real             shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
679     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
680     real             *shiftvec,*fshift,*x,*f;
681     int              vdwioffset0;
682     real             ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
683     int              vdwioffset1;
684     real             ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
685     int              vdwioffset2;
686     real             ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
687     int              vdwjidx0;
688     real             jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
689     int              vdwjidx1;
690     real             jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
691     int              vdwjidx2;
692     real             jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
693     real             dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
694     real             dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
695     real             dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
696     real             dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
697     real             dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
698     real             dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
699     real             dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
700     real             dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
701     real             dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
702     real             velec,felec,velecsum,facel,crf,krf,krf2;
703     real             *charge;
704     int              vfitab;
705     real             rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
706     real             *vftab;
707
708     x                = xx[0];
709     f                = ff[0];
710
711     nri              = nlist->nri;
712     iinr             = nlist->iinr;
713     jindex           = nlist->jindex;
714     jjnr             = nlist->jjnr;
715     shiftidx         = nlist->shift;
716     gid              = nlist->gid;
717     shiftvec         = fr->shift_vec[0];
718     fshift           = fr->fshift[0];
719     facel            = fr->epsfac;
720     charge           = mdatoms->chargeA;
721
722     vftab            = kernel_data->table_elec->data;
723     vftabscale       = kernel_data->table_elec->scale;
724
725     /* Setup water-specific parameters */
726     inr              = nlist->iinr[0];
727     iq0              = facel*charge[inr+0];
728     iq1              = facel*charge[inr+1];
729     iq2              = facel*charge[inr+2];
730
731     jq0              = charge[inr+0];
732     jq1              = charge[inr+1];
733     jq2              = charge[inr+2];
734     qq00             = iq0*jq0;
735     qq01             = iq0*jq1;
736     qq02             = iq0*jq2;
737     qq10             = iq1*jq0;
738     qq11             = iq1*jq1;
739     qq12             = iq1*jq2;
740     qq20             = iq2*jq0;
741     qq21             = iq2*jq1;
742     qq22             = iq2*jq2;
743
744     outeriter        = 0;
745     inneriter        = 0;
746
747     /* Start outer loop over neighborlists */
748     for(iidx=0; iidx<nri; iidx++)
749     {
750         /* Load shift vector for this list */
751         i_shift_offset   = DIM*shiftidx[iidx];
752         shX              = shiftvec[i_shift_offset+XX];
753         shY              = shiftvec[i_shift_offset+YY];
754         shZ              = shiftvec[i_shift_offset+ZZ];
755
756         /* Load limits for loop over neighbors */
757         j_index_start    = jindex[iidx];
758         j_index_end      = jindex[iidx+1];
759
760         /* Get outer coordinate index */
761         inr              = iinr[iidx];
762         i_coord_offset   = DIM*inr;
763
764         /* Load i particle coords and add shift vector */
765         ix0              = shX + x[i_coord_offset+DIM*0+XX];
766         iy0              = shY + x[i_coord_offset+DIM*0+YY];
767         iz0              = shZ + x[i_coord_offset+DIM*0+ZZ];
768         ix1              = shX + x[i_coord_offset+DIM*1+XX];
769         iy1              = shY + x[i_coord_offset+DIM*1+YY];
770         iz1              = shZ + x[i_coord_offset+DIM*1+ZZ];
771         ix2              = shX + x[i_coord_offset+DIM*2+XX];
772         iy2              = shY + x[i_coord_offset+DIM*2+YY];
773         iz2              = shZ + x[i_coord_offset+DIM*2+ZZ];
774
775         fix0             = 0.0;
776         fiy0             = 0.0;
777         fiz0             = 0.0;
778         fix1             = 0.0;
779         fiy1             = 0.0;
780         fiz1             = 0.0;
781         fix2             = 0.0;
782         fiy2             = 0.0;
783         fiz2             = 0.0;
784
785         /* Start inner kernel loop */
786         for(jidx=j_index_start; jidx<j_index_end; jidx++)
787         {
788             /* Get j neighbor index, and coordinate index */
789             jnr              = jjnr[jidx];
790             j_coord_offset   = DIM*jnr;
791
792             /* load j atom coordinates */
793             jx0              = x[j_coord_offset+DIM*0+XX];
794             jy0              = x[j_coord_offset+DIM*0+YY];
795             jz0              = x[j_coord_offset+DIM*0+ZZ];
796             jx1              = x[j_coord_offset+DIM*1+XX];
797             jy1              = x[j_coord_offset+DIM*1+YY];
798             jz1              = x[j_coord_offset+DIM*1+ZZ];
799             jx2              = x[j_coord_offset+DIM*2+XX];
800             jy2              = x[j_coord_offset+DIM*2+YY];
801             jz2              = x[j_coord_offset+DIM*2+ZZ];
802
803             /* Calculate displacement vector */
804             dx00             = ix0 - jx0;
805             dy00             = iy0 - jy0;
806             dz00             = iz0 - jz0;
807             dx01             = ix0 - jx1;
808             dy01             = iy0 - jy1;
809             dz01             = iz0 - jz1;
810             dx02             = ix0 - jx2;
811             dy02             = iy0 - jy2;
812             dz02             = iz0 - jz2;
813             dx10             = ix1 - jx0;
814             dy10             = iy1 - jy0;
815             dz10             = iz1 - jz0;
816             dx11             = ix1 - jx1;
817             dy11             = iy1 - jy1;
818             dz11             = iz1 - jz1;
819             dx12             = ix1 - jx2;
820             dy12             = iy1 - jy2;
821             dz12             = iz1 - jz2;
822             dx20             = ix2 - jx0;
823             dy20             = iy2 - jy0;
824             dz20             = iz2 - jz0;
825             dx21             = ix2 - jx1;
826             dy21             = iy2 - jy1;
827             dz21             = iz2 - jz1;
828             dx22             = ix2 - jx2;
829             dy22             = iy2 - jy2;
830             dz22             = iz2 - jz2;
831
832             /* Calculate squared distance and things based on it */
833             rsq00            = dx00*dx00+dy00*dy00+dz00*dz00;
834             rsq01            = dx01*dx01+dy01*dy01+dz01*dz01;
835             rsq02            = dx02*dx02+dy02*dy02+dz02*dz02;
836             rsq10            = dx10*dx10+dy10*dy10+dz10*dz10;
837             rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
838             rsq12            = dx12*dx12+dy12*dy12+dz12*dz12;
839             rsq20            = dx20*dx20+dy20*dy20+dz20*dz20;
840             rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
841             rsq22            = dx22*dx22+dy22*dy22+dz22*dz22;
842
843             rinv00           = gmx_invsqrt(rsq00);
844             rinv01           = gmx_invsqrt(rsq01);
845             rinv02           = gmx_invsqrt(rsq02);
846             rinv10           = gmx_invsqrt(rsq10);
847             rinv11           = gmx_invsqrt(rsq11);
848             rinv12           = gmx_invsqrt(rsq12);
849             rinv20           = gmx_invsqrt(rsq20);
850             rinv21           = gmx_invsqrt(rsq21);
851             rinv22           = gmx_invsqrt(rsq22);
852
853             /**************************
854              * CALCULATE INTERACTIONS *
855              **************************/
856
857             r00              = rsq00*rinv00;
858
859             /* Calculate table index by multiplying r with table scale and truncate to integer */
860             rt               = r00*vftabscale;
861             vfitab           = rt;
862             vfeps            = rt-vfitab;
863             vfitab           = 1*4*vfitab;
864
865             /* CUBIC SPLINE TABLE ELECTROSTATICS */
866             F                = vftab[vfitab+1];
867             Geps             = vfeps*vftab[vfitab+2];
868             Heps2            = vfeps*vfeps*vftab[vfitab+3];
869             Fp               = F+Geps+Heps2;
870             FF               = Fp+Geps+2.0*Heps2;
871             felec            = -qq00*FF*vftabscale*rinv00;
872
873             fscal            = felec;
874
875             /* Calculate temporary vectorial force */
876             tx               = fscal*dx00;
877             ty               = fscal*dy00;
878             tz               = fscal*dz00;
879
880             /* Update vectorial force */
881             fix0            += tx;
882             fiy0            += ty;
883             fiz0            += tz;
884             f[j_coord_offset+DIM*0+XX] -= tx;
885             f[j_coord_offset+DIM*0+YY] -= ty;
886             f[j_coord_offset+DIM*0+ZZ] -= tz;
887
888             /**************************
889              * CALCULATE INTERACTIONS *
890              **************************/
891
892             r01              = rsq01*rinv01;
893
894             /* Calculate table index by multiplying r with table scale and truncate to integer */
895             rt               = r01*vftabscale;
896             vfitab           = rt;
897             vfeps            = rt-vfitab;
898             vfitab           = 1*4*vfitab;
899
900             /* CUBIC SPLINE TABLE ELECTROSTATICS */
901             F                = vftab[vfitab+1];
902             Geps             = vfeps*vftab[vfitab+2];
903             Heps2            = vfeps*vfeps*vftab[vfitab+3];
904             Fp               = F+Geps+Heps2;
905             FF               = Fp+Geps+2.0*Heps2;
906             felec            = -qq01*FF*vftabscale*rinv01;
907
908             fscal            = felec;
909
910             /* Calculate temporary vectorial force */
911             tx               = fscal*dx01;
912             ty               = fscal*dy01;
913             tz               = fscal*dz01;
914
915             /* Update vectorial force */
916             fix0            += tx;
917             fiy0            += ty;
918             fiz0            += tz;
919             f[j_coord_offset+DIM*1+XX] -= tx;
920             f[j_coord_offset+DIM*1+YY] -= ty;
921             f[j_coord_offset+DIM*1+ZZ] -= tz;
922
923             /**************************
924              * CALCULATE INTERACTIONS *
925              **************************/
926
927             r02              = rsq02*rinv02;
928
929             /* Calculate table index by multiplying r with table scale and truncate to integer */
930             rt               = r02*vftabscale;
931             vfitab           = rt;
932             vfeps            = rt-vfitab;
933             vfitab           = 1*4*vfitab;
934
935             /* CUBIC SPLINE TABLE ELECTROSTATICS */
936             F                = vftab[vfitab+1];
937             Geps             = vfeps*vftab[vfitab+2];
938             Heps2            = vfeps*vfeps*vftab[vfitab+3];
939             Fp               = F+Geps+Heps2;
940             FF               = Fp+Geps+2.0*Heps2;
941             felec            = -qq02*FF*vftabscale*rinv02;
942
943             fscal            = felec;
944
945             /* Calculate temporary vectorial force */
946             tx               = fscal*dx02;
947             ty               = fscal*dy02;
948             tz               = fscal*dz02;
949
950             /* Update vectorial force */
951             fix0            += tx;
952             fiy0            += ty;
953             fiz0            += tz;
954             f[j_coord_offset+DIM*2+XX] -= tx;
955             f[j_coord_offset+DIM*2+YY] -= ty;
956             f[j_coord_offset+DIM*2+ZZ] -= tz;
957
958             /**************************
959              * CALCULATE INTERACTIONS *
960              **************************/
961
962             r10              = rsq10*rinv10;
963
964             /* Calculate table index by multiplying r with table scale and truncate to integer */
965             rt               = r10*vftabscale;
966             vfitab           = rt;
967             vfeps            = rt-vfitab;
968             vfitab           = 1*4*vfitab;
969
970             /* CUBIC SPLINE TABLE ELECTROSTATICS */
971             F                = vftab[vfitab+1];
972             Geps             = vfeps*vftab[vfitab+2];
973             Heps2            = vfeps*vfeps*vftab[vfitab+3];
974             Fp               = F+Geps+Heps2;
975             FF               = Fp+Geps+2.0*Heps2;
976             felec            = -qq10*FF*vftabscale*rinv10;
977
978             fscal            = felec;
979
980             /* Calculate temporary vectorial force */
981             tx               = fscal*dx10;
982             ty               = fscal*dy10;
983             tz               = fscal*dz10;
984
985             /* Update vectorial force */
986             fix1            += tx;
987             fiy1            += ty;
988             fiz1            += tz;
989             f[j_coord_offset+DIM*0+XX] -= tx;
990             f[j_coord_offset+DIM*0+YY] -= ty;
991             f[j_coord_offset+DIM*0+ZZ] -= tz;
992
993             /**************************
994              * CALCULATE INTERACTIONS *
995              **************************/
996
997             r11              = rsq11*rinv11;
998
999             /* Calculate table index by multiplying r with table scale and truncate to integer */
1000             rt               = r11*vftabscale;
1001             vfitab           = rt;
1002             vfeps            = rt-vfitab;
1003             vfitab           = 1*4*vfitab;
1004
1005             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1006             F                = vftab[vfitab+1];
1007             Geps             = vfeps*vftab[vfitab+2];
1008             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1009             Fp               = F+Geps+Heps2;
1010             FF               = Fp+Geps+2.0*Heps2;
1011             felec            = -qq11*FF*vftabscale*rinv11;
1012
1013             fscal            = felec;
1014
1015             /* Calculate temporary vectorial force */
1016             tx               = fscal*dx11;
1017             ty               = fscal*dy11;
1018             tz               = fscal*dz11;
1019
1020             /* Update vectorial force */
1021             fix1            += tx;
1022             fiy1            += ty;
1023             fiz1            += tz;
1024             f[j_coord_offset+DIM*1+XX] -= tx;
1025             f[j_coord_offset+DIM*1+YY] -= ty;
1026             f[j_coord_offset+DIM*1+ZZ] -= tz;
1027
1028             /**************************
1029              * CALCULATE INTERACTIONS *
1030              **************************/
1031
1032             r12              = rsq12*rinv12;
1033
1034             /* Calculate table index by multiplying r with table scale and truncate to integer */
1035             rt               = r12*vftabscale;
1036             vfitab           = rt;
1037             vfeps            = rt-vfitab;
1038             vfitab           = 1*4*vfitab;
1039
1040             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1041             F                = vftab[vfitab+1];
1042             Geps             = vfeps*vftab[vfitab+2];
1043             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1044             Fp               = F+Geps+Heps2;
1045             FF               = Fp+Geps+2.0*Heps2;
1046             felec            = -qq12*FF*vftabscale*rinv12;
1047
1048             fscal            = felec;
1049
1050             /* Calculate temporary vectorial force */
1051             tx               = fscal*dx12;
1052             ty               = fscal*dy12;
1053             tz               = fscal*dz12;
1054
1055             /* Update vectorial force */
1056             fix1            += tx;
1057             fiy1            += ty;
1058             fiz1            += tz;
1059             f[j_coord_offset+DIM*2+XX] -= tx;
1060             f[j_coord_offset+DIM*2+YY] -= ty;
1061             f[j_coord_offset+DIM*2+ZZ] -= tz;
1062
1063             /**************************
1064              * CALCULATE INTERACTIONS *
1065              **************************/
1066
1067             r20              = rsq20*rinv20;
1068
1069             /* Calculate table index by multiplying r with table scale and truncate to integer */
1070             rt               = r20*vftabscale;
1071             vfitab           = rt;
1072             vfeps            = rt-vfitab;
1073             vfitab           = 1*4*vfitab;
1074
1075             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1076             F                = vftab[vfitab+1];
1077             Geps             = vfeps*vftab[vfitab+2];
1078             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1079             Fp               = F+Geps+Heps2;
1080             FF               = Fp+Geps+2.0*Heps2;
1081             felec            = -qq20*FF*vftabscale*rinv20;
1082
1083             fscal            = felec;
1084
1085             /* Calculate temporary vectorial force */
1086             tx               = fscal*dx20;
1087             ty               = fscal*dy20;
1088             tz               = fscal*dz20;
1089
1090             /* Update vectorial force */
1091             fix2            += tx;
1092             fiy2            += ty;
1093             fiz2            += tz;
1094             f[j_coord_offset+DIM*0+XX] -= tx;
1095             f[j_coord_offset+DIM*0+YY] -= ty;
1096             f[j_coord_offset+DIM*0+ZZ] -= tz;
1097
1098             /**************************
1099              * CALCULATE INTERACTIONS *
1100              **************************/
1101
1102             r21              = rsq21*rinv21;
1103
1104             /* Calculate table index by multiplying r with table scale and truncate to integer */
1105             rt               = r21*vftabscale;
1106             vfitab           = rt;
1107             vfeps            = rt-vfitab;
1108             vfitab           = 1*4*vfitab;
1109
1110             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1111             F                = vftab[vfitab+1];
1112             Geps             = vfeps*vftab[vfitab+2];
1113             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1114             Fp               = F+Geps+Heps2;
1115             FF               = Fp+Geps+2.0*Heps2;
1116             felec            = -qq21*FF*vftabscale*rinv21;
1117
1118             fscal            = felec;
1119
1120             /* Calculate temporary vectorial force */
1121             tx               = fscal*dx21;
1122             ty               = fscal*dy21;
1123             tz               = fscal*dz21;
1124
1125             /* Update vectorial force */
1126             fix2            += tx;
1127             fiy2            += ty;
1128             fiz2            += tz;
1129             f[j_coord_offset+DIM*1+XX] -= tx;
1130             f[j_coord_offset+DIM*1+YY] -= ty;
1131             f[j_coord_offset+DIM*1+ZZ] -= tz;
1132
1133             /**************************
1134              * CALCULATE INTERACTIONS *
1135              **************************/
1136
1137             r22              = rsq22*rinv22;
1138
1139             /* Calculate table index by multiplying r with table scale and truncate to integer */
1140             rt               = r22*vftabscale;
1141             vfitab           = rt;
1142             vfeps            = rt-vfitab;
1143             vfitab           = 1*4*vfitab;
1144
1145             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1146             F                = vftab[vfitab+1];
1147             Geps             = vfeps*vftab[vfitab+2];
1148             Heps2            = vfeps*vfeps*vftab[vfitab+3];
1149             Fp               = F+Geps+Heps2;
1150             FF               = Fp+Geps+2.0*Heps2;
1151             felec            = -qq22*FF*vftabscale*rinv22;
1152
1153             fscal            = felec;
1154
1155             /* Calculate temporary vectorial force */
1156             tx               = fscal*dx22;
1157             ty               = fscal*dy22;
1158             tz               = fscal*dz22;
1159
1160             /* Update vectorial force */
1161             fix2            += tx;
1162             fiy2            += ty;
1163             fiz2            += tz;
1164             f[j_coord_offset+DIM*2+XX] -= tx;
1165             f[j_coord_offset+DIM*2+YY] -= ty;
1166             f[j_coord_offset+DIM*2+ZZ] -= tz;
1167
1168             /* Inner loop uses 333 flops */
1169         }
1170         /* End of innermost loop */
1171
1172         tx = ty = tz = 0;
1173         f[i_coord_offset+DIM*0+XX] += fix0;
1174         f[i_coord_offset+DIM*0+YY] += fiy0;
1175         f[i_coord_offset+DIM*0+ZZ] += fiz0;
1176         tx                         += fix0;
1177         ty                         += fiy0;
1178         tz                         += fiz0;
1179         f[i_coord_offset+DIM*1+XX] += fix1;
1180         f[i_coord_offset+DIM*1+YY] += fiy1;
1181         f[i_coord_offset+DIM*1+ZZ] += fiz1;
1182         tx                         += fix1;
1183         ty                         += fiy1;
1184         tz                         += fiz1;
1185         f[i_coord_offset+DIM*2+XX] += fix2;
1186         f[i_coord_offset+DIM*2+YY] += fiy2;
1187         f[i_coord_offset+DIM*2+ZZ] += fiz2;
1188         tx                         += fix2;
1189         ty                         += fiy2;
1190         tz                         += fiz2;
1191         fshift[i_shift_offset+XX]  += tx;
1192         fshift[i_shift_offset+YY]  += ty;
1193         fshift[i_shift_offset+ZZ]  += tz;
1194
1195         /* Increment number of inner iterations */
1196         inneriter                  += j_index_end - j_index_start;
1197
1198         /* Outer loop uses 30 flops */
1199     }
1200
1201     /* Increment number of outer iterations */
1202     outeriter        += nri;
1203
1204     /* Update outer/inner flops */
1205
1206     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*333);
1207 }