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