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