Fujitsu Sparc64 acceleration and general fixes for non-x86 builds
[alexxy/gromacs.git] / src / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecEw_VdwCSTab_GeomW3W3_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012, by the GROMACS development team, led by
5  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6  * others, as listed in the AUTHORS file in the top-level source
7  * directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
37  */
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "vec.h"
47 #include "nrnb.h"
48
49 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecEw_VdwCSTab_GeomW3W3_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: Ewald
54  * VdW interaction:            CubicSplineTable
55  * Geometry:                   Water3-Water3
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecEw_VdwCSTab_GeomW3W3_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_restrict        kernel_data,
66                      t_nrnb * gmx_restrict                  nrnb)
67 {
68     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69      * just 0 for non-waters.
70      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71      * jnr indices corresponding to data put in the four positions in the SIMD register.
72      */
73     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
74     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75     int              jnrA,jnrB;
76     int              j_coord_offsetA,j_coord_offsetB;
77     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
78     real             rcutoff_scalar;
79     real             *shiftvec,*fshift,*x,*f;
80     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81     int              vdwioffset0;
82     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
83     int              vdwioffset1;
84     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
85     int              vdwioffset2;
86     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
87     int              vdwjidx0A,vdwjidx0B;
88     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89     int              vdwjidx1A,vdwjidx1B;
90     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
91     int              vdwjidx2A,vdwjidx2B;
92     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
93     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
94     _fjsp_v2r8       dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
95     _fjsp_v2r8       dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
96     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
97     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
98     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
99     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
100     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
101     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
102     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
103     real             *charge;
104     int              nvdwtype;
105     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
106     int              *vdwtype;
107     real             *vdwparam;
108     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
109     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
110     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
111     real             *vftab;
112     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
113     real             *ewtab;
114     _fjsp_v2r8       itab_tmp;
115     _fjsp_v2r8       dummy_mask,cutoff_mask;
116     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
117     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
118     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
119
120     x                = xx[0];
121     f                = ff[0];
122
123     nri              = nlist->nri;
124     iinr             = nlist->iinr;
125     jindex           = nlist->jindex;
126     jjnr             = nlist->jjnr;
127     shiftidx         = nlist->shift;
128     gid              = nlist->gid;
129     shiftvec         = fr->shift_vec[0];
130     fshift           = fr->fshift[0];
131     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
132     charge           = mdatoms->chargeA;
133     nvdwtype         = fr->ntype;
134     vdwparam         = fr->nbfp;
135     vdwtype          = mdatoms->typeA;
136
137     vftab            = kernel_data->table_vdw->data;
138     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
139
140     sh_ewald         = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
141     ewtab            = fr->ic->tabq_coul_FDV0;
142     ewtabscale       = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
143     ewtabhalfspace   = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
144
145     /* Setup water-specific parameters */
146     inr              = nlist->iinr[0];
147     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
148     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
149     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
150     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
151
152     jq0              = gmx_fjsp_set1_v2r8(charge[inr+0]);
153     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
154     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
155     vdwjidx0A        = 2*vdwtype[inr+0];
156     qq00             = _fjsp_mul_v2r8(iq0,jq0);
157     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
158     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
159     qq01             = _fjsp_mul_v2r8(iq0,jq1);
160     qq02             = _fjsp_mul_v2r8(iq0,jq2);
161     qq10             = _fjsp_mul_v2r8(iq1,jq0);
162     qq11             = _fjsp_mul_v2r8(iq1,jq1);
163     qq12             = _fjsp_mul_v2r8(iq1,jq2);
164     qq20             = _fjsp_mul_v2r8(iq2,jq0);
165     qq21             = _fjsp_mul_v2r8(iq2,jq1);
166     qq22             = _fjsp_mul_v2r8(iq2,jq2);
167
168     /* Avoid stupid compiler warnings */
169     jnrA = jnrB = 0;
170     j_coord_offsetA = 0;
171     j_coord_offsetB = 0;
172
173     outeriter        = 0;
174     inneriter        = 0;
175
176     /* Start outer loop over neighborlists */
177     for(iidx=0; iidx<nri; iidx++)
178     {
179         /* Load shift vector for this list */
180         i_shift_offset   = DIM*shiftidx[iidx];
181
182         /* Load limits for loop over neighbors */
183         j_index_start    = jindex[iidx];
184         j_index_end      = jindex[iidx+1];
185
186         /* Get outer coordinate index */
187         inr              = iinr[iidx];
188         i_coord_offset   = DIM*inr;
189
190         /* Load i particle coords and add shift vector */
191         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
192                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
193
194         fix0             = _fjsp_setzero_v2r8();
195         fiy0             = _fjsp_setzero_v2r8();
196         fiz0             = _fjsp_setzero_v2r8();
197         fix1             = _fjsp_setzero_v2r8();
198         fiy1             = _fjsp_setzero_v2r8();
199         fiz1             = _fjsp_setzero_v2r8();
200         fix2             = _fjsp_setzero_v2r8();
201         fiy2             = _fjsp_setzero_v2r8();
202         fiz2             = _fjsp_setzero_v2r8();
203
204         /* Reset potential sums */
205         velecsum         = _fjsp_setzero_v2r8();
206         vvdwsum          = _fjsp_setzero_v2r8();
207
208         /* Start inner kernel loop */
209         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
210         {
211
212             /* Get j neighbor index, and coordinate index */
213             jnrA             = jjnr[jidx];
214             jnrB             = jjnr[jidx+1];
215             j_coord_offsetA  = DIM*jnrA;
216             j_coord_offsetB  = DIM*jnrB;
217
218             /* load j atom coordinates */
219             gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
220                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
221
222             /* Calculate displacement vector */
223             dx00             = _fjsp_sub_v2r8(ix0,jx0);
224             dy00             = _fjsp_sub_v2r8(iy0,jy0);
225             dz00             = _fjsp_sub_v2r8(iz0,jz0);
226             dx01             = _fjsp_sub_v2r8(ix0,jx1);
227             dy01             = _fjsp_sub_v2r8(iy0,jy1);
228             dz01             = _fjsp_sub_v2r8(iz0,jz1);
229             dx02             = _fjsp_sub_v2r8(ix0,jx2);
230             dy02             = _fjsp_sub_v2r8(iy0,jy2);
231             dz02             = _fjsp_sub_v2r8(iz0,jz2);
232             dx10             = _fjsp_sub_v2r8(ix1,jx0);
233             dy10             = _fjsp_sub_v2r8(iy1,jy0);
234             dz10             = _fjsp_sub_v2r8(iz1,jz0);
235             dx11             = _fjsp_sub_v2r8(ix1,jx1);
236             dy11             = _fjsp_sub_v2r8(iy1,jy1);
237             dz11             = _fjsp_sub_v2r8(iz1,jz1);
238             dx12             = _fjsp_sub_v2r8(ix1,jx2);
239             dy12             = _fjsp_sub_v2r8(iy1,jy2);
240             dz12             = _fjsp_sub_v2r8(iz1,jz2);
241             dx20             = _fjsp_sub_v2r8(ix2,jx0);
242             dy20             = _fjsp_sub_v2r8(iy2,jy0);
243             dz20             = _fjsp_sub_v2r8(iz2,jz0);
244             dx21             = _fjsp_sub_v2r8(ix2,jx1);
245             dy21             = _fjsp_sub_v2r8(iy2,jy1);
246             dz21             = _fjsp_sub_v2r8(iz2,jz1);
247             dx22             = _fjsp_sub_v2r8(ix2,jx2);
248             dy22             = _fjsp_sub_v2r8(iy2,jy2);
249             dz22             = _fjsp_sub_v2r8(iz2,jz2);
250
251             /* Calculate squared distance and things based on it */
252             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
253             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
254             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
255             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
256             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
257             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
258             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
259             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
260             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
261
262             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
263             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
264             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
265             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
266             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
267             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
268             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
269             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
270             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
271
272             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
273             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
274             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
275             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
276             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
277             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
278             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
279             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
280             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
281
282             fjx0             = _fjsp_setzero_v2r8();
283             fjy0             = _fjsp_setzero_v2r8();
284             fjz0             = _fjsp_setzero_v2r8();
285             fjx1             = _fjsp_setzero_v2r8();
286             fjy1             = _fjsp_setzero_v2r8();
287             fjz1             = _fjsp_setzero_v2r8();
288             fjx2             = _fjsp_setzero_v2r8();
289             fjy2             = _fjsp_setzero_v2r8();
290             fjz2             = _fjsp_setzero_v2r8();
291
292             /**************************
293              * CALCULATE INTERACTIONS *
294              **************************/
295
296             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
297
298             /* Calculate table index by multiplying r with table scale and truncate to integer */
299             rt               = _fjsp_mul_v2r8(r00,vftabscale);
300             itab_tmp         = _fjsp_dtox_v2r8(rt);
301             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
302             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
303             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
304
305             vfconv.i[0]     *= 8;
306             vfconv.i[1]     *= 8;
307
308             /* EWALD ELECTROSTATICS */
309
310             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
311             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
312             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
313             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
314             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
315
316             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
317             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
318             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
319             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
320             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
321             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
322             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
323             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
324             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
325             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
326
327             /* CUBIC SPLINE TABLE DISPERSION */
328             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
329             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
330             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
331             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
332             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
333             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
334             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
335             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
336             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
337             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
338             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
339
340             /* CUBIC SPLINE TABLE REPULSION */
341             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
342             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
343             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
344             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
345             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
346             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
347             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
348             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
349             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
350             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
351             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
352             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
353             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
354
355             /* Update potential sum for this i atom from the interaction with this j atom. */
356             velecsum         = _fjsp_add_v2r8(velecsum,velec);
357             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
358
359             fscal            = _fjsp_add_v2r8(felec,fvdw);
360
361             /* Update vectorial force */
362             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
363             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
364             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
365             
366             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
367             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
368             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
369
370             /**************************
371              * CALCULATE INTERACTIONS *
372              **************************/
373
374             r01              = _fjsp_mul_v2r8(rsq01,rinv01);
375
376             /* EWALD ELECTROSTATICS */
377
378             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
379             ewrt             = _fjsp_mul_v2r8(r01,ewtabscale);
380             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
381             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
382             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
383
384             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
385             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
386             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
387             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
388             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
389             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
390             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
391             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
392             velec            = _fjsp_mul_v2r8(qq01,_fjsp_sub_v2r8(rinv01,velec));
393             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq01,rinv01),_fjsp_sub_v2r8(rinvsq01,felec));
394
395             /* Update potential sum for this i atom from the interaction with this j atom. */
396             velecsum         = _fjsp_add_v2r8(velecsum,velec);
397
398             fscal            = felec;
399
400             /* Update vectorial force */
401             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
402             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
403             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
404             
405             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
406             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
407             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
408
409             /**************************
410              * CALCULATE INTERACTIONS *
411              **************************/
412
413             r02              = _fjsp_mul_v2r8(rsq02,rinv02);
414
415             /* EWALD ELECTROSTATICS */
416
417             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
418             ewrt             = _fjsp_mul_v2r8(r02,ewtabscale);
419             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
420             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
421             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
422
423             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
424             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
425             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
426             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
427             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
428             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
429             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
430             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
431             velec            = _fjsp_mul_v2r8(qq02,_fjsp_sub_v2r8(rinv02,velec));
432             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq02,rinv02),_fjsp_sub_v2r8(rinvsq02,felec));
433
434             /* Update potential sum for this i atom from the interaction with this j atom. */
435             velecsum         = _fjsp_add_v2r8(velecsum,velec);
436
437             fscal            = felec;
438
439             /* Update vectorial force */
440             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
441             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
442             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
443             
444             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
445             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
446             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
447
448             /**************************
449              * CALCULATE INTERACTIONS *
450              **************************/
451
452             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
453
454             /* EWALD ELECTROSTATICS */
455
456             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
457             ewrt             = _fjsp_mul_v2r8(r10,ewtabscale);
458             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
459             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
460             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
461
462             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
463             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
464             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
465             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
466             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
467             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
468             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
469             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
470             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
471             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
472
473             /* Update potential sum for this i atom from the interaction with this j atom. */
474             velecsum         = _fjsp_add_v2r8(velecsum,velec);
475
476             fscal            = felec;
477
478             /* Update vectorial force */
479             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
480             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
481             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
482             
483             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
484             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
485             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
486
487             /**************************
488              * CALCULATE INTERACTIONS *
489              **************************/
490
491             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
492
493             /* EWALD ELECTROSTATICS */
494
495             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
496             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
497             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
498             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
499             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
500
501             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
502             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
503             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
504             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
505             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
506             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
507             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
508             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
509             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(rinv11,velec));
510             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
511
512             /* Update potential sum for this i atom from the interaction with this j atom. */
513             velecsum         = _fjsp_add_v2r8(velecsum,velec);
514
515             fscal            = felec;
516
517             /* Update vectorial force */
518             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
519             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
520             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
521             
522             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
523             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
524             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
525
526             /**************************
527              * CALCULATE INTERACTIONS *
528              **************************/
529
530             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
531
532             /* EWALD ELECTROSTATICS */
533
534             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
535             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
536             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
537             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
538             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
539
540             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
541             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
542             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
543             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
544             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
545             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
546             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
547             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
548             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(rinv12,velec));
549             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
550
551             /* Update potential sum for this i atom from the interaction with this j atom. */
552             velecsum         = _fjsp_add_v2r8(velecsum,velec);
553
554             fscal            = felec;
555
556             /* Update vectorial force */
557             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
558             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
559             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
560             
561             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
562             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
563             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
564
565             /**************************
566              * CALCULATE INTERACTIONS *
567              **************************/
568
569             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
570
571             /* EWALD ELECTROSTATICS */
572
573             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
574             ewrt             = _fjsp_mul_v2r8(r20,ewtabscale);
575             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
576             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
577             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
578
579             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
580             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
581             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
582             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
583             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
584             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
585             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
586             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
587             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
588             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
589
590             /* Update potential sum for this i atom from the interaction with this j atom. */
591             velecsum         = _fjsp_add_v2r8(velecsum,velec);
592
593             fscal            = felec;
594
595             /* Update vectorial force */
596             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
597             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
598             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
599             
600             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
601             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
602             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
603
604             /**************************
605              * CALCULATE INTERACTIONS *
606              **************************/
607
608             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
609
610             /* EWALD ELECTROSTATICS */
611
612             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
613             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
614             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
615             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
616             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
617
618             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
619             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
620             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
621             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
622             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
623             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
624             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
625             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
626             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(rinv21,velec));
627             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
628
629             /* Update potential sum for this i atom from the interaction with this j atom. */
630             velecsum         = _fjsp_add_v2r8(velecsum,velec);
631
632             fscal            = felec;
633
634             /* Update vectorial force */
635             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
636             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
637             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
638             
639             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
640             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
641             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
642
643             /**************************
644              * CALCULATE INTERACTIONS *
645              **************************/
646
647             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
648
649             /* EWALD ELECTROSTATICS */
650
651             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
652             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
653             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
654             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
655             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
656
657             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
658             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
659             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
660             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
661             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
662             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
663             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
664             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
665             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(rinv22,velec));
666             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
667
668             /* Update potential sum for this i atom from the interaction with this j atom. */
669             velecsum         = _fjsp_add_v2r8(velecsum,velec);
670
671             fscal            = felec;
672
673             /* Update vectorial force */
674             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
675             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
676             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
677             
678             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
679             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
680             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
681
682             gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
683
684             /* Inner loop uses 430 flops */
685         }
686
687         if(jidx<j_index_end)
688         {
689
690             jnrA             = jjnr[jidx];
691             j_coord_offsetA  = DIM*jnrA;
692
693             /* load j atom coordinates */
694             gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
695                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
696
697             /* Calculate displacement vector */
698             dx00             = _fjsp_sub_v2r8(ix0,jx0);
699             dy00             = _fjsp_sub_v2r8(iy0,jy0);
700             dz00             = _fjsp_sub_v2r8(iz0,jz0);
701             dx01             = _fjsp_sub_v2r8(ix0,jx1);
702             dy01             = _fjsp_sub_v2r8(iy0,jy1);
703             dz01             = _fjsp_sub_v2r8(iz0,jz1);
704             dx02             = _fjsp_sub_v2r8(ix0,jx2);
705             dy02             = _fjsp_sub_v2r8(iy0,jy2);
706             dz02             = _fjsp_sub_v2r8(iz0,jz2);
707             dx10             = _fjsp_sub_v2r8(ix1,jx0);
708             dy10             = _fjsp_sub_v2r8(iy1,jy0);
709             dz10             = _fjsp_sub_v2r8(iz1,jz0);
710             dx11             = _fjsp_sub_v2r8(ix1,jx1);
711             dy11             = _fjsp_sub_v2r8(iy1,jy1);
712             dz11             = _fjsp_sub_v2r8(iz1,jz1);
713             dx12             = _fjsp_sub_v2r8(ix1,jx2);
714             dy12             = _fjsp_sub_v2r8(iy1,jy2);
715             dz12             = _fjsp_sub_v2r8(iz1,jz2);
716             dx20             = _fjsp_sub_v2r8(ix2,jx0);
717             dy20             = _fjsp_sub_v2r8(iy2,jy0);
718             dz20             = _fjsp_sub_v2r8(iz2,jz0);
719             dx21             = _fjsp_sub_v2r8(ix2,jx1);
720             dy21             = _fjsp_sub_v2r8(iy2,jy1);
721             dz21             = _fjsp_sub_v2r8(iz2,jz1);
722             dx22             = _fjsp_sub_v2r8(ix2,jx2);
723             dy22             = _fjsp_sub_v2r8(iy2,jy2);
724             dz22             = _fjsp_sub_v2r8(iz2,jz2);
725
726             /* Calculate squared distance and things based on it */
727             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
728             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
729             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
730             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
731             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
732             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
733             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
734             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
735             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
736
737             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
738             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
739             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
740             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
741             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
742             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
743             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
744             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
745             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
746
747             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
748             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
749             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
750             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
751             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
752             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
753             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
754             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
755             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
756
757             fjx0             = _fjsp_setzero_v2r8();
758             fjy0             = _fjsp_setzero_v2r8();
759             fjz0             = _fjsp_setzero_v2r8();
760             fjx1             = _fjsp_setzero_v2r8();
761             fjy1             = _fjsp_setzero_v2r8();
762             fjz1             = _fjsp_setzero_v2r8();
763             fjx2             = _fjsp_setzero_v2r8();
764             fjy2             = _fjsp_setzero_v2r8();
765             fjz2             = _fjsp_setzero_v2r8();
766
767             /**************************
768              * CALCULATE INTERACTIONS *
769              **************************/
770
771             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
772
773             /* Calculate table index by multiplying r with table scale and truncate to integer */
774             rt               = _fjsp_mul_v2r8(r00,vftabscale);
775             itab_tmp         = _fjsp_dtox_v2r8(rt);
776             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
777             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
778             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
779
780             vfconv.i[0]     *= 8;
781             vfconv.i[1]     *= 8;
782
783             /* EWALD ELECTROSTATICS */
784
785             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
786             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
787             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
788             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
789             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
790
791             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
792             ewtabD           = _fjsp_setzero_v2r8();
793             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
794             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
795             ewtabFn          = _fjsp_setzero_v2r8();
796             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
797             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
798             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
799             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
800             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
801
802             /* CUBIC SPLINE TABLE DISPERSION */
803             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
804             F                = _fjsp_setzero_v2r8();
805             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
806             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
807             H                = _fjsp_setzero_v2r8();
808             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
809             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
810             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
811             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
812             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
813             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
814
815             /* CUBIC SPLINE TABLE REPULSION */
816             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
817             F                = _fjsp_setzero_v2r8();
818             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
819             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
820             H                = _fjsp_setzero_v2r8();
821             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
822             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
823             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
824             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
825             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
826             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
827             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
828             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
829
830             /* Update potential sum for this i atom from the interaction with this j atom. */
831             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
832             velecsum         = _fjsp_add_v2r8(velecsum,velec);
833             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
834             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
835
836             fscal            = _fjsp_add_v2r8(felec,fvdw);
837
838             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
839
840             /* Update vectorial force */
841             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
842             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
843             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
844             
845             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
846             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
847             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
848
849             /**************************
850              * CALCULATE INTERACTIONS *
851              **************************/
852
853             r01              = _fjsp_mul_v2r8(rsq01,rinv01);
854
855             /* EWALD ELECTROSTATICS */
856
857             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
858             ewrt             = _fjsp_mul_v2r8(r01,ewtabscale);
859             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
860             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
861             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
862
863             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
864             ewtabD           = _fjsp_setzero_v2r8();
865             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
866             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
867             ewtabFn          = _fjsp_setzero_v2r8();
868             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
869             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
870             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
871             velec            = _fjsp_mul_v2r8(qq01,_fjsp_sub_v2r8(rinv01,velec));
872             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq01,rinv01),_fjsp_sub_v2r8(rinvsq01,felec));
873
874             /* Update potential sum for this i atom from the interaction with this j atom. */
875             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
876             velecsum         = _fjsp_add_v2r8(velecsum,velec);
877
878             fscal            = felec;
879
880             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
881
882             /* Update vectorial force */
883             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
884             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
885             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
886             
887             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
888             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
889             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
890
891             /**************************
892              * CALCULATE INTERACTIONS *
893              **************************/
894
895             r02              = _fjsp_mul_v2r8(rsq02,rinv02);
896
897             /* EWALD ELECTROSTATICS */
898
899             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
900             ewrt             = _fjsp_mul_v2r8(r02,ewtabscale);
901             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
902             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
903             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
904
905             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
906             ewtabD           = _fjsp_setzero_v2r8();
907             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
908             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
909             ewtabFn          = _fjsp_setzero_v2r8();
910             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
911             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
912             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
913             velec            = _fjsp_mul_v2r8(qq02,_fjsp_sub_v2r8(rinv02,velec));
914             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq02,rinv02),_fjsp_sub_v2r8(rinvsq02,felec));
915
916             /* Update potential sum for this i atom from the interaction with this j atom. */
917             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
918             velecsum         = _fjsp_add_v2r8(velecsum,velec);
919
920             fscal            = felec;
921
922             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
923
924             /* Update vectorial force */
925             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
926             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
927             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
928             
929             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
930             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
931             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
932
933             /**************************
934              * CALCULATE INTERACTIONS *
935              **************************/
936
937             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
938
939             /* EWALD ELECTROSTATICS */
940
941             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
942             ewrt             = _fjsp_mul_v2r8(r10,ewtabscale);
943             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
944             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
945             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
946
947             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
948             ewtabD           = _fjsp_setzero_v2r8();
949             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
950             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
951             ewtabFn          = _fjsp_setzero_v2r8();
952             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
953             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
954             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
955             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(rinv10,velec));
956             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
957
958             /* Update potential sum for this i atom from the interaction with this j atom. */
959             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
960             velecsum         = _fjsp_add_v2r8(velecsum,velec);
961
962             fscal            = felec;
963
964             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
965
966             /* Update vectorial force */
967             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
968             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
969             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
970             
971             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
972             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
973             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
974
975             /**************************
976              * CALCULATE INTERACTIONS *
977              **************************/
978
979             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
980
981             /* EWALD ELECTROSTATICS */
982
983             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
984             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
985             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
986             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
987             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
988
989             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
990             ewtabD           = _fjsp_setzero_v2r8();
991             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
992             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
993             ewtabFn          = _fjsp_setzero_v2r8();
994             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
995             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
996             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
997             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(rinv11,velec));
998             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
999
1000             /* Update potential sum for this i atom from the interaction with this j atom. */
1001             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1002             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1003
1004             fscal            = felec;
1005
1006             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1007
1008             /* Update vectorial force */
1009             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1010             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1011             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1012             
1013             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1014             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1015             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1016
1017             /**************************
1018              * CALCULATE INTERACTIONS *
1019              **************************/
1020
1021             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
1022
1023             /* EWALD ELECTROSTATICS */
1024
1025             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1026             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
1027             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1028             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1029             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1030
1031             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1032             ewtabD           = _fjsp_setzero_v2r8();
1033             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1034             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1035             ewtabFn          = _fjsp_setzero_v2r8();
1036             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1037             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1038             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1039             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(rinv12,velec));
1040             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1041
1042             /* Update potential sum for this i atom from the interaction with this j atom. */
1043             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1044             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1045
1046             fscal            = felec;
1047
1048             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1049
1050             /* Update vectorial force */
1051             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1052             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1053             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1054             
1055             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1056             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1057             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1058
1059             /**************************
1060              * CALCULATE INTERACTIONS *
1061              **************************/
1062
1063             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
1064
1065             /* EWALD ELECTROSTATICS */
1066
1067             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1068             ewrt             = _fjsp_mul_v2r8(r20,ewtabscale);
1069             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1070             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1071             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1072
1073             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1074             ewtabD           = _fjsp_setzero_v2r8();
1075             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1076             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1077             ewtabFn          = _fjsp_setzero_v2r8();
1078             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1079             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1080             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1081             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(rinv20,velec));
1082             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1083
1084             /* Update potential sum for this i atom from the interaction with this j atom. */
1085             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1086             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1087
1088             fscal            = felec;
1089
1090             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1091
1092             /* Update vectorial force */
1093             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1094             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1095             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1096             
1097             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1098             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1099             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1100
1101             /**************************
1102              * CALCULATE INTERACTIONS *
1103              **************************/
1104
1105             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
1106
1107             /* EWALD ELECTROSTATICS */
1108
1109             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1110             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
1111             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1112             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1113             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1114
1115             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1116             ewtabD           = _fjsp_setzero_v2r8();
1117             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1118             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1119             ewtabFn          = _fjsp_setzero_v2r8();
1120             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1121             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1122             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1123             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(rinv21,velec));
1124             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1125
1126             /* Update potential sum for this i atom from the interaction with this j atom. */
1127             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1128             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1129
1130             fscal            = felec;
1131
1132             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1133
1134             /* Update vectorial force */
1135             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1136             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1137             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1138             
1139             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1140             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1141             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1142
1143             /**************************
1144              * CALCULATE INTERACTIONS *
1145              **************************/
1146
1147             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
1148
1149             /* EWALD ELECTROSTATICS */
1150
1151             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1152             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
1153             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1154             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1155             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1156
1157             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1158             ewtabD           = _fjsp_setzero_v2r8();
1159             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1160             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1161             ewtabFn          = _fjsp_setzero_v2r8();
1162             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1163             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1164             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1165             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(rinv22,velec));
1166             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1167
1168             /* Update potential sum for this i atom from the interaction with this j atom. */
1169             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1170             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1171
1172             fscal            = felec;
1173
1174             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1175
1176             /* Update vectorial force */
1177             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1178             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1179             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1180             
1181             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1182             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1183             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1184
1185             gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1186
1187             /* Inner loop uses 430 flops */
1188         }
1189
1190         /* End of innermost loop */
1191
1192         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1193                                               f+i_coord_offset,fshift+i_shift_offset);
1194
1195         ggid                        = gid[iidx];
1196         /* Update potential energies */
1197         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
1198         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
1199
1200         /* Increment number of inner iterations */
1201         inneriter                  += j_index_end - j_index_start;
1202
1203         /* Outer loop uses 20 flops */
1204     }
1205
1206     /* Increment number of outer iterations */
1207     outeriter        += nri;
1208
1209     /* Update outer/inner flops */
1210
1211     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*430);
1212 }
1213 /*
1214  * Gromacs nonbonded kernel:   nb_kernel_ElecEw_VdwCSTab_GeomW3W3_F_sparc64_hpc_ace_double
1215  * Electrostatics interaction: Ewald
1216  * VdW interaction:            CubicSplineTable
1217  * Geometry:                   Water3-Water3
1218  * Calculate force/pot:        Force
1219  */
1220 void
1221 nb_kernel_ElecEw_VdwCSTab_GeomW3W3_F_sparc64_hpc_ace_double
1222                     (t_nblist * gmx_restrict                nlist,
1223                      rvec * gmx_restrict                    xx,
1224                      rvec * gmx_restrict                    ff,
1225                      t_forcerec * gmx_restrict              fr,
1226                      t_mdatoms * gmx_restrict               mdatoms,
1227                      nb_kernel_data_t * gmx_restrict        kernel_data,
1228                      t_nrnb * gmx_restrict                  nrnb)
1229 {
1230     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1231      * just 0 for non-waters.
1232      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
1233      * jnr indices corresponding to data put in the four positions in the SIMD register.
1234      */
1235     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
1236     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1237     int              jnrA,jnrB;
1238     int              j_coord_offsetA,j_coord_offsetB;
1239     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
1240     real             rcutoff_scalar;
1241     real             *shiftvec,*fshift,*x,*f;
1242     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
1243     int              vdwioffset0;
1244     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1245     int              vdwioffset1;
1246     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1247     int              vdwioffset2;
1248     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1249     int              vdwjidx0A,vdwjidx0B;
1250     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1251     int              vdwjidx1A,vdwjidx1B;
1252     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1253     int              vdwjidx2A,vdwjidx2B;
1254     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1255     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1256     _fjsp_v2r8       dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
1257     _fjsp_v2r8       dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
1258     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
1259     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1260     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1261     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
1262     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1263     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1264     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
1265     real             *charge;
1266     int              nvdwtype;
1267     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1268     int              *vdwtype;
1269     real             *vdwparam;
1270     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
1271     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1272     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
1273     real             *vftab;
1274     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
1275     real             *ewtab;
1276     _fjsp_v2r8       itab_tmp;
1277     _fjsp_v2r8       dummy_mask,cutoff_mask;
1278     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
1279     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
1280     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1281
1282     x                = xx[0];
1283     f                = ff[0];
1284
1285     nri              = nlist->nri;
1286     iinr             = nlist->iinr;
1287     jindex           = nlist->jindex;
1288     jjnr             = nlist->jjnr;
1289     shiftidx         = nlist->shift;
1290     gid              = nlist->gid;
1291     shiftvec         = fr->shift_vec[0];
1292     fshift           = fr->fshift[0];
1293     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
1294     charge           = mdatoms->chargeA;
1295     nvdwtype         = fr->ntype;
1296     vdwparam         = fr->nbfp;
1297     vdwtype          = mdatoms->typeA;
1298
1299     vftab            = kernel_data->table_vdw->data;
1300     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
1301
1302     sh_ewald         = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
1303     ewtab            = fr->ic->tabq_coul_F;
1304     ewtabscale       = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
1305     ewtabhalfspace   = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
1306
1307     /* Setup water-specific parameters */
1308     inr              = nlist->iinr[0];
1309     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
1310     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1311     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1312     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
1313
1314     jq0              = gmx_fjsp_set1_v2r8(charge[inr+0]);
1315     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
1316     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
1317     vdwjidx0A        = 2*vdwtype[inr+0];
1318     qq00             = _fjsp_mul_v2r8(iq0,jq0);
1319     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1320     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1321     qq01             = _fjsp_mul_v2r8(iq0,jq1);
1322     qq02             = _fjsp_mul_v2r8(iq0,jq2);
1323     qq10             = _fjsp_mul_v2r8(iq1,jq0);
1324     qq11             = _fjsp_mul_v2r8(iq1,jq1);
1325     qq12             = _fjsp_mul_v2r8(iq1,jq2);
1326     qq20             = _fjsp_mul_v2r8(iq2,jq0);
1327     qq21             = _fjsp_mul_v2r8(iq2,jq1);
1328     qq22             = _fjsp_mul_v2r8(iq2,jq2);
1329
1330     /* Avoid stupid compiler warnings */
1331     jnrA = jnrB = 0;
1332     j_coord_offsetA = 0;
1333     j_coord_offsetB = 0;
1334
1335     outeriter        = 0;
1336     inneriter        = 0;
1337
1338     /* Start outer loop over neighborlists */
1339     for(iidx=0; iidx<nri; iidx++)
1340     {
1341         /* Load shift vector for this list */
1342         i_shift_offset   = DIM*shiftidx[iidx];
1343
1344         /* Load limits for loop over neighbors */
1345         j_index_start    = jindex[iidx];
1346         j_index_end      = jindex[iidx+1];
1347
1348         /* Get outer coordinate index */
1349         inr              = iinr[iidx];
1350         i_coord_offset   = DIM*inr;
1351
1352         /* Load i particle coords and add shift vector */
1353         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1354                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
1355
1356         fix0             = _fjsp_setzero_v2r8();
1357         fiy0             = _fjsp_setzero_v2r8();
1358         fiz0             = _fjsp_setzero_v2r8();
1359         fix1             = _fjsp_setzero_v2r8();
1360         fiy1             = _fjsp_setzero_v2r8();
1361         fiz1             = _fjsp_setzero_v2r8();
1362         fix2             = _fjsp_setzero_v2r8();
1363         fiy2             = _fjsp_setzero_v2r8();
1364         fiz2             = _fjsp_setzero_v2r8();
1365
1366         /* Start inner kernel loop */
1367         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1368         {
1369
1370             /* Get j neighbor index, and coordinate index */
1371             jnrA             = jjnr[jidx];
1372             jnrB             = jjnr[jidx+1];
1373             j_coord_offsetA  = DIM*jnrA;
1374             j_coord_offsetB  = DIM*jnrB;
1375
1376             /* load j atom coordinates */
1377             gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1378                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1379
1380             /* Calculate displacement vector */
1381             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1382             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1383             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1384             dx01             = _fjsp_sub_v2r8(ix0,jx1);
1385             dy01             = _fjsp_sub_v2r8(iy0,jy1);
1386             dz01             = _fjsp_sub_v2r8(iz0,jz1);
1387             dx02             = _fjsp_sub_v2r8(ix0,jx2);
1388             dy02             = _fjsp_sub_v2r8(iy0,jy2);
1389             dz02             = _fjsp_sub_v2r8(iz0,jz2);
1390             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1391             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1392             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1393             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1394             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1395             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1396             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1397             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1398             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1399             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1400             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1401             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1402             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1403             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1404             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1405             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1406             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1407             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1408
1409             /* Calculate squared distance and things based on it */
1410             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1411             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1412             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1413             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1414             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1415             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1416             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1417             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1418             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1419
1420             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1421             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
1422             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
1423             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1424             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1425             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1426             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1427             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1428             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1429
1430             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
1431             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
1432             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
1433             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
1434             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1435             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1436             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
1437             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1438             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1439
1440             fjx0             = _fjsp_setzero_v2r8();
1441             fjy0             = _fjsp_setzero_v2r8();
1442             fjz0             = _fjsp_setzero_v2r8();
1443             fjx1             = _fjsp_setzero_v2r8();
1444             fjy1             = _fjsp_setzero_v2r8();
1445             fjz1             = _fjsp_setzero_v2r8();
1446             fjx2             = _fjsp_setzero_v2r8();
1447             fjy2             = _fjsp_setzero_v2r8();
1448             fjz2             = _fjsp_setzero_v2r8();
1449
1450             /**************************
1451              * CALCULATE INTERACTIONS *
1452              **************************/
1453
1454             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1455
1456             /* Calculate table index by multiplying r with table scale and truncate to integer */
1457             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1458             itab_tmp         = _fjsp_dtox_v2r8(rt);
1459             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1460             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1461             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1462
1463             vfconv.i[0]     *= 8;
1464             vfconv.i[1]     *= 8;
1465
1466             /* EWALD ELECTROSTATICS */
1467
1468             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1469             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
1470             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1471             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1472             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1473
1474             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1475                                          &ewtabF,&ewtabFn);
1476             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1477             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
1478
1479             /* CUBIC SPLINE TABLE DISPERSION */
1480             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1481             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1482             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1483             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1484             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
1485             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1486             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1487             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1488             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1489
1490             /* CUBIC SPLINE TABLE REPULSION */
1491             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1492             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
1493             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1494             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1495             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
1496             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1497             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1498             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1499             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1500             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1501
1502             fscal            = _fjsp_add_v2r8(felec,fvdw);
1503
1504             /* Update vectorial force */
1505             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1506             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1507             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1508             
1509             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1510             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1511             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1512
1513             /**************************
1514              * CALCULATE INTERACTIONS *
1515              **************************/
1516
1517             r01              = _fjsp_mul_v2r8(rsq01,rinv01);
1518
1519             /* EWALD ELECTROSTATICS */
1520
1521             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1522             ewrt             = _fjsp_mul_v2r8(r01,ewtabscale);
1523             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1524             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1525             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1526
1527             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1528                                          &ewtabF,&ewtabFn);
1529             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1530             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq01,rinv01),_fjsp_sub_v2r8(rinvsq01,felec));
1531
1532             fscal            = felec;
1533
1534             /* Update vectorial force */
1535             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
1536             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1537             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1538             
1539             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1540             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1541             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1542
1543             /**************************
1544              * CALCULATE INTERACTIONS *
1545              **************************/
1546
1547             r02              = _fjsp_mul_v2r8(rsq02,rinv02);
1548
1549             /* EWALD ELECTROSTATICS */
1550
1551             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1552             ewrt             = _fjsp_mul_v2r8(r02,ewtabscale);
1553             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1554             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1555             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1556
1557             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1558                                          &ewtabF,&ewtabFn);
1559             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1560             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq02,rinv02),_fjsp_sub_v2r8(rinvsq02,felec));
1561
1562             fscal            = felec;
1563
1564             /* Update vectorial force */
1565             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
1566             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1567             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1568             
1569             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1570             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1571             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1572
1573             /**************************
1574              * CALCULATE INTERACTIONS *
1575              **************************/
1576
1577             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
1578
1579             /* EWALD ELECTROSTATICS */
1580
1581             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1582             ewrt             = _fjsp_mul_v2r8(r10,ewtabscale);
1583             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1584             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1585             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1586
1587             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1588                                          &ewtabF,&ewtabFn);
1589             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1590             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1591
1592             fscal            = felec;
1593
1594             /* Update vectorial force */
1595             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1596             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1597             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1598             
1599             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1600             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1601             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1602
1603             /**************************
1604              * CALCULATE INTERACTIONS *
1605              **************************/
1606
1607             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
1608
1609             /* EWALD ELECTROSTATICS */
1610
1611             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1612             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
1613             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1614             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1615             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1616
1617             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1618                                          &ewtabF,&ewtabFn);
1619             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1620             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
1621
1622             fscal            = felec;
1623
1624             /* Update vectorial force */
1625             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1626             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1627             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1628             
1629             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1630             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1631             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1632
1633             /**************************
1634              * CALCULATE INTERACTIONS *
1635              **************************/
1636
1637             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
1638
1639             /* EWALD ELECTROSTATICS */
1640
1641             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1642             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
1643             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1644             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1645             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1646
1647             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1648                                          &ewtabF,&ewtabFn);
1649             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1650             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1651
1652             fscal            = felec;
1653
1654             /* Update vectorial force */
1655             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1656             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1657             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1658             
1659             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1660             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1661             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1662
1663             /**************************
1664              * CALCULATE INTERACTIONS *
1665              **************************/
1666
1667             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
1668
1669             /* EWALD ELECTROSTATICS */
1670
1671             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1672             ewrt             = _fjsp_mul_v2r8(r20,ewtabscale);
1673             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1674             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1675             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1676
1677             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1678                                          &ewtabF,&ewtabFn);
1679             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1680             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
1681
1682             fscal            = felec;
1683
1684             /* Update vectorial force */
1685             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1686             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1687             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1688             
1689             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1690             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1691             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1692
1693             /**************************
1694              * CALCULATE INTERACTIONS *
1695              **************************/
1696
1697             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
1698
1699             /* EWALD ELECTROSTATICS */
1700
1701             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1702             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
1703             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1704             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1705             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1706
1707             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1708                                          &ewtabF,&ewtabFn);
1709             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1710             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1711
1712             fscal            = felec;
1713
1714             /* Update vectorial force */
1715             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1716             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1717             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1718             
1719             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1720             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1721             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1722
1723             /**************************
1724              * CALCULATE INTERACTIONS *
1725              **************************/
1726
1727             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
1728
1729             /* EWALD ELECTROSTATICS */
1730
1731             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1732             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
1733             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1734             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1735             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1736
1737             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1738                                          &ewtabF,&ewtabFn);
1739             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1740             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1741
1742             fscal            = felec;
1743
1744             /* Update vectorial force */
1745             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1746             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1747             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1748             
1749             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1750             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1751             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1752
1753             gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1754
1755             /* Inner loop uses 377 flops */
1756         }
1757
1758         if(jidx<j_index_end)
1759         {
1760
1761             jnrA             = jjnr[jidx];
1762             j_coord_offsetA  = DIM*jnrA;
1763
1764             /* load j atom coordinates */
1765             gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1766                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1767
1768             /* Calculate displacement vector */
1769             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1770             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1771             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1772             dx01             = _fjsp_sub_v2r8(ix0,jx1);
1773             dy01             = _fjsp_sub_v2r8(iy0,jy1);
1774             dz01             = _fjsp_sub_v2r8(iz0,jz1);
1775             dx02             = _fjsp_sub_v2r8(ix0,jx2);
1776             dy02             = _fjsp_sub_v2r8(iy0,jy2);
1777             dz02             = _fjsp_sub_v2r8(iz0,jz2);
1778             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1779             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1780             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1781             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1782             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1783             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1784             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1785             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1786             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1787             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1788             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1789             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1790             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1791             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1792             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1793             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1794             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1795             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1796
1797             /* Calculate squared distance and things based on it */
1798             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1799             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1800             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1801             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1802             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1803             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1804             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1805             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1806             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1807
1808             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1809             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
1810             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
1811             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1812             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1813             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1814             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1815             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1816             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1817
1818             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
1819             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
1820             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
1821             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
1822             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1823             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1824             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
1825             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1826             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1827
1828             fjx0             = _fjsp_setzero_v2r8();
1829             fjy0             = _fjsp_setzero_v2r8();
1830             fjz0             = _fjsp_setzero_v2r8();
1831             fjx1             = _fjsp_setzero_v2r8();
1832             fjy1             = _fjsp_setzero_v2r8();
1833             fjz1             = _fjsp_setzero_v2r8();
1834             fjx2             = _fjsp_setzero_v2r8();
1835             fjy2             = _fjsp_setzero_v2r8();
1836             fjz2             = _fjsp_setzero_v2r8();
1837
1838             /**************************
1839              * CALCULATE INTERACTIONS *
1840              **************************/
1841
1842             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1843
1844             /* Calculate table index by multiplying r with table scale and truncate to integer */
1845             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1846             itab_tmp         = _fjsp_dtox_v2r8(rt);
1847             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1848             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1849             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1850
1851             vfconv.i[0]     *= 8;
1852             vfconv.i[1]     *= 8;
1853
1854             /* EWALD ELECTROSTATICS */
1855
1856             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1857             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
1858             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1859             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1860             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1861
1862             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1863             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1864             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
1865
1866             /* CUBIC SPLINE TABLE DISPERSION */
1867             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1868             F                = _fjsp_setzero_v2r8();
1869             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1870             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1871             H                = _fjsp_setzero_v2r8();
1872             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1873             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1874             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1875             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1876
1877             /* CUBIC SPLINE TABLE REPULSION */
1878             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1879             F                = _fjsp_setzero_v2r8();
1880             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1881             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1882             H                = _fjsp_setzero_v2r8();
1883             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1884             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1885             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1886             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1887             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1888
1889             fscal            = _fjsp_add_v2r8(felec,fvdw);
1890
1891             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1892
1893             /* Update vectorial force */
1894             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1895             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1896             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1897             
1898             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1899             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1900             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1901
1902             /**************************
1903              * CALCULATE INTERACTIONS *
1904              **************************/
1905
1906             r01              = _fjsp_mul_v2r8(rsq01,rinv01);
1907
1908             /* EWALD ELECTROSTATICS */
1909
1910             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1911             ewrt             = _fjsp_mul_v2r8(r01,ewtabscale);
1912             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1913             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1914             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1915
1916             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1917             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1918             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq01,rinv01),_fjsp_sub_v2r8(rinvsq01,felec));
1919
1920             fscal            = felec;
1921
1922             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1923
1924             /* Update vectorial force */
1925             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
1926             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1927             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1928             
1929             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1930             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1931             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1932
1933             /**************************
1934              * CALCULATE INTERACTIONS *
1935              **************************/
1936
1937             r02              = _fjsp_mul_v2r8(rsq02,rinv02);
1938
1939             /* EWALD ELECTROSTATICS */
1940
1941             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1942             ewrt             = _fjsp_mul_v2r8(r02,ewtabscale);
1943             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1944             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1945             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1946
1947             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1948             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1949             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq02,rinv02),_fjsp_sub_v2r8(rinvsq02,felec));
1950
1951             fscal            = felec;
1952
1953             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1954
1955             /* Update vectorial force */
1956             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
1957             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1958             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1959             
1960             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1961             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1962             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1963
1964             /**************************
1965              * CALCULATE INTERACTIONS *
1966              **************************/
1967
1968             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
1969
1970             /* EWALD ELECTROSTATICS */
1971
1972             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1973             ewrt             = _fjsp_mul_v2r8(r10,ewtabscale);
1974             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1975             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1976             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1977
1978             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
1979             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1980             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,rinv10),_fjsp_sub_v2r8(rinvsq10,felec));
1981
1982             fscal            = felec;
1983
1984             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1985
1986             /* Update vectorial force */
1987             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1988             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1989             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1990             
1991             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1992             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1993             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1994
1995             /**************************
1996              * CALCULATE INTERACTIONS *
1997              **************************/
1998
1999             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
2000
2001             /* EWALD ELECTROSTATICS */
2002
2003             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2004             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
2005             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2006             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2007             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2008
2009             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2010             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2011             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
2012
2013             fscal            = felec;
2014
2015             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2016
2017             /* Update vectorial force */
2018             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
2019             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
2020             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
2021             
2022             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
2023             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
2024             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
2025
2026             /**************************
2027              * CALCULATE INTERACTIONS *
2028              **************************/
2029
2030             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
2031
2032             /* EWALD ELECTROSTATICS */
2033
2034             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2035             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
2036             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2037             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2038             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2039
2040             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2041             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2042             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
2043
2044             fscal            = felec;
2045
2046             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2047
2048             /* Update vectorial force */
2049             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
2050             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
2051             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
2052             
2053             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
2054             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
2055             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
2056
2057             /**************************
2058              * CALCULATE INTERACTIONS *
2059              **************************/
2060
2061             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
2062
2063             /* EWALD ELECTROSTATICS */
2064
2065             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2066             ewrt             = _fjsp_mul_v2r8(r20,ewtabscale);
2067             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2068             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2069             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2070
2071             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2072             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2073             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,rinv20),_fjsp_sub_v2r8(rinvsq20,felec));
2074
2075             fscal            = felec;
2076
2077             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2078
2079             /* Update vectorial force */
2080             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
2081             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
2082             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
2083             
2084             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
2085             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
2086             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
2087
2088             /**************************
2089              * CALCULATE INTERACTIONS *
2090              **************************/
2091
2092             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
2093
2094             /* EWALD ELECTROSTATICS */
2095
2096             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2097             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
2098             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2099             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2100             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2101
2102             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2103             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2104             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
2105
2106             fscal            = felec;
2107
2108             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2109
2110             /* Update vectorial force */
2111             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
2112             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
2113             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
2114             
2115             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
2116             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
2117             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
2118
2119             /**************************
2120              * CALCULATE INTERACTIONS *
2121              **************************/
2122
2123             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
2124
2125             /* EWALD ELECTROSTATICS */
2126
2127             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2128             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
2129             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2130             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2131             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2132
2133             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2134             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2135             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
2136
2137             fscal            = felec;
2138
2139             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2140
2141             /* Update vectorial force */
2142             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
2143             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
2144             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
2145             
2146             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
2147             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
2148             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
2149
2150             gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
2151
2152             /* Inner loop uses 377 flops */
2153         }
2154
2155         /* End of innermost loop */
2156
2157         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
2158                                               f+i_coord_offset,fshift+i_shift_offset);
2159
2160         /* Increment number of inner iterations */
2161         inneriter                  += j_index_end - j_index_start;
2162
2163         /* Outer loop uses 18 flops */
2164     }
2165
2166     /* Increment number of outer iterations */
2167     outeriter        += nri;
2168
2169     /* Update outer/inner flops */
2170
2171     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*377);
2172 }