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