Introduce gmxpre.h for truly global definitions
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS 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/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
48
49 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: CubicSplineTable
54  * VdW interaction:            CubicSplineTable
55  * Geometry:                   Water4-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_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              vdwioffset3;
88     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89     int              vdwjidx0A,vdwjidx0B;
90     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
93     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
94     _fjsp_v2r8       dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
95     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
96     real             *charge;
97     int              nvdwtype;
98     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
99     int              *vdwtype;
100     real             *vdwparam;
101     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
102     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
103     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
104     real             *vftab;
105     _fjsp_v2r8       itab_tmp;
106     _fjsp_v2r8       dummy_mask,cutoff_mask;
107     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
108     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
109     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
110
111     x                = xx[0];
112     f                = ff[0];
113
114     nri              = nlist->nri;
115     iinr             = nlist->iinr;
116     jindex           = nlist->jindex;
117     jjnr             = nlist->jjnr;
118     shiftidx         = nlist->shift;
119     gid              = nlist->gid;
120     shiftvec         = fr->shift_vec[0];
121     fshift           = fr->fshift[0];
122     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
123     charge           = mdatoms->chargeA;
124     nvdwtype         = fr->ntype;
125     vdwparam         = fr->nbfp;
126     vdwtype          = mdatoms->typeA;
127
128     vftab            = kernel_data->table_elec_vdw->data;
129     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
130
131     /* Setup water-specific parameters */
132     inr              = nlist->iinr[0];
133     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
134     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
135     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
136     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
137
138     /* Avoid stupid compiler warnings */
139     jnrA = jnrB = 0;
140     j_coord_offsetA = 0;
141     j_coord_offsetB = 0;
142
143     outeriter        = 0;
144     inneriter        = 0;
145
146     /* Start outer loop over neighborlists */
147     for(iidx=0; iidx<nri; iidx++)
148     {
149         /* Load shift vector for this list */
150         i_shift_offset   = DIM*shiftidx[iidx];
151
152         /* Load limits for loop over neighbors */
153         j_index_start    = jindex[iidx];
154         j_index_end      = jindex[iidx+1];
155
156         /* Get outer coordinate index */
157         inr              = iinr[iidx];
158         i_coord_offset   = DIM*inr;
159
160         /* Load i particle coords and add shift vector */
161         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
162                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
163
164         fix0             = _fjsp_setzero_v2r8();
165         fiy0             = _fjsp_setzero_v2r8();
166         fiz0             = _fjsp_setzero_v2r8();
167         fix1             = _fjsp_setzero_v2r8();
168         fiy1             = _fjsp_setzero_v2r8();
169         fiz1             = _fjsp_setzero_v2r8();
170         fix2             = _fjsp_setzero_v2r8();
171         fiy2             = _fjsp_setzero_v2r8();
172         fiz2             = _fjsp_setzero_v2r8();
173         fix3             = _fjsp_setzero_v2r8();
174         fiy3             = _fjsp_setzero_v2r8();
175         fiz3             = _fjsp_setzero_v2r8();
176
177         /* Reset potential sums */
178         velecsum         = _fjsp_setzero_v2r8();
179         vvdwsum          = _fjsp_setzero_v2r8();
180
181         /* Start inner kernel loop */
182         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
183         {
184
185             /* Get j neighbor index, and coordinate index */
186             jnrA             = jjnr[jidx];
187             jnrB             = jjnr[jidx+1];
188             j_coord_offsetA  = DIM*jnrA;
189             j_coord_offsetB  = DIM*jnrB;
190
191             /* load j atom coordinates */
192             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
193                                               &jx0,&jy0,&jz0);
194
195             /* Calculate displacement vector */
196             dx00             = _fjsp_sub_v2r8(ix0,jx0);
197             dy00             = _fjsp_sub_v2r8(iy0,jy0);
198             dz00             = _fjsp_sub_v2r8(iz0,jz0);
199             dx10             = _fjsp_sub_v2r8(ix1,jx0);
200             dy10             = _fjsp_sub_v2r8(iy1,jy0);
201             dz10             = _fjsp_sub_v2r8(iz1,jz0);
202             dx20             = _fjsp_sub_v2r8(ix2,jx0);
203             dy20             = _fjsp_sub_v2r8(iy2,jy0);
204             dz20             = _fjsp_sub_v2r8(iz2,jz0);
205             dx30             = _fjsp_sub_v2r8(ix3,jx0);
206             dy30             = _fjsp_sub_v2r8(iy3,jy0);
207             dz30             = _fjsp_sub_v2r8(iz3,jz0);
208
209             /* Calculate squared distance and things based on it */
210             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
211             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
212             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
213             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
214
215             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
216             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
217             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
218             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
219
220             /* Load parameters for j particles */
221             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
222             vdwjidx0A        = 2*vdwtype[jnrA+0];
223             vdwjidx0B        = 2*vdwtype[jnrB+0];
224
225             fjx0             = _fjsp_setzero_v2r8();
226             fjy0             = _fjsp_setzero_v2r8();
227             fjz0             = _fjsp_setzero_v2r8();
228
229             /**************************
230              * CALCULATE INTERACTIONS *
231              **************************/
232
233             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
234
235             /* Compute parameters for interactions between i and j atoms */
236             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
237                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
238
239             /* Calculate table index by multiplying r with table scale and truncate to integer */
240             rt               = _fjsp_mul_v2r8(r00,vftabscale);
241             itab_tmp         = _fjsp_dtox_v2r8(rt);
242             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
243             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
244             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
245
246             vfconv.i[0]     *= 12;
247             vfconv.i[1]     *= 12;
248
249             /* CUBIC SPLINE TABLE DISPERSION */
250             vfconv.i[0]       += 4;
251             vfconv.i[1]       += 4;
252             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
253             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
254             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
255             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
256             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
257             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
258             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
259             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
260             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
261             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
262             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
263
264             /* CUBIC SPLINE TABLE REPULSION */
265             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
266             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
267             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
268             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
269             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
270             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
271             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
272             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
273             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
274             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
275             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
276             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
277             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
278
279             /* Update potential sum for this i atom from the interaction with this j atom. */
280             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
281
282             fscal            = fvdw;
283
284             /* Update vectorial force */
285             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
286             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
287             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
288             
289             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
290             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
291             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
292
293             /**************************
294              * CALCULATE INTERACTIONS *
295              **************************/
296
297             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
298
299             /* Compute parameters for interactions between i and j atoms */
300             qq10             = _fjsp_mul_v2r8(iq1,jq0);
301
302             /* Calculate table index by multiplying r with table scale and truncate to integer */
303             rt               = _fjsp_mul_v2r8(r10,vftabscale);
304             itab_tmp         = _fjsp_dtox_v2r8(rt);
305             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
306             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
307             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
308
309             vfconv.i[0]     *= 12;
310             vfconv.i[1]     *= 12;
311
312             /* CUBIC SPLINE TABLE ELECTROSTATICS */
313             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
314             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
315             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
316             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
317             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
318             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
319             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
320             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
321             velec            = _fjsp_mul_v2r8(qq10,VV);
322             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
323             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
324
325             /* Update potential sum for this i atom from the interaction with this j atom. */
326             velecsum         = _fjsp_add_v2r8(velecsum,velec);
327
328             fscal            = felec;
329
330             /* Update vectorial force */
331             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
332             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
333             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
334             
335             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
336             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
337             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
338
339             /**************************
340              * CALCULATE INTERACTIONS *
341              **************************/
342
343             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
344
345             /* Compute parameters for interactions between i and j atoms */
346             qq20             = _fjsp_mul_v2r8(iq2,jq0);
347
348             /* Calculate table index by multiplying r with table scale and truncate to integer */
349             rt               = _fjsp_mul_v2r8(r20,vftabscale);
350             itab_tmp         = _fjsp_dtox_v2r8(rt);
351             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
352             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
353             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
354
355             vfconv.i[0]     *= 12;
356             vfconv.i[1]     *= 12;
357
358             /* CUBIC SPLINE TABLE ELECTROSTATICS */
359             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
360             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
361             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
362             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
363             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
364             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
365             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
366             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
367             velec            = _fjsp_mul_v2r8(qq20,VV);
368             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
369             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
370
371             /* Update potential sum for this i atom from the interaction with this j atom. */
372             velecsum         = _fjsp_add_v2r8(velecsum,velec);
373
374             fscal            = felec;
375
376             /* Update vectorial force */
377             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
378             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
379             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
380             
381             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
382             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
383             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
384
385             /**************************
386              * CALCULATE INTERACTIONS *
387              **************************/
388
389             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
390
391             /* Compute parameters for interactions between i and j atoms */
392             qq30             = _fjsp_mul_v2r8(iq3,jq0);
393
394             /* Calculate table index by multiplying r with table scale and truncate to integer */
395             rt               = _fjsp_mul_v2r8(r30,vftabscale);
396             itab_tmp         = _fjsp_dtox_v2r8(rt);
397             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
398             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
399             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
400
401             vfconv.i[0]     *= 12;
402             vfconv.i[1]     *= 12;
403
404             /* CUBIC SPLINE TABLE ELECTROSTATICS */
405             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
406             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
407             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
408             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
409             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
410             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
411             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
412             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
413             velec            = _fjsp_mul_v2r8(qq30,VV);
414             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
415             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
416
417             /* Update potential sum for this i atom from the interaction with this j atom. */
418             velecsum         = _fjsp_add_v2r8(velecsum,velec);
419
420             fscal            = felec;
421
422             /* Update vectorial force */
423             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
424             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
425             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
426             
427             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
428             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
429             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
430
431             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
432
433             /* Inner loop uses 200 flops */
434         }
435
436         if(jidx<j_index_end)
437         {
438
439             jnrA             = jjnr[jidx];
440             j_coord_offsetA  = DIM*jnrA;
441
442             /* load j atom coordinates */
443             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
444                                               &jx0,&jy0,&jz0);
445
446             /* Calculate displacement vector */
447             dx00             = _fjsp_sub_v2r8(ix0,jx0);
448             dy00             = _fjsp_sub_v2r8(iy0,jy0);
449             dz00             = _fjsp_sub_v2r8(iz0,jz0);
450             dx10             = _fjsp_sub_v2r8(ix1,jx0);
451             dy10             = _fjsp_sub_v2r8(iy1,jy0);
452             dz10             = _fjsp_sub_v2r8(iz1,jz0);
453             dx20             = _fjsp_sub_v2r8(ix2,jx0);
454             dy20             = _fjsp_sub_v2r8(iy2,jy0);
455             dz20             = _fjsp_sub_v2r8(iz2,jz0);
456             dx30             = _fjsp_sub_v2r8(ix3,jx0);
457             dy30             = _fjsp_sub_v2r8(iy3,jy0);
458             dz30             = _fjsp_sub_v2r8(iz3,jz0);
459
460             /* Calculate squared distance and things based on it */
461             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
462             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
463             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
464             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
465
466             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
467             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
468             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
469             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
470
471             /* Load parameters for j particles */
472             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
473             vdwjidx0A        = 2*vdwtype[jnrA+0];
474
475             fjx0             = _fjsp_setzero_v2r8();
476             fjy0             = _fjsp_setzero_v2r8();
477             fjz0             = _fjsp_setzero_v2r8();
478
479             /**************************
480              * CALCULATE INTERACTIONS *
481              **************************/
482
483             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
484
485             /* Compute parameters for interactions between i and j atoms */
486             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
487
488             /* Calculate table index by multiplying r with table scale and truncate to integer */
489             rt               = _fjsp_mul_v2r8(r00,vftabscale);
490             itab_tmp         = _fjsp_dtox_v2r8(rt);
491             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
492             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
493             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
494
495             vfconv.i[0]     *= 12;
496             vfconv.i[1]     *= 12;
497
498             /* CUBIC SPLINE TABLE DISPERSION */
499             vfconv.i[0]       += 4;
500             vfconv.i[1]       += 4;
501             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
502             F                = _fjsp_setzero_v2r8();
503             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
504             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
505             H                = _fjsp_setzero_v2r8();
506             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
507             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
508             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
509             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
510             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
511             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
512
513             /* CUBIC SPLINE TABLE REPULSION */
514             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
515             F                = _fjsp_setzero_v2r8();
516             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
517             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
518             H                = _fjsp_setzero_v2r8();
519             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
520             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
521             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
522             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
523             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
524             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
525             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
526             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
527
528             /* Update potential sum for this i atom from the interaction with this j atom. */
529             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
530             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
531
532             fscal            = fvdw;
533
534             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
535
536             /* Update vectorial force */
537             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
538             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
539             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
540             
541             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
542             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
543             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
544
545             /**************************
546              * CALCULATE INTERACTIONS *
547              **************************/
548
549             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
550
551             /* Compute parameters for interactions between i and j atoms */
552             qq10             = _fjsp_mul_v2r8(iq1,jq0);
553
554             /* Calculate table index by multiplying r with table scale and truncate to integer */
555             rt               = _fjsp_mul_v2r8(r10,vftabscale);
556             itab_tmp         = _fjsp_dtox_v2r8(rt);
557             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
558             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
559             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
560
561             vfconv.i[0]     *= 12;
562             vfconv.i[1]     *= 12;
563
564             /* CUBIC SPLINE TABLE ELECTROSTATICS */
565             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
566             F                = _fjsp_setzero_v2r8();
567             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
568             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
569             H                = _fjsp_setzero_v2r8();
570             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
571             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
572             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
573             velec            = _fjsp_mul_v2r8(qq10,VV);
574             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
575             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
576
577             /* Update potential sum for this i atom from the interaction with this j atom. */
578             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
579             velecsum         = _fjsp_add_v2r8(velecsum,velec);
580
581             fscal            = felec;
582
583             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
584
585             /* Update vectorial force */
586             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
587             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
588             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
589             
590             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
591             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
592             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
593
594             /**************************
595              * CALCULATE INTERACTIONS *
596              **************************/
597
598             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
599
600             /* Compute parameters for interactions between i and j atoms */
601             qq20             = _fjsp_mul_v2r8(iq2,jq0);
602
603             /* Calculate table index by multiplying r with table scale and truncate to integer */
604             rt               = _fjsp_mul_v2r8(r20,vftabscale);
605             itab_tmp         = _fjsp_dtox_v2r8(rt);
606             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
607             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
608             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
609
610             vfconv.i[0]     *= 12;
611             vfconv.i[1]     *= 12;
612
613             /* CUBIC SPLINE TABLE ELECTROSTATICS */
614             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
615             F                = _fjsp_setzero_v2r8();
616             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
617             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
618             H                = _fjsp_setzero_v2r8();
619             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
620             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
621             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
622             velec            = _fjsp_mul_v2r8(qq20,VV);
623             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
624             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
625
626             /* Update potential sum for this i atom from the interaction with this j atom. */
627             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
628             velecsum         = _fjsp_add_v2r8(velecsum,velec);
629
630             fscal            = felec;
631
632             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
633
634             /* Update vectorial force */
635             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
636             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
637             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
638             
639             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
640             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
641             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
642
643             /**************************
644              * CALCULATE INTERACTIONS *
645              **************************/
646
647             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
648
649             /* Compute parameters for interactions between i and j atoms */
650             qq30             = _fjsp_mul_v2r8(iq3,jq0);
651
652             /* Calculate table index by multiplying r with table scale and truncate to integer */
653             rt               = _fjsp_mul_v2r8(r30,vftabscale);
654             itab_tmp         = _fjsp_dtox_v2r8(rt);
655             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
656             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
657             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
658
659             vfconv.i[0]     *= 12;
660             vfconv.i[1]     *= 12;
661
662             /* CUBIC SPLINE TABLE ELECTROSTATICS */
663             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
664             F                = _fjsp_setzero_v2r8();
665             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
666             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
667             H                = _fjsp_setzero_v2r8();
668             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
669             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
670             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
671             velec            = _fjsp_mul_v2r8(qq30,VV);
672             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
673             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
674
675             /* Update potential sum for this i atom from the interaction with this j atom. */
676             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
677             velecsum         = _fjsp_add_v2r8(velecsum,velec);
678
679             fscal            = felec;
680
681             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
682
683             /* Update vectorial force */
684             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
685             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
686             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
687             
688             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
689             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
690             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
691
692             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
693
694             /* Inner loop uses 200 flops */
695         }
696
697         /* End of innermost loop */
698
699         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
700                                               f+i_coord_offset,fshift+i_shift_offset);
701
702         ggid                        = gid[iidx];
703         /* Update potential energies */
704         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
705         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
706
707         /* Increment number of inner iterations */
708         inneriter                  += j_index_end - j_index_start;
709
710         /* Outer loop uses 26 flops */
711     }
712
713     /* Increment number of outer iterations */
714     outeriter        += nri;
715
716     /* Update outer/inner flops */
717
718     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*200);
719 }
720 /*
721  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
722  * Electrostatics interaction: CubicSplineTable
723  * VdW interaction:            CubicSplineTable
724  * Geometry:                   Water4-Particle
725  * Calculate force/pot:        Force
726  */
727 void
728 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
729                     (t_nblist                    * gmx_restrict       nlist,
730                      rvec                        * gmx_restrict          xx,
731                      rvec                        * gmx_restrict          ff,
732                      t_forcerec                  * gmx_restrict          fr,
733                      t_mdatoms                   * gmx_restrict     mdatoms,
734                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
735                      t_nrnb                      * gmx_restrict        nrnb)
736 {
737     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
738      * just 0 for non-waters.
739      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
740      * jnr indices corresponding to data put in the four positions in the SIMD register.
741      */
742     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
743     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
744     int              jnrA,jnrB;
745     int              j_coord_offsetA,j_coord_offsetB;
746     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
747     real             rcutoff_scalar;
748     real             *shiftvec,*fshift,*x,*f;
749     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
750     int              vdwioffset0;
751     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
752     int              vdwioffset1;
753     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
754     int              vdwioffset2;
755     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
756     int              vdwioffset3;
757     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
758     int              vdwjidx0A,vdwjidx0B;
759     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
760     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
761     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
762     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
763     _fjsp_v2r8       dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
764     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
765     real             *charge;
766     int              nvdwtype;
767     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
768     int              *vdwtype;
769     real             *vdwparam;
770     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
771     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
772     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
773     real             *vftab;
774     _fjsp_v2r8       itab_tmp;
775     _fjsp_v2r8       dummy_mask,cutoff_mask;
776     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
777     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
778     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
779
780     x                = xx[0];
781     f                = ff[0];
782
783     nri              = nlist->nri;
784     iinr             = nlist->iinr;
785     jindex           = nlist->jindex;
786     jjnr             = nlist->jjnr;
787     shiftidx         = nlist->shift;
788     gid              = nlist->gid;
789     shiftvec         = fr->shift_vec[0];
790     fshift           = fr->fshift[0];
791     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
792     charge           = mdatoms->chargeA;
793     nvdwtype         = fr->ntype;
794     vdwparam         = fr->nbfp;
795     vdwtype          = mdatoms->typeA;
796
797     vftab            = kernel_data->table_elec_vdw->data;
798     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
799
800     /* Setup water-specific parameters */
801     inr              = nlist->iinr[0];
802     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
803     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
804     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
805     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
806
807     /* Avoid stupid compiler warnings */
808     jnrA = jnrB = 0;
809     j_coord_offsetA = 0;
810     j_coord_offsetB = 0;
811
812     outeriter        = 0;
813     inneriter        = 0;
814
815     /* Start outer loop over neighborlists */
816     for(iidx=0; iidx<nri; iidx++)
817     {
818         /* Load shift vector for this list */
819         i_shift_offset   = DIM*shiftidx[iidx];
820
821         /* Load limits for loop over neighbors */
822         j_index_start    = jindex[iidx];
823         j_index_end      = jindex[iidx+1];
824
825         /* Get outer coordinate index */
826         inr              = iinr[iidx];
827         i_coord_offset   = DIM*inr;
828
829         /* Load i particle coords and add shift vector */
830         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
831                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
832
833         fix0             = _fjsp_setzero_v2r8();
834         fiy0             = _fjsp_setzero_v2r8();
835         fiz0             = _fjsp_setzero_v2r8();
836         fix1             = _fjsp_setzero_v2r8();
837         fiy1             = _fjsp_setzero_v2r8();
838         fiz1             = _fjsp_setzero_v2r8();
839         fix2             = _fjsp_setzero_v2r8();
840         fiy2             = _fjsp_setzero_v2r8();
841         fiz2             = _fjsp_setzero_v2r8();
842         fix3             = _fjsp_setzero_v2r8();
843         fiy3             = _fjsp_setzero_v2r8();
844         fiz3             = _fjsp_setzero_v2r8();
845
846         /* Start inner kernel loop */
847         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
848         {
849
850             /* Get j neighbor index, and coordinate index */
851             jnrA             = jjnr[jidx];
852             jnrB             = jjnr[jidx+1];
853             j_coord_offsetA  = DIM*jnrA;
854             j_coord_offsetB  = DIM*jnrB;
855
856             /* load j atom coordinates */
857             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
858                                               &jx0,&jy0,&jz0);
859
860             /* Calculate displacement vector */
861             dx00             = _fjsp_sub_v2r8(ix0,jx0);
862             dy00             = _fjsp_sub_v2r8(iy0,jy0);
863             dz00             = _fjsp_sub_v2r8(iz0,jz0);
864             dx10             = _fjsp_sub_v2r8(ix1,jx0);
865             dy10             = _fjsp_sub_v2r8(iy1,jy0);
866             dz10             = _fjsp_sub_v2r8(iz1,jz0);
867             dx20             = _fjsp_sub_v2r8(ix2,jx0);
868             dy20             = _fjsp_sub_v2r8(iy2,jy0);
869             dz20             = _fjsp_sub_v2r8(iz2,jz0);
870             dx30             = _fjsp_sub_v2r8(ix3,jx0);
871             dy30             = _fjsp_sub_v2r8(iy3,jy0);
872             dz30             = _fjsp_sub_v2r8(iz3,jz0);
873
874             /* Calculate squared distance and things based on it */
875             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
876             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
877             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
878             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
879
880             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
881             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
882             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
883             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
884
885             /* Load parameters for j particles */
886             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
887             vdwjidx0A        = 2*vdwtype[jnrA+0];
888             vdwjidx0B        = 2*vdwtype[jnrB+0];
889
890             fjx0             = _fjsp_setzero_v2r8();
891             fjy0             = _fjsp_setzero_v2r8();
892             fjz0             = _fjsp_setzero_v2r8();
893
894             /**************************
895              * CALCULATE INTERACTIONS *
896              **************************/
897
898             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
899
900             /* Compute parameters for interactions between i and j atoms */
901             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
902                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
903
904             /* Calculate table index by multiplying r with table scale and truncate to integer */
905             rt               = _fjsp_mul_v2r8(r00,vftabscale);
906             itab_tmp         = _fjsp_dtox_v2r8(rt);
907             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
908             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
909             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
910
911             vfconv.i[0]     *= 12;
912             vfconv.i[1]     *= 12;
913
914             /* CUBIC SPLINE TABLE DISPERSION */
915             vfconv.i[0]       += 4;
916             vfconv.i[1]       += 4;
917             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
918             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
919             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
920             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
921             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
922             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
923             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
924             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
925             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
926
927             /* CUBIC SPLINE TABLE REPULSION */
928             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
929             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
930             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
931             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
932             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
933             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
934             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
935             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
936             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
937             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
938
939             fscal            = fvdw;
940
941             /* Update vectorial force */
942             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
943             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
944             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
945             
946             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
947             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
948             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
949
950             /**************************
951              * CALCULATE INTERACTIONS *
952              **************************/
953
954             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
955
956             /* Compute parameters for interactions between i and j atoms */
957             qq10             = _fjsp_mul_v2r8(iq1,jq0);
958
959             /* Calculate table index by multiplying r with table scale and truncate to integer */
960             rt               = _fjsp_mul_v2r8(r10,vftabscale);
961             itab_tmp         = _fjsp_dtox_v2r8(rt);
962             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
963             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
964             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
965
966             vfconv.i[0]     *= 12;
967             vfconv.i[1]     *= 12;
968
969             /* CUBIC SPLINE TABLE ELECTROSTATICS */
970             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
971             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
972             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
973             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
974             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
975             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
976             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
977             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
978             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
979
980             fscal            = felec;
981
982             /* Update vectorial force */
983             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
984             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
985             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
986             
987             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
988             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
989             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
990
991             /**************************
992              * CALCULATE INTERACTIONS *
993              **************************/
994
995             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
996
997             /* Compute parameters for interactions between i and j atoms */
998             qq20             = _fjsp_mul_v2r8(iq2,jq0);
999
1000             /* Calculate table index by multiplying r with table scale and truncate to integer */
1001             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1002             itab_tmp         = _fjsp_dtox_v2r8(rt);
1003             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1004             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1005             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1006
1007             vfconv.i[0]     *= 12;
1008             vfconv.i[1]     *= 12;
1009
1010             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1011             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1012             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1013             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1014             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1015             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1016             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1017             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1018             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1019             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1020
1021             fscal            = felec;
1022
1023             /* Update vectorial force */
1024             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1025             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1026             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1027             
1028             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1029             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1030             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1031
1032             /**************************
1033              * CALCULATE INTERACTIONS *
1034              **************************/
1035
1036             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
1037
1038             /* Compute parameters for interactions between i and j atoms */
1039             qq30             = _fjsp_mul_v2r8(iq3,jq0);
1040
1041             /* Calculate table index by multiplying r with table scale and truncate to integer */
1042             rt               = _fjsp_mul_v2r8(r30,vftabscale);
1043             itab_tmp         = _fjsp_dtox_v2r8(rt);
1044             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1045             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1046             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1047
1048             vfconv.i[0]     *= 12;
1049             vfconv.i[1]     *= 12;
1050
1051             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1052             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1053             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1054             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1055             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1056             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1057             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1058             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1059             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1060             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1061
1062             fscal            = felec;
1063
1064             /* Update vectorial force */
1065             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
1066             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1067             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1068             
1069             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1070             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1071             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1072
1073             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1074
1075             /* Inner loop uses 180 flops */
1076         }
1077
1078         if(jidx<j_index_end)
1079         {
1080
1081             jnrA             = jjnr[jidx];
1082             j_coord_offsetA  = DIM*jnrA;
1083
1084             /* load j atom coordinates */
1085             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1086                                               &jx0,&jy0,&jz0);
1087
1088             /* Calculate displacement vector */
1089             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1090             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1091             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1092             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1093             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1094             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1095             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1096             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1097             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1098             dx30             = _fjsp_sub_v2r8(ix3,jx0);
1099             dy30             = _fjsp_sub_v2r8(iy3,jy0);
1100             dz30             = _fjsp_sub_v2r8(iz3,jz0);
1101
1102             /* Calculate squared distance and things based on it */
1103             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1104             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1105             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1106             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1107
1108             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1109             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1110             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1111             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
1112
1113             /* Load parameters for j particles */
1114             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1115             vdwjidx0A        = 2*vdwtype[jnrA+0];
1116
1117             fjx0             = _fjsp_setzero_v2r8();
1118             fjy0             = _fjsp_setzero_v2r8();
1119             fjz0             = _fjsp_setzero_v2r8();
1120
1121             /**************************
1122              * CALCULATE INTERACTIONS *
1123              **************************/
1124
1125             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1126
1127             /* Compute parameters for interactions between i and j atoms */
1128             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&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 }