Valgrind suppression for OS X 10.9
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecEw_VdwNone_GeomP1P1_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
37  */
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "gromacs/legacyheaders/vec.h"
47 #include "nrnb.h"
48
49 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecEw_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: Ewald
54  * VdW interaction:            None
55  * Geometry:                   Particle-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecEw_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
60                     (t_nblist                    * gmx_restrict       nlist,
61                      rvec                        * gmx_restrict          xx,
62                      rvec                        * gmx_restrict          ff,
63                      t_forcerec                  * gmx_restrict          fr,
64                      t_mdatoms                   * gmx_restrict     mdatoms,
65                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66                      t_nrnb                      * gmx_restrict        nrnb)
67 {
68     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69      * just 0 for non-waters.
70      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71      * jnr indices corresponding to data put in the four positions in the SIMD register.
72      */
73     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
74     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75     int              jnrA,jnrB;
76     int              j_coord_offsetA,j_coord_offsetB;
77     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
78     real             rcutoff_scalar;
79     real             *shiftvec,*fshift,*x,*f;
80     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81     int              vdwioffset0;
82     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
83     int              vdwjidx0A,vdwjidx0B;
84     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
85     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
86     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
87     real             *charge;
88     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
89     real             *ewtab;
90     _fjsp_v2r8       itab_tmp;
91     _fjsp_v2r8       dummy_mask,cutoff_mask;
92     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
93     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
94     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
95
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            = gmx_fjsp_set1_v2r8(fr->epsfac);
108     charge           = mdatoms->chargeA;
109
110     sh_ewald         = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
111     ewtab            = fr->ic->tabq_coul_FDV0;
112     ewtabscale       = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
113     ewtabhalfspace   = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
114
115     /* Avoid stupid compiler warnings */
116     jnrA = jnrB = 0;
117     j_coord_offsetA = 0;
118     j_coord_offsetB = 0;
119
120     outeriter        = 0;
121     inneriter        = 0;
122
123     /* Start outer loop over neighborlists */
124     for(iidx=0; iidx<nri; iidx++)
125     {
126         /* Load shift vector for this list */
127         i_shift_offset   = DIM*shiftidx[iidx];
128
129         /* Load limits for loop over neighbors */
130         j_index_start    = jindex[iidx];
131         j_index_end      = jindex[iidx+1];
132
133         /* Get outer coordinate index */
134         inr              = iinr[iidx];
135         i_coord_offset   = DIM*inr;
136
137         /* Load i particle coords and add shift vector */
138         gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
139
140         fix0             = _fjsp_setzero_v2r8();
141         fiy0             = _fjsp_setzero_v2r8();
142         fiz0             = _fjsp_setzero_v2r8();
143
144         /* Load parameters for i particles */
145         iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
146
147         /* Reset potential sums */
148         velecsum         = _fjsp_setzero_v2r8();
149
150         /* Start inner kernel loop */
151         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
152         {
153
154             /* Get j neighbor index, and coordinate index */
155             jnrA             = jjnr[jidx];
156             jnrB             = jjnr[jidx+1];
157             j_coord_offsetA  = DIM*jnrA;
158             j_coord_offsetB  = DIM*jnrB;
159
160             /* load j atom coordinates */
161             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
162                                               &jx0,&jy0,&jz0);
163
164             /* Calculate displacement vector */
165             dx00             = _fjsp_sub_v2r8(ix0,jx0);
166             dy00             = _fjsp_sub_v2r8(iy0,jy0);
167             dz00             = _fjsp_sub_v2r8(iz0,jz0);
168
169             /* Calculate squared distance and things based on it */
170             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
171
172             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
173
174             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
175
176             /* Load parameters for j particles */
177             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
178
179             /**************************
180              * CALCULATE INTERACTIONS *
181              **************************/
182
183             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
184
185             /* Compute parameters for interactions between i and j atoms */
186             qq00             = _fjsp_mul_v2r8(iq0,jq0);
187
188             /* EWALD ELECTROSTATICS */
189
190             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
191             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
192             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
193             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
194             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
195
196             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
197             ewtabD           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[1] );
198             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
199             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
200             ewtabFn          = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[1] +2);
201             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
202             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
203             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
204             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
205             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
206
207             /* Update potential sum for this i atom from the interaction with this j atom. */
208             velecsum         = _fjsp_add_v2r8(velecsum,velec);
209
210             fscal            = felec;
211
212             /* Update vectorial force */
213             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
214             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
215             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
216             
217             gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
218
219             /* Inner loop uses 44 flops */
220         }
221
222         if(jidx<j_index_end)
223         {
224
225             jnrA             = jjnr[jidx];
226             j_coord_offsetA  = DIM*jnrA;
227
228             /* load j atom coordinates */
229             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
230                                               &jx0,&jy0,&jz0);
231
232             /* Calculate displacement vector */
233             dx00             = _fjsp_sub_v2r8(ix0,jx0);
234             dy00             = _fjsp_sub_v2r8(iy0,jy0);
235             dz00             = _fjsp_sub_v2r8(iz0,jz0);
236
237             /* Calculate squared distance and things based on it */
238             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
239
240             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
241
242             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
243
244             /* Load parameters for j particles */
245             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
246
247             /**************************
248              * CALCULATE INTERACTIONS *
249              **************************/
250
251             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
252
253             /* Compute parameters for interactions between i and j atoms */
254             qq00             = _fjsp_mul_v2r8(iq0,jq0);
255
256             /* EWALD ELECTROSTATICS */
257
258             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
259             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
260             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
261             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
262             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
263
264             ewtabF           = _fjsp_load_v2r8( ewtab + 4*ewconv.i[0] );
265             ewtabD           = _fjsp_setzero_v2r8();
266             GMX_FJSP_TRANSPOSE2_V2R8(ewtabF,ewtabD);
267             ewtabV           = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(), ewtab + 4*ewconv.i[0] +2);
268             ewtabFn          = _fjsp_setzero_v2r8();
269             GMX_FJSP_TRANSPOSE2_V2R8(ewtabV,ewtabFn);
270             felec            = _fjsp_madd_v2r8(eweps,ewtabD,ewtabF);
271             velec            = _fjsp_nmsub_v2r8(_fjsp_mul_v2r8(ewtabhalfspace,eweps) ,_fjsp_add_v2r8(ewtabF,felec), ewtabV);
272             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(rinv00,velec));
273             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
274
275             /* Update potential sum for this i atom from the interaction with this j atom. */
276             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
277             velecsum         = _fjsp_add_v2r8(velecsum,velec);
278
279             fscal            = felec;
280
281             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
282
283             /* Update vectorial force */
284             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
285             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
286             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
287             
288             gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
289
290             /* Inner loop uses 44 flops */
291         }
292
293         /* End of innermost loop */
294
295         gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
296                                               f+i_coord_offset,fshift+i_shift_offset);
297
298         ggid                        = gid[iidx];
299         /* Update potential energies */
300         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
301
302         /* Increment number of inner iterations */
303         inneriter                  += j_index_end - j_index_start;
304
305         /* Outer loop uses 8 flops */
306     }
307
308     /* Increment number of outer iterations */
309     outeriter        += nri;
310
311     /* Update outer/inner flops */
312
313     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*44);
314 }
315 /*
316  * Gromacs nonbonded kernel:   nb_kernel_ElecEw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
317  * Electrostatics interaction: Ewald
318  * VdW interaction:            None
319  * Geometry:                   Particle-Particle
320  * Calculate force/pot:        Force
321  */
322 void
323 nb_kernel_ElecEw_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
324                     (t_nblist                    * gmx_restrict       nlist,
325                      rvec                        * gmx_restrict          xx,
326                      rvec                        * gmx_restrict          ff,
327                      t_forcerec                  * gmx_restrict          fr,
328                      t_mdatoms                   * gmx_restrict     mdatoms,
329                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
330                      t_nrnb                      * gmx_restrict        nrnb)
331 {
332     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
333      * just 0 for non-waters.
334      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
335      * jnr indices corresponding to data put in the four positions in the SIMD register.
336      */
337     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
338     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
339     int              jnrA,jnrB;
340     int              j_coord_offsetA,j_coord_offsetB;
341     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
342     real             rcutoff_scalar;
343     real             *shiftvec,*fshift,*x,*f;
344     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
345     int              vdwioffset0;
346     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
347     int              vdwjidx0A,vdwjidx0B;
348     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
349     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
350     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
351     real             *charge;
352     _fjsp_v2r8       ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
353     real             *ewtab;
354     _fjsp_v2r8       itab_tmp;
355     _fjsp_v2r8       dummy_mask,cutoff_mask;
356     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
357     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
358     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
359
360     x                = xx[0];
361     f                = ff[0];
362
363     nri              = nlist->nri;
364     iinr             = nlist->iinr;
365     jindex           = nlist->jindex;
366     jjnr             = nlist->jjnr;
367     shiftidx         = nlist->shift;
368     gid              = nlist->gid;
369     shiftvec         = fr->shift_vec[0];
370     fshift           = fr->fshift[0];
371     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
372     charge           = mdatoms->chargeA;
373
374     sh_ewald         = gmx_fjsp_set1_v2r8(fr->ic->sh_ewald);
375     ewtab            = fr->ic->tabq_coul_F;
376     ewtabscale       = gmx_fjsp_set1_v2r8(fr->ic->tabq_scale);
377     ewtabhalfspace   = gmx_fjsp_set1_v2r8(0.5/fr->ic->tabq_scale);
378
379     /* Avoid stupid compiler warnings */
380     jnrA = jnrB = 0;
381     j_coord_offsetA = 0;
382     j_coord_offsetB = 0;
383
384     outeriter        = 0;
385     inneriter        = 0;
386
387     /* Start outer loop over neighborlists */
388     for(iidx=0; iidx<nri; iidx++)
389     {
390         /* Load shift vector for this list */
391         i_shift_offset   = DIM*shiftidx[iidx];
392
393         /* Load limits for loop over neighbors */
394         j_index_start    = jindex[iidx];
395         j_index_end      = jindex[iidx+1];
396
397         /* Get outer coordinate index */
398         inr              = iinr[iidx];
399         i_coord_offset   = DIM*inr;
400
401         /* Load i particle coords and add shift vector */
402         gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
403
404         fix0             = _fjsp_setzero_v2r8();
405         fiy0             = _fjsp_setzero_v2r8();
406         fiz0             = _fjsp_setzero_v2r8();
407
408         /* Load parameters for i particles */
409         iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
410
411         /* Start inner kernel loop */
412         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
413         {
414
415             /* Get j neighbor index, and coordinate index */
416             jnrA             = jjnr[jidx];
417             jnrB             = jjnr[jidx+1];
418             j_coord_offsetA  = DIM*jnrA;
419             j_coord_offsetB  = DIM*jnrB;
420
421             /* load j atom coordinates */
422             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
423                                               &jx0,&jy0,&jz0);
424
425             /* Calculate displacement vector */
426             dx00             = _fjsp_sub_v2r8(ix0,jx0);
427             dy00             = _fjsp_sub_v2r8(iy0,jy0);
428             dz00             = _fjsp_sub_v2r8(iz0,jz0);
429
430             /* Calculate squared distance and things based on it */
431             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
432
433             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
434
435             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
436
437             /* Load parameters for j particles */
438             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
439
440             /**************************
441              * CALCULATE INTERACTIONS *
442              **************************/
443
444             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
445
446             /* Compute parameters for interactions between i and j atoms */
447             qq00             = _fjsp_mul_v2r8(iq0,jq0);
448
449             /* EWALD ELECTROSTATICS */
450
451             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
452             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
453             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
454             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
455             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
456
457             gmx_fjsp_load_2pair_swizzle_v2r8(ewtab+ewconv.i[0],ewtab+ewconv.i[1],
458                                          &ewtabF,&ewtabFn);
459             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
460             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
461
462             fscal            = felec;
463
464             /* Update vectorial force */
465             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
466             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
467             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
468             
469             gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
470
471             /* Inner loop uses 39 flops */
472         }
473
474         if(jidx<j_index_end)
475         {
476
477             jnrA             = jjnr[jidx];
478             j_coord_offsetA  = DIM*jnrA;
479
480             /* load j atom coordinates */
481             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
482                                               &jx0,&jy0,&jz0);
483
484             /* Calculate displacement vector */
485             dx00             = _fjsp_sub_v2r8(ix0,jx0);
486             dy00             = _fjsp_sub_v2r8(iy0,jy0);
487             dz00             = _fjsp_sub_v2r8(iz0,jz0);
488
489             /* Calculate squared distance and things based on it */
490             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
491
492             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
493
494             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
495
496             /* Load parameters for j particles */
497             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
498
499             /**************************
500              * CALCULATE INTERACTIONS *
501              **************************/
502
503             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
504
505             /* Compute parameters for interactions between i and j atoms */
506             qq00             = _fjsp_mul_v2r8(iq0,jq0);
507
508             /* EWALD ELECTROSTATICS */
509
510             /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
511             ewrt             = _fjsp_mul_v2r8(r00,ewtabscale);
512             itab_tmp         = _fjsp_dtox_v2r8(ewrt);
513             eweps            = _fjsp_sub_v2r8(ewrt,_fjsp_xtod_v2r8(itab_tmp));
514             _fjsp_store_v2r8(&ewconv.simd,itab_tmp);
515
516             gmx_fjsp_load_1pair_swizzle_v2r8(ewtab+ewconv.i[0],&ewtabF,&ewtabFn);
517             felec            = _fjsp_madd_v2r8(eweps,ewtabFn,_fjsp_nmsub_v2r8(eweps,ewtabF,ewtabF));
518             felec            = _fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,rinv00),_fjsp_sub_v2r8(rinvsq00,felec));
519
520             fscal            = felec;
521
522             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
523
524             /* Update vectorial force */
525             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
526             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
527             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
528             
529             gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
530
531             /* Inner loop uses 39 flops */
532         }
533
534         /* End of innermost loop */
535
536         gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
537                                               f+i_coord_offset,fshift+i_shift_offset);
538
539         /* Increment number of inner iterations */
540         inneriter                  += j_index_end - j_index_start;
541
542         /* Outer loop uses 7 flops */
543     }
544
545     /* Increment number of outer iterations */
546     outeriter        += nri;
547
548     /* Update outer/inner flops */
549
550     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*39);
551 }