Merge release-4-6 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_avx_128_fma_single / nb_kernel_ElecRF_VdwNone_GeomP1P1_avx_128_fma_single.c
1 /*
2  * Note: this file was generated by the Gromacs avx_128_fma_single kernel generator.
3  *
4  *                This source code is part of
5  *
6  *                 G   R   O   M   A   C   S
7  *
8  * Copyright (c) 2001-2012, The GROMACS Development Team
9  *
10  * Gromacs is a library for molecular simulation and trajectory analysis,
11  * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12  * a full list of developers and information, check out http://www.gromacs.org
13  *
14  * This program is free software; you can redistribute it and/or modify it under
15  * the terms of the GNU Lesser General Public License as published by the Free
16  * Software Foundation; either version 2 of the License, or (at your option) any
17  * later version.
18  *
19  * To help fund GROMACS development, we humbly ask that you cite
20  * the papers people have written on it - you can find them on the website.
21  */
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <math.h>
27
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
30 #include "vec.h"
31 #include "nrnb.h"
32
33 #include "gmx_math_x86_avx_128_fma_single.h"
34 #include "kernelutil_x86_avx_128_fma_single.h"
35
36 /*
37  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwNone_GeomP1P1_VF_avx_128_fma_single
38  * Electrostatics interaction: ReactionField
39  * VdW interaction:            None
40  * Geometry:                   Particle-Particle
41  * Calculate force/pot:        PotentialAndForce
42  */
43 void
44 nb_kernel_ElecRF_VdwNone_GeomP1P1_VF_avx_128_fma_single
45                     (t_nblist * gmx_restrict                nlist,
46                      rvec * gmx_restrict                    xx,
47                      rvec * gmx_restrict                    ff,
48                      t_forcerec * gmx_restrict              fr,
49                      t_mdatoms * gmx_restrict               mdatoms,
50                      nb_kernel_data_t * gmx_restrict        kernel_data,
51                      t_nrnb * gmx_restrict                  nrnb)
52 {
53     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
54      * just 0 for non-waters.
55      * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
56      * jnr indices corresponding to data put in the four positions in the SIMD register.
57      */
58     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
59     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
60     int              jnrA,jnrB,jnrC,jnrD;
61     int              jnrlistA,jnrlistB,jnrlistC,jnrlistD;
62     int              j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
63     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
64     real             rcutoff_scalar;
65     real             *shiftvec,*fshift,*x,*f;
66     real             *fjptrA,*fjptrB,*fjptrC,*fjptrD;
67     real             scratch[4*DIM];
68     __m128           fscal,rcutoff,rcutoff2,jidxall;
69     int              vdwioffset0;
70     __m128           ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
71     int              vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
72     __m128           jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
73     __m128           dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
74     __m128           velec,felec,velecsum,facel,crf,krf,krf2;
75     real             *charge;
76     __m128           dummy_mask,cutoff_mask;
77     __m128           signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
78     __m128           one     = _mm_set1_ps(1.0);
79     __m128           two     = _mm_set1_ps(2.0);
80     x                = xx[0];
81     f                = ff[0];
82
83     nri              = nlist->nri;
84     iinr             = nlist->iinr;
85     jindex           = nlist->jindex;
86     jjnr             = nlist->jjnr;
87     shiftidx         = nlist->shift;
88     gid              = nlist->gid;
89     shiftvec         = fr->shift_vec[0];
90     fshift           = fr->fshift[0];
91     facel            = _mm_set1_ps(fr->epsfac);
92     charge           = mdatoms->chargeA;
93     krf              = _mm_set1_ps(fr->ic->k_rf);
94     krf2             = _mm_set1_ps(fr->ic->k_rf*2.0);
95     crf              = _mm_set1_ps(fr->ic->c_rf);
96
97     /* Avoid stupid compiler warnings */
98     jnrA = jnrB = jnrC = jnrD = 0;
99     j_coord_offsetA = 0;
100     j_coord_offsetB = 0;
101     j_coord_offsetC = 0;
102     j_coord_offsetD = 0;
103
104     outeriter        = 0;
105     inneriter        = 0;
106
107     for(iidx=0;iidx<4*DIM;iidx++)
108     {
109         scratch[iidx] = 0.0;
110     }
111
112     /* Start outer loop over neighborlists */
113     for(iidx=0; iidx<nri; iidx++)
114     {
115         /* Load shift vector for this list */
116         i_shift_offset   = DIM*shiftidx[iidx];
117
118         /* Load limits for loop over neighbors */
119         j_index_start    = jindex[iidx];
120         j_index_end      = jindex[iidx+1];
121
122         /* Get outer coordinate index */
123         inr              = iinr[iidx];
124         i_coord_offset   = DIM*inr;
125
126         /* Load i particle coords and add shift vector */
127         gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
128
129         fix0             = _mm_setzero_ps();
130         fiy0             = _mm_setzero_ps();
131         fiz0             = _mm_setzero_ps();
132
133         /* Load parameters for i particles */
134         iq0              = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
135
136         /* Reset potential sums */
137         velecsum         = _mm_setzero_ps();
138
139         /* Start inner kernel loop */
140         for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
141         {
142
143             /* Get j neighbor index, and coordinate index */
144             jnrA             = jjnr[jidx];
145             jnrB             = jjnr[jidx+1];
146             jnrC             = jjnr[jidx+2];
147             jnrD             = jjnr[jidx+3];
148             j_coord_offsetA  = DIM*jnrA;
149             j_coord_offsetB  = DIM*jnrB;
150             j_coord_offsetC  = DIM*jnrC;
151             j_coord_offsetD  = DIM*jnrD;
152
153             /* load j atom coordinates */
154             gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
155                                               x+j_coord_offsetC,x+j_coord_offsetD,
156                                               &jx0,&jy0,&jz0);
157
158             /* Calculate displacement vector */
159             dx00             = _mm_sub_ps(ix0,jx0);
160             dy00             = _mm_sub_ps(iy0,jy0);
161             dz00             = _mm_sub_ps(iz0,jz0);
162
163             /* Calculate squared distance and things based on it */
164             rsq00            = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
165
166             rinv00           = gmx_mm_invsqrt_ps(rsq00);
167
168             rinvsq00         = _mm_mul_ps(rinv00,rinv00);
169
170             /* Load parameters for j particles */
171             jq0              = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
172                                                               charge+jnrC+0,charge+jnrD+0);
173
174             /**************************
175              * CALCULATE INTERACTIONS *
176              **************************/
177
178             /* Compute parameters for interactions between i and j atoms */
179             qq00             = _mm_mul_ps(iq0,jq0);
180
181             /* REACTION-FIELD ELECTROSTATICS */
182             velec            = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
183             felec            = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
184
185             /* Update potential sum for this i atom from the interaction with this j atom. */
186             velecsum         = _mm_add_ps(velecsum,velec);
187
188             fscal            = felec;
189
190              /* Update vectorial force */
191             fix0             = _mm_macc_ps(dx00,fscal,fix0);
192             fiy0             = _mm_macc_ps(dy00,fscal,fiy0);
193             fiz0             = _mm_macc_ps(dz00,fscal,fiz0);
194
195             fjptrA             = f+j_coord_offsetA;
196             fjptrB             = f+j_coord_offsetB;
197             fjptrC             = f+j_coord_offsetC;
198             fjptrD             = f+j_coord_offsetD;
199             gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
200                                                    _mm_mul_ps(dx00,fscal),
201                                                    _mm_mul_ps(dy00,fscal),
202                                                    _mm_mul_ps(dz00,fscal));
203
204             /* Inner loop uses 35 flops */
205         }
206
207         if(jidx<j_index_end)
208         {
209
210             /* Get j neighbor index, and coordinate index */
211             jnrlistA         = jjnr[jidx];
212             jnrlistB         = jjnr[jidx+1];
213             jnrlistC         = jjnr[jidx+2];
214             jnrlistD         = jjnr[jidx+3];
215             /* Sign of each element will be negative for non-real atoms.
216              * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
217              * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
218              */
219             dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
220             jnrA       = (jnrlistA>=0) ? jnrlistA : 0;
221             jnrB       = (jnrlistB>=0) ? jnrlistB : 0;
222             jnrC       = (jnrlistC>=0) ? jnrlistC : 0;
223             jnrD       = (jnrlistD>=0) ? jnrlistD : 0;
224             j_coord_offsetA  = DIM*jnrA;
225             j_coord_offsetB  = DIM*jnrB;
226             j_coord_offsetC  = DIM*jnrC;
227             j_coord_offsetD  = DIM*jnrD;
228
229             /* load j atom coordinates */
230             gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
231                                               x+j_coord_offsetC,x+j_coord_offsetD,
232                                               &jx0,&jy0,&jz0);
233
234             /* Calculate displacement vector */
235             dx00             = _mm_sub_ps(ix0,jx0);
236             dy00             = _mm_sub_ps(iy0,jy0);
237             dz00             = _mm_sub_ps(iz0,jz0);
238
239             /* Calculate squared distance and things based on it */
240             rsq00            = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
241
242             rinv00           = gmx_mm_invsqrt_ps(rsq00);
243
244             rinvsq00         = _mm_mul_ps(rinv00,rinv00);
245
246             /* Load parameters for j particles */
247             jq0              = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
248                                                               charge+jnrC+0,charge+jnrD+0);
249
250             /**************************
251              * CALCULATE INTERACTIONS *
252              **************************/
253
254             /* Compute parameters for interactions between i and j atoms */
255             qq00             = _mm_mul_ps(iq0,jq0);
256
257             /* REACTION-FIELD ELECTROSTATICS */
258             velec            = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
259             felec            = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
260
261             /* Update potential sum for this i atom from the interaction with this j atom. */
262             velec            = _mm_andnot_ps(dummy_mask,velec);
263             velecsum         = _mm_add_ps(velecsum,velec);
264
265             fscal            = felec;
266
267             fscal            = _mm_andnot_ps(dummy_mask,fscal);
268
269              /* Update vectorial force */
270             fix0             = _mm_macc_ps(dx00,fscal,fix0);
271             fiy0             = _mm_macc_ps(dy00,fscal,fiy0);
272             fiz0             = _mm_macc_ps(dz00,fscal,fiz0);
273
274             fjptrA             = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
275             fjptrB             = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
276             fjptrC             = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
277             fjptrD             = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
278             gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
279                                                    _mm_mul_ps(dx00,fscal),
280                                                    _mm_mul_ps(dy00,fscal),
281                                                    _mm_mul_ps(dz00,fscal));
282
283             /* Inner loop uses 35 flops */
284         }
285
286         /* End of innermost loop */
287
288         gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
289                                               f+i_coord_offset,fshift+i_shift_offset);
290
291         ggid                        = gid[iidx];
292         /* Update potential energies */
293         gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
294
295         /* Increment number of inner iterations */
296         inneriter                  += j_index_end - j_index_start;
297
298         /* Outer loop uses 8 flops */
299     }
300
301     /* Increment number of outer iterations */
302     outeriter        += nri;
303
304     /* Update outer/inner flops */
305
306     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*35);
307 }
308 /*
309  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwNone_GeomP1P1_F_avx_128_fma_single
310  * Electrostatics interaction: ReactionField
311  * VdW interaction:            None
312  * Geometry:                   Particle-Particle
313  * Calculate force/pot:        Force
314  */
315 void
316 nb_kernel_ElecRF_VdwNone_GeomP1P1_F_avx_128_fma_single
317                     (t_nblist * gmx_restrict                nlist,
318                      rvec * gmx_restrict                    xx,
319                      rvec * gmx_restrict                    ff,
320                      t_forcerec * gmx_restrict              fr,
321                      t_mdatoms * gmx_restrict               mdatoms,
322                      nb_kernel_data_t * gmx_restrict        kernel_data,
323                      t_nrnb * gmx_restrict                  nrnb)
324 {
325     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
326      * just 0 for non-waters.
327      * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
328      * jnr indices corresponding to data put in the four positions in the SIMD register.
329      */
330     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
331     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
332     int              jnrA,jnrB,jnrC,jnrD;
333     int              jnrlistA,jnrlistB,jnrlistC,jnrlistD;
334     int              j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
335     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
336     real             rcutoff_scalar;
337     real             *shiftvec,*fshift,*x,*f;
338     real             *fjptrA,*fjptrB,*fjptrC,*fjptrD;
339     real             scratch[4*DIM];
340     __m128           fscal,rcutoff,rcutoff2,jidxall;
341     int              vdwioffset0;
342     __m128           ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
343     int              vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
344     __m128           jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
345     __m128           dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
346     __m128           velec,felec,velecsum,facel,crf,krf,krf2;
347     real             *charge;
348     __m128           dummy_mask,cutoff_mask;
349     __m128           signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
350     __m128           one     = _mm_set1_ps(1.0);
351     __m128           two     = _mm_set1_ps(2.0);
352     x                = xx[0];
353     f                = ff[0];
354
355     nri              = nlist->nri;
356     iinr             = nlist->iinr;
357     jindex           = nlist->jindex;
358     jjnr             = nlist->jjnr;
359     shiftidx         = nlist->shift;
360     gid              = nlist->gid;
361     shiftvec         = fr->shift_vec[0];
362     fshift           = fr->fshift[0];
363     facel            = _mm_set1_ps(fr->epsfac);
364     charge           = mdatoms->chargeA;
365     krf              = _mm_set1_ps(fr->ic->k_rf);
366     krf2             = _mm_set1_ps(fr->ic->k_rf*2.0);
367     crf              = _mm_set1_ps(fr->ic->c_rf);
368
369     /* Avoid stupid compiler warnings */
370     jnrA = jnrB = jnrC = jnrD = 0;
371     j_coord_offsetA = 0;
372     j_coord_offsetB = 0;
373     j_coord_offsetC = 0;
374     j_coord_offsetD = 0;
375
376     outeriter        = 0;
377     inneriter        = 0;
378
379     for(iidx=0;iidx<4*DIM;iidx++)
380     {
381         scratch[iidx] = 0.0;
382     }
383
384     /* Start outer loop over neighborlists */
385     for(iidx=0; iidx<nri; iidx++)
386     {
387         /* Load shift vector for this list */
388         i_shift_offset   = DIM*shiftidx[iidx];
389
390         /* Load limits for loop over neighbors */
391         j_index_start    = jindex[iidx];
392         j_index_end      = jindex[iidx+1];
393
394         /* Get outer coordinate index */
395         inr              = iinr[iidx];
396         i_coord_offset   = DIM*inr;
397
398         /* Load i particle coords and add shift vector */
399         gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
400
401         fix0             = _mm_setzero_ps();
402         fiy0             = _mm_setzero_ps();
403         fiz0             = _mm_setzero_ps();
404
405         /* Load parameters for i particles */
406         iq0              = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
407
408         /* Start inner kernel loop */
409         for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
410         {
411
412             /* Get j neighbor index, and coordinate index */
413             jnrA             = jjnr[jidx];
414             jnrB             = jjnr[jidx+1];
415             jnrC             = jjnr[jidx+2];
416             jnrD             = jjnr[jidx+3];
417             j_coord_offsetA  = DIM*jnrA;
418             j_coord_offsetB  = DIM*jnrB;
419             j_coord_offsetC  = DIM*jnrC;
420             j_coord_offsetD  = DIM*jnrD;
421
422             /* load j atom coordinates */
423             gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
424                                               x+j_coord_offsetC,x+j_coord_offsetD,
425                                               &jx0,&jy0,&jz0);
426
427             /* Calculate displacement vector */
428             dx00             = _mm_sub_ps(ix0,jx0);
429             dy00             = _mm_sub_ps(iy0,jy0);
430             dz00             = _mm_sub_ps(iz0,jz0);
431
432             /* Calculate squared distance and things based on it */
433             rsq00            = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
434
435             rinv00           = gmx_mm_invsqrt_ps(rsq00);
436
437             rinvsq00         = _mm_mul_ps(rinv00,rinv00);
438
439             /* Load parameters for j particles */
440             jq0              = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
441                                                               charge+jnrC+0,charge+jnrD+0);
442
443             /**************************
444              * CALCULATE INTERACTIONS *
445              **************************/
446
447             /* Compute parameters for interactions between i and j atoms */
448             qq00             = _mm_mul_ps(iq0,jq0);
449
450             /* REACTION-FIELD ELECTROSTATICS */
451             felec            = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
452
453             fscal            = felec;
454
455              /* Update vectorial force */
456             fix0             = _mm_macc_ps(dx00,fscal,fix0);
457             fiy0             = _mm_macc_ps(dy00,fscal,fiy0);
458             fiz0             = _mm_macc_ps(dz00,fscal,fiz0);
459
460             fjptrA             = f+j_coord_offsetA;
461             fjptrB             = f+j_coord_offsetB;
462             fjptrC             = f+j_coord_offsetC;
463             fjptrD             = f+j_coord_offsetD;
464             gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
465                                                    _mm_mul_ps(dx00,fscal),
466                                                    _mm_mul_ps(dy00,fscal),
467                                                    _mm_mul_ps(dz00,fscal));
468
469             /* Inner loop uses 30 flops */
470         }
471
472         if(jidx<j_index_end)
473         {
474
475             /* Get j neighbor index, and coordinate index */
476             jnrlistA         = jjnr[jidx];
477             jnrlistB         = jjnr[jidx+1];
478             jnrlistC         = jjnr[jidx+2];
479             jnrlistD         = jjnr[jidx+3];
480             /* Sign of each element will be negative for non-real atoms.
481              * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
482              * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
483              */
484             dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
485             jnrA       = (jnrlistA>=0) ? jnrlistA : 0;
486             jnrB       = (jnrlistB>=0) ? jnrlistB : 0;
487             jnrC       = (jnrlistC>=0) ? jnrlistC : 0;
488             jnrD       = (jnrlistD>=0) ? jnrlistD : 0;
489             j_coord_offsetA  = DIM*jnrA;
490             j_coord_offsetB  = DIM*jnrB;
491             j_coord_offsetC  = DIM*jnrC;
492             j_coord_offsetD  = DIM*jnrD;
493
494             /* load j atom coordinates */
495             gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
496                                               x+j_coord_offsetC,x+j_coord_offsetD,
497                                               &jx0,&jy0,&jz0);
498
499             /* Calculate displacement vector */
500             dx00             = _mm_sub_ps(ix0,jx0);
501             dy00             = _mm_sub_ps(iy0,jy0);
502             dz00             = _mm_sub_ps(iz0,jz0);
503
504             /* Calculate squared distance and things based on it */
505             rsq00            = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
506
507             rinv00           = gmx_mm_invsqrt_ps(rsq00);
508
509             rinvsq00         = _mm_mul_ps(rinv00,rinv00);
510
511             /* Load parameters for j particles */
512             jq0              = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
513                                                               charge+jnrC+0,charge+jnrD+0);
514
515             /**************************
516              * CALCULATE INTERACTIONS *
517              **************************/
518
519             /* Compute parameters for interactions between i and j atoms */
520             qq00             = _mm_mul_ps(iq0,jq0);
521
522             /* REACTION-FIELD ELECTROSTATICS */
523             felec            = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
524
525             fscal            = felec;
526
527             fscal            = _mm_andnot_ps(dummy_mask,fscal);
528
529              /* Update vectorial force */
530             fix0             = _mm_macc_ps(dx00,fscal,fix0);
531             fiy0             = _mm_macc_ps(dy00,fscal,fiy0);
532             fiz0             = _mm_macc_ps(dz00,fscal,fiz0);
533
534             fjptrA             = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
535             fjptrB             = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
536             fjptrC             = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
537             fjptrD             = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
538             gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
539                                                    _mm_mul_ps(dx00,fscal),
540                                                    _mm_mul_ps(dy00,fscal),
541                                                    _mm_mul_ps(dz00,fscal));
542
543             /* Inner loop uses 30 flops */
544         }
545
546         /* End of innermost loop */
547
548         gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
549                                               f+i_coord_offset,fshift+i_shift_offset);
550
551         /* Increment number of inner iterations */
552         inneriter                  += j_index_end - j_index_start;
553
554         /* Outer loop uses 7 flops */
555     }
556
557     /* Increment number of outer iterations */
558     outeriter        += nri;
559
560     /* Update outer/inner flops */
561
562     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*30);
563 }