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