03b4b2bb33aceddbe5a953f111229a2f4309b1f6
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_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 "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
46
47 #include "kernelutil_sparc64_hpc_ace_double.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_VF_sparc64_hpc_ace_double
51  * Electrostatics interaction: Ewald
52  * VdW interaction:            LennardJones
53  * Geometry:                   Water4-Water4
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_VF_sparc64_hpc_ace_double
58                     (t_nblist                    * gmx_restrict       nlist,
59                      rvec                        * gmx_restrict          xx,
60                      rvec                        * gmx_restrict          ff,
61                      t_forcerec                  * gmx_restrict          fr,
62                      t_mdatoms                   * gmx_restrict     mdatoms,
63                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64                      t_nrnb                      * gmx_restrict        nrnb)
65 {
66     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67      * just 0 for non-waters.
68      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69      * jnr indices corresponding to data put in the four positions in the SIMD register.
70      */
71     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
72     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
73     int              jnrA,jnrB;
74     int              j_coord_offsetA,j_coord_offsetB;
75     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
76     real             rcutoff_scalar;
77     real             *shiftvec,*fshift,*x,*f;
78     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
79     int              vdwioffset0;
80     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81     int              vdwioffset1;
82     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
83     int              vdwioffset2;
84     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85     int              vdwioffset3;
86     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87     int              vdwjidx0A,vdwjidx0B;
88     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89     int              vdwjidx1A,vdwjidx1B;
90     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
91     int              vdwjidx2A,vdwjidx2B;
92     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
93     int              vdwjidx3A,vdwjidx3B;
94     _fjsp_v2r8       jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
95     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
97     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
98     _fjsp_v2r8       dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
99     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
100     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
101     _fjsp_v2r8       dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
102     _fjsp_v2r8       dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
103     _fjsp_v2r8       dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
104     _fjsp_v2r8       dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
105     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
106     real             *charge;
107     int              nvdwtype;
108     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
109     int              *vdwtype;
110     real             *vdwparam;
111     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
112     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
113     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
114     real             *ewtab;
115     _fjsp_v2r8       itab_tmp;
116     _fjsp_v2r8       dummy_mask,cutoff_mask;
117     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
118     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
119     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
120
121     x                = xx[0];
122     f                = ff[0];
123
124     nri              = nlist->nri;
125     iinr             = nlist->iinr;
126     jindex           = nlist->jindex;
127     jjnr             = nlist->jjnr;
128     shiftidx         = nlist->shift;
129     gid              = nlist->gid;
130     shiftvec         = fr->shift_vec[0];
131     fshift           = fr->fshift[0];
132     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
133     charge           = mdatoms->chargeA;
134     nvdwtype         = fr->ntype;
135     vdwparam         = fr->nbfp;
136     vdwtype          = mdatoms->typeA;
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     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
146     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
147     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
148     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
149
150     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
151     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
152     jq3              = gmx_fjsp_set1_v2r8(charge[inr+3]);
153     vdwjidx0A        = 2*vdwtype[inr+0];
154     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
155     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
156     qq11             = _fjsp_mul_v2r8(iq1,jq1);
157     qq12             = _fjsp_mul_v2r8(iq1,jq2);
158     qq13             = _fjsp_mul_v2r8(iq1,jq3);
159     qq21             = _fjsp_mul_v2r8(iq2,jq1);
160     qq22             = _fjsp_mul_v2r8(iq2,jq2);
161     qq23             = _fjsp_mul_v2r8(iq2,jq3);
162     qq31             = _fjsp_mul_v2r8(iq3,jq1);
163     qq32             = _fjsp_mul_v2r8(iq3,jq2);
164     qq33             = _fjsp_mul_v2r8(iq3,jq3);
165
166     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
167     rcutoff_scalar   = fr->rcoulomb;
168     rcutoff          = gmx_fjsp_set1_v2r8(rcutoff_scalar);
169     rcutoff2         = _fjsp_mul_v2r8(rcutoff,rcutoff);
170
171     sh_vdw_invrcut6  = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
172     rvdw             = gmx_fjsp_set1_v2r8(fr->rvdw);
173
174     /* Avoid stupid compiler warnings */
175     jnrA = jnrB = 0;
176     j_coord_offsetA = 0;
177     j_coord_offsetB = 0;
178
179     outeriter        = 0;
180     inneriter        = 0;
181
182     /* Start outer loop over neighborlists */
183     for(iidx=0; iidx<nri; iidx++)
184     {
185         /* Load shift vector for this list */
186         i_shift_offset   = DIM*shiftidx[iidx];
187
188         /* Load limits for loop over neighbors */
189         j_index_start    = jindex[iidx];
190         j_index_end      = jindex[iidx+1];
191
192         /* Get outer coordinate index */
193         inr              = iinr[iidx];
194         i_coord_offset   = DIM*inr;
195
196         /* Load i particle coords and add shift vector */
197         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
198                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
199
200         fix0             = _fjsp_setzero_v2r8();
201         fiy0             = _fjsp_setzero_v2r8();
202         fiz0             = _fjsp_setzero_v2r8();
203         fix1             = _fjsp_setzero_v2r8();
204         fiy1             = _fjsp_setzero_v2r8();
205         fiz1             = _fjsp_setzero_v2r8();
206         fix2             = _fjsp_setzero_v2r8();
207         fiy2             = _fjsp_setzero_v2r8();
208         fiz2             = _fjsp_setzero_v2r8();
209         fix3             = _fjsp_setzero_v2r8();
210         fiy3             = _fjsp_setzero_v2r8();
211         fiz3             = _fjsp_setzero_v2r8();
212
213         /* Reset potential sums */
214         velecsum         = _fjsp_setzero_v2r8();
215         vvdwsum          = _fjsp_setzero_v2r8();
216
217         /* Start inner kernel loop */
218         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
219         {
220
221             /* Get j neighbor index, and coordinate index */
222             jnrA             = jjnr[jidx];
223             jnrB             = jjnr[jidx+1];
224             j_coord_offsetA  = DIM*jnrA;
225             j_coord_offsetB  = DIM*jnrB;
226
227             /* load j atom coordinates */
228             gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
229                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
230                                               &jy2,&jz2,&jx3,&jy3,&jz3);
231
232             /* Calculate displacement vector */
233             dx00             = _fjsp_sub_v2r8(ix0,jx0);
234             dy00             = _fjsp_sub_v2r8(iy0,jy0);
235             dz00             = _fjsp_sub_v2r8(iz0,jz0);
236             dx11             = _fjsp_sub_v2r8(ix1,jx1);
237             dy11             = _fjsp_sub_v2r8(iy1,jy1);
238             dz11             = _fjsp_sub_v2r8(iz1,jz1);
239             dx12             = _fjsp_sub_v2r8(ix1,jx2);
240             dy12             = _fjsp_sub_v2r8(iy1,jy2);
241             dz12             = _fjsp_sub_v2r8(iz1,jz2);
242             dx13             = _fjsp_sub_v2r8(ix1,jx3);
243             dy13             = _fjsp_sub_v2r8(iy1,jy3);
244             dz13             = _fjsp_sub_v2r8(iz1,jz3);
245             dx21             = _fjsp_sub_v2r8(ix2,jx1);
246             dy21             = _fjsp_sub_v2r8(iy2,jy1);
247             dz21             = _fjsp_sub_v2r8(iz2,jz1);
248             dx22             = _fjsp_sub_v2r8(ix2,jx2);
249             dy22             = _fjsp_sub_v2r8(iy2,jy2);
250             dz22             = _fjsp_sub_v2r8(iz2,jz2);
251             dx23             = _fjsp_sub_v2r8(ix2,jx3);
252             dy23             = _fjsp_sub_v2r8(iy2,jy3);
253             dz23             = _fjsp_sub_v2r8(iz2,jz3);
254             dx31             = _fjsp_sub_v2r8(ix3,jx1);
255             dy31             = _fjsp_sub_v2r8(iy3,jy1);
256             dz31             = _fjsp_sub_v2r8(iz3,jz1);
257             dx32             = _fjsp_sub_v2r8(ix3,jx2);
258             dy32             = _fjsp_sub_v2r8(iy3,jy2);
259             dz32             = _fjsp_sub_v2r8(iz3,jz2);
260             dx33             = _fjsp_sub_v2r8(ix3,jx3);
261             dy33             = _fjsp_sub_v2r8(iy3,jy3);
262             dz33             = _fjsp_sub_v2r8(iz3,jz3);
263
264             /* Calculate squared distance and things based on it */
265             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
266             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
267             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
268             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
269             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
270             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
271             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
272             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
273             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
274             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
275
276             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
277             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
278             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
279             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
280             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
281             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
282             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
283             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
284             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
285
286             rinvsq00         = gmx_fjsp_inv_v2r8(rsq00);
287             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
288             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
289             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
290             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
291             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
292             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
293             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
294             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
295             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
296
297             fjx0             = _fjsp_setzero_v2r8();
298             fjy0             = _fjsp_setzero_v2r8();
299             fjz0             = _fjsp_setzero_v2r8();
300             fjx1             = _fjsp_setzero_v2r8();
301             fjy1             = _fjsp_setzero_v2r8();
302             fjz1             = _fjsp_setzero_v2r8();
303             fjx2             = _fjsp_setzero_v2r8();
304             fjy2             = _fjsp_setzero_v2r8();
305             fjz2             = _fjsp_setzero_v2r8();
306             fjx3             = _fjsp_setzero_v2r8();
307             fjy3             = _fjsp_setzero_v2r8();
308             fjz3             = _fjsp_setzero_v2r8();
309
310             /**************************
311              * CALCULATE INTERACTIONS *
312              **************************/
313
314             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
315             {
316
317             /* LENNARD-JONES DISPERSION/REPULSION */
318
319             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
320             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
321             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
322             vvdw             = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
323                                            _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
324             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
325
326             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
327
328             /* Update potential sum for this i atom from the interaction with this j atom. */
329             vvdw             = _fjsp_and_v2r8(vvdw,cutoff_mask);
330             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
331
332             fscal            = fvdw;
333
334             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
335
336             /* Update vectorial force */
337             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
338             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
339             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
340             
341             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
342             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
343             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
344
345             }
346
347             /**************************
348              * CALCULATE INTERACTIONS *
349              **************************/
350
351             if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
352             {
353
354             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
355
356             /* EWALD ELECTROSTATICS */
357
358             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
359             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
360             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
361             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
362             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
363
364             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
365             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
366             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
367             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
368             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
369             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
370             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
371             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
372             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
373             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
374
375             cutoff_mask      = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
376
377             /* Update potential sum for this i atom from the interaction with this j atom. */
378             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
379             velecsum         = _fjsp_add_v2r8(velecsum,velec);
380
381             fscal            = felec;
382
383             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
384
385             /* Update vectorial force */
386             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
387             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
388             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
389             
390             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
391             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
392             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
393
394             }
395
396             /**************************
397              * CALCULATE INTERACTIONS *
398              **************************/
399
400             if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
401             {
402
403             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
404
405             /* EWALD ELECTROSTATICS */
406
407             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
408             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
409             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
410             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
411             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
412
413             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
414             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
415             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
416             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
417             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
418             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
419             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
420             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
421             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
422             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
423
424             cutoff_mask      = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
425
426             /* Update potential sum for this i atom from the interaction with this j atom. */
427             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
428             velecsum         = _fjsp_add_v2r8(velecsum,velec);
429
430             fscal            = felec;
431
432             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
433
434             /* Update vectorial force */
435             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
436             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
437             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
438             
439             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
440             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
441             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
442
443             }
444
445             /**************************
446              * CALCULATE INTERACTIONS *
447              **************************/
448
449             if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
450             {
451
452             r13              = _fjsp_mul_v2r8(rsq13,rinv13);
453
454             /* EWALD ELECTROSTATICS */
455
456             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
457             ewrt             = _fjsp_mul_v2r8(r13,ewtabscale);
458             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
459             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
460             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
461
462             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
463             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
464             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
465             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
466             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
467             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
468             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
469             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
470             velec            = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
471             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
472
473             cutoff_mask      = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
474
475             /* Update potential sum for this i atom from the interaction with this j atom. */
476             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
477             velecsum         = _fjsp_add_v2r8(velecsum,velec);
478
479             fscal            = felec;
480
481             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
482
483             /* Update vectorial force */
484             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
485             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
486             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
487             
488             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
489             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
490             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
491
492             }
493
494             /**************************
495              * CALCULATE INTERACTIONS *
496              **************************/
497
498             if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
499             {
500
501             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
502
503             /* EWALD ELECTROSTATICS */
504
505             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
506             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
507             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
508             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
509             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
510
511             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
512             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
513             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
514             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
515             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
516             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
517             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
518             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
519             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
520             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
521
522             cutoff_mask      = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
523
524             /* Update potential sum for this i atom from the interaction with this j atom. */
525             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
526             velecsum         = _fjsp_add_v2r8(velecsum,velec);
527
528             fscal            = felec;
529
530             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
531
532             /* Update vectorial force */
533             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
534             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
535             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
536             
537             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
538             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
539             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
540
541             }
542
543             /**************************
544              * CALCULATE INTERACTIONS *
545              **************************/
546
547             if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
548             {
549
550             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
551
552             /* EWALD ELECTROSTATICS */
553
554             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
555             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
556             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
557             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
558             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
559
560             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
561             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
562             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
563             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
564             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
565             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
566             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
567             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
568             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
569             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
570
571             cutoff_mask      = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
572
573             /* Update potential sum for this i atom from the interaction with this j atom. */
574             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
575             velecsum         = _fjsp_add_v2r8(velecsum,velec);
576
577             fscal            = felec;
578
579             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
580
581             /* Update vectorial force */
582             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
583             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
584             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
585             
586             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
587             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
588             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
589
590             }
591
592             /**************************
593              * CALCULATE INTERACTIONS *
594              **************************/
595
596             if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
597             {
598
599             r23              = _fjsp_mul_v2r8(rsq23,rinv23);
600
601             /* EWALD ELECTROSTATICS */
602
603             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
604             ewrt             = _fjsp_mul_v2r8(r23,ewtabscale);
605             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
606             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
607             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
608
609             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
610             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
611             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
612             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
613             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
614             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
615             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
616             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
617             velec            = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
618             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
619
620             cutoff_mask      = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
621
622             /* Update potential sum for this i atom from the interaction with this j atom. */
623             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
624             velecsum         = _fjsp_add_v2r8(velecsum,velec);
625
626             fscal            = felec;
627
628             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
629
630             /* Update vectorial force */
631             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
632             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
633             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
634             
635             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
636             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
637             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
638
639             }
640
641             /**************************
642              * CALCULATE INTERACTIONS *
643              **************************/
644
645             if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
646             {
647
648             r31              = _fjsp_mul_v2r8(rsq31,rinv31);
649
650             /* EWALD ELECTROSTATICS */
651
652             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
653             ewrt             = _fjsp_mul_v2r8(r31,ewtabscale);
654             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
655             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
656             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
657
658             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
659             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
660             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
661             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
662             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
663             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
664             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
665             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
666             velec            = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
667             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
668
669             cutoff_mask      = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
670
671             /* Update potential sum for this i atom from the interaction with this j atom. */
672             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
673             velecsum         = _fjsp_add_v2r8(velecsum,velec);
674
675             fscal            = felec;
676
677             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
678
679             /* Update vectorial force */
680             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
681             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
682             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
683             
684             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
685             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
686             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
687
688             }
689
690             /**************************
691              * CALCULATE INTERACTIONS *
692              **************************/
693
694             if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
695             {
696
697             r32              = _fjsp_mul_v2r8(rsq32,rinv32);
698
699             /* EWALD ELECTROSTATICS */
700
701             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
702             ewrt             = _fjsp_mul_v2r8(r32,ewtabscale);
703             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
704             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
705             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
706
707             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
708             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
709             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
710             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
711             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
712             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
713             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
714             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
715             velec            = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
716             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
717
718             cutoff_mask      = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
719
720             /* Update potential sum for this i atom from the interaction with this j atom. */
721             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
722             velecsum         = _fjsp_add_v2r8(velecsum,velec);
723
724             fscal            = felec;
725
726             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
727
728             /* Update vectorial force */
729             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
730             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
731             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
732             
733             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
734             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
735             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
736
737             }
738
739             /**************************
740              * CALCULATE INTERACTIONS *
741              **************************/
742
743             if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
744             {
745
746             r33              = _fjsp_mul_v2r8(rsq33,rinv33);
747
748             /* EWALD ELECTROSTATICS */
749
750             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
751             ewrt             = _fjsp_mul_v2r8(r33,ewtabscale);
752             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
753             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
754             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
755
756             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
757             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
758             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
759             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
760             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
761             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
762             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
763             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
764             velec            = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
765             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
766
767             cutoff_mask      = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
768
769             /* Update potential sum for this i atom from the interaction with this j atom. */
770             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
771             velecsum         = _fjsp_add_v2r8(velecsum,velec);
772
773             fscal            = felec;
774
775             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
776
777             /* Update vectorial force */
778             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
779             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
780             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
781             
782             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
783             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
784             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
785
786             }
787
788             gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
789
790             /* Inner loop uses 488 flops */
791         }
792
793         if(jidx<j_index_end)
794         {
795
796             jnrA             = jjnr[jidx];
797             j_coord_offsetA  = DIM*jnrA;
798
799             /* load j atom coordinates */
800             gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
801                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
802                                               &jy2,&jz2,&jx3,&jy3,&jz3);
803
804             /* Calculate displacement vector */
805             dx00             = _fjsp_sub_v2r8(ix0,jx0);
806             dy00             = _fjsp_sub_v2r8(iy0,jy0);
807             dz00             = _fjsp_sub_v2r8(iz0,jz0);
808             dx11             = _fjsp_sub_v2r8(ix1,jx1);
809             dy11             = _fjsp_sub_v2r8(iy1,jy1);
810             dz11             = _fjsp_sub_v2r8(iz1,jz1);
811             dx12             = _fjsp_sub_v2r8(ix1,jx2);
812             dy12             = _fjsp_sub_v2r8(iy1,jy2);
813             dz12             = _fjsp_sub_v2r8(iz1,jz2);
814             dx13             = _fjsp_sub_v2r8(ix1,jx3);
815             dy13             = _fjsp_sub_v2r8(iy1,jy3);
816             dz13             = _fjsp_sub_v2r8(iz1,jz3);
817             dx21             = _fjsp_sub_v2r8(ix2,jx1);
818             dy21             = _fjsp_sub_v2r8(iy2,jy1);
819             dz21             = _fjsp_sub_v2r8(iz2,jz1);
820             dx22             = _fjsp_sub_v2r8(ix2,jx2);
821             dy22             = _fjsp_sub_v2r8(iy2,jy2);
822             dz22             = _fjsp_sub_v2r8(iz2,jz2);
823             dx23             = _fjsp_sub_v2r8(ix2,jx3);
824             dy23             = _fjsp_sub_v2r8(iy2,jy3);
825             dz23             = _fjsp_sub_v2r8(iz2,jz3);
826             dx31             = _fjsp_sub_v2r8(ix3,jx1);
827             dy31             = _fjsp_sub_v2r8(iy3,jy1);
828             dz31             = _fjsp_sub_v2r8(iz3,jz1);
829             dx32             = _fjsp_sub_v2r8(ix3,jx2);
830             dy32             = _fjsp_sub_v2r8(iy3,jy2);
831             dz32             = _fjsp_sub_v2r8(iz3,jz2);
832             dx33             = _fjsp_sub_v2r8(ix3,jx3);
833             dy33             = _fjsp_sub_v2r8(iy3,jy3);
834             dz33             = _fjsp_sub_v2r8(iz3,jz3);
835
836             /* Calculate squared distance and things based on it */
837             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
838             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
839             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
840             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
841             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
842             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
843             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
844             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
845             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
846             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
847
848             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
849             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
850             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
851             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
852             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
853             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
854             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
855             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
856             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
857
858             rinvsq00         = gmx_fjsp_inv_v2r8(rsq00);
859             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
860             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
861             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
862             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
863             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
864             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
865             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
866             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
867             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
868
869             fjx0             = _fjsp_setzero_v2r8();
870             fjy0             = _fjsp_setzero_v2r8();
871             fjz0             = _fjsp_setzero_v2r8();
872             fjx1             = _fjsp_setzero_v2r8();
873             fjy1             = _fjsp_setzero_v2r8();
874             fjz1             = _fjsp_setzero_v2r8();
875             fjx2             = _fjsp_setzero_v2r8();
876             fjy2             = _fjsp_setzero_v2r8();
877             fjz2             = _fjsp_setzero_v2r8();
878             fjx3             = _fjsp_setzero_v2r8();
879             fjy3             = _fjsp_setzero_v2r8();
880             fjz3             = _fjsp_setzero_v2r8();
881
882             /**************************
883              * CALCULATE INTERACTIONS *
884              **************************/
885
886             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
887             {
888
889             /* LENNARD-JONES DISPERSION/REPULSION */
890
891             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
892             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
893             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
894             vvdw             = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
895                                            _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
896             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
897
898             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
899
900             /* Update potential sum for this i atom from the interaction with this j atom. */
901             vvdw             = _fjsp_and_v2r8(vvdw,cutoff_mask);
902             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
903             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
904
905             fscal            = fvdw;
906
907             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
908
909             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
910
911             /* Update vectorial force */
912             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
913             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
914             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
915             
916             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
917             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
918             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
919
920             }
921
922             /**************************
923              * CALCULATE INTERACTIONS *
924              **************************/
925
926             if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
927             {
928
929             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
930
931             /* EWALD ELECTROSTATICS */
932
933             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
934             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
935             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
936             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
937             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
938
939             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
940             ewtabD           = _fjsp_setzero_v2r8();
941             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
942             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
943             ewtabFn          = _fjsp_setzero_v2r8();
944             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
945             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
946             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
947             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv11,sh_ewald),velec));
948             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
949
950             cutoff_mask      = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
951
952             /* Update potential sum for this i atom from the interaction with this j atom. */
953             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
954             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
955             velecsum         = _fjsp_add_v2r8(velecsum,velec);
956
957             fscal            = felec;
958
959             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
960
961             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
962
963             /* Update vectorial force */
964             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
965             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
966             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
967             
968             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
969             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
970             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
971
972             }
973
974             /**************************
975              * CALCULATE INTERACTIONS *
976              **************************/
977
978             if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
979             {
980
981             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
982
983             /* EWALD ELECTROSTATICS */
984
985             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
986             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
987             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
988             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
989             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
990
991             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
992             ewtabD           = _fjsp_setzero_v2r8();
993             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
994             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
995             ewtabFn          = _fjsp_setzero_v2r8();
996             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
997             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
998             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
999             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv12,sh_ewald),velec));
1000             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1001
1002             cutoff_mask      = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1003
1004             /* Update potential sum for this i atom from the interaction with this j atom. */
1005             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1006             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1007             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1008
1009             fscal            = felec;
1010
1011             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1012
1013             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1014
1015             /* Update vectorial force */
1016             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1017             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1018             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1019             
1020             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1021             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1022             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1023
1024             }
1025
1026             /**************************
1027              * CALCULATE INTERACTIONS *
1028              **************************/
1029
1030             if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1031             {
1032
1033             r13              = _fjsp_mul_v2r8(rsq13,rinv13);
1034
1035             /* EWALD ELECTROSTATICS */
1036
1037             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1038             ewrt             = _fjsp_mul_v2r8(r13,ewtabscale);
1039             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1040             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1041             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1042
1043             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1044             ewtabD           = _fjsp_setzero_v2r8();
1045             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1046             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1047             ewtabFn          = _fjsp_setzero_v2r8();
1048             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1049             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1050             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1051             velec            = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv13,sh_ewald),velec));
1052             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1053
1054             cutoff_mask      = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1055
1056             /* Update potential sum for this i atom from the interaction with this j atom. */
1057             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1058             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1059             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1060
1061             fscal            = felec;
1062
1063             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1064
1065             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1066
1067             /* Update vectorial force */
1068             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
1069             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1070             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1071             
1072             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1073             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1074             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1075
1076             }
1077
1078             /**************************
1079              * CALCULATE INTERACTIONS *
1080              **************************/
1081
1082             if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1083             {
1084
1085             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
1086
1087             /* EWALD ELECTROSTATICS */
1088
1089             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1090             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
1091             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1092             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1093             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1094
1095             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1096             ewtabD           = _fjsp_setzero_v2r8();
1097             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1098             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1099             ewtabFn          = _fjsp_setzero_v2r8();
1100             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1101             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1102             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1103             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv21,sh_ewald),velec));
1104             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1105
1106             cutoff_mask      = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1107
1108             /* Update potential sum for this i atom from the interaction with this j atom. */
1109             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1110             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1111             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1112
1113             fscal            = felec;
1114
1115             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1116
1117             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1118
1119             /* Update vectorial force */
1120             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1121             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1122             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1123             
1124             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1125             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1126             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1127
1128             }
1129
1130             /**************************
1131              * CALCULATE INTERACTIONS *
1132              **************************/
1133
1134             if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1135             {
1136
1137             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
1138
1139             /* EWALD ELECTROSTATICS */
1140
1141             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1142             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
1143             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1144             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1145             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1146
1147             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1148             ewtabD           = _fjsp_setzero_v2r8();
1149             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1150             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1151             ewtabFn          = _fjsp_setzero_v2r8();
1152             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1153             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1154             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1155             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv22,sh_ewald),velec));
1156             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1157
1158             cutoff_mask      = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1159
1160             /* Update potential sum for this i atom from the interaction with this j atom. */
1161             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1162             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1163             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1164
1165             fscal            = felec;
1166
1167             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1168
1169             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1170
1171             /* Update vectorial force */
1172             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1173             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1174             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1175             
1176             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1177             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1178             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1179
1180             }
1181
1182             /**************************
1183              * CALCULATE INTERACTIONS *
1184              **************************/
1185
1186             if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1187             {
1188
1189             r23              = _fjsp_mul_v2r8(rsq23,rinv23);
1190
1191             /* EWALD ELECTROSTATICS */
1192
1193             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1194             ewrt             = _fjsp_mul_v2r8(r23,ewtabscale);
1195             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1196             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1197             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1198
1199             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1200             ewtabD           = _fjsp_setzero_v2r8();
1201             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1202             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1203             ewtabFn          = _fjsp_setzero_v2r8();
1204             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1205             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1206             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1207             velec            = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv23,sh_ewald),velec));
1208             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1209
1210             cutoff_mask      = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1211
1212             /* Update potential sum for this i atom from the interaction with this j atom. */
1213             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1214             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1215             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1216
1217             fscal            = felec;
1218
1219             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1220
1221             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1222
1223             /* Update vectorial force */
1224             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
1225             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1226             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1227             
1228             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1229             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1230             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1231
1232             }
1233
1234             /**************************
1235              * CALCULATE INTERACTIONS *
1236              **************************/
1237
1238             if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1239             {
1240
1241             r31              = _fjsp_mul_v2r8(rsq31,rinv31);
1242
1243             /* EWALD ELECTROSTATICS */
1244
1245             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1246             ewrt             = _fjsp_mul_v2r8(r31,ewtabscale);
1247             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1248             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1249             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1250
1251             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1252             ewtabD           = _fjsp_setzero_v2r8();
1253             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1254             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1255             ewtabFn          = _fjsp_setzero_v2r8();
1256             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1257             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1258             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1259             velec            = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv31,sh_ewald),velec));
1260             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1261
1262             cutoff_mask      = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1263
1264             /* Update potential sum for this i atom from the interaction with this j atom. */
1265             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1266             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1267             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1268
1269             fscal            = felec;
1270
1271             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1272
1273             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1274
1275             /* Update vectorial force */
1276             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
1277             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1278             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1279             
1280             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1281             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1282             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1283
1284             }
1285
1286             /**************************
1287              * CALCULATE INTERACTIONS *
1288              **************************/
1289
1290             if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1291             {
1292
1293             r32              = _fjsp_mul_v2r8(rsq32,rinv32);
1294
1295             /* EWALD ELECTROSTATICS */
1296
1297             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1298             ewrt             = _fjsp_mul_v2r8(r32,ewtabscale);
1299             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1300             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1301             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1302
1303             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1304             ewtabD           = _fjsp_setzero_v2r8();
1305             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1306             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1307             ewtabFn          = _fjsp_setzero_v2r8();
1308             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1309             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1310             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1311             velec            = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv32,sh_ewald),velec));
1312             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
1313
1314             cutoff_mask      = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
1315
1316             /* Update potential sum for this i atom from the interaction with this j atom. */
1317             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1318             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1319             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1320
1321             fscal            = felec;
1322
1323             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1324
1325             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1326
1327             /* Update vectorial force */
1328             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
1329             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1330             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1331             
1332             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1333             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1334             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1335
1336             }
1337
1338             /**************************
1339              * CALCULATE INTERACTIONS *
1340              **************************/
1341
1342             if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
1343             {
1344
1345             r33              = _fjsp_mul_v2r8(rsq33,rinv33);
1346
1347             /* EWALD ELECTROSTATICS */
1348
1349             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1350             ewrt             = _fjsp_mul_v2r8(r33,ewtabscale);
1351             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1352             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1353             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1354
1355             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
1356             ewtabD           = _fjsp_setzero_v2r8();
1357             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
1358             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
1359             ewtabFn          = _fjsp_setzero_v2r8();
1360             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
1361             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
1362             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
1363             velec            = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_sub_v2r8(rinv33,sh_ewald),velec));
1364             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
1365
1366             cutoff_mask      = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
1367
1368             /* Update potential sum for this i atom from the interaction with this j atom. */
1369             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
1370             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
1371             velecsum         = _fjsp_add_v2r8(velecsum,velec);
1372
1373             fscal            = felec;
1374
1375             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1376
1377             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1378
1379             /* Update vectorial force */
1380             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
1381             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1382             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1383             
1384             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1385             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1386             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1387
1388             }
1389
1390             gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1391
1392             /* Inner loop uses 488 flops */
1393         }
1394
1395         /* End of innermost loop */
1396
1397         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1398                                               f+i_coord_offset,fshift+i_shift_offset);
1399
1400         ggid                        = gid[iidx];
1401         /* Update potential energies */
1402         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
1403         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
1404
1405         /* Increment number of inner iterations */
1406         inneriter                  += j_index_end - j_index_start;
1407
1408         /* Outer loop uses 26 flops */
1409     }
1410
1411     /* Increment number of outer iterations */
1412     outeriter        += nri;
1413
1414     /* Update outer/inner flops */
1415
1416     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*488);
1417 }
1418 /*
1419  * Gromacs nonbonded kernel:   nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1420  * Electrostatics interaction: Ewald
1421  * VdW interaction:            LennardJones
1422  * Geometry:                   Water4-Water4
1423  * Calculate force/pot:        Force
1424  */
1425 void
1426 nb_kernel_ElecEwSh_VdwLJSh_GeomW4W4_F_sparc64_hpc_ace_double
1427                     (t_nblist                    * gmx_restrict       nlist,
1428                      rvec                        * gmx_restrict          xx,
1429                      rvec                        * gmx_restrict          ff,
1430                      t_forcerec                  * gmx_restrict          fr,
1431                      t_mdatoms                   * gmx_restrict     mdatoms,
1432                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
1433                      t_nrnb                      * gmx_restrict        nrnb)
1434 {
1435     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1436      * just 0 for non-waters.
1437      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
1438      * jnr indices corresponding to data put in the four positions in the SIMD register.
1439      */
1440     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
1441     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1442     int              jnrA,jnrB;
1443     int              j_coord_offsetA,j_coord_offsetB;
1444     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
1445     real             rcutoff_scalar;
1446     real             *shiftvec,*fshift,*x,*f;
1447     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
1448     int              vdwioffset0;
1449     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1450     int              vdwioffset1;
1451     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1452     int              vdwioffset2;
1453     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1454     int              vdwioffset3;
1455     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
1456     int              vdwjidx0A,vdwjidx0B;
1457     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1458     int              vdwjidx1A,vdwjidx1B;
1459     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1460     int              vdwjidx2A,vdwjidx2B;
1461     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1462     int              vdwjidx3A,vdwjidx3B;
1463     _fjsp_v2r8       jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
1464     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1465     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1466     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1467     _fjsp_v2r8       dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
1468     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1469     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1470     _fjsp_v2r8       dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
1471     _fjsp_v2r8       dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
1472     _fjsp_v2r8       dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
1473     _fjsp_v2r8       dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
1474     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
1475     real             *charge;
1476     int              nvdwtype;
1477     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1478     int              *vdwtype;
1479     real             *vdwparam;
1480     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
1481     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1482     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
1483     real             *ewtab;
1484     _fjsp_v2r8       itab_tmp;
1485     _fjsp_v2r8       dummy_mask,cutoff_mask;
1486     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
1487     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
1488     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1489
1490     x                = xx[0];
1491     f                = ff[0];
1492
1493     nri              = nlist->nri;
1494     iinr             = nlist->iinr;
1495     jindex           = nlist->jindex;
1496     jjnr             = nlist->jjnr;
1497     shiftidx         = nlist->shift;
1498     gid              = nlist->gid;
1499     shiftvec         = fr->shift_vec[0];
1500     fshift           = fr->fshift[0];
1501     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
1502     charge           = mdatoms->chargeA;
1503     nvdwtype         = fr->ntype;
1504     vdwparam         = fr->nbfp;
1505     vdwtype          = mdatoms->typeA;
1506
1507     sh_ewald         = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
1508     ewtab            = fr->ic->tabq_coul_F;
1509     ewtabscale       = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
1510     ewtabhalfspace   = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
1511
1512     /* Setup water-specific parameters */
1513     inr              = nlist->iinr[0];
1514     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1515     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1516     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
1517     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
1518
1519     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
1520     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
1521     jq3              = gmx_fjsp_set1_v2r8(charge[inr+3]);
1522     vdwjidx0A        = 2*vdwtype[inr+0];
1523     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1524     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1525     qq11             = _fjsp_mul_v2r8(iq1,jq1);
1526     qq12             = _fjsp_mul_v2r8(iq1,jq2);
1527     qq13             = _fjsp_mul_v2r8(iq1,jq3);
1528     qq21             = _fjsp_mul_v2r8(iq2,jq1);
1529     qq22             = _fjsp_mul_v2r8(iq2,jq2);
1530     qq23             = _fjsp_mul_v2r8(iq2,jq3);
1531     qq31             = _fjsp_mul_v2r8(iq3,jq1);
1532     qq32             = _fjsp_mul_v2r8(iq3,jq2);
1533     qq33             = _fjsp_mul_v2r8(iq3,jq3);
1534
1535     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
1536     rcutoff_scalar   = fr->rcoulomb;
1537     rcutoff          = gmx_fjsp_set1_v2r8(rcutoff_scalar);
1538     rcutoff2         = _fjsp_mul_v2r8(rcutoff,rcutoff);
1539
1540     sh_vdw_invrcut6  = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
1541     rvdw             = gmx_fjsp_set1_v2r8(fr->rvdw);
1542
1543     /* Avoid stupid compiler warnings */
1544     jnrA = jnrB = 0;
1545     j_coord_offsetA = 0;
1546     j_coord_offsetB = 0;
1547
1548     outeriter        = 0;
1549     inneriter        = 0;
1550
1551     /* Start outer loop over neighborlists */
1552     for(iidx=0; iidx<nri; iidx++)
1553     {
1554         /* Load shift vector for this list */
1555         i_shift_offset   = DIM*shiftidx[iidx];
1556
1557         /* Load limits for loop over neighbors */
1558         j_index_start    = jindex[iidx];
1559         j_index_end      = jindex[iidx+1];
1560
1561         /* Get outer coordinate index */
1562         inr              = iinr[iidx];
1563         i_coord_offset   = DIM*inr;
1564
1565         /* Load i particle coords and add shift vector */
1566         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1567                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1568
1569         fix0             = _fjsp_setzero_v2r8();
1570         fiy0             = _fjsp_setzero_v2r8();
1571         fiz0             = _fjsp_setzero_v2r8();
1572         fix1             = _fjsp_setzero_v2r8();
1573         fiy1             = _fjsp_setzero_v2r8();
1574         fiz1             = _fjsp_setzero_v2r8();
1575         fix2             = _fjsp_setzero_v2r8();
1576         fiy2             = _fjsp_setzero_v2r8();
1577         fiz2             = _fjsp_setzero_v2r8();
1578         fix3             = _fjsp_setzero_v2r8();
1579         fiy3             = _fjsp_setzero_v2r8();
1580         fiz3             = _fjsp_setzero_v2r8();
1581
1582         /* Start inner kernel loop */
1583         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1584         {
1585
1586             /* Get j neighbor index, and coordinate index */
1587             jnrA             = jjnr[jidx];
1588             jnrB             = jjnr[jidx+1];
1589             j_coord_offsetA  = DIM*jnrA;
1590             j_coord_offsetB  = DIM*jnrB;
1591
1592             /* load j atom coordinates */
1593             gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1594                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1595                                               &jy2,&jz2,&jx3,&jy3,&jz3);
1596
1597             /* Calculate displacement vector */
1598             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1599             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1600             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1601             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1602             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1603             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1604             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1605             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1606             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1607             dx13             = _fjsp_sub_v2r8(ix1,jx3);
1608             dy13             = _fjsp_sub_v2r8(iy1,jy3);
1609             dz13             = _fjsp_sub_v2r8(iz1,jz3);
1610             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1611             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1612             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1613             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1614             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1615             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1616             dx23             = _fjsp_sub_v2r8(ix2,jx3);
1617             dy23             = _fjsp_sub_v2r8(iy2,jy3);
1618             dz23             = _fjsp_sub_v2r8(iz2,jz3);
1619             dx31             = _fjsp_sub_v2r8(ix3,jx1);
1620             dy31             = _fjsp_sub_v2r8(iy3,jy1);
1621             dz31             = _fjsp_sub_v2r8(iz3,jz1);
1622             dx32             = _fjsp_sub_v2r8(ix3,jx2);
1623             dy32             = _fjsp_sub_v2r8(iy3,jy2);
1624             dz32             = _fjsp_sub_v2r8(iz3,jz2);
1625             dx33             = _fjsp_sub_v2r8(ix3,jx3);
1626             dy33             = _fjsp_sub_v2r8(iy3,jy3);
1627             dz33             = _fjsp_sub_v2r8(iz3,jz3);
1628
1629             /* Calculate squared distance and things based on it */
1630             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1631             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1632             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1633             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1634             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1635             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1636             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1637             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1638             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1639             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1640
1641             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1642             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1643             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
1644             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1645             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1646             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
1647             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
1648             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
1649             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
1650
1651             rinvsq00         = gmx_fjsp_inv_v2r8(rsq00);
1652             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1653             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1654             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
1655             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1656             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1657             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
1658             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
1659             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
1660             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
1661
1662             fjx0             = _fjsp_setzero_v2r8();
1663             fjy0             = _fjsp_setzero_v2r8();
1664             fjz0             = _fjsp_setzero_v2r8();
1665             fjx1             = _fjsp_setzero_v2r8();
1666             fjy1             = _fjsp_setzero_v2r8();
1667             fjz1             = _fjsp_setzero_v2r8();
1668             fjx2             = _fjsp_setzero_v2r8();
1669             fjy2             = _fjsp_setzero_v2r8();
1670             fjz2             = _fjsp_setzero_v2r8();
1671             fjx3             = _fjsp_setzero_v2r8();
1672             fjy3             = _fjsp_setzero_v2r8();
1673             fjz3             = _fjsp_setzero_v2r8();
1674
1675             /**************************
1676              * CALCULATE INTERACTIONS *
1677              **************************/
1678
1679             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
1680             {
1681
1682             /* LENNARD-JONES DISPERSION/REPULSION */
1683
1684             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1685             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1686
1687             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
1688
1689             fscal            = fvdw;
1690
1691             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1692
1693             /* Update vectorial force */
1694             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1695             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1696             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1697             
1698             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1699             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1700             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1701
1702             }
1703
1704             /**************************
1705              * CALCULATE INTERACTIONS *
1706              **************************/
1707
1708             if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
1709             {
1710
1711             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
1712
1713             /* EWALD ELECTROSTATICS */
1714
1715             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1716             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
1717             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1718             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1719             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1720
1721             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1722                                          &ewtabF,&ewtabFn);
1723             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1724             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
1725
1726             cutoff_mask      = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
1727
1728             fscal            = felec;
1729
1730             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1731
1732             /* Update vectorial force */
1733             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1734             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1735             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1736             
1737             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1738             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1739             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1740
1741             }
1742
1743             /**************************
1744              * CALCULATE INTERACTIONS *
1745              **************************/
1746
1747             if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
1748             {
1749
1750             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
1751
1752             /* EWALD ELECTROSTATICS */
1753
1754             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1755             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
1756             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1757             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1758             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1759
1760             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1761                                          &ewtabF,&ewtabFn);
1762             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1763             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
1764
1765             cutoff_mask      = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
1766
1767             fscal            = felec;
1768
1769             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1770
1771             /* Update vectorial force */
1772             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1773             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1774             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1775             
1776             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1777             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1778             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1779
1780             }
1781
1782             /**************************
1783              * CALCULATE INTERACTIONS *
1784              **************************/
1785
1786             if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
1787             {
1788
1789             r13              = _fjsp_mul_v2r8(rsq13,rinv13);
1790
1791             /* EWALD ELECTROSTATICS */
1792
1793             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1794             ewrt             = _fjsp_mul_v2r8(r13,ewtabscale);
1795             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1796             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1797             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1798
1799             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1800                                          &ewtabF,&ewtabFn);
1801             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1802             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
1803
1804             cutoff_mask      = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
1805
1806             fscal            = felec;
1807
1808             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1809
1810             /* Update vectorial force */
1811             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
1812             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1813             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1814             
1815             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1816             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1817             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1818
1819             }
1820
1821             /**************************
1822              * CALCULATE INTERACTIONS *
1823              **************************/
1824
1825             if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
1826             {
1827
1828             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
1829
1830             /* EWALD ELECTROSTATICS */
1831
1832             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1833             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
1834             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1835             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1836             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1837
1838             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1839                                          &ewtabF,&ewtabFn);
1840             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1841             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
1842
1843             cutoff_mask      = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
1844
1845             fscal            = felec;
1846
1847             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1848
1849             /* Update vectorial force */
1850             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1851             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1852             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1853             
1854             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1855             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1856             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1857
1858             }
1859
1860             /**************************
1861              * CALCULATE INTERACTIONS *
1862              **************************/
1863
1864             if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
1865             {
1866
1867             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
1868
1869             /* EWALD ELECTROSTATICS */
1870
1871             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1872             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
1873             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1874             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1875             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1876
1877             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1878                                          &ewtabF,&ewtabFn);
1879             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1880             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
1881
1882             cutoff_mask      = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
1883
1884             fscal            = felec;
1885
1886             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1887
1888             /* Update vectorial force */
1889             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1890             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1891             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1892             
1893             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1894             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1895             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1896
1897             }
1898
1899             /**************************
1900              * CALCULATE INTERACTIONS *
1901              **************************/
1902
1903             if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
1904             {
1905
1906             r23              = _fjsp_mul_v2r8(rsq23,rinv23);
1907
1908             /* EWALD ELECTROSTATICS */
1909
1910             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1911             ewrt             = _fjsp_mul_v2r8(r23,ewtabscale);
1912             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1913             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1914             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1915
1916             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1917                                          &ewtabF,&ewtabFn);
1918             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1919             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
1920
1921             cutoff_mask      = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
1922
1923             fscal            = felec;
1924
1925             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1926
1927             /* Update vectorial force */
1928             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
1929             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1930             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1931             
1932             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1933             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1934             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1935
1936             }
1937
1938             /**************************
1939              * CALCULATE INTERACTIONS *
1940              **************************/
1941
1942             if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
1943             {
1944
1945             r31              = _fjsp_mul_v2r8(rsq31,rinv31);
1946
1947             /* EWALD ELECTROSTATICS */
1948
1949             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1950             ewrt             = _fjsp_mul_v2r8(r31,ewtabscale);
1951             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1952             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1953             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1954
1955             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1956                                          &ewtabF,&ewtabFn);
1957             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1958             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
1959
1960             cutoff_mask      = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
1961
1962             fscal            = felec;
1963
1964             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
1965
1966             /* Update vectorial force */
1967             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
1968             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1969             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1970             
1971             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1972             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1973             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1974
1975             }
1976
1977             /**************************
1978              * CALCULATE INTERACTIONS *
1979              **************************/
1980
1981             if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
1982             {
1983
1984             r32              = _fjsp_mul_v2r8(rsq32,rinv32);
1985
1986             /* EWALD ELECTROSTATICS */
1987
1988             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1989             ewrt             = _fjsp_mul_v2r8(r32,ewtabscale);
1990             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
1991             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
1992             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
1993
1994             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
1995                                          &ewtabF,&ewtabFn);
1996             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
1997             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
1998
1999             cutoff_mask      = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2000
2001             fscal            = felec;
2002
2003             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2004
2005             /* Update vectorial force */
2006             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
2007             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2008             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2009             
2010             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2011             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2012             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2013
2014             }
2015
2016             /**************************
2017              * CALCULATE INTERACTIONS *
2018              **************************/
2019
2020             if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2021             {
2022
2023             r33              = _fjsp_mul_v2r8(rsq33,rinv33);
2024
2025             /* EWALD ELECTROSTATICS */
2026
2027             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2028             ewrt             = _fjsp_mul_v2r8(r33,ewtabscale);
2029             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2030             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2031             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2032
2033             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
2034                                          &ewtabF,&ewtabFn);
2035             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2036             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2037
2038             cutoff_mask      = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2039
2040             fscal            = felec;
2041
2042             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2043
2044             /* Update vectorial force */
2045             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
2046             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2047             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2048             
2049             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2050             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2051             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2052
2053             }
2054
2055             gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
2056
2057             /* Inner loop uses 414 flops */
2058         }
2059
2060         if(jidx<j_index_end)
2061         {
2062
2063             jnrA             = jjnr[jidx];
2064             j_coord_offsetA  = DIM*jnrA;
2065
2066             /* load j atom coordinates */
2067             gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
2068                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
2069                                               &jy2,&jz2,&jx3,&jy3,&jz3);
2070
2071             /* Calculate displacement vector */
2072             dx00             = _fjsp_sub_v2r8(ix0,jx0);
2073             dy00             = _fjsp_sub_v2r8(iy0,jy0);
2074             dz00             = _fjsp_sub_v2r8(iz0,jz0);
2075             dx11             = _fjsp_sub_v2r8(ix1,jx1);
2076             dy11             = _fjsp_sub_v2r8(iy1,jy1);
2077             dz11             = _fjsp_sub_v2r8(iz1,jz1);
2078             dx12             = _fjsp_sub_v2r8(ix1,jx2);
2079             dy12             = _fjsp_sub_v2r8(iy1,jy2);
2080             dz12             = _fjsp_sub_v2r8(iz1,jz2);
2081             dx13             = _fjsp_sub_v2r8(ix1,jx3);
2082             dy13             = _fjsp_sub_v2r8(iy1,jy3);
2083             dz13             = _fjsp_sub_v2r8(iz1,jz3);
2084             dx21             = _fjsp_sub_v2r8(ix2,jx1);
2085             dy21             = _fjsp_sub_v2r8(iy2,jy1);
2086             dz21             = _fjsp_sub_v2r8(iz2,jz1);
2087             dx22             = _fjsp_sub_v2r8(ix2,jx2);
2088             dy22             = _fjsp_sub_v2r8(iy2,jy2);
2089             dz22             = _fjsp_sub_v2r8(iz2,jz2);
2090             dx23             = _fjsp_sub_v2r8(ix2,jx3);
2091             dy23             = _fjsp_sub_v2r8(iy2,jy3);
2092             dz23             = _fjsp_sub_v2r8(iz2,jz3);
2093             dx31             = _fjsp_sub_v2r8(ix3,jx1);
2094             dy31             = _fjsp_sub_v2r8(iy3,jy1);
2095             dz31             = _fjsp_sub_v2r8(iz3,jz1);
2096             dx32             = _fjsp_sub_v2r8(ix3,jx2);
2097             dy32             = _fjsp_sub_v2r8(iy3,jy2);
2098             dz32             = _fjsp_sub_v2r8(iz3,jz2);
2099             dx33             = _fjsp_sub_v2r8(ix3,jx3);
2100             dy33             = _fjsp_sub_v2r8(iy3,jy3);
2101             dz33             = _fjsp_sub_v2r8(iz3,jz3);
2102
2103             /* Calculate squared distance and things based on it */
2104             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
2105             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
2106             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
2107             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
2108             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
2109             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
2110             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
2111             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
2112             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
2113             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
2114
2115             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
2116             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
2117             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
2118             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
2119             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
2120             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
2121             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
2122             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
2123             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
2124
2125             rinvsq00         = gmx_fjsp_inv_v2r8(rsq00);
2126             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
2127             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
2128             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
2129             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
2130             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
2131             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
2132             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
2133             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
2134             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
2135
2136             fjx0             = _fjsp_setzero_v2r8();
2137             fjy0             = _fjsp_setzero_v2r8();
2138             fjz0             = _fjsp_setzero_v2r8();
2139             fjx1             = _fjsp_setzero_v2r8();
2140             fjy1             = _fjsp_setzero_v2r8();
2141             fjz1             = _fjsp_setzero_v2r8();
2142             fjx2             = _fjsp_setzero_v2r8();
2143             fjy2             = _fjsp_setzero_v2r8();
2144             fjz2             = _fjsp_setzero_v2r8();
2145             fjx3             = _fjsp_setzero_v2r8();
2146             fjy3             = _fjsp_setzero_v2r8();
2147             fjz3             = _fjsp_setzero_v2r8();
2148
2149             /**************************
2150              * CALCULATE INTERACTIONS *
2151              **************************/
2152
2153             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
2154             {
2155
2156             /* LENNARD-JONES DISPERSION/REPULSION */
2157
2158             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
2159             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
2160
2161             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
2162
2163             fscal            = fvdw;
2164
2165             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2166
2167             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2168
2169             /* Update vectorial force */
2170             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
2171             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
2172             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
2173             
2174             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
2175             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
2176             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
2177
2178             }
2179
2180             /**************************
2181              * CALCULATE INTERACTIONS *
2182              **************************/
2183
2184             if (gmx_fjsp_any_lt_v2r8(rsq11,rcutoff2))
2185             {
2186
2187             r11              = _fjsp_mul_v2r8(rsq11,rinv11);
2188
2189             /* EWALD ELECTROSTATICS */
2190
2191             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2192             ewrt             = _fjsp_mul_v2r8(r11,ewtabscale);
2193             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2194             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2195             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2196
2197             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2198             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2199             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq11,rinv11),_fjsp_sub_v2r8(rinvsq11,felec));
2200
2201             cutoff_mask      = _fjsp_cmplt_v2r8(rsq11,rcutoff2);
2202
2203             fscal            = felec;
2204
2205             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2206
2207             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2208
2209             /* Update vectorial force */
2210             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
2211             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
2212             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
2213             
2214             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
2215             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
2216             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
2217
2218             }
2219
2220             /**************************
2221              * CALCULATE INTERACTIONS *
2222              **************************/
2223
2224             if (gmx_fjsp_any_lt_v2r8(rsq12,rcutoff2))
2225             {
2226
2227             r12              = _fjsp_mul_v2r8(rsq12,rinv12);
2228
2229             /* EWALD ELECTROSTATICS */
2230
2231             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2232             ewrt             = _fjsp_mul_v2r8(r12,ewtabscale);
2233             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2234             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2235             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2236
2237             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2238             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2239             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq12,rinv12),_fjsp_sub_v2r8(rinvsq12,felec));
2240
2241             cutoff_mask      = _fjsp_cmplt_v2r8(rsq12,rcutoff2);
2242
2243             fscal            = felec;
2244
2245             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2246
2247             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2248
2249             /* Update vectorial force */
2250             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
2251             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
2252             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
2253             
2254             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
2255             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
2256             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
2257
2258             }
2259
2260             /**************************
2261              * CALCULATE INTERACTIONS *
2262              **************************/
2263
2264             if (gmx_fjsp_any_lt_v2r8(rsq13,rcutoff2))
2265             {
2266
2267             r13              = _fjsp_mul_v2r8(rsq13,rinv13);
2268
2269             /* EWALD ELECTROSTATICS */
2270
2271             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2272             ewrt             = _fjsp_mul_v2r8(r13,ewtabscale);
2273             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2274             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2275             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2276
2277             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2278             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2279             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq13,rinv13),_fjsp_sub_v2r8(rinvsq13,felec));
2280
2281             cutoff_mask      = _fjsp_cmplt_v2r8(rsq13,rcutoff2);
2282
2283             fscal            = felec;
2284
2285             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2286
2287             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2288
2289             /* Update vectorial force */
2290             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
2291             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
2292             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
2293             
2294             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
2295             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
2296             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
2297
2298             }
2299
2300             /**************************
2301              * CALCULATE INTERACTIONS *
2302              **************************/
2303
2304             if (gmx_fjsp_any_lt_v2r8(rsq21,rcutoff2))
2305             {
2306
2307             r21              = _fjsp_mul_v2r8(rsq21,rinv21);
2308
2309             /* EWALD ELECTROSTATICS */
2310
2311             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2312             ewrt             = _fjsp_mul_v2r8(r21,ewtabscale);
2313             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2314             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2315             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2316
2317             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2318             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2319             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq21,rinv21),_fjsp_sub_v2r8(rinvsq21,felec));
2320
2321             cutoff_mask      = _fjsp_cmplt_v2r8(rsq21,rcutoff2);
2322
2323             fscal            = felec;
2324
2325             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2326
2327             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2328
2329             /* Update vectorial force */
2330             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
2331             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
2332             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
2333             
2334             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
2335             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
2336             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
2337
2338             }
2339
2340             /**************************
2341              * CALCULATE INTERACTIONS *
2342              **************************/
2343
2344             if (gmx_fjsp_any_lt_v2r8(rsq22,rcutoff2))
2345             {
2346
2347             r22              = _fjsp_mul_v2r8(rsq22,rinv22);
2348
2349             /* EWALD ELECTROSTATICS */
2350
2351             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2352             ewrt             = _fjsp_mul_v2r8(r22,ewtabscale);
2353             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2354             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2355             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2356
2357             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2358             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2359             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq22,rinv22),_fjsp_sub_v2r8(rinvsq22,felec));
2360
2361             cutoff_mask      = _fjsp_cmplt_v2r8(rsq22,rcutoff2);
2362
2363             fscal            = felec;
2364
2365             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2366
2367             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2368
2369             /* Update vectorial force */
2370             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
2371             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
2372             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
2373             
2374             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
2375             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
2376             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
2377
2378             }
2379
2380             /**************************
2381              * CALCULATE INTERACTIONS *
2382              **************************/
2383
2384             if (gmx_fjsp_any_lt_v2r8(rsq23,rcutoff2))
2385             {
2386
2387             r23              = _fjsp_mul_v2r8(rsq23,rinv23);
2388
2389             /* EWALD ELECTROSTATICS */
2390
2391             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2392             ewrt             = _fjsp_mul_v2r8(r23,ewtabscale);
2393             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2394             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2395             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2396
2397             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2398             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2399             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq23,rinv23),_fjsp_sub_v2r8(rinvsq23,felec));
2400
2401             cutoff_mask      = _fjsp_cmplt_v2r8(rsq23,rcutoff2);
2402
2403             fscal            = felec;
2404
2405             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2406
2407             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2408
2409             /* Update vectorial force */
2410             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
2411             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
2412             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
2413             
2414             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
2415             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
2416             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
2417
2418             }
2419
2420             /**************************
2421              * CALCULATE INTERACTIONS *
2422              **************************/
2423
2424             if (gmx_fjsp_any_lt_v2r8(rsq31,rcutoff2))
2425             {
2426
2427             r31              = _fjsp_mul_v2r8(rsq31,rinv31);
2428
2429             /* EWALD ELECTROSTATICS */
2430
2431             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2432             ewrt             = _fjsp_mul_v2r8(r31,ewtabscale);
2433             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2434             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2435             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2436
2437             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2438             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2439             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq31,rinv31),_fjsp_sub_v2r8(rinvsq31,felec));
2440
2441             cutoff_mask      = _fjsp_cmplt_v2r8(rsq31,rcutoff2);
2442
2443             fscal            = felec;
2444
2445             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2446
2447             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2448
2449             /* Update vectorial force */
2450             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
2451             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
2452             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
2453             
2454             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
2455             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
2456             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
2457
2458             }
2459
2460             /**************************
2461              * CALCULATE INTERACTIONS *
2462              **************************/
2463
2464             if (gmx_fjsp_any_lt_v2r8(rsq32,rcutoff2))
2465             {
2466
2467             r32              = _fjsp_mul_v2r8(rsq32,rinv32);
2468
2469             /* EWALD ELECTROSTATICS */
2470
2471             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2472             ewrt             = _fjsp_mul_v2r8(r32,ewtabscale);
2473             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2474             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2475             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2476
2477             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2478             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2479             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq32,rinv32),_fjsp_sub_v2r8(rinvsq32,felec));
2480
2481             cutoff_mask      = _fjsp_cmplt_v2r8(rsq32,rcutoff2);
2482
2483             fscal            = felec;
2484
2485             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2486
2487             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2488
2489             /* Update vectorial force */
2490             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
2491             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
2492             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
2493             
2494             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
2495             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
2496             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
2497
2498             }
2499
2500             /**************************
2501              * CALCULATE INTERACTIONS *
2502              **************************/
2503
2504             if (gmx_fjsp_any_lt_v2r8(rsq33,rcutoff2))
2505             {
2506
2507             r33              = _fjsp_mul_v2r8(rsq33,rinv33);
2508
2509             /* EWALD ELECTROSTATICS */
2510
2511             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
2512             ewrt             = _fjsp_mul_v2r8(r33,ewtabscale);
2513             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
2514             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
2515             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
2516
2517             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
2518             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
2519             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq33,rinv33),_fjsp_sub_v2r8(rinvsq33,felec));
2520
2521             cutoff_mask      = _fjsp_cmplt_v2r8(rsq33,rcutoff2);
2522
2523             fscal            = felec;
2524
2525             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
2526
2527             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
2528
2529             /* Update vectorial force */
2530             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
2531             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
2532             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
2533             
2534             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
2535             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
2536             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
2537
2538             }
2539
2540             gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
2541
2542             /* Inner loop uses 414 flops */
2543         }
2544
2545         /* End of innermost loop */
2546
2547         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
2548                                               f+i_coord_offset,fshift+i_shift_offset);
2549
2550         /* Increment number of inner iterations */
2551         inneriter                  += j_index_end - j_index_start;
2552
2553         /* Outer loop uses 24 flops */
2554     }
2555
2556     /* Increment number of outer iterations */
2557     outeriter        += nri;
2558
2559     /* Update outer/inner flops */
2560
2561     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*414);
2562 }