Remove all unnecessary HAVE_CONFIG_H
[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 "config.h"
39
40 #include <math.h>
41
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "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                      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->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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
485
486             /* Calculate table index by multiplying r with table scale and truncate to integer */
487             rt               = _fjsp_mul_v2r8(r00,vftabscale);
488             itab_tmp         = _fjsp_dtox_v2r8(rt);
489             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
490             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
491             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
492
493             vfconv.i[0]     *= 12;
494             vfconv.i[1]     *= 12;
495
496             /* CUBIC SPLINE TABLE DISPERSION */
497             vfconv.i[0]       += 4;
498             vfconv.i[1]       += 4;
499             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
500             F                = _fjsp_setzero_v2r8();
501             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
502             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
503             H                = _fjsp_setzero_v2r8();
504             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
505             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
506             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
507             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
508             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
509             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
510
511             /* CUBIC SPLINE TABLE REPULSION */
512             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
513             F                = _fjsp_setzero_v2r8();
514             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
515             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
516             H                = _fjsp_setzero_v2r8();
517             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
518             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
519             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
520             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
521             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
522             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
523             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
524             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
525
526             /* Update potential sum for this i atom from the interaction with this j atom. */
527             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
528             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
529
530             fscal            = fvdw;
531
532             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
533
534             /* Update vectorial force */
535             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
536             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
537             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
538             
539             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
540             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
541             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
542
543             /**************************
544              * CALCULATE INTERACTIONS *
545              **************************/
546
547             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
548
549             /* Compute parameters for interactions between i and j atoms */
550             qq10             = _fjsp_mul_v2r8(iq1,jq0);
551
552             /* Calculate table index by multiplying r with table scale and truncate to integer */
553             rt               = _fjsp_mul_v2r8(r10,vftabscale);
554             itab_tmp         = _fjsp_dtox_v2r8(rt);
555             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
556             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
557             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
558
559             vfconv.i[0]     *= 12;
560             vfconv.i[1]     *= 12;
561
562             /* CUBIC SPLINE TABLE ELECTROSTATICS */
563             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
564             F                = _fjsp_setzero_v2r8();
565             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
566             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
567             H                = _fjsp_setzero_v2r8();
568             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
569             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
570             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
571             velec            = _fjsp_mul_v2r8(qq10,VV);
572             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
573             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
574
575             /* Update potential sum for this i atom from the interaction with this j atom. */
576             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
577             velecsum         = _fjsp_add_v2r8(velecsum,velec);
578
579             fscal            = felec;
580
581             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
582
583             /* Update vectorial force */
584             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
585             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
586             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
587             
588             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
589             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
590             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
591
592             /**************************
593              * CALCULATE INTERACTIONS *
594              **************************/
595
596             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
597
598             /* Compute parameters for interactions between i and j atoms */
599             qq20             = _fjsp_mul_v2r8(iq2,jq0);
600
601             /* Calculate table index by multiplying r with table scale and truncate to integer */
602             rt               = _fjsp_mul_v2r8(r20,vftabscale);
603             itab_tmp         = _fjsp_dtox_v2r8(rt);
604             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
605             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
606             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
607
608             vfconv.i[0]     *= 12;
609             vfconv.i[1]     *= 12;
610
611             /* CUBIC SPLINE TABLE ELECTROSTATICS */
612             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
613             F                = _fjsp_setzero_v2r8();
614             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
615             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
616             H                = _fjsp_setzero_v2r8();
617             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
618             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
619             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
620             velec            = _fjsp_mul_v2r8(qq20,VV);
621             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
622             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
623
624             /* Update potential sum for this i atom from the interaction with this j atom. */
625             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
626             velecsum         = _fjsp_add_v2r8(velecsum,velec);
627
628             fscal            = felec;
629
630             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
631
632             /* Update vectorial force */
633             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
634             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
635             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
636             
637             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
638             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
639             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
640
641             /**************************
642              * CALCULATE INTERACTIONS *
643              **************************/
644
645             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
646
647             /* Compute parameters for interactions between i and j atoms */
648             qq30             = _fjsp_mul_v2r8(iq3,jq0);
649
650             /* Calculate table index by multiplying r with table scale and truncate to integer */
651             rt               = _fjsp_mul_v2r8(r30,vftabscale);
652             itab_tmp         = _fjsp_dtox_v2r8(rt);
653             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
654             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
655             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
656
657             vfconv.i[0]     *= 12;
658             vfconv.i[1]     *= 12;
659
660             /* CUBIC SPLINE TABLE ELECTROSTATICS */
661             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
662             F                = _fjsp_setzero_v2r8();
663             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
664             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
665             H                = _fjsp_setzero_v2r8();
666             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
667             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
668             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
669             velec            = _fjsp_mul_v2r8(qq30,VV);
670             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
671             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
672
673             /* Update potential sum for this i atom from the interaction with this j atom. */
674             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
675             velecsum         = _fjsp_add_v2r8(velecsum,velec);
676
677             fscal            = felec;
678
679             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
680
681             /* Update vectorial force */
682             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
683             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
684             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
685             
686             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
687             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
688             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
689
690             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
691
692             /* Inner loop uses 200 flops */
693         }
694
695         /* End of innermost loop */
696
697         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
698                                               f+i_coord_offset,fshift+i_shift_offset);
699
700         ggid                        = gid[iidx];
701         /* Update potential energies */
702         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
703         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
704
705         /* Increment number of inner iterations */
706         inneriter                  += j_index_end - j_index_start;
707
708         /* Outer loop uses 26 flops */
709     }
710
711     /* Increment number of outer iterations */
712     outeriter        += nri;
713
714     /* Update outer/inner flops */
715
716     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*200);
717 }
718 /*
719  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
720  * Electrostatics interaction: CubicSplineTable
721  * VdW interaction:            CubicSplineTable
722  * Geometry:                   Water4-Particle
723  * Calculate force/pot:        Force
724  */
725 void
726 nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sparc64_hpc_ace_double
727                     (t_nblist                    * gmx_restrict       nlist,
728                      rvec                        * gmx_restrict          xx,
729                      rvec                        * gmx_restrict          ff,
730                      t_forcerec                  * gmx_restrict          fr,
731                      t_mdatoms                   * gmx_restrict     mdatoms,
732                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
733                      t_nrnb                      * gmx_restrict        nrnb)
734 {
735     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
736      * just 0 for non-waters.
737      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
738      * jnr indices corresponding to data put in the four positions in the SIMD register.
739      */
740     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
741     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
742     int              jnrA,jnrB;
743     int              j_coord_offsetA,j_coord_offsetB;
744     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
745     real             rcutoff_scalar;
746     real             *shiftvec,*fshift,*x,*f;
747     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
748     int              vdwioffset0;
749     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
750     int              vdwioffset1;
751     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
752     int              vdwioffset2;
753     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
754     int              vdwioffset3;
755     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
756     int              vdwjidx0A,vdwjidx0B;
757     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
758     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
759     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
760     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
761     _fjsp_v2r8       dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
762     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
763     real             *charge;
764     int              nvdwtype;
765     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
766     int              *vdwtype;
767     real             *vdwparam;
768     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
769     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
770     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
771     real             *vftab;
772     _fjsp_v2r8       itab_tmp;
773     _fjsp_v2r8       dummy_mask,cutoff_mask;
774     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
775     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
776     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
777
778     x                = xx[0];
779     f                = ff[0];
780
781     nri              = nlist->nri;
782     iinr             = nlist->iinr;
783     jindex           = nlist->jindex;
784     jjnr             = nlist->jjnr;
785     shiftidx         = nlist->shift;
786     gid              = nlist->gid;
787     shiftvec         = fr->shift_vec[0];
788     fshift           = fr->fshift[0];
789     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
790     charge           = mdatoms->chargeA;
791     nvdwtype         = fr->ntype;
792     vdwparam         = fr->nbfp;
793     vdwtype          = mdatoms->typeA;
794
795     vftab            = kernel_data->table_elec_vdw->data;
796     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
797
798     /* Setup water-specific parameters */
799     inr              = nlist->iinr[0];
800     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
801     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
802     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
803     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
804
805     /* Avoid stupid compiler warnings */
806     jnrA = jnrB = 0;
807     j_coord_offsetA = 0;
808     j_coord_offsetB = 0;
809
810     outeriter        = 0;
811     inneriter        = 0;
812
813     /* Start outer loop over neighborlists */
814     for(iidx=0; iidx<nri; iidx++)
815     {
816         /* Load shift vector for this list */
817         i_shift_offset   = DIM*shiftidx[iidx];
818
819         /* Load limits for loop over neighbors */
820         j_index_start    = jindex[iidx];
821         j_index_end      = jindex[iidx+1];
822
823         /* Get outer coordinate index */
824         inr              = iinr[iidx];
825         i_coord_offset   = DIM*inr;
826
827         /* Load i particle coords and add shift vector */
828         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
829                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
830
831         fix0             = _fjsp_setzero_v2r8();
832         fiy0             = _fjsp_setzero_v2r8();
833         fiz0             = _fjsp_setzero_v2r8();
834         fix1             = _fjsp_setzero_v2r8();
835         fiy1             = _fjsp_setzero_v2r8();
836         fiz1             = _fjsp_setzero_v2r8();
837         fix2             = _fjsp_setzero_v2r8();
838         fiy2             = _fjsp_setzero_v2r8();
839         fiz2             = _fjsp_setzero_v2r8();
840         fix3             = _fjsp_setzero_v2r8();
841         fiy3             = _fjsp_setzero_v2r8();
842         fiz3             = _fjsp_setzero_v2r8();
843
844         /* Start inner kernel loop */
845         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
846         {
847
848             /* Get j neighbor index, and coordinate index */
849             jnrA             = jjnr[jidx];
850             jnrB             = jjnr[jidx+1];
851             j_coord_offsetA  = DIM*jnrA;
852             j_coord_offsetB  = DIM*jnrB;
853
854             /* load j atom coordinates */
855             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
856                                               &jx0,&jy0,&jz0);
857
858             /* Calculate displacement vector */
859             dx00             = _fjsp_sub_v2r8(ix0,jx0);
860             dy00             = _fjsp_sub_v2r8(iy0,jy0);
861             dz00             = _fjsp_sub_v2r8(iz0,jz0);
862             dx10             = _fjsp_sub_v2r8(ix1,jx0);
863             dy10             = _fjsp_sub_v2r8(iy1,jy0);
864             dz10             = _fjsp_sub_v2r8(iz1,jz0);
865             dx20             = _fjsp_sub_v2r8(ix2,jx0);
866             dy20             = _fjsp_sub_v2r8(iy2,jy0);
867             dz20             = _fjsp_sub_v2r8(iz2,jz0);
868             dx30             = _fjsp_sub_v2r8(ix3,jx0);
869             dy30             = _fjsp_sub_v2r8(iy3,jy0);
870             dz30             = _fjsp_sub_v2r8(iz3,jz0);
871
872             /* Calculate squared distance and things based on it */
873             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
874             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
875             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
876             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
877
878             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
879             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
880             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
881             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
882
883             /* Load parameters for j particles */
884             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
885             vdwjidx0A        = 2*vdwtype[jnrA+0];
886             vdwjidx0B        = 2*vdwtype[jnrB+0];
887
888             fjx0             = _fjsp_setzero_v2r8();
889             fjy0             = _fjsp_setzero_v2r8();
890             fjz0             = _fjsp_setzero_v2r8();
891
892             /**************************
893              * CALCULATE INTERACTIONS *
894              **************************/
895
896             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
897
898             /* Compute parameters for interactions between i and j atoms */
899             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
900                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
901
902             /* Calculate table index by multiplying r with table scale and truncate to integer */
903             rt               = _fjsp_mul_v2r8(r00,vftabscale);
904             itab_tmp         = _fjsp_dtox_v2r8(rt);
905             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
906             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
907             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
908
909             vfconv.i[0]     *= 12;
910             vfconv.i[1]     *= 12;
911
912             /* CUBIC SPLINE TABLE DISPERSION */
913             vfconv.i[0]       += 4;
914             vfconv.i[1]       += 4;
915             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
916             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
917             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
918             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
919             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
920             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
921             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
922             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
923             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
924
925             /* CUBIC SPLINE TABLE REPULSION */
926             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
927             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
928             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
929             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
930             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
931             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
932             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
933             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
934             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
935             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
936
937             fscal            = fvdw;
938
939             /* Update vectorial force */
940             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
941             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
942             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
943             
944             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
945             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
946             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
947
948             /**************************
949              * CALCULATE INTERACTIONS *
950              **************************/
951
952             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
953
954             /* Compute parameters for interactions between i and j atoms */
955             qq10             = _fjsp_mul_v2r8(iq1,jq0);
956
957             /* Calculate table index by multiplying r with table scale and truncate to integer */
958             rt               = _fjsp_mul_v2r8(r10,vftabscale);
959             itab_tmp         = _fjsp_dtox_v2r8(rt);
960             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
961             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
962             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
963
964             vfconv.i[0]     *= 12;
965             vfconv.i[1]     *= 12;
966
967             /* CUBIC SPLINE TABLE ELECTROSTATICS */
968             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
969             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
970             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
971             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
972             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
973             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
974             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
975             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
976             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
977
978             fscal            = felec;
979
980             /* Update vectorial force */
981             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
982             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
983             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
984             
985             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
986             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
987             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
988
989             /**************************
990              * CALCULATE INTERACTIONS *
991              **************************/
992
993             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
994
995             /* Compute parameters for interactions between i and j atoms */
996             qq20             = _fjsp_mul_v2r8(iq2,jq0);
997
998             /* Calculate table index by multiplying r with table scale and truncate to integer */
999             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1000             itab_tmp         = _fjsp_dtox_v2r8(rt);
1001             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1002             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1003             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1004
1005             vfconv.i[0]     *= 12;
1006             vfconv.i[1]     *= 12;
1007
1008             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1009             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1010             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1011             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1012             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1013             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1014             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1015             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1016             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1017             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1018
1019             fscal            = felec;
1020
1021             /* Update vectorial force */
1022             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1023             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1024             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1025             
1026             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1027             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1028             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1029
1030             /**************************
1031              * CALCULATE INTERACTIONS *
1032              **************************/
1033
1034             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
1035
1036             /* Compute parameters for interactions between i and j atoms */
1037             qq30             = _fjsp_mul_v2r8(iq3,jq0);
1038
1039             /* Calculate table index by multiplying r with table scale and truncate to integer */
1040             rt               = _fjsp_mul_v2r8(r30,vftabscale);
1041             itab_tmp         = _fjsp_dtox_v2r8(rt);
1042             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1043             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1044             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1045
1046             vfconv.i[0]     *= 12;
1047             vfconv.i[1]     *= 12;
1048
1049             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1050             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1051             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1052             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1053             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1054             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
1055             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1056             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1057             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1058             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1059
1060             fscal            = felec;
1061
1062             /* Update vectorial force */
1063             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
1064             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1065             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1066             
1067             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1068             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1069             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1070
1071             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
1072
1073             /* Inner loop uses 180 flops */
1074         }
1075
1076         if(jidx<j_index_end)
1077         {
1078
1079             jnrA             = jjnr[jidx];
1080             j_coord_offsetA  = DIM*jnrA;
1081
1082             /* load j atom coordinates */
1083             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1084                                               &jx0,&jy0,&jz0);
1085
1086             /* Calculate displacement vector */
1087             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1088             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1089             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1090             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1091             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1092             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1093             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1094             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1095             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1096             dx30             = _fjsp_sub_v2r8(ix3,jx0);
1097             dy30             = _fjsp_sub_v2r8(iy3,jy0);
1098             dz30             = _fjsp_sub_v2r8(iz3,jz0);
1099
1100             /* Calculate squared distance and things based on it */
1101             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1102             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1103             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1104             rsq30            = gmx_fjsp_calc_rsq_v2r8(dx30,dy30,dz30);
1105
1106             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1107             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1108             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1109             rinv30           = gmx_fjsp_invsqrt_v2r8(rsq30);
1110
1111             /* Load parameters for j particles */
1112             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
1113             vdwjidx0A        = 2*vdwtype[jnrA+0];
1114
1115             fjx0             = _fjsp_setzero_v2r8();
1116             fjy0             = _fjsp_setzero_v2r8();
1117             fjz0             = _fjsp_setzero_v2r8();
1118
1119             /**************************
1120              * CALCULATE INTERACTIONS *
1121              **************************/
1122
1123             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1124
1125             /* Compute parameters for interactions between i and j atoms */
1126             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1127
1128             /* Calculate table index by multiplying r with table scale and truncate to integer */
1129             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1130             itab_tmp         = _fjsp_dtox_v2r8(rt);
1131             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1132             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1133             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1134
1135             vfconv.i[0]     *= 12;
1136             vfconv.i[1]     *= 12;
1137
1138             /* CUBIC SPLINE TABLE DISPERSION */
1139             vfconv.i[0]       += 4;
1140             vfconv.i[1]       += 4;
1141             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1142             F                = _fjsp_setzero_v2r8();
1143             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1144             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1145             H                = _fjsp_setzero_v2r8();
1146             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1147             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1148             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1149             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1150
1151             /* CUBIC SPLINE TABLE REPULSION */
1152             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1153             F                = _fjsp_setzero_v2r8();
1154             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1155             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1156             H                = _fjsp_setzero_v2r8();
1157             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1158             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1159             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1160             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1161             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1162
1163             fscal            = fvdw;
1164
1165             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1166
1167             /* Update vectorial force */
1168             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1169             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1170             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1171             
1172             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1173             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1174             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1175
1176             /**************************
1177              * CALCULATE INTERACTIONS *
1178              **************************/
1179
1180             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
1181
1182             /* Compute parameters for interactions between i and j atoms */
1183             qq10             = _fjsp_mul_v2r8(iq1,jq0);
1184
1185             /* Calculate table index by multiplying r with table scale and truncate to integer */
1186             rt               = _fjsp_mul_v2r8(r10,vftabscale);
1187             itab_tmp         = _fjsp_dtox_v2r8(rt);
1188             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1189             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1190             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1191
1192             vfconv.i[0]     *= 12;
1193             vfconv.i[1]     *= 12;
1194
1195             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1196             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1197             F                = _fjsp_setzero_v2r8();
1198             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1199             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1200             H                = _fjsp_setzero_v2r8();
1201             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1202             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1203             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1204             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1205
1206             fscal            = felec;
1207
1208             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1209
1210             /* Update vectorial force */
1211             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1212             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1213             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1214             
1215             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1216             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1217             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1218
1219             /**************************
1220              * CALCULATE INTERACTIONS *
1221              **************************/
1222
1223             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
1224
1225             /* Compute parameters for interactions between i and j atoms */
1226             qq20             = _fjsp_mul_v2r8(iq2,jq0);
1227
1228             /* Calculate table index by multiplying r with table scale and truncate to integer */
1229             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1230             itab_tmp         = _fjsp_dtox_v2r8(rt);
1231             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1232             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1233             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1234
1235             vfconv.i[0]     *= 12;
1236             vfconv.i[1]     *= 12;
1237
1238             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1239             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1240             F                = _fjsp_setzero_v2r8();
1241             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1242             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1243             H                = _fjsp_setzero_v2r8();
1244             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1245             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1246             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1247             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1248
1249             fscal            = felec;
1250
1251             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1252
1253             /* Update vectorial force */
1254             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1255             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1256             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1257             
1258             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1259             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1260             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1261
1262             /**************************
1263              * CALCULATE INTERACTIONS *
1264              **************************/
1265
1266             r30              = _fjsp_mul_v2r8(rsq30,rinv30);
1267
1268             /* Compute parameters for interactions between i and j atoms */
1269             qq30             = _fjsp_mul_v2r8(iq3,jq0);
1270
1271             /* Calculate table index by multiplying r with table scale and truncate to integer */
1272             rt               = _fjsp_mul_v2r8(r30,vftabscale);
1273             itab_tmp         = _fjsp_dtox_v2r8(rt);
1274             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1275             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1276             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1277
1278             vfconv.i[0]     *= 12;
1279             vfconv.i[1]     *= 12;
1280
1281             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1282             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1283             F                = _fjsp_setzero_v2r8();
1284             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1285             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1286             H                = _fjsp_setzero_v2r8();
1287             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1288             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1289             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1290             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq30,FF),_fjsp_mul_v2r8(vftabscale,rinv30)));
1291
1292             fscal            = felec;
1293
1294             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1295
1296             /* Update vectorial force */
1297             fix3             = _fjsp_madd_v2r8(dx30,fscal,fix3);
1298             fiy3             = _fjsp_madd_v2r8(dy30,fscal,fiy3);
1299             fiz3             = _fjsp_madd_v2r8(dz30,fscal,fiz3);
1300             
1301             fjx0             = _fjsp_madd_v2r8(dx30,fscal,fjx0);
1302             fjy0             = _fjsp_madd_v2r8(dy30,fscal,fjy0);
1303             fjz0             = _fjsp_madd_v2r8(dz30,fscal,fjz0);
1304
1305             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1306
1307             /* Inner loop uses 180 flops */
1308         }
1309
1310         /* End of innermost loop */
1311
1312         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1313                                               f+i_coord_offset,fshift+i_shift_offset);
1314
1315         /* Increment number of inner iterations */
1316         inneriter                  += j_index_end - j_index_start;
1317
1318         /* Outer loop uses 24 flops */
1319     }
1320
1321     /* Increment number of outer iterations */
1322     outeriter        += nri;
1323
1324     /* Update outer/inner flops */
1325
1326     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*180);
1327 }