4cba5e8deaf8458b697fed1ea9f514f708695b00
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_sparc64_hpc_ace_double.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 sparc64_hpc_ace_double 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 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: Coulomb
54  * VdW interaction:            CubicSplineTable
55  * Geometry:                   Water3-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
60                     (t_nblist                    * gmx_restrict       nlist,
61                      rvec                        * gmx_restrict          xx,
62                      rvec                        * gmx_restrict          ff,
63                      t_forcerec                  * gmx_restrict          fr,
64                      t_mdatoms                   * gmx_restrict     mdatoms,
65                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66                      t_nrnb                      * gmx_restrict        nrnb)
67 {
68     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69      * just 0 for non-waters.
70      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71      * jnr indices corresponding to data put in the four positions in the SIMD register.
72      */
73     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
74     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75     int              jnrA,jnrB;
76     int              j_coord_offsetA,j_coord_offsetB;
77     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
78     real             rcutoff_scalar;
79     real             *shiftvec,*fshift,*x,*f;
80     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81     int              vdwioffset0;
82     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
83     int              vdwioffset1;
84     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
85     int              vdwioffset2;
86     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
87     int              vdwjidx0A,vdwjidx0B;
88     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
93     real             *charge;
94     int              nvdwtype;
95     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96     int              *vdwtype;
97     real             *vdwparam;
98     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
99     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
101     real             *vftab;
102     _fjsp_v2r8       itab_tmp;
103     _fjsp_v2r8       dummy_mask,cutoff_mask;
104     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
105     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
106     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
107
108     x                = xx[0];
109     f                = ff[0];
110
111     nri              = nlist->nri;
112     iinr             = nlist->iinr;
113     jindex           = nlist->jindex;
114     jjnr             = nlist->jjnr;
115     shiftidx         = nlist->shift;
116     gid              = nlist->gid;
117     shiftvec         = fr->shift_vec[0];
118     fshift           = fr->fshift[0];
119     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
120     charge           = mdatoms->chargeA;
121     nvdwtype         = fr->ntype;
122     vdwparam         = fr->nbfp;
123     vdwtype          = mdatoms->typeA;
124
125     vftab            = kernel_data->table_vdw->data;
126     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
127
128     /* Setup water-specific parameters */
129     inr              = nlist->iinr[0];
130     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
131     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
132     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
133     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
134
135     /* Avoid stupid compiler warnings */
136     jnrA = jnrB = 0;
137     j_coord_offsetA = 0;
138     j_coord_offsetB = 0;
139
140     outeriter        = 0;
141     inneriter        = 0;
142
143     /* Start outer loop over neighborlists */
144     for(iidx=0; iidx<nri; iidx++)
145     {
146         /* Load shift vector for this list */
147         i_shift_offset   = DIM*shiftidx[iidx];
148
149         /* Load limits for loop over neighbors */
150         j_index_start    = jindex[iidx];
151         j_index_end      = jindex[iidx+1];
152
153         /* Get outer coordinate index */
154         inr              = iinr[iidx];
155         i_coord_offset   = DIM*inr;
156
157         /* Load i particle coords and add shift vector */
158         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
159                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
160
161         fix0             = _fjsp_setzero_v2r8();
162         fiy0             = _fjsp_setzero_v2r8();
163         fiz0             = _fjsp_setzero_v2r8();
164         fix1             = _fjsp_setzero_v2r8();
165         fiy1             = _fjsp_setzero_v2r8();
166         fiz1             = _fjsp_setzero_v2r8();
167         fix2             = _fjsp_setzero_v2r8();
168         fiy2             = _fjsp_setzero_v2r8();
169         fiz2             = _fjsp_setzero_v2r8();
170
171         /* Reset potential sums */
172         velecsum         = _fjsp_setzero_v2r8();
173         vvdwsum          = _fjsp_setzero_v2r8();
174
175         /* Start inner kernel loop */
176         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
177         {
178
179             /* Get j neighbor index, and coordinate index */
180             jnrA             = jjnr[jidx];
181             jnrB             = jjnr[jidx+1];
182             j_coord_offsetA  = DIM*jnrA;
183             j_coord_offsetB  = DIM*jnrB;
184
185             /* load j atom coordinates */
186             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
187                                               &jx0,&jy0,&jz0);
188
189             /* Calculate displacement vector */
190             dx00             = _fjsp_sub_v2r8(ix0,jx0);
191             dy00             = _fjsp_sub_v2r8(iy0,jy0);
192             dz00             = _fjsp_sub_v2r8(iz0,jz0);
193             dx10             = _fjsp_sub_v2r8(ix1,jx0);
194             dy10             = _fjsp_sub_v2r8(iy1,jy0);
195             dz10             = _fjsp_sub_v2r8(iz1,jz0);
196             dx20             = _fjsp_sub_v2r8(ix2,jx0);
197             dy20             = _fjsp_sub_v2r8(iy2,jy0);
198             dz20             = _fjsp_sub_v2r8(iz2,jz0);
199
200             /* Calculate squared distance and things based on it */
201             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
202             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
203             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
204
205             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
206             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
207             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
208
209             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
210             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
211             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
212
213             /* Load parameters for j particles */
214             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
215             vdwjidx0A        = 2*vdwtype[jnrA+0];
216             vdwjidx0B        = 2*vdwtype[jnrB+0];
217
218             fjx0             = _fjsp_setzero_v2r8();
219             fjy0             = _fjsp_setzero_v2r8();
220             fjz0             = _fjsp_setzero_v2r8();
221
222             /**************************
223              * CALCULATE INTERACTIONS *
224              **************************/
225
226             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
227
228             /* Compute parameters for interactions between i and j atoms */
229             qq00             = _fjsp_mul_v2r8(iq0,jq0);
230             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
231                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
232
233             /* Calculate table index by multiplying r with table scale and truncate to integer */
234             rt               = _fjsp_mul_v2r8(r00,vftabscale);
235             itab_tmp         = _fjsp_dtox_v2r8(rt);
236             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
237             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
238             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
239
240             vfconv.i[0]     *= 8;
241             vfconv.i[1]     *= 8;
242
243             /* COULOMB ELECTROSTATICS */
244             velec            = _fjsp_mul_v2r8(qq00,rinv00);
245             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
246
247             /* CUBIC SPLINE TABLE DISPERSION */
248             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
249             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
250             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
251             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
252             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
253             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
254             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
255             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
256             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
257             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
258             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
259
260             /* CUBIC SPLINE TABLE REPULSION */
261             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
262             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
263             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
264             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
265             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
266             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
267             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
268             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
269             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
270             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
271             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
272             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
273             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
274
275             /* Update potential sum for this i atom from the interaction with this j atom. */
276             velecsum         = _fjsp_add_v2r8(velecsum,velec);
277             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
278
279             fscal            = _fjsp_add_v2r8(felec,fvdw);
280
281             /* Update vectorial force */
282             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
283             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
284             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
285             
286             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
287             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
288             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
289
290             /**************************
291              * CALCULATE INTERACTIONS *
292              **************************/
293
294             /* Compute parameters for interactions between i and j atoms */
295             qq10             = _fjsp_mul_v2r8(iq1,jq0);
296
297             /* COULOMB ELECTROSTATICS */
298             velec            = _fjsp_mul_v2r8(qq10,rinv10);
299             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
300
301             /* Update potential sum for this i atom from the interaction with this j atom. */
302             velecsum         = _fjsp_add_v2r8(velecsum,velec);
303
304             fscal            = felec;
305
306             /* Update vectorial force */
307             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
308             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
309             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
310             
311             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
312             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
313             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
314
315             /**************************
316              * CALCULATE INTERACTIONS *
317              **************************/
318
319             /* Compute parameters for interactions between i and j atoms */
320             qq20             = _fjsp_mul_v2r8(iq2,jq0);
321
322             /* COULOMB ELECTROSTATICS */
323             velec            = _fjsp_mul_v2r8(qq20,rinv20);
324             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
325
326             /* Update potential sum for this i atom from the interaction with this j atom. */
327             velecsum         = _fjsp_add_v2r8(velecsum,velec);
328
329             fscal            = felec;
330
331             /* Update vectorial force */
332             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
333             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
334             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
335             
336             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
337             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
338             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
339
340             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
341
342             /* Inner loop uses 131 flops */
343         }
344
345         if(jidx<j_index_end)
346         {
347
348             jnrA             = jjnr[jidx];
349             j_coord_offsetA  = DIM*jnrA;
350
351             /* load j atom coordinates */
352             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
353                                               &jx0,&jy0,&jz0);
354
355             /* Calculate displacement vector */
356             dx00             = _fjsp_sub_v2r8(ix0,jx0);
357             dy00             = _fjsp_sub_v2r8(iy0,jy0);
358             dz00             = _fjsp_sub_v2r8(iz0,jz0);
359             dx10             = _fjsp_sub_v2r8(ix1,jx0);
360             dy10             = _fjsp_sub_v2r8(iy1,jy0);
361             dz10             = _fjsp_sub_v2r8(iz1,jz0);
362             dx20             = _fjsp_sub_v2r8(ix2,jx0);
363             dy20             = _fjsp_sub_v2r8(iy2,jy0);
364             dz20             = _fjsp_sub_v2r8(iz2,jz0);
365
366             /* Calculate squared distance and things based on it */
367             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
368             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
369             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
370
371             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
372             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
373             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
374
375             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
376             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
377             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
378
379             /* Load parameters for j particles */
380             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
381             vdwjidx0A        = 2*vdwtype[jnrA+0];
382
383             fjx0             = _fjsp_setzero_v2r8();
384             fjy0             = _fjsp_setzero_v2r8();
385             fjz0             = _fjsp_setzero_v2r8();
386
387             /**************************
388              * CALCULATE INTERACTIONS *
389              **************************/
390
391             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
392
393             /* Compute parameters for interactions between i and j atoms */
394             qq00             = _fjsp_mul_v2r8(iq0,jq0);
395             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
396
397             /* Calculate table index by multiplying r with table scale and truncate to integer */
398             rt               = _fjsp_mul_v2r8(r00,vftabscale);
399             itab_tmp         = _fjsp_dtox_v2r8(rt);
400             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
401             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
402             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
403
404             vfconv.i[0]     *= 8;
405             vfconv.i[1]     *= 8;
406
407             /* COULOMB ELECTROSTATICS */
408             velec            = _fjsp_mul_v2r8(qq00,rinv00);
409             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
410
411             /* CUBIC SPLINE TABLE DISPERSION */
412             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
413             F                = _fjsp_setzero_v2r8();
414             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
415             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
416             H                = _fjsp_setzero_v2r8();
417             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
418             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
419             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
420             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
421             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
422             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
423
424             /* CUBIC SPLINE TABLE REPULSION */
425             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
426             F                = _fjsp_setzero_v2r8();
427             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
428             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
429             H                = _fjsp_setzero_v2r8();
430             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
431             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
432             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
433             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
434             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
435             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
436             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
437             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
438
439             /* Update potential sum for this i atom from the interaction with this j atom. */
440             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
441             velecsum         = _fjsp_add_v2r8(velecsum,velec);
442             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
443             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
444
445             fscal            = _fjsp_add_v2r8(felec,fvdw);
446
447             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
448
449             /* Update vectorial force */
450             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
451             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
452             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
453             
454             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
455             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
456             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
457
458             /**************************
459              * CALCULATE INTERACTIONS *
460              **************************/
461
462             /* Compute parameters for interactions between i and j atoms */
463             qq10             = _fjsp_mul_v2r8(iq1,jq0);
464
465             /* COULOMB ELECTROSTATICS */
466             velec            = _fjsp_mul_v2r8(qq10,rinv10);
467             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
468
469             /* Update potential sum for this i atom from the interaction with this j atom. */
470             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
471             velecsum         = _fjsp_add_v2r8(velecsum,velec);
472
473             fscal            = felec;
474
475             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
476
477             /* Update vectorial force */
478             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
479             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
480             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
481             
482             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
483             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
484             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
485
486             /**************************
487              * CALCULATE INTERACTIONS *
488              **************************/
489
490             /* Compute parameters for interactions between i and j atoms */
491             qq20             = _fjsp_mul_v2r8(iq2,jq0);
492
493             /* COULOMB ELECTROSTATICS */
494             velec            = _fjsp_mul_v2r8(qq20,rinv20);
495             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
496
497             /* Update potential sum for this i atom from the interaction with this j atom. */
498             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
499             velecsum         = _fjsp_add_v2r8(velecsum,velec);
500
501             fscal            = felec;
502
503             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
504
505             /* Update vectorial force */
506             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
507             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
508             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
509             
510             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
511             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
512             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
513
514             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
515
516             /* Inner loop uses 131 flops */
517         }
518
519         /* End of innermost loop */
520
521         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
522                                               f+i_coord_offset,fshift+i_shift_offset);
523
524         ggid                        = gid[iidx];
525         /* Update potential energies */
526         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
527         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
528
529         /* Increment number of inner iterations */
530         inneriter                  += j_index_end - j_index_start;
531
532         /* Outer loop uses 20 flops */
533     }
534
535     /* Increment number of outer iterations */
536     outeriter        += nri;
537
538     /* Update outer/inner flops */
539
540     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*131);
541 }
542 /*
543  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
544  * Electrostatics interaction: Coulomb
545  * VdW interaction:            CubicSplineTable
546  * Geometry:                   Water3-Particle
547  * Calculate force/pot:        Force
548  */
549 void
550 nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
551                     (t_nblist                    * gmx_restrict       nlist,
552                      rvec                        * gmx_restrict          xx,
553                      rvec                        * gmx_restrict          ff,
554                      t_forcerec                  * gmx_restrict          fr,
555                      t_mdatoms                   * gmx_restrict     mdatoms,
556                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
557                      t_nrnb                      * gmx_restrict        nrnb)
558 {
559     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
560      * just 0 for non-waters.
561      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
562      * jnr indices corresponding to data put in the four positions in the SIMD register.
563      */
564     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
565     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
566     int              jnrA,jnrB;
567     int              j_coord_offsetA,j_coord_offsetB;
568     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
569     real             rcutoff_scalar;
570     real             *shiftvec,*fshift,*x,*f;
571     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
572     int              vdwioffset0;
573     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
574     int              vdwioffset1;
575     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
576     int              vdwioffset2;
577     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
578     int              vdwjidx0A,vdwjidx0B;
579     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
580     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
581     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
582     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
583     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
584     real             *charge;
585     int              nvdwtype;
586     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
587     int              *vdwtype;
588     real             *vdwparam;
589     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
590     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
591     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
592     real             *vftab;
593     _fjsp_v2r8       itab_tmp;
594     _fjsp_v2r8       dummy_mask,cutoff_mask;
595     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
596     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
597     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
598
599     x                = xx[0];
600     f                = ff[0];
601
602     nri              = nlist->nri;
603     iinr             = nlist->iinr;
604     jindex           = nlist->jindex;
605     jjnr             = nlist->jjnr;
606     shiftidx         = nlist->shift;
607     gid              = nlist->gid;
608     shiftvec         = fr->shift_vec[0];
609     fshift           = fr->fshift[0];
610     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
611     charge           = mdatoms->chargeA;
612     nvdwtype         = fr->ntype;
613     vdwparam         = fr->nbfp;
614     vdwtype          = mdatoms->typeA;
615
616     vftab            = kernel_data->table_vdw->data;
617     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
618
619     /* Setup water-specific parameters */
620     inr              = nlist->iinr[0];
621     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
622     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
623     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
624     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
625
626     /* Avoid stupid compiler warnings */
627     jnrA = jnrB = 0;
628     j_coord_offsetA = 0;
629     j_coord_offsetB = 0;
630
631     outeriter        = 0;
632     inneriter        = 0;
633
634     /* Start outer loop over neighborlists */
635     for(iidx=0; iidx<nri; iidx++)
636     {
637         /* Load shift vector for this list */
638         i_shift_offset   = DIM*shiftidx[iidx];
639
640         /* Load limits for loop over neighbors */
641         j_index_start    = jindex[iidx];
642         j_index_end      = jindex[iidx+1];
643
644         /* Get outer coordinate index */
645         inr              = iinr[iidx];
646         i_coord_offset   = DIM*inr;
647
648         /* Load i particle coords and add shift vector */
649         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
650                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
651
652         fix0             = _fjsp_setzero_v2r8();
653         fiy0             = _fjsp_setzero_v2r8();
654         fiz0             = _fjsp_setzero_v2r8();
655         fix1             = _fjsp_setzero_v2r8();
656         fiy1             = _fjsp_setzero_v2r8();
657         fiz1             = _fjsp_setzero_v2r8();
658         fix2             = _fjsp_setzero_v2r8();
659         fiy2             = _fjsp_setzero_v2r8();
660         fiz2             = _fjsp_setzero_v2r8();
661
662         /* Start inner kernel loop */
663         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
664         {
665
666             /* Get j neighbor index, and coordinate index */
667             jnrA             = jjnr[jidx];
668             jnrB             = jjnr[jidx+1];
669             j_coord_offsetA  = DIM*jnrA;
670             j_coord_offsetB  = DIM*jnrB;
671
672             /* load j atom coordinates */
673             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
674                                               &jx0,&jy0,&jz0);
675
676             /* Calculate displacement vector */
677             dx00             = _fjsp_sub_v2r8(ix0,jx0);
678             dy00             = _fjsp_sub_v2r8(iy0,jy0);
679             dz00             = _fjsp_sub_v2r8(iz0,jz0);
680             dx10             = _fjsp_sub_v2r8(ix1,jx0);
681             dy10             = _fjsp_sub_v2r8(iy1,jy0);
682             dz10             = _fjsp_sub_v2r8(iz1,jz0);
683             dx20             = _fjsp_sub_v2r8(ix2,jx0);
684             dy20             = _fjsp_sub_v2r8(iy2,jy0);
685             dz20             = _fjsp_sub_v2r8(iz2,jz0);
686
687             /* Calculate squared distance and things based on it */
688             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
689             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
690             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
691
692             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
693             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
694             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
695
696             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
697             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
698             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
699
700             /* Load parameters for j particles */
701             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
702             vdwjidx0A        = 2*vdwtype[jnrA+0];
703             vdwjidx0B        = 2*vdwtype[jnrB+0];
704
705             fjx0             = _fjsp_setzero_v2r8();
706             fjy0             = _fjsp_setzero_v2r8();
707             fjz0             = _fjsp_setzero_v2r8();
708
709             /**************************
710              * CALCULATE INTERACTIONS *
711              **************************/
712
713             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
714
715             /* Compute parameters for interactions between i and j atoms */
716             qq00             = _fjsp_mul_v2r8(iq0,jq0);
717             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
718                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
719
720             /* Calculate table index by multiplying r with table scale and truncate to integer */
721             rt               = _fjsp_mul_v2r8(r00,vftabscale);
722             itab_tmp         = _fjsp_dtox_v2r8(rt);
723             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
724             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
725             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
726
727             vfconv.i[0]     *= 8;
728             vfconv.i[1]     *= 8;
729
730             /* COULOMB ELECTROSTATICS */
731             velec            = _fjsp_mul_v2r8(qq00,rinv00);
732             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
733
734             /* CUBIC SPLINE TABLE DISPERSION */
735             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
736             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
737             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
738             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
739             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
740             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
741             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
742             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
743             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
744
745             /* CUBIC SPLINE TABLE REPULSION */
746             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
747             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
748             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
749             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
750             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
751             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
752             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
753             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
754             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
755             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
756
757             fscal            = _fjsp_add_v2r8(felec,fvdw);
758
759             /* Update vectorial force */
760             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
761             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
762             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
763             
764             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
765             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
766             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
767
768             /**************************
769              * CALCULATE INTERACTIONS *
770              **************************/
771
772             /* Compute parameters for interactions between i and j atoms */
773             qq10             = _fjsp_mul_v2r8(iq1,jq0);
774
775             /* COULOMB ELECTROSTATICS */
776             velec            = _fjsp_mul_v2r8(qq10,rinv10);
777             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
778
779             fscal            = felec;
780
781             /* Update vectorial force */
782             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
783             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
784             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
785             
786             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
787             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
788             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
789
790             /**************************
791              * CALCULATE INTERACTIONS *
792              **************************/
793
794             /* Compute parameters for interactions between i and j atoms */
795             qq20             = _fjsp_mul_v2r8(iq2,jq0);
796
797             /* COULOMB ELECTROSTATICS */
798             velec            = _fjsp_mul_v2r8(qq20,rinv20);
799             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
800
801             fscal            = felec;
802
803             /* Update vectorial force */
804             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
805             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
806             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
807             
808             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
809             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
810             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
811
812             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
813
814             /* Inner loop uses 120 flops */
815         }
816
817         if(jidx<j_index_end)
818         {
819
820             jnrA             = jjnr[jidx];
821             j_coord_offsetA  = DIM*jnrA;
822
823             /* load j atom coordinates */
824             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
825                                               &jx0,&jy0,&jz0);
826
827             /* Calculate displacement vector */
828             dx00             = _fjsp_sub_v2r8(ix0,jx0);
829             dy00             = _fjsp_sub_v2r8(iy0,jy0);
830             dz00             = _fjsp_sub_v2r8(iz0,jz0);
831             dx10             = _fjsp_sub_v2r8(ix1,jx0);
832             dy10             = _fjsp_sub_v2r8(iy1,jy0);
833             dz10             = _fjsp_sub_v2r8(iz1,jz0);
834             dx20             = _fjsp_sub_v2r8(ix2,jx0);
835             dy20             = _fjsp_sub_v2r8(iy2,jy0);
836             dz20             = _fjsp_sub_v2r8(iz2,jz0);
837
838             /* Calculate squared distance and things based on it */
839             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
840             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
841             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
842
843             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
844             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
845             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
846
847             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
848             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
849             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
850
851             /* Load parameters for j particles */
852             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
853             vdwjidx0A        = 2*vdwtype[jnrA+0];
854
855             fjx0             = _fjsp_setzero_v2r8();
856             fjy0             = _fjsp_setzero_v2r8();
857             fjz0             = _fjsp_setzero_v2r8();
858
859             /**************************
860              * CALCULATE INTERACTIONS *
861              **************************/
862
863             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
864
865             /* Compute parameters for interactions between i and j atoms */
866             qq00             = _fjsp_mul_v2r8(iq0,jq0);
867             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
868
869             /* Calculate table index by multiplying r with table scale and truncate to integer */
870             rt               = _fjsp_mul_v2r8(r00,vftabscale);
871             itab_tmp         = _fjsp_dtox_v2r8(rt);
872             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
873             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
874             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
875
876             vfconv.i[0]     *= 8;
877             vfconv.i[1]     *= 8;
878
879             /* COULOMB ELECTROSTATICS */
880             velec            = _fjsp_mul_v2r8(qq00,rinv00);
881             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
882
883             /* CUBIC SPLINE TABLE DISPERSION */
884             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
885             F                = _fjsp_setzero_v2r8();
886             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
887             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
888             H                = _fjsp_setzero_v2r8();
889             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
890             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
891             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
892             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
893
894             /* CUBIC SPLINE TABLE REPULSION */
895             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
896             F                = _fjsp_setzero_v2r8();
897             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
898             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
899             H                = _fjsp_setzero_v2r8();
900             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
901             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
902             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
903             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
904             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
905
906             fscal            = _fjsp_add_v2r8(felec,fvdw);
907
908             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
909
910             /* Update vectorial force */
911             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
912             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
913             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
914             
915             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
916             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
917             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
918
919             /**************************
920              * CALCULATE INTERACTIONS *
921              **************************/
922
923             /* Compute parameters for interactions between i and j atoms */
924             qq10             = _fjsp_mul_v2r8(iq1,jq0);
925
926             /* COULOMB ELECTROSTATICS */
927             velec            = _fjsp_mul_v2r8(qq10,rinv10);
928             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
929
930             fscal            = felec;
931
932             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
933
934             /* Update vectorial force */
935             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
936             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
937             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
938             
939             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
940             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
941             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
942
943             /**************************
944              * CALCULATE INTERACTIONS *
945              **************************/
946
947             /* Compute parameters for interactions between i and j atoms */
948             qq20             = _fjsp_mul_v2r8(iq2,jq0);
949
950             /* COULOMB ELECTROSTATICS */
951             velec            = _fjsp_mul_v2r8(qq20,rinv20);
952             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
953
954             fscal            = felec;
955
956             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
957
958             /* Update vectorial force */
959             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
960             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
961             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
962             
963             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
964             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
965             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
966
967             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
968
969             /* Inner loop uses 120 flops */
970         }
971
972         /* End of innermost loop */
973
974         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
975                                               f+i_coord_offset,fshift+i_shift_offset);
976
977         /* Increment number of inner iterations */
978         inneriter                  += j_index_end - j_index_start;
979
980         /* Outer loop uses 18 flops */
981     }
982
983     /* Increment number of outer iterations */
984     outeriter        += nri;
985
986     /* Update outer/inner flops */
987
988     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*120);
989 }