Remove no-inline-max-size and suppress remark
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCSTab_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_ElecCSTab_VdwNone_GeomP1P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: CubicSplineTable
54  * VdW interaction:            None
55  * Geometry:                   Particle-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecCSTab_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       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
89     real             *vftab;
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     vftab            = kernel_data->table_elec->data;
111     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec->scale);
112
113     /* Avoid stupid compiler warnings */
114     jnrA = jnrB = 0;
115     j_coord_offsetA = 0;
116     j_coord_offsetB = 0;
117
118     outeriter        = 0;
119     inneriter        = 0;
120
121     /* Start outer loop over neighborlists */
122     for(iidx=0; iidx<nri; iidx++)
123     {
124         /* Load shift vector for this list */
125         i_shift_offset   = DIM*shiftidx[iidx];
126
127         /* Load limits for loop over neighbors */
128         j_index_start    = jindex[iidx];
129         j_index_end      = jindex[iidx+1];
130
131         /* Get outer coordinate index */
132         inr              = iinr[iidx];
133         i_coord_offset   = DIM*inr;
134
135         /* Load i particle coords and add shift vector */
136         gmx_fjsp_load_shift_and_1rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
137
138         fix0             = _fjsp_setzero_v2r8();
139         fiy0             = _fjsp_setzero_v2r8();
140         fiz0             = _fjsp_setzero_v2r8();
141
142         /* Load parameters for i particles */
143         iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_load1_v2r8(charge+inr+0));
144
145         /* Reset potential sums */
146         velecsum         = _fjsp_setzero_v2r8();
147
148         /* Start inner kernel loop */
149         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
150         {
151
152             /* Get j neighbor index, and coordinate index */
153             jnrA             = jjnr[jidx];
154             jnrB             = jjnr[jidx+1];
155             j_coord_offsetA  = DIM*jnrA;
156             j_coord_offsetB  = DIM*jnrB;
157
158             /* load j atom coordinates */
159             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
160                                               &jx0,&jy0,&jz0);
161
162             /* Calculate displacement vector */
163             dx00             = _fjsp_sub_v2r8(ix0,jx0);
164             dy00             = _fjsp_sub_v2r8(iy0,jy0);
165             dz00             = _fjsp_sub_v2r8(iz0,jz0);
166
167             /* Calculate squared distance and things based on it */
168             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
169
170             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
171
172             /* Load parameters for j particles */
173             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
174
175             /**************************
176              * CALCULATE INTERACTIONS *
177              **************************/
178
179             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
180
181             /* Compute parameters for interactions between i and j atoms */
182             qq00             = _fjsp_mul_v2r8(iq0,jq0);
183
184             /* Calculate table index by multiplying r with table scale and truncate to integer */
185             rt               = _fjsp_mul_v2r8(r00,vftabscale);
186             itab_tmp         = _fjsp_dtox_v2r8(rt);
187             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
188             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
189             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
190
191             vfconv.i[0]     *= 4;
192             vfconv.i[1]     *= 4;
193
194             /* CUBIC SPLINE TABLE ELECTROSTATICS */
195             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
196             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
197             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
198             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
199             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
200             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
201             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
202             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
203             velec            = _fjsp_mul_v2r8(qq00,VV);
204             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
205             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
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 46 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             /* Load parameters for j particles */
243             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
244
245             /**************************
246              * CALCULATE INTERACTIONS *
247              **************************/
248
249             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
250
251             /* Compute parameters for interactions between i and j atoms */
252             qq00             = _fjsp_mul_v2r8(iq0,jq0);
253
254             /* Calculate table index by multiplying r with table scale and truncate to integer */
255             rt               = _fjsp_mul_v2r8(r00,vftabscale);
256             itab_tmp         = _fjsp_dtox_v2r8(rt);
257             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
258             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
259             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
260
261             vfconv.i[0]     *= 4;
262             vfconv.i[1]     *= 4;
263
264             /* CUBIC SPLINE TABLE ELECTROSTATICS */
265             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
266             F                = _fjsp_setzero_v2r8();
267             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
268             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
269             H                = _fjsp_setzero_v2r8();
270             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
271             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
272             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
273             velec            = _fjsp_mul_v2r8(qq00,VV);
274             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
275             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
276
277             /* Update potential sum for this i atom from the interaction with this j atom. */
278             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
279             velecsum         = _fjsp_add_v2r8(velecsum,velec);
280
281             fscal            = felec;
282
283             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
284
285             /* Update vectorial force */
286             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
287             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
288             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
289             
290             gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
291
292             /* Inner loop uses 46 flops */
293         }
294
295         /* End of innermost loop */
296
297         gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
298                                               f+i_coord_offset,fshift+i_shift_offset);
299
300         ggid                        = gid[iidx];
301         /* Update potential energies */
302         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
303
304         /* Increment number of inner iterations */
305         inneriter                  += j_index_end - j_index_start;
306
307         /* Outer loop uses 8 flops */
308     }
309
310     /* Increment number of outer iterations */
311     outeriter        += nri;
312
313     /* Update outer/inner flops */
314
315     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*46);
316 }
317 /*
318  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
319  * Electrostatics interaction: CubicSplineTable
320  * VdW interaction:            None
321  * Geometry:                   Particle-Particle
322  * Calculate force/pot:        Force
323  */
324 void
325 nb_kernel_ElecCSTab_VdwNone_GeomP1P1_F_sparc64_hpc_ace_double
326                     (t_nblist                    * gmx_restrict       nlist,
327                      rvec                        * gmx_restrict          xx,
328                      rvec                        * gmx_restrict          ff,
329                      t_forcerec                  * gmx_restrict          fr,
330                      t_mdatoms                   * gmx_restrict     mdatoms,
331                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
332                      t_nrnb                      * gmx_restrict        nrnb)
333 {
334     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
335      * just 0 for non-waters.
336      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
337      * jnr indices corresponding to data put in the four positions in the SIMD register.
338      */
339     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
340     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
341     int              jnrA,jnrB;
342     int              j_coord_offsetA,j_coord_offsetB;
343     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
344     real             rcutoff_scalar;
345     real             *shiftvec,*fshift,*x,*f;
346     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
347     int              vdwioffset0;
348     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
349     int              vdwjidx0A,vdwjidx0B;
350     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
351     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
352     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
353     real             *charge;
354     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
355     real             *vftab;
356     _fjsp_v2r8       itab_tmp;
357     _fjsp_v2r8       dummy_mask,cutoff_mask;
358     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
359     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
360     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
361
362     x                = xx[0];
363     f                = ff[0];
364
365     nri              = nlist->nri;
366     iinr             = nlist->iinr;
367     jindex           = nlist->jindex;
368     jjnr             = nlist->jjnr;
369     shiftidx         = nlist->shift;
370     gid              = nlist->gid;
371     shiftvec         = fr->shift_vec[0];
372     fshift           = fr->fshift[0];
373     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
374     charge           = mdatoms->chargeA;
375
376     vftab            = kernel_data->table_elec->data;
377     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec->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             /* Load parameters for j particles */
436             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
437
438             /**************************
439              * CALCULATE INTERACTIONS *
440              **************************/
441
442             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
443
444             /* Compute parameters for interactions between i and j atoms */
445             qq00             = _fjsp_mul_v2r8(iq0,jq0);
446
447             /* Calculate table index by multiplying r with table scale and truncate to integer */
448             rt               = _fjsp_mul_v2r8(r00,vftabscale);
449             itab_tmp         = _fjsp_dtox_v2r8(rt);
450             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
451             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
452             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
453
454             vfconv.i[0]     *= 4;
455             vfconv.i[1]     *= 4;
456
457             /* CUBIC SPLINE TABLE ELECTROSTATICS */
458             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
459             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
460             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
461             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
462             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
463             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
464             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
465             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
466             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
467
468             fscal            = felec;
469
470             /* Update vectorial force */
471             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
472             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
473             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
474             
475             gmx_fjsp_decrement_fma_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fscal,dx00,dy00,dz00);
476
477             /* Inner loop uses 42 flops */
478         }
479
480         if(jidx<j_index_end)
481         {
482
483             jnrA             = jjnr[jidx];
484             j_coord_offsetA  = DIM*jnrA;
485
486             /* load j atom coordinates */
487             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
488                                               &jx0,&jy0,&jz0);
489
490             /* Calculate displacement vector */
491             dx00             = _fjsp_sub_v2r8(ix0,jx0);
492             dy00             = _fjsp_sub_v2r8(iy0,jy0);
493             dz00             = _fjsp_sub_v2r8(iz0,jz0);
494
495             /* Calculate squared distance and things based on it */
496             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
497
498             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
499
500             /* Load parameters for j particles */
501             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
502
503             /**************************
504              * CALCULATE INTERACTIONS *
505              **************************/
506
507             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
508
509             /* Compute parameters for interactions between i and j atoms */
510             qq00             = _fjsp_mul_v2r8(iq0,jq0);
511
512             /* Calculate table index by multiplying r with table scale and truncate to integer */
513             rt               = _fjsp_mul_v2r8(r00,vftabscale);
514             itab_tmp         = _fjsp_dtox_v2r8(rt);
515             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
516             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
517             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
518
519             vfconv.i[0]     *= 4;
520             vfconv.i[1]     *= 4;
521
522             /* CUBIC SPLINE TABLE ELECTROSTATICS */
523             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
524             F                = _fjsp_setzero_v2r8();
525             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
526             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
527             H                = _fjsp_setzero_v2r8();
528             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
529             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
530             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
531             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
532
533             fscal            = felec;
534
535             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
536
537             /* Update vectorial force */
538             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
539             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
540             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
541             
542             gmx_fjsp_decrement_fma_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fscal,dx00,dy00,dz00);
543
544             /* Inner loop uses 42 flops */
545         }
546
547         /* End of innermost loop */
548
549         gmx_fjsp_update_iforce_1atom_swizzle_v2r8(fix0,fiy0,fiz0,
550                                               f+i_coord_offset,fshift+i_shift_offset);
551
552         /* Increment number of inner iterations */
553         inneriter                  += j_index_end - j_index_start;
554
555         /* Outer loop uses 7 flops */
556     }
557
558     /* Increment number of outer iterations */
559     outeriter        += nri;
560
561     /* Update outer/inner flops */
562
563     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*42);
564 }