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