32cb4034e219fed070fc92bf00527f648cbb469f
[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, 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 "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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
403
404             /* REACTION-FIELD ELECTROSTATICS */
405             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
406             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
407
408             /* LENNARD-JONES DISPERSION/REPULSION */
409
410             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
411             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
412             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
413             vvdw             = _fjsp_msub_v2r8(_fjsp_nmsub_v2r8(c12_00,_fjsp_mul_v2r8(sh_vdw_invrcut6,sh_vdw_invrcut6),vvdw12),one_twelfth,
414                                            _fjsp_mul_v2r8(_fjsp_nmsub_v2r8( c6_00,sh_vdw_invrcut6,vvdw6),one_sixth));
415             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
416
417             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
418
419             /* Update potential sum for this i atom from the interaction with this j atom. */
420             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
421             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
422             velecsum         = _fjsp_add_v2r8(velecsum,velec);
423             vvdw             = _fjsp_and_v2r8(vvdw,cutoff_mask);
424             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
425             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
426
427             fscal            = _fjsp_add_v2r8(felec,fvdw);
428
429             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
430
431             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
432
433             /* Update vectorial force */
434             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
435             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
436             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
437             
438             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
439             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
440             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
441
442             }
443
444             /**************************
445              * CALCULATE INTERACTIONS *
446              **************************/
447
448             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
449             {
450
451             /* Compute parameters for interactions between i and j atoms */
452             qq10             = _fjsp_mul_v2r8(iq1,jq0);
453
454             /* REACTION-FIELD ELECTROSTATICS */
455             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
456             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
457
458             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
459
460             /* Update potential sum for this i atom from the interaction with this j atom. */
461             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
462             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
463             velecsum         = _fjsp_add_v2r8(velecsum,velec);
464
465             fscal            = felec;
466
467             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
468
469             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
470
471             /* Update vectorial force */
472             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
473             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
474             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
475             
476             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
477             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
478             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
479
480             }
481
482             /**************************
483              * CALCULATE INTERACTIONS *
484              **************************/
485
486             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
487             {
488
489             /* Compute parameters for interactions between i and j atoms */
490             qq20             = _fjsp_mul_v2r8(iq2,jq0);
491
492             /* REACTION-FIELD ELECTROSTATICS */
493             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
494             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
495
496             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
497
498             /* Update potential sum for this i atom from the interaction with this j atom. */
499             velec            = _fjsp_and_v2r8(velec,cutoff_mask);
500             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
501             velecsum         = _fjsp_add_v2r8(velecsum,velec);
502
503             fscal            = felec;
504
505             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
506
507             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
508
509             /* Update vectorial force */
510             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
511             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
512             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
513             
514             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
515             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
516             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
517
518             }
519
520             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
521
522             /* Inner loop uses 138 flops */
523         }
524
525         /* End of innermost loop */
526
527         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
528                                               f+i_coord_offset,fshift+i_shift_offset);
529
530         ggid                        = gid[iidx];
531         /* Update potential energies */
532         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
533         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
534
535         /* Increment number of inner iterations */
536         inneriter                  += j_index_end - j_index_start;
537
538         /* Outer loop uses 20 flops */
539     }
540
541     /* Increment number of outer iterations */
542     outeriter        += nri;
543
544     /* Update outer/inner flops */
545
546     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*138);
547 }
548 /*
549  * Gromacs nonbonded kernel:   nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
550  * Electrostatics interaction: ReactionField
551  * VdW interaction:            LennardJones
552  * Geometry:                   Water3-Particle
553  * Calculate force/pot:        Force
554  */
555 void
556 nb_kernel_ElecRFCut_VdwLJSh_GeomW3P1_F_sparc64_hpc_ace_double
557                     (t_nblist                    * gmx_restrict       nlist,
558                      rvec                        * gmx_restrict          xx,
559                      rvec                        * gmx_restrict          ff,
560                      t_forcerec                  * gmx_restrict          fr,
561                      t_mdatoms                   * gmx_restrict     mdatoms,
562                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
563                      t_nrnb                      * gmx_restrict        nrnb)
564 {
565     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
566      * just 0 for non-waters.
567      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
568      * jnr indices corresponding to data put in the four positions in the SIMD register.
569      */
570     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
571     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
572     int              jnrA,jnrB;
573     int              j_coord_offsetA,j_coord_offsetB;
574     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
575     real             rcutoff_scalar;
576     real             *shiftvec,*fshift,*x,*f;
577     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
578     int              vdwioffset0;
579     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
580     int              vdwioffset1;
581     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
582     int              vdwioffset2;
583     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
584     int              vdwjidx0A,vdwjidx0B;
585     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
586     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
587     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
588     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
589     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
590     real             *charge;
591     int              nvdwtype;
592     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
593     int              *vdwtype;
594     real             *vdwparam;
595     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
596     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
597     _fjsp_v2r8       itab_tmp;
598     _fjsp_v2r8       dummy_mask,cutoff_mask;
599     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
600     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
601     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
602
603     x                = xx[0];
604     f                = ff[0];
605
606     nri              = nlist->nri;
607     iinr             = nlist->iinr;
608     jindex           = nlist->jindex;
609     jjnr             = nlist->jjnr;
610     shiftidx         = nlist->shift;
611     gid              = nlist->gid;
612     shiftvec         = fr->shift_vec[0];
613     fshift           = fr->fshift[0];
614     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
615     charge           = mdatoms->chargeA;
616     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
617     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
618     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
619     nvdwtype         = fr->ntype;
620     vdwparam         = fr->nbfp;
621     vdwtype          = mdatoms->typeA;
622
623     /* Setup water-specific parameters */
624     inr              = nlist->iinr[0];
625     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
626     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
627     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
628     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
629
630     /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
631     rcutoff_scalar   = fr->rcoulomb;
632     rcutoff          = gmx_fjsp_set1_v2r8(rcutoff_scalar);
633     rcutoff2         = _fjsp_mul_v2r8(rcutoff,rcutoff);
634
635     sh_vdw_invrcut6  = gmx_fjsp_set1_v2r8(fr->ic->sh_invrc6);
636     rvdw             = gmx_fjsp_set1_v2r8(fr->rvdw);
637
638     /* Avoid stupid compiler warnings */
639     jnrA = jnrB = 0;
640     j_coord_offsetA = 0;
641     j_coord_offsetB = 0;
642
643     outeriter        = 0;
644     inneriter        = 0;
645
646     /* Start outer loop over neighborlists */
647     for(iidx=0; iidx<nri; iidx++)
648     {
649         /* Load shift vector for this list */
650         i_shift_offset   = DIM*shiftidx[iidx];
651
652         /* Load limits for loop over neighbors */
653         j_index_start    = jindex[iidx];
654         j_index_end      = jindex[iidx+1];
655
656         /* Get outer coordinate index */
657         inr              = iinr[iidx];
658         i_coord_offset   = DIM*inr;
659
660         /* Load i particle coords and add shift vector */
661         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
662                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
663
664         fix0             = _fjsp_setzero_v2r8();
665         fiy0             = _fjsp_setzero_v2r8();
666         fiz0             = _fjsp_setzero_v2r8();
667         fix1             = _fjsp_setzero_v2r8();
668         fiy1             = _fjsp_setzero_v2r8();
669         fiz1             = _fjsp_setzero_v2r8();
670         fix2             = _fjsp_setzero_v2r8();
671         fiy2             = _fjsp_setzero_v2r8();
672         fiz2             = _fjsp_setzero_v2r8();
673
674         /* Start inner kernel loop */
675         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
676         {
677
678             /* Get j neighbor index, and coordinate index */
679             jnrA             = jjnr[jidx];
680             jnrB             = jjnr[jidx+1];
681             j_coord_offsetA  = DIM*jnrA;
682             j_coord_offsetB  = DIM*jnrB;
683
684             /* load j atom coordinates */
685             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
686                                               &jx0,&jy0,&jz0);
687
688             /* Calculate displacement vector */
689             dx00             = _fjsp_sub_v2r8(ix0,jx0);
690             dy00             = _fjsp_sub_v2r8(iy0,jy0);
691             dz00             = _fjsp_sub_v2r8(iz0,jz0);
692             dx10             = _fjsp_sub_v2r8(ix1,jx0);
693             dy10             = _fjsp_sub_v2r8(iy1,jy0);
694             dz10             = _fjsp_sub_v2r8(iz1,jz0);
695             dx20             = _fjsp_sub_v2r8(ix2,jx0);
696             dy20             = _fjsp_sub_v2r8(iy2,jy0);
697             dz20             = _fjsp_sub_v2r8(iz2,jz0);
698
699             /* Calculate squared distance and things based on it */
700             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
701             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
702             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
703
704             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
705             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
706             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
707
708             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
709             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
710             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
711
712             /* Load parameters for j particles */
713             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
714             vdwjidx0A        = 2*vdwtype[jnrA+0];
715             vdwjidx0B        = 2*vdwtype[jnrB+0];
716
717             fjx0             = _fjsp_setzero_v2r8();
718             fjy0             = _fjsp_setzero_v2r8();
719             fjz0             = _fjsp_setzero_v2r8();
720
721             /**************************
722              * CALCULATE INTERACTIONS *
723              **************************/
724
725             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
726             {
727
728             /* Compute parameters for interactions between i and j atoms */
729             qq00             = _fjsp_mul_v2r8(iq0,jq0);
730             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
731                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
732
733             /* REACTION-FIELD ELECTROSTATICS */
734             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
735
736             /* LENNARD-JONES DISPERSION/REPULSION */
737
738             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
739             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
740
741             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
742
743             fscal            = _fjsp_add_v2r8(felec,fvdw);
744
745             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
746
747             /* Update vectorial force */
748             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
749             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
750             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
751             
752             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
753             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
754             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
755
756             }
757
758             /**************************
759              * CALCULATE INTERACTIONS *
760              **************************/
761
762             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
763             {
764
765             /* Compute parameters for interactions between i and j atoms */
766             qq10             = _fjsp_mul_v2r8(iq1,jq0);
767
768             /* REACTION-FIELD ELECTROSTATICS */
769             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
770
771             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
772
773             fscal            = felec;
774
775             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
776
777             /* Update vectorial force */
778             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
779             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
780             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
781             
782             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
783             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
784             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
785
786             }
787
788             /**************************
789              * CALCULATE INTERACTIONS *
790              **************************/
791
792             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
793             {
794
795             /* Compute parameters for interactions between i and j atoms */
796             qq20             = _fjsp_mul_v2r8(iq2,jq0);
797
798             /* REACTION-FIELD ELECTROSTATICS */
799             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
800
801             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
802
803             fscal            = felec;
804
805             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
806
807             /* Update vectorial force */
808             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
809             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
810             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
811             
812             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
813             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
814             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
815
816             }
817
818             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
819
820             /* Inner loop uses 109 flops */
821         }
822
823         if(jidx<j_index_end)
824         {
825
826             jnrA             = jjnr[jidx];
827             j_coord_offsetA  = DIM*jnrA;
828
829             /* load j atom coordinates */
830             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
831                                               &jx0,&jy0,&jz0);
832
833             /* Calculate displacement vector */
834             dx00             = _fjsp_sub_v2r8(ix0,jx0);
835             dy00             = _fjsp_sub_v2r8(iy0,jy0);
836             dz00             = _fjsp_sub_v2r8(iz0,jz0);
837             dx10             = _fjsp_sub_v2r8(ix1,jx0);
838             dy10             = _fjsp_sub_v2r8(iy1,jy0);
839             dz10             = _fjsp_sub_v2r8(iz1,jz0);
840             dx20             = _fjsp_sub_v2r8(ix2,jx0);
841             dy20             = _fjsp_sub_v2r8(iy2,jy0);
842             dz20             = _fjsp_sub_v2r8(iz2,jz0);
843
844             /* Calculate squared distance and things based on it */
845             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
846             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
847             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
848
849             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
850             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
851             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
852
853             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
854             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
855             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
856
857             /* Load parameters for j particles */
858             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
859             vdwjidx0A        = 2*vdwtype[jnrA+0];
860
861             fjx0             = _fjsp_setzero_v2r8();
862             fjy0             = _fjsp_setzero_v2r8();
863             fjz0             = _fjsp_setzero_v2r8();
864
865             /**************************
866              * CALCULATE INTERACTIONS *
867              **************************/
868
869             if (gmx_fjsp_any_lt_v2r8(rsq00,rcutoff2))
870             {
871
872             /* Compute parameters for interactions between i and j atoms */
873             qq00             = _fjsp_mul_v2r8(iq0,jq0);
874             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
875
876             /* REACTION-FIELD ELECTROSTATICS */
877             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
878
879             /* LENNARD-JONES DISPERSION/REPULSION */
880
881             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
882             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
883
884             cutoff_mask      = _fjsp_cmplt_v2r8(rsq00,rcutoff2);
885
886             fscal            = _fjsp_add_v2r8(felec,fvdw);
887
888             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
889
890             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
891
892             /* Update vectorial force */
893             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
894             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
895             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
896             
897             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
898             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
899             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
900
901             }
902
903             /**************************
904              * CALCULATE INTERACTIONS *
905              **************************/
906
907             if (gmx_fjsp_any_lt_v2r8(rsq10,rcutoff2))
908             {
909
910             /* Compute parameters for interactions between i and j atoms */
911             qq10             = _fjsp_mul_v2r8(iq1,jq0);
912
913             /* REACTION-FIELD ELECTROSTATICS */
914             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
915
916             cutoff_mask      = _fjsp_cmplt_v2r8(rsq10,rcutoff2);
917
918             fscal            = felec;
919
920             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
921
922             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
923
924             /* Update vectorial force */
925             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
926             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
927             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
928             
929             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
930             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
931             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
932
933             }
934
935             /**************************
936              * CALCULATE INTERACTIONS *
937              **************************/
938
939             if (gmx_fjsp_any_lt_v2r8(rsq20,rcutoff2))
940             {
941
942             /* Compute parameters for interactions between i and j atoms */
943             qq20             = _fjsp_mul_v2r8(iq2,jq0);
944
945             /* REACTION-FIELD ELECTROSTATICS */
946             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
947
948             cutoff_mask      = _fjsp_cmplt_v2r8(rsq20,rcutoff2);
949
950             fscal            = felec;
951
952             fscal            = _fjsp_and_v2r8(fscal,cutoff_mask);
953
954             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
955
956             /* Update vectorial force */
957             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
958             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
959             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
960             
961             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
962             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
963             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
964
965             }
966
967             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
968
969             /* Inner loop uses 109 flops */
970         }
971
972         /* End of innermost loop */
973
974         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
975                                               f+i_coord_offset,fshift+i_shift_offset);
976
977         /* Increment number of inner iterations */
978         inneriter                  += j_index_end - j_index_start;
979
980         /* Outer loop uses 18 flops */
981     }
982
983     /* Increment number of outer iterations */
984     outeriter        += nri;
985
986     /* Update outer/inner flops */
987
988     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109);
989 }