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