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