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