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