Version bumps after new release
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_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_GeomW3P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: ReactionField
54  * VdW interaction:            LennardJones
55  * Geometry:                   Water3-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_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     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
93     real             *charge;
94     int              nvdwtype;
95     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96     int              *vdwtype;
97     real             *vdwparam;
98     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
99     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100     _fjsp_v2r8       itab_tmp;
101     _fjsp_v2r8       dummy_mask,cutoff_mask;
102     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
103     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
104     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
105
106     x                = xx[0];
107     f                = ff[0];
108
109     nri              = nlist->nri;
110     iinr             = nlist->iinr;
111     jindex           = nlist->jindex;
112     jjnr             = nlist->jjnr;
113     shiftidx         = nlist->shift;
114     gid              = nlist->gid;
115     shiftvec         = fr->shift_vec[0];
116     fshift           = fr->fshift[0];
117     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
118     charge           = mdatoms->chargeA;
119     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
120     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
121     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
122     nvdwtype         = fr->ntype;
123     vdwparam         = fr->nbfp;
124     vdwtype          = mdatoms->typeA;
125
126     /* Setup water-specific parameters */
127     inr              = nlist->iinr[0];
128     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
129     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
130     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
131     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
132
133     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
134     rcutoff_scalar   = fr->rcoulomb;
135     rcutoff          = gmx_fjsp_set1_v2r8(rcutoff_scalar);
136     rcutoff2         = _fjsp_mul_v2r8(rcutoff,rcutoff);
137
138     sh_vdw_invrcut6  = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
139     rvdw             = gmx_fjsp_set1_v2r8(fr->rvdw);
140
141     /* Avoid stupid compiler warnings */
142     jnrA = jnrB = 0;
143     j_coord_offsetA = 0;
144     j_coord_offsetB = 0;
145
146     outeriter        = 0;
147     inneriter        = 0;
148
149     /* Start outer loop over neighborlists */
150     for(iidx=0; iidx<nri; iidx++)
151     {
152         /* Load shift vector for this list */
153         i_shift_offset   = DIM*shiftidx[iidx];
154
155         /* Load limits for loop over neighbors */
156         j_index_start    = jindex[iidx];
157         j_index_end      = jindex[iidx+1];
158
159         /* Get outer coordinate index */
160         inr              = iinr[iidx];
161         i_coord_offset   = DIM*inr;
162
163         /* Load i particle coords and add shift vector */
164         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
165                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
166
167         fix0             = _fjsp_setzero_v2r8();
168         fiy0             = _fjsp_setzero_v2r8();
169         fiz0             = _fjsp_setzero_v2r8();
170         fix1             = _fjsp_setzero_v2r8();
171         fiy1             = _fjsp_setzero_v2r8();
172         fiz1             = _fjsp_setzero_v2r8();
173         fix2             = _fjsp_setzero_v2r8();
174         fiy2             = _fjsp_setzero_v2r8();
175         fiz2             = _fjsp_setzero_v2r8();
176
177         /* Reset potential sums */
178         velecsum         = _fjsp_setzero_v2r8();
179         vvdwsum          = _fjsp_setzero_v2r8();
180
181         /* Start inner kernel loop */
182         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
183         {
184
185             /* Get j neighbor index, and coordinate index */
186             jnrA             = jjnr[jidx];
187             jnrB             = jjnr[jidx+1];
188             j_coord_offsetA  = DIM*jnrA;
189             j_coord_offsetB  = DIM*jnrB;
190
191             /* load j atom coordinates */
192             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
193                                               &jx0,&jy0,&jz0);
194
195             /* Calculate displacement vector */
196             dx00             = _fjsp_sub_v2r8(ix0,jx0);
197             dy00             = _fjsp_sub_v2r8(iy0,jy0);
198             dz00             = _fjsp_sub_v2r8(iz0,jz0);
199             dx10             = _fjsp_sub_v2r8(ix1,jx0);
200             dy10             = _fjsp_sub_v2r8(iy1,jy0);
201             dz10             = _fjsp_sub_v2r8(iz1,jz0);
202             dx20             = _fjsp_sub_v2r8(ix2,jx0);
203             dy20             = _fjsp_sub_v2r8(iy2,jy0);
204             dz20             = _fjsp_sub_v2r8(iz2,jz0);
205
206             /* Calculate squared distance and things based on it */
207             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
208             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
209             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
210
211             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
212             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
213             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
214
215             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
216             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
217             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
218
219             /* Load parameters for j particles */
220             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
221             vdwjidx0A        = 2*vdwtype[jnrA+0];
222             vdwjidx0B        = 2*vdwtype[jnrB+0];
223
224             fjx0             = _fjsp_setzero_v2r8();
225             fjy0             = _fjsp_setzero_v2r8();
226             fjz0             = _fjsp_setzero_v2r8();
227
228             /**************************
229              * CALCULATE INTERACTIONS *
230              **************************/
231
232             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
233             {
234
235             /* Compute parameters for interactions between i and j atoms */
236             qq00             = _fjsp_mul_v2r8(iq0,jq0);
237             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
238                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
239
240             /* REACTION-FIELD ELECTROSTATICS */
241             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
242             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
243
244             /* LENNARD-JONES DISPERSION/REPULSION */
245
246             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
247             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
248             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
249             vvdw             = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
250                                            _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
251             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
252
253             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
254
255             /* Update potential sum for this i atom from the interaction with this j atom. */
256             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
257             velecsum         = _fjsp_add_v2r8(velecsum,velec);
258             vvdw             = _fjsp_and_v2r8(vvdw,cutoff_mask);
259             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
260
261             fscal            = _fjsp_add_v2r8(felec,fvdw);
262
263             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
264
265             /* Update vectorial force */
266             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
267             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
268             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
269             
270             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
271             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
272             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
273
274             }
275
276             /**************************
277              * CALCULATE INTERACTIONS *
278              **************************/
279
280             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
281             {
282
283             /* Compute parameters for interactions between i and j atoms */
284             qq10             = _fjsp_mul_v2r8(iq1,jq0);
285
286             /* REACTION-FIELD ELECTROSTATICS */
287             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
288             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
289
290             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
291
292             /* Update potential sum for this i atom from the interaction with this j atom. */
293             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
294             velecsum         = _fjsp_add_v2r8(velecsum,velec);
295
296             fscal            = felec;
297
298             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
299
300             /* Update vectorial force */
301             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
302             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
303             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
304             
305             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
306             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
307             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
308
309             }
310
311             /**************************
312              * CALCULATE INTERACTIONS *
313              **************************/
314
315             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
316             {
317
318             /* Compute parameters for interactions between i and j atoms */
319             qq20             = _fjsp_mul_v2r8(iq2,jq0);
320
321             /* REACTION-FIELD ELECTROSTATICS */
322             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
323             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
324
325             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
326
327             /* Update potential sum for this i atom from the interaction with this j atom. */
328             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
329             velecsum         = _fjsp_add_v2r8(velecsum,velec);
330
331             fscal            = felec;
332
333             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
334
335             /* Update vectorial force */
336             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
337             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
338             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
339             
340             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
341             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
342             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
343
344             }
345
346             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
347
348             /* Inner loop uses 138 flops */
349         }
350
351         if(jidx<j_index_end)
352         {
353
354             jnrA             = jjnr[jidx];
355             j_coord_offsetA  = DIM*jnrA;
356
357             /* load j atom coordinates */
358             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
359                                               &jx0,&jy0,&jz0);
360
361             /* Calculate displacement vector */
362             dx00             = _fjsp_sub_v2r8(ix0,jx0);
363             dy00             = _fjsp_sub_v2r8(iy0,jy0);
364             dz00             = _fjsp_sub_v2r8(iz0,jz0);
365             dx10             = _fjsp_sub_v2r8(ix1,jx0);
366             dy10             = _fjsp_sub_v2r8(iy1,jy0);
367             dz10             = _fjsp_sub_v2r8(iz1,jz0);
368             dx20             = _fjsp_sub_v2r8(ix2,jx0);
369             dy20             = _fjsp_sub_v2r8(iy2,jy0);
370             dz20             = _fjsp_sub_v2r8(iz2,jz0);
371
372             /* Calculate squared distance and things based on it */
373             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
374             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
375             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
376
377             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
378             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
379             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
380
381             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
382             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
383             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
384
385             /* Load parameters for j particles */
386             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
387             vdwjidx0A        = 2*vdwtype[jnrA+0];
388
389             fjx0             = _fjsp_setzero_v2r8();
390             fjy0             = _fjsp_setzero_v2r8();
391             fjz0             = _fjsp_setzero_v2r8();
392
393             /**************************
394              * CALCULATE INTERACTIONS *
395              **************************/
396
397             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
398             {
399
400             /* Compute parameters for interactions between i and j atoms */
401             qq00             = _fjsp_mul_v2r8(iq0,jq0);
402             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
403                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
404
405             /* REACTION-FIELD ELECTROSTATICS */
406             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
407             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
408
409             /* LENNARD-JONES DISPERSION/REPULSION */
410
411             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
412             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
413             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
414             vvdw             = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
415                                            _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
416             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
417
418             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
419
420             /* Update potential sum for this i atom from the interaction with this j atom. */
421             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
422             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
423             velecsum         = _fjsp_add_v2r8(velecsum,velec);
424             vvdw             = _fjsp_and_v2r8(vvdw,cutoff_mask);
425             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
426             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
427
428             fscal            = _fjsp_add_v2r8(felec,fvdw);
429
430             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
431
432             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
433
434             /* Update vectorial force */
435             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
436             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
437             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
438             
439             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
440             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
441             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
442
443             }
444
445             /**************************
446              * CALCULATE INTERACTIONS *
447              **************************/
448
449             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
450             {
451
452             /* Compute parameters for interactions between i and j atoms */
453             qq10             = _fjsp_mul_v2r8(iq1,jq0);
454
455             /* REACTION-FIELD ELECTROSTATICS */
456             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
457             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
458
459             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
460
461             /* Update potential sum for this i atom from the interaction with this j atom. */
462             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
463             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
464             velecsum         = _fjsp_add_v2r8(velecsum,velec);
465
466             fscal            = felec;
467
468             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
469
470             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
471
472             /* Update vectorial force */
473             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
474             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
475             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
476             
477             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
478             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
479             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
480
481             }
482
483             /**************************
484              * CALCULATE INTERACTIONS *
485              **************************/
486
487             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
488             {
489
490             /* Compute parameters for interactions between i and j atoms */
491             qq20             = _fjsp_mul_v2r8(iq2,jq0);
492
493             /* REACTION-FIELD ELECTROSTATICS */
494             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
495             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
496
497             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
498
499             /* Update potential sum for this i atom from the interaction with this j atom. */
500             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
501             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
502             velecsum         = _fjsp_add_v2r8(velecsum,velec);
503
504             fscal            = felec;
505
506             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
507
508             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
509
510             /* Update vectorial force */
511             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
512             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
513             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
514             
515             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
516             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
517             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
518
519             }
520
521             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
522
523             /* Inner loop uses 138 flops */
524         }
525
526         /* End of innermost loop */
527
528         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
529                                               f+i_coord_offset,fshift+i_shift_offset);
530
531         ggid                        = gid[iidx];
532         /* Update potential energies */
533         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
534         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
535
536         /* Increment number of inner iterations */
537         inneriter                  += j_index_end - j_index_start;
538
539         /* Outer loop uses 20 flops */
540     }
541
542     /* Increment number of outer iterations */
543     outeriter        += nri;
544
545     /* Update outer/inner flops */
546
547     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*138);
548 }
549 /*
550  * Gromacs nonbonded kernel:   nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
551  * Electrostatics interaction: ReactionField
552  * VdW interaction:            LennardJones
553  * Geometry:                   Water3-Particle
554  * Calculate force/pot:        Force
555  */
556 void
557 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
558                     (t_nblist                    * gmx_restrict       nlist,
559                      rvec                        * gmx_restrict          xx,
560                      rvec                        * gmx_restrict          ff,
561                      t_forcerec                  * gmx_restrict          fr,
562                      t_mdatoms                   * gmx_restrict     mdatoms,
563                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
564                      t_nrnb                      * gmx_restrict        nrnb)
565 {
566     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
567      * just 0 for non-waters.
568      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
569      * jnr indices corresponding to data put in the four positions in the SIMD register.
570      */
571     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
572     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
573     int              jnrA,jnrB;
574     int              j_coord_offsetA,j_coord_offsetB;
575     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
576     real             rcutoff_scalar;
577     real             *shiftvec,*fshift,*x,*f;
578     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
579     int              vdwioffset0;
580     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
581     int              vdwioffset1;
582     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
583     int              vdwioffset2;
584     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
585     int              vdwjidx0A,vdwjidx0B;
586     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
587     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
588     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
589     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
590     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
591     real             *charge;
592     int              nvdwtype;
593     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
594     int              *vdwtype;
595     real             *vdwparam;
596     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
597     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
598     _fjsp_v2r8       itab_tmp;
599     _fjsp_v2r8       dummy_mask,cutoff_mask;
600     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
601     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
602     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
603
604     x                = xx[0];
605     f                = ff[0];
606
607     nri              = nlist->nri;
608     iinr             = nlist->iinr;
609     jindex           = nlist->jindex;
610     jjnr             = nlist->jjnr;
611     shiftidx         = nlist->shift;
612     gid              = nlist->gid;
613     shiftvec         = fr->shift_vec[0];
614     fshift           = fr->fshift[0];
615     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
616     charge           = mdatoms->chargeA;
617     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
618     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
619     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
620     nvdwtype         = fr->ntype;
621     vdwparam         = fr->nbfp;
622     vdwtype          = mdatoms->typeA;
623
624     /* Setup water-specific parameters */
625     inr              = nlist->iinr[0];
626     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
627     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
628     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
629     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
630
631     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
632     rcutoff_scalar   = fr->rcoulomb;
633     rcutoff          = gmx_fjsp_set1_v2r8(rcutoff_scalar);
634     rcutoff2         = _fjsp_mul_v2r8(rcutoff,rcutoff);
635
636     sh_vdw_invrcut6  = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
637     rvdw             = gmx_fjsp_set1_v2r8(fr->rvdw);
638
639     /* Avoid stupid compiler warnings */
640     jnrA = jnrB = 0;
641     j_coord_offsetA = 0;
642     j_coord_offsetB = 0;
643
644     outeriter        = 0;
645     inneriter        = 0;
646
647     /* Start outer loop over neighborlists */
648     for(iidx=0; iidx<nri; iidx++)
649     {
650         /* Load shift vector for this list */
651         i_shift_offset   = DIM*shiftidx[iidx];
652
653         /* Load limits for loop over neighbors */
654         j_index_start    = jindex[iidx];
655         j_index_end      = jindex[iidx+1];
656
657         /* Get outer coordinate index */
658         inr              = iinr[iidx];
659         i_coord_offset   = DIM*inr;
660
661         /* Load i particle coords and add shift vector */
662         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
663                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
664
665         fix0             = _fjsp_setzero_v2r8();
666         fiy0             = _fjsp_setzero_v2r8();
667         fiz0             = _fjsp_setzero_v2r8();
668         fix1             = _fjsp_setzero_v2r8();
669         fiy1             = _fjsp_setzero_v2r8();
670         fiz1             = _fjsp_setzero_v2r8();
671         fix2             = _fjsp_setzero_v2r8();
672         fiy2             = _fjsp_setzero_v2r8();
673         fiz2             = _fjsp_setzero_v2r8();
674
675         /* Start inner kernel loop */
676         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
677         {
678
679             /* Get j neighbor index, and coordinate index */
680             jnrA             = jjnr[jidx];
681             jnrB             = jjnr[jidx+1];
682             j_coord_offsetA  = DIM*jnrA;
683             j_coord_offsetB  = DIM*jnrB;
684
685             /* load j atom coordinates */
686             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
687                                               &jx0,&jy0,&jz0);
688
689             /* Calculate displacement vector */
690             dx00             = _fjsp_sub_v2r8(ix0,jx0);
691             dy00             = _fjsp_sub_v2r8(iy0,jy0);
692             dz00             = _fjsp_sub_v2r8(iz0,jz0);
693             dx10             = _fjsp_sub_v2r8(ix1,jx0);
694             dy10             = _fjsp_sub_v2r8(iy1,jy0);
695             dz10             = _fjsp_sub_v2r8(iz1,jz0);
696             dx20             = _fjsp_sub_v2r8(ix2,jx0);
697             dy20             = _fjsp_sub_v2r8(iy2,jy0);
698             dz20             = _fjsp_sub_v2r8(iz2,jz0);
699
700             /* Calculate squared distance and things based on it */
701             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
702             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
703             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
704
705             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
706             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
707             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
708
709             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
710             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
711             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
712
713             /* Load parameters for j particles */
714             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
715             vdwjidx0A        = 2*vdwtype[jnrA+0];
716             vdwjidx0B        = 2*vdwtype[jnrB+0];
717
718             fjx0             = _fjsp_setzero_v2r8();
719             fjy0             = _fjsp_setzero_v2r8();
720             fjz0             = _fjsp_setzero_v2r8();
721
722             /**************************
723              * CALCULATE INTERACTIONS *
724              **************************/
725
726             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
727             {
728
729             /* Compute parameters for interactions between i and j atoms */
730             qq00             = _fjsp_mul_v2r8(iq0,jq0);
731             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
732                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
733
734             /* REACTION-FIELD ELECTROSTATICS */
735             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
736
737             /* LENNARD-JONES DISPERSION/REPULSION */
738
739             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
740             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
741
742             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
743
744             fscal            = _fjsp_add_v2r8(felec,fvdw);
745
746             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
747
748             /* Update vectorial force */
749             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
750             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
751             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
752             
753             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
754             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
755             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
756
757             }
758
759             /**************************
760              * CALCULATE INTERACTIONS *
761              **************************/
762
763             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
764             {
765
766             /* Compute parameters for interactions between i and j atoms */
767             qq10             = _fjsp_mul_v2r8(iq1,jq0);
768
769             /* REACTION-FIELD ELECTROSTATICS */
770             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
771
772             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
773
774             fscal            = felec;
775
776             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
777
778             /* Update vectorial force */
779             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
780             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
781             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
782             
783             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
784             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
785             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
786
787             }
788
789             /**************************
790              * CALCULATE INTERACTIONS *
791              **************************/
792
793             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
794             {
795
796             /* Compute parameters for interactions between i and j atoms */
797             qq20             = _fjsp_mul_v2r8(iq2,jq0);
798
799             /* REACTION-FIELD ELECTROSTATICS */
800             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
801
802             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
803
804             fscal            = felec;
805
806             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
807
808             /* Update vectorial force */
809             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
810             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
811             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
812             
813             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
814             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
815             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
816
817             }
818
819             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
820
821             /* Inner loop uses 109 flops */
822         }
823
824         if(jidx<j_index_end)
825         {
826
827             jnrA             = jjnr[jidx];
828             j_coord_offsetA  = DIM*jnrA;
829
830             /* load j atom coordinates */
831             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
832                                               &jx0,&jy0,&jz0);
833
834             /* Calculate displacement vector */
835             dx00             = _fjsp_sub_v2r8(ix0,jx0);
836             dy00             = _fjsp_sub_v2r8(iy0,jy0);
837             dz00             = _fjsp_sub_v2r8(iz0,jz0);
838             dx10             = _fjsp_sub_v2r8(ix1,jx0);
839             dy10             = _fjsp_sub_v2r8(iy1,jy0);
840             dz10             = _fjsp_sub_v2r8(iz1,jz0);
841             dx20             = _fjsp_sub_v2r8(ix2,jx0);
842             dy20             = _fjsp_sub_v2r8(iy2,jy0);
843             dz20             = _fjsp_sub_v2r8(iz2,jz0);
844
845             /* Calculate squared distance and things based on it */
846             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
847             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
848             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
849
850             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
851             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
852             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
853
854             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
855             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
856             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
857
858             /* Load parameters for j particles */
859             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
860             vdwjidx0A        = 2*vdwtype[jnrA+0];
861
862             fjx0             = _fjsp_setzero_v2r8();
863             fjy0             = _fjsp_setzero_v2r8();
864             fjz0             = _fjsp_setzero_v2r8();
865
866             /**************************
867              * CALCULATE INTERACTIONS *
868              **************************/
869
870             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
871             {
872
873             /* Compute parameters for interactions between i and j atoms */
874             qq00             = _fjsp_mul_v2r8(iq0,jq0);
875             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
876                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
877
878             /* REACTION-FIELD ELECTROSTATICS */
879             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
880
881             /* LENNARD-JONES DISPERSION/REPULSION */
882
883             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
884             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
885
886             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
887
888             fscal            = _fjsp_add_v2r8(felec,fvdw);
889
890             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
891
892             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
893
894             /* Update vectorial force */
895             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
896             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
897             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
898             
899             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
900             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
901             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
902
903             }
904
905             /**************************
906              * CALCULATE INTERACTIONS *
907              **************************/
908
909             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
910             {
911
912             /* Compute parameters for interactions between i and j atoms */
913             qq10             = _fjsp_mul_v2r8(iq1,jq0);
914
915             /* REACTION-FIELD ELECTROSTATICS */
916             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
917
918             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
919
920             fscal            = felec;
921
922             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
923
924             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
925
926             /* Update vectorial force */
927             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
928             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
929             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
930             
931             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
932             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
933             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
934
935             }
936
937             /**************************
938              * CALCULATE INTERACTIONS *
939              **************************/
940
941             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
942             {
943
944             /* Compute parameters for interactions between i and j atoms */
945             qq20             = _fjsp_mul_v2r8(iq2,jq0);
946
947             /* REACTION-FIELD ELECTROSTATICS */
948             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
949
950             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
951
952             fscal            = felec;
953
954             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
955
956             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
957
958             /* Update vectorial force */
959             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
960             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
961             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
962             
963             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
964             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
965             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
966
967             }
968
969             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
970
971             /* Inner loop uses 109 flops */
972         }
973
974         /* End of innermost loop */
975
976         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
977                                               f+i_coord_offset,fshift+i_shift_offset);
978
979         /* Increment number of inner iterations */
980         inneriter                  += j_index_end - j_index_start;
981
982         /* Outer loop uses 18 flops */
983     }
984
985     /* Increment number of outer iterations */
986     outeriter        += nri;
987
988     /* Update outer/inner flops */
989
990     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109);
991 }