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