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