4c65aec4bf4d2c68e7c085cdade3f79c3acfb1f8
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_sparc64_hpc_ace_double.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014,2015,2017,2018, 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 #include "gmxpre.h"
39
40 #include "config.h"
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
46
47 #include "kernelutil_sparc64_hpc_ace_double.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
51  * Electrostatics interaction: CubicSplineTable
52  * VdW interaction:            CubicSplineTable
53  * Geometry:                   Water4-Particle
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
58                     (t_nblist                    * gmx_restrict       nlist,
59                      rvec                        * gmx_restrict          xx,
60                      rvec                        * gmx_restrict          ff,
61                      struct t_forcerec           * gmx_restrict          fr,
62                      t_mdatoms                   * gmx_restrict     mdatoms,
63                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64                      t_nrnb                      * gmx_restrict        nrnb)
65 {
66     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67      * just 0 for non-waters.
68      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69      * jnr indices corresponding to data put in the four positions in the SIMD register.
70      */
71     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
72     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
73     int              jnrA,jnrB;
74     int              j_coord_offsetA,j_coord_offsetB;
75     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
76     real             rcutoff_scalar;
77     real             *shiftvec,*fshift,*x,*f;
78     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
79     int              vdwioffset0;
80     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81     int              vdwioffset1;
82     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
83     int              vdwioffset2;
84     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85     int              vdwioffset3;
86     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
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       dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
94     real             *charge;
95     int              nvdwtype;
96     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
97     int              *vdwtype;
98     real             *vdwparam;
99     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
100     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
101     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
102     real             *vftab;
103     _fjsp_v2r8       itab_tmp;
104     _fjsp_v2r8       dummy_mask,cutoff_mask;
105     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
106     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
107     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
108
109     x                = xx[0];
110     f                = ff[0];
111
112     nri              = nlist->nri;
113     iinr             = nlist->iinr;
114     jindex           = nlist->jindex;
115     jjnr             = nlist->jjnr;
116     shiftidx         = nlist->shift;
117     gid              = nlist->gid;
118     shiftvec         = fr->shift_vec[0];
119     fshift           = fr->fshift[0];
120     facel            = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
121     charge           = mdatoms->chargeA;
122     nvdwtype         = fr->ntype;
123     vdwparam         = fr->nbfp;
124     vdwtype          = mdatoms->typeA;
125
126     vftab            = kernel_data->table_elec_vdw->data;
127     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
128
129     /* Setup water-specific parameters */
130     inr              = nlist->iinr[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     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
134     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
135
136     /* Avoid stupid compiler warnings */
137     jnrA = jnrB = 0;
138     j_coord_offsetA = 0;
139     j_coord_offsetB = 0;
140
141     outeriter        = 0;
142     inneriter        = 0;
143
144     /* Start outer loop over neighborlists */
145     for(iidx=0; iidx<nri; iidx++)
146     {
147         /* Load shift vector for this list */
148         i_shift_offset   = DIM*shiftidx[iidx];
149
150         /* Load limits for loop over neighbors */
151         j_index_start    = jindex[iidx];
152         j_index_end      = jindex[iidx+1];
153
154         /* Get outer coordinate index */
155         inr              = iinr[iidx];
156         i_coord_offset   = DIM*inr;
157
158         /* Load i particle coords and add shift vector */
159         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
160                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
161
162         fix0             = _fjsp_setzero_v2r8();
163         fiy0             = _fjsp_setzero_v2r8();
164         fiz0             = _fjsp_setzero_v2r8();
165         fix1             = _fjsp_setzero_v2r8();
166         fiy1             = _fjsp_setzero_v2r8();
167         fiz1             = _fjsp_setzero_v2r8();
168         fix2             = _fjsp_setzero_v2r8();
169         fiy2             = _fjsp_setzero_v2r8();
170         fiz2             = _fjsp_setzero_v2r8();
171         fix3             = _fjsp_setzero_v2r8();
172         fiy3             = _fjsp_setzero_v2r8();
173         fiz3             = _fjsp_setzero_v2r8();
174
175         /* Reset potential sums */
176         velecsum         = _fjsp_setzero_v2r8();
177         vvdwsum          = _fjsp_setzero_v2r8();
178
179         /* Start inner kernel loop */
180         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
181         {
182
183             /* Get j neighbor index, and coordinate index */
184             jnrA             = jjnr[jidx];
185             jnrB             = jjnr[jidx+1];
186             j_coord_offsetA  = DIM*jnrA;
187             j_coord_offsetB  = DIM*jnrB;
188
189             /* load j atom coordinates */
190             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
191                                               &jx0,&jy0,&jz0);
192
193             /* Calculate displacement vector */
194             dx00             = _fjsp_sub_v2r8(ix0,jx0);
195             dy00             = _fjsp_sub_v2r8(iy0,jy0);
196             dz00             = _fjsp_sub_v2r8(iz0,jz0);
197             dx10             = _fjsp_sub_v2r8(ix1,jx0);
198             dy10             = _fjsp_sub_v2r8(iy1,jy0);
199             dz10             = _fjsp_sub_v2r8(iz1,jz0);
200             dx20             = _fjsp_sub_v2r8(ix2,jx0);
201             dy20             = _fjsp_sub_v2r8(iy2,jy0);
202             dz20             = _fjsp_sub_v2r8(iz2,jz0);
203             dx30             = _fjsp_sub_v2r8(ix3,jx0);
204             dy30             = _fjsp_sub_v2r8(iy3,jy0);
205             dz30             = _fjsp_sub_v2r8(iz3,jz0);
206
207             /* Calculate squared distance and things based on it */
208             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
209             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
210             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
211             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
212
213             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
214             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
215             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
216             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
217
218             /* Load parameters for j particles */
219             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
220             vdwjidx0A        = 2*vdwtype[jnrA+0];
221             vdwjidx0B        = 2*vdwtype[jnrB+0];
222
223             fjx0             = _fjsp_setzero_v2r8();
224             fjy0             = _fjsp_setzero_v2r8();
225             fjz0             = _fjsp_setzero_v2r8();
226
227             /**************************
228              * CALCULATE INTERACTIONS *
229              **************************/
230
231             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
232
233             /* Compute parameters for interactions between i and j atoms */
234             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
235                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
236
237             /* Calculate table index by multiplying r with table scale and truncate to integer */
238             rt               = _fjsp_mul_v2r8(r00,vftabscale);
239             itab_tmp         = _fjsp_dtox_v2r8(rt);
240             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
241             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
242             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
243
244             vfconv.i[0]     *= 12;
245             vfconv.i[1]     *= 12;
246
247             /* CUBIC SPLINE TABLE DISPERSION */
248             vfconv.i[0]       += 4;
249             vfconv.i[1]       += 4;
250             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
251             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
252             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
253             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
254             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
255             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
256             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
257             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
258             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
259             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
260             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
261
262             /* CUBIC SPLINE TABLE REPULSION */
263             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
264             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
265             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
266             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
267             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
268             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
269             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
270             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
271             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
272             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
273             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
274             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
275             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
276
277             /* Update potential sum for this i atom from the interaction with this j atom. */
278             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
279
280             fscal            = fvdw;
281
282             /* Update vectorial force */
283             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
284             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
285             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
286             
287             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
288             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
289             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
290
291             /**************************
292              * CALCULATE INTERACTIONS *
293              **************************/
294
295             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
296
297             /* Compute parameters for interactions between i and j atoms */
298             qq10             = _fjsp_mul_v2r8(iq1,jq0);
299
300             /* Calculate table index by multiplying r with table scale and truncate to integer */
301             rt               = _fjsp_mul_v2r8(r10,vftabscale);
302             itab_tmp         = _fjsp_dtox_v2r8(rt);
303             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
304             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
305             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
306
307             vfconv.i[0]     *= 12;
308             vfconv.i[1]     *= 12;
309
310             /* CUBIC SPLINE TABLE ELECTROSTATICS */
311             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
312             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
313             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
314             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
315             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
316             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
317             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
318             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
319             velec            = _fjsp_mul_v2r8(qq10,VV);
320             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
321             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
322
323             /* Update potential sum for this i atom from the interaction with this j atom. */
324             velecsum         = _fjsp_add_v2r8(velecsum,velec);
325
326             fscal            = felec;
327
328             /* Update vectorial force */
329             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
330             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
331             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
332             
333             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
334             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
335             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
336
337             /**************************
338              * CALCULATE INTERACTIONS *
339              **************************/
340
341             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
342
343             /* Compute parameters for interactions between i and j atoms */
344             qq20             = _fjsp_mul_v2r8(iq2,jq0);
345
346             /* Calculate table index by multiplying r with table scale and truncate to integer */
347             rt               = _fjsp_mul_v2r8(r20,vftabscale);
348             itab_tmp         = _fjsp_dtox_v2r8(rt);
349             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
350             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
351             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
352
353             vfconv.i[0]     *= 12;
354             vfconv.i[1]     *= 12;
355
356             /* CUBIC SPLINE TABLE ELECTROSTATICS */
357             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
358             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
359             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
360             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
361             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
362             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
363             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
364             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
365             velec            = _fjsp_mul_v2r8(qq20,VV);
366             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
367             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
368
369             /* Update potential sum for this i atom from the interaction with this j atom. */
370             velecsum         = _fjsp_add_v2r8(velecsum,velec);
371
372             fscal            = felec;
373
374             /* Update vectorial force */
375             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
376             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
377             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
378             
379             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
380             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
381             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
382
383             /**************************
384              * CALCULATE INTERACTIONS *
385              **************************/
386
387             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
388
389             /* Compute parameters for interactions between i and j atoms */
390             qq30             = _fjsp_mul_v2r8(iq3,jq0);
391
392             /* Calculate table index by multiplying r with table scale and truncate to integer */
393             rt               = _fjsp_mul_v2r8(r30,vftabscale);
394             itab_tmp         = _fjsp_dtox_v2r8(rt);
395             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
396             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
397             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
398
399             vfconv.i[0]     *= 12;
400             vfconv.i[1]     *= 12;
401
402             /* CUBIC SPLINE TABLE ELECTROSTATICS */
403             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
404             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
405             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
406             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
407             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
408             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
409             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
410             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
411             velec            = _fjsp_mul_v2r8(qq30,VV);
412             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
413             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
414
415             /* Update potential sum for this i atom from the interaction with this j atom. */
416             velecsum         = _fjsp_add_v2r8(velecsum,velec);
417
418             fscal            = felec;
419
420             /* Update vectorial force */
421             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
422             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
423             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
424             
425             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
426             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
427             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
428
429             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
430
431             /* Inner loop uses 200 flops */
432         }
433
434         if(jidx<j_index_end)
435         {
436
437             jnrA             = jjnr[jidx];
438             j_coord_offsetA  = DIM*jnrA;
439
440             /* load j atom coordinates */
441             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
442                                               &jx0,&jy0,&jz0);
443
444             /* Calculate displacement vector */
445             dx00             = _fjsp_sub_v2r8(ix0,jx0);
446             dy00             = _fjsp_sub_v2r8(iy0,jy0);
447             dz00             = _fjsp_sub_v2r8(iz0,jz0);
448             dx10             = _fjsp_sub_v2r8(ix1,jx0);
449             dy10             = _fjsp_sub_v2r8(iy1,jy0);
450             dz10             = _fjsp_sub_v2r8(iz1,jz0);
451             dx20             = _fjsp_sub_v2r8(ix2,jx0);
452             dy20             = _fjsp_sub_v2r8(iy2,jy0);
453             dz20             = _fjsp_sub_v2r8(iz2,jz0);
454             dx30             = _fjsp_sub_v2r8(ix3,jx0);
455             dy30             = _fjsp_sub_v2r8(iy3,jy0);
456             dz30             = _fjsp_sub_v2r8(iz3,jz0);
457
458             /* Calculate squared distance and things based on it */
459             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
460             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
461             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
462             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
463
464             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
465             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
466             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
467             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
468
469             /* Load parameters for j particles */
470             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
471             vdwjidx0A        = 2*vdwtype[jnrA+0];
472
473             fjx0             = _fjsp_setzero_v2r8();
474             fjy0             = _fjsp_setzero_v2r8();
475             fjz0             = _fjsp_setzero_v2r8();
476
477             /**************************
478              * CALCULATE INTERACTIONS *
479              **************************/
480
481             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
482
483             /* Compute parameters for interactions between i and j atoms */
484             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
485                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
486
487             /* Calculate table index by multiplying r with table scale and truncate to integer */
488             rt               = _fjsp_mul_v2r8(r00,vftabscale);
489             itab_tmp         = _fjsp_dtox_v2r8(rt);
490             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
491             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
492             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
493
494             vfconv.i[0]     *= 12;
495             vfconv.i[1]     *= 12;
496
497             /* CUBIC SPLINE TABLE DISPERSION */
498             vfconv.i[0]       += 4;
499             vfconv.i[1]       += 4;
500             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
501             F                = _fjsp_setzero_v2r8();
502             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
503             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
504             H                = _fjsp_setzero_v2r8();
505             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
506             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
507             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
508             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
509             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
510             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
511
512             /* CUBIC SPLINE TABLE REPULSION */
513             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
514             F                = _fjsp_setzero_v2r8();
515             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
516             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
517             H                = _fjsp_setzero_v2r8();
518             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
519             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
520             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
521             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
522             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
523             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
524             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
525             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
526
527             /* Update potential sum for this i atom from the interaction with this j atom. */
528             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
529             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
530
531             fscal            = fvdw;
532
533             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
534
535             /* Update vectorial force */
536             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
537             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
538             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
539             
540             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
541             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
542             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
543
544             /**************************
545              * CALCULATE INTERACTIONS *
546              **************************/
547
548             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
549
550             /* Compute parameters for interactions between i and j atoms */
551             qq10             = _fjsp_mul_v2r8(iq1,jq0);
552
553             /* Calculate table index by multiplying r with table scale and truncate to integer */
554             rt               = _fjsp_mul_v2r8(r10,vftabscale);
555             itab_tmp         = _fjsp_dtox_v2r8(rt);
556             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
557             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
558             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
559
560             vfconv.i[0]     *= 12;
561             vfconv.i[1]     *= 12;
562
563             /* CUBIC SPLINE TABLE ELECTROSTATICS */
564             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
565             F                = _fjsp_setzero_v2r8();
566             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
567             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
568             H                = _fjsp_setzero_v2r8();
569             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
570             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
571             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
572             velec            = _fjsp_mul_v2r8(qq10,VV);
573             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
574             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
575
576             /* Update potential sum for this i atom from the interaction with this j atom. */
577             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
578             velecsum         = _fjsp_add_v2r8(velecsum,velec);
579
580             fscal            = felec;
581
582             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
583
584             /* Update vectorial force */
585             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
586             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
587             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
588             
589             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
590             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
591             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
592
593             /**************************
594              * CALCULATE INTERACTIONS *
595              **************************/
596
597             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
598
599             /* Compute parameters for interactions between i and j atoms */
600             qq20             = _fjsp_mul_v2r8(iq2,jq0);
601
602             /* Calculate table index by multiplying r with table scale and truncate to integer */
603             rt               = _fjsp_mul_v2r8(r20,vftabscale);
604             itab_tmp         = _fjsp_dtox_v2r8(rt);
605             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
606             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
607             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
608
609             vfconv.i[0]     *= 12;
610             vfconv.i[1]     *= 12;
611
612             /* CUBIC SPLINE TABLE ELECTROSTATICS */
613             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
614             F                = _fjsp_setzero_v2r8();
615             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
616             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
617             H                = _fjsp_setzero_v2r8();
618             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
619             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
620             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
621             velec            = _fjsp_mul_v2r8(qq20,VV);
622             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
623             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
624
625             /* Update potential sum for this i atom from the interaction with this j atom. */
626             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
627             velecsum         = _fjsp_add_v2r8(velecsum,velec);
628
629             fscal            = felec;
630
631             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
632
633             /* Update vectorial force */
634             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
635             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
636             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
637             
638             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
639             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
640             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
641
642             /**************************
643              * CALCULATE INTERACTIONS *
644              **************************/
645
646             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
647
648             /* Compute parameters for interactions between i and j atoms */
649             qq30             = _fjsp_mul_v2r8(iq3,jq0);
650
651             /* Calculate table index by multiplying r with table scale and truncate to integer */
652             rt               = _fjsp_mul_v2r8(r30,vftabscale);
653             itab_tmp         = _fjsp_dtox_v2r8(rt);
654             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
655             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
656             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
657
658             vfconv.i[0]     *= 12;
659             vfconv.i[1]     *= 12;
660
661             /* CUBIC SPLINE TABLE ELECTROSTATICS */
662             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
663             F                = _fjsp_setzero_v2r8();
664             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
665             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
666             H                = _fjsp_setzero_v2r8();
667             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
668             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
669             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
670             velec            = _fjsp_mul_v2r8(qq30,VV);
671             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
672             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
673
674             /* Update potential sum for this i atom from the interaction with this j atom. */
675             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
676             velecsum         = _fjsp_add_v2r8(velecsum,velec);
677
678             fscal            = felec;
679
680             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
681
682             /* Update vectorial force */
683             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
684             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
685             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
686             
687             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
688             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
689             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
690
691             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
692
693             /* Inner loop uses 200 flops */
694         }
695
696         /* End of innermost loop */
697
698         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
699                                               f+i_coord_offset,fshift+i_shift_offset);
700
701         ggid                        = gid[iidx];
702         /* Update potential energies */
703         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
704         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
705
706         /* Increment number of inner iterations */
707         inneriter                  += j_index_end - j_index_start;
708
709         /* Outer loop uses 26 flops */
710     }
711
712     /* Increment number of outer iterations */
713     outeriter        += nri;
714
715     /* Update outer/inner flops */
716
717     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*200);
718 }
719 /*
720  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
721  * Electrostatics interaction: CubicSplineTable
722  * VdW interaction:            CubicSplineTable
723  * Geometry:                   Water4-Particle
724  * Calculate force/pot:        Force
725  */
726 void
727 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
728                     (t_nblist                    * gmx_restrict       nlist,
729                      rvec                        * gmx_restrict          xx,
730                      rvec                        * gmx_restrict          ff,
731                      struct t_forcerec           * gmx_restrict          fr,
732                      t_mdatoms                   * gmx_restrict     mdatoms,
733                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
734                      t_nrnb                      * gmx_restrict        nrnb)
735 {
736     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
737      * just 0 for non-waters.
738      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
739      * jnr indices corresponding to data put in the four positions in the SIMD register.
740      */
741     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
742     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
743     int              jnrA,jnrB;
744     int              j_coord_offsetA,j_coord_offsetB;
745     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
746     real             rcutoff_scalar;
747     real             *shiftvec,*fshift,*x,*f;
748     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
749     int              vdwioffset0;
750     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
751     int              vdwioffset1;
752     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
753     int              vdwioffset2;
754     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
755     int              vdwioffset3;
756     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
757     int              vdwjidx0A,vdwjidx0B;
758     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
759     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
760     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
761     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
762     _fjsp_v2r8       dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
763     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
764     real             *charge;
765     int              nvdwtype;
766     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
767     int              *vdwtype;
768     real             *vdwparam;
769     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
770     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
771     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
772     real             *vftab;
773     _fjsp_v2r8       itab_tmp;
774     _fjsp_v2r8       dummy_mask,cutoff_mask;
775     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
776     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
777     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
778
779     x                = xx[0];
780     f                = ff[0];
781
782     nri              = nlist->nri;
783     iinr             = nlist->iinr;
784     jindex           = nlist->jindex;
785     jjnr             = nlist->jjnr;
786     shiftidx         = nlist->shift;
787     gid              = nlist->gid;
788     shiftvec         = fr->shift_vec[0];
789     fshift           = fr->fshift[0];
790     facel            = gmx_fjsp_set1_v2r8(fr->ic->epsfac);
791     charge           = mdatoms->chargeA;
792     nvdwtype         = fr->ntype;
793     vdwparam         = fr->nbfp;
794     vdwtype          = mdatoms->typeA;
795
796     vftab            = kernel_data->table_elec_vdw->data;
797     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
798
799     /* Setup water-specific parameters */
800     inr              = nlist->iinr[0];
801     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
802     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
803     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
804     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
805
806     /* Avoid stupid compiler warnings */
807     jnrA = jnrB = 0;
808     j_coord_offsetA = 0;
809     j_coord_offsetB = 0;
810
811     outeriter        = 0;
812     inneriter        = 0;
813
814     /* Start outer loop over neighborlists */
815     for(iidx=0; iidx<nri; iidx++)
816     {
817         /* Load shift vector for this list */
818         i_shift_offset   = DIM*shiftidx[iidx];
819
820         /* Load limits for loop over neighbors */
821         j_index_start    = jindex[iidx];
822         j_index_end      = jindex[iidx+1];
823
824         /* Get outer coordinate index */
825         inr              = iinr[iidx];
826         i_coord_offset   = DIM*inr;
827
828         /* Load i particle coords and add shift vector */
829         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
830                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
831
832         fix0             = _fjsp_setzero_v2r8();
833         fiy0             = _fjsp_setzero_v2r8();
834         fiz0             = _fjsp_setzero_v2r8();
835         fix1             = _fjsp_setzero_v2r8();
836         fiy1             = _fjsp_setzero_v2r8();
837         fiz1             = _fjsp_setzero_v2r8();
838         fix2             = _fjsp_setzero_v2r8();
839         fiy2             = _fjsp_setzero_v2r8();
840         fiz2             = _fjsp_setzero_v2r8();
841         fix3             = _fjsp_setzero_v2r8();
842         fiy3             = _fjsp_setzero_v2r8();
843         fiz3             = _fjsp_setzero_v2r8();
844
845         /* Start inner kernel loop */
846         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
847         {
848
849             /* Get j neighbor index, and coordinate index */
850             jnrA             = jjnr[jidx];
851             jnrB             = jjnr[jidx+1];
852             j_coord_offsetA  = DIM*jnrA;
853             j_coord_offsetB  = DIM*jnrB;
854
855             /* load j atom coordinates */
856             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
857                                               &jx0,&jy0,&jz0);
858
859             /* Calculate displacement vector */
860             dx00             = _fjsp_sub_v2r8(ix0,jx0);
861             dy00             = _fjsp_sub_v2r8(iy0,jy0);
862             dz00             = _fjsp_sub_v2r8(iz0,jz0);
863             dx10             = _fjsp_sub_v2r8(ix1,jx0);
864             dy10             = _fjsp_sub_v2r8(iy1,jy0);
865             dz10             = _fjsp_sub_v2r8(iz1,jz0);
866             dx20             = _fjsp_sub_v2r8(ix2,jx0);
867             dy20             = _fjsp_sub_v2r8(iy2,jy0);
868             dz20             = _fjsp_sub_v2r8(iz2,jz0);
869             dx30             = _fjsp_sub_v2r8(ix3,jx0);
870             dy30             = _fjsp_sub_v2r8(iy3,jy0);
871             dz30             = _fjsp_sub_v2r8(iz3,jz0);
872
873             /* Calculate squared distance and things based on it */
874             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
875             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
876             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
877             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
878
879             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
880             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
881             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
882             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
883
884             /* Load parameters for j particles */
885             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
886             vdwjidx0A        = 2*vdwtype[jnrA+0];
887             vdwjidx0B        = 2*vdwtype[jnrB+0];
888
889             fjx0             = _fjsp_setzero_v2r8();
890             fjy0             = _fjsp_setzero_v2r8();
891             fjz0             = _fjsp_setzero_v2r8();
892
893             /**************************
894              * CALCULATE INTERACTIONS *
895              **************************/
896
897             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
898
899             /* Compute parameters for interactions between i and j atoms */
900             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
901                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
902
903             /* Calculate table index by multiplying r with table scale and truncate to integer */
904             rt               = _fjsp_mul_v2r8(r00,vftabscale);
905             itab_tmp         = _fjsp_dtox_v2r8(rt);
906             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
907             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
908             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
909
910             vfconv.i[0]     *= 12;
911             vfconv.i[1]     *= 12;
912
913             /* CUBIC SPLINE TABLE DISPERSION */
914             vfconv.i[0]       += 4;
915             vfconv.i[1]       += 4;
916             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
917             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
918             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
919             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
920             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
921             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
922             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
923             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
924             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
925
926             /* CUBIC SPLINE TABLE REPULSION */
927             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
928             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
929             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
930             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
931             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
932             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
933             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
934             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
935             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
936             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
937
938             fscal            = fvdw;
939
940             /* Update vectorial force */
941             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
942             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
943             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
944             
945             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
946             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
947             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
948
949             /**************************
950              * CALCULATE INTERACTIONS *
951              **************************/
952
953             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
954
955             /* Compute parameters for interactions between i and j atoms */
956             qq10             = _fjsp_mul_v2r8(iq1,jq0);
957
958             /* Calculate table index by multiplying r with table scale and truncate to integer */
959             rt               = _fjsp_mul_v2r8(r10,vftabscale);
960             itab_tmp         = _fjsp_dtox_v2r8(rt);
961             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
962             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
963             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
964
965             vfconv.i[0]     *= 12;
966             vfconv.i[1]     *= 12;
967
968             /* CUBIC SPLINE TABLE ELECTROSTATICS */
969             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
970             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
971             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
972             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
973             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
974             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
975             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
976             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
977             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
978
979             fscal            = felec;
980
981             /* Update vectorial force */
982             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
983             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
984             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
985             
986             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
987             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
988             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
989
990             /**************************
991              * CALCULATE INTERACTIONS *
992              **************************/
993
994             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
995
996             /* Compute parameters for interactions between i and j atoms */
997             qq20             = _fjsp_mul_v2r8(iq2,jq0);
998
999             /* Calculate table index by multiplying r with table scale and truncate to integer */
1000             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1001             itab_tmp         = _fjsp_dtox_v2r8(rt);
1002             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1003             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1004             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1005
1006             vfconv.i[0]     *= 12;
1007             vfconv.i[1]     *= 12;
1008
1009             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1010             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1011             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1012             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1013             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1014             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1015             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1016             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1017             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1018             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1019
1020             fscal            = felec;
1021
1022             /* Update vectorial force */
1023             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1024             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1025             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1026             
1027             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1028             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1029             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1030
1031             /**************************
1032              * CALCULATE INTERACTIONS *
1033              **************************/
1034
1035             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
1036
1037             /* Compute parameters for interactions between i and j atoms */
1038             qq30             = _fjsp_mul_v2r8(iq3,jq0);
1039
1040             /* Calculate table index by multiplying r with table scale and truncate to integer */
1041             rt               = _fjsp_mul_v2r8(r30,vftabscale);
1042             itab_tmp         = _fjsp_dtox_v2r8(rt);
1043             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1044             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1045             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1046
1047             vfconv.i[0]     *= 12;
1048             vfconv.i[1]     *= 12;
1049
1050             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1051             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1052             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1053             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1054             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1055             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1056             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1057             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1058             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1059             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1060
1061             fscal            = felec;
1062
1063             /* Update vectorial force */
1064             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
1065             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1066             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1067             
1068             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1069             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1070             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1071
1072             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1073
1074             /* Inner loop uses 180 flops */
1075         }
1076
1077         if(jidx<j_index_end)
1078         {
1079
1080             jnrA             = jjnr[jidx];
1081             j_coord_offsetA  = DIM*jnrA;
1082
1083             /* load j atom coordinates */
1084             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1085                                               &jx0,&jy0,&jz0);
1086
1087             /* Calculate displacement vector */
1088             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1089             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1090             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1091             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1092             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1093             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1094             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1095             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1096             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1097             dx30             = _fjsp_sub_v2r8(ix3,jx0);
1098             dy30             = _fjsp_sub_v2r8(iy3,jy0);
1099             dz30             = _fjsp_sub_v2r8(iz3,jz0);
1100
1101             /* Calculate squared distance and things based on it */
1102             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1103             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1104             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1105             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1106
1107             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1108             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1109             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1110             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
1111
1112             /* Load parameters for j particles */
1113             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1114             vdwjidx0A        = 2*vdwtype[jnrA+0];
1115
1116             fjx0             = _fjsp_setzero_v2r8();
1117             fjy0             = _fjsp_setzero_v2r8();
1118             fjz0             = _fjsp_setzero_v2r8();
1119
1120             /**************************
1121              * CALCULATE INTERACTIONS *
1122              **************************/
1123
1124             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1125
1126             /* Compute parameters for interactions between i and j atoms */
1127             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
1128                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
1129
1130             /* Calculate table index by multiplying r with table scale and truncate to integer */
1131             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1132             itab_tmp         = _fjsp_dtox_v2r8(rt);
1133             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1134             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1135             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1136
1137             vfconv.i[0]     *= 12;
1138             vfconv.i[1]     *= 12;
1139
1140             /* CUBIC SPLINE TABLE DISPERSION */
1141             vfconv.i[0]       += 4;
1142             vfconv.i[1]       += 4;
1143             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1144             F                = _fjsp_setzero_v2r8();
1145             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1146             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1147             H                = _fjsp_setzero_v2r8();
1148             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1149             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1150             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1151             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1152
1153             /* CUBIC SPLINE TABLE REPULSION */
1154             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1155             F                = _fjsp_setzero_v2r8();
1156             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1157             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1158             H                = _fjsp_setzero_v2r8();
1159             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1160             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1161             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1162             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1163             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1164
1165             fscal            = fvdw;
1166
1167             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1168
1169             /* Update vectorial force */
1170             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1171             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1172             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1173             
1174             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1175             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1176             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1177
1178             /**************************
1179              * CALCULATE INTERACTIONS *
1180              **************************/
1181
1182             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
1183
1184             /* Compute parameters for interactions between i and j atoms */
1185             qq10             = _fjsp_mul_v2r8(iq1,jq0);
1186
1187             /* Calculate table index by multiplying r with table scale and truncate to integer */
1188             rt               = _fjsp_mul_v2r8(r10,vftabscale);
1189             itab_tmp         = _fjsp_dtox_v2r8(rt);
1190             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1191             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1192             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1193
1194             vfconv.i[0]     *= 12;
1195             vfconv.i[1]     *= 12;
1196
1197             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1198             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1199             F                = _fjsp_setzero_v2r8();
1200             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1201             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1202             H                = _fjsp_setzero_v2r8();
1203             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1204             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1205             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1206             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1207
1208             fscal            = felec;
1209
1210             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1211
1212             /* Update vectorial force */
1213             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1214             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1215             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1216             
1217             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1218             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1219             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1220
1221             /**************************
1222              * CALCULATE INTERACTIONS *
1223              **************************/
1224
1225             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
1226
1227             /* Compute parameters for interactions between i and j atoms */
1228             qq20             = _fjsp_mul_v2r8(iq2,jq0);
1229
1230             /* Calculate table index by multiplying r with table scale and truncate to integer */
1231             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1232             itab_tmp         = _fjsp_dtox_v2r8(rt);
1233             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1234             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1235             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1236
1237             vfconv.i[0]     *= 12;
1238             vfconv.i[1]     *= 12;
1239
1240             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1241             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1242             F                = _fjsp_setzero_v2r8();
1243             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1244             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1245             H                = _fjsp_setzero_v2r8();
1246             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1247             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1248             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1249             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1250
1251             fscal            = felec;
1252
1253             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1254
1255             /* Update vectorial force */
1256             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1257             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1258             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1259             
1260             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1261             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1262             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1263
1264             /**************************
1265              * CALCULATE INTERACTIONS *
1266              **************************/
1267
1268             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
1269
1270             /* Compute parameters for interactions between i and j atoms */
1271             qq30             = _fjsp_mul_v2r8(iq3,jq0);
1272
1273             /* Calculate table index by multiplying r with table scale and truncate to integer */
1274             rt               = _fjsp_mul_v2r8(r30,vftabscale);
1275             itab_tmp         = _fjsp_dtox_v2r8(rt);
1276             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1277             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1278             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1279
1280             vfconv.i[0]     *= 12;
1281             vfconv.i[1]     *= 12;
1282
1283             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1284             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1285             F                = _fjsp_setzero_v2r8();
1286             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1287             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1288             H                = _fjsp_setzero_v2r8();
1289             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1290             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1291             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1292             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1293
1294             fscal            = felec;
1295
1296             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1297
1298             /* Update vectorial force */
1299             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
1300             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1301             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1302             
1303             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1304             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1305             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1306
1307             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1308
1309             /* Inner loop uses 180 flops */
1310         }
1311
1312         /* End of innermost loop */
1313
1314         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1315                                               f+i_coord_offset,fshift+i_shift_offset);
1316
1317         /* Increment number of inner iterations */
1318         inneriter                  += j_index_end - j_index_start;
1319
1320         /* Outer loop uses 24 flops */
1321     }
1322
1323     /* Increment number of outer iterations */
1324     outeriter        += nri;
1325
1326     /* Update outer/inner flops */
1327
1328     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);
1329 }