nb_kernel_sparc64_hpc_ace_double: clean up -Wunused-parameter warnings
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012, by the GROMACS development team, led by
5  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6  * others, as listed in the AUTHORS file in the top-level source
7  * 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 "vec.h"
47 #include "nrnb.h"
48
49 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: CubicSplineTable
54  * VdW interaction:            CubicSplineTable
55  * Geometry:                   Water3-Particle
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_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              vdwioffset1;
84     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
85     int              vdwioffset2;
86     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
87     int              vdwjidx0A,vdwjidx0B;
88     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
93     real             *charge;
94     int              nvdwtype;
95     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
96     int              *vdwtype;
97     real             *vdwparam;
98     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
99     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
100     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
101     real             *vftab;
102     _fjsp_v2r8       itab_tmp;
103     _fjsp_v2r8       dummy_mask,cutoff_mask;
104     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
105     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
106     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
107
108     x                = xx[0];
109     f                = ff[0];
110
111     nri              = nlist->nri;
112     iinr             = nlist->iinr;
113     jindex           = nlist->jindex;
114     jjnr             = nlist->jjnr;
115     shiftidx         = nlist->shift;
116     gid              = nlist->gid;
117     shiftvec         = fr->shift_vec[0];
118     fshift           = fr->fshift[0];
119     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
120     charge           = mdatoms->chargeA;
121     nvdwtype         = fr->ntype;
122     vdwparam         = fr->nbfp;
123     vdwtype          = mdatoms->typeA;
124
125     vftab            = kernel_data->table_elec_vdw->data;
126     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
127
128     /* Setup water-specific parameters */
129     inr              = nlist->iinr[0];
130     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
131     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
132     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
133     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
134
135     /* Avoid stupid compiler warnings */
136     jnrA = jnrB = 0;
137     j_coord_offsetA = 0;
138     j_coord_offsetB = 0;
139
140     outeriter        = 0;
141     inneriter        = 0;
142
143     /* Start outer loop over neighborlists */
144     for(iidx=0; iidx<nri; iidx++)
145     {
146         /* Load shift vector for this list */
147         i_shift_offset   = DIM*shiftidx[iidx];
148
149         /* Load limits for loop over neighbors */
150         j_index_start    = jindex[iidx];
151         j_index_end      = jindex[iidx+1];
152
153         /* Get outer coordinate index */
154         inr              = iinr[iidx];
155         i_coord_offset   = DIM*inr;
156
157         /* Load i particle coords and add shift vector */
158         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
159                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
160
161         fix0             = _fjsp_setzero_v2r8();
162         fiy0             = _fjsp_setzero_v2r8();
163         fiz0             = _fjsp_setzero_v2r8();
164         fix1             = _fjsp_setzero_v2r8();
165         fiy1             = _fjsp_setzero_v2r8();
166         fiz1             = _fjsp_setzero_v2r8();
167         fix2             = _fjsp_setzero_v2r8();
168         fiy2             = _fjsp_setzero_v2r8();
169         fiz2             = _fjsp_setzero_v2r8();
170
171         /* Reset potential sums */
172         velecsum         = _fjsp_setzero_v2r8();
173         vvdwsum          = _fjsp_setzero_v2r8();
174
175         /* Start inner kernel loop */
176         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
177         {
178
179             /* Get j neighbor index, and coordinate index */
180             jnrA             = jjnr[jidx];
181             jnrB             = jjnr[jidx+1];
182             j_coord_offsetA  = DIM*jnrA;
183             j_coord_offsetB  = DIM*jnrB;
184
185             /* load j atom coordinates */
186             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
187                                               &jx0,&jy0,&jz0);
188
189             /* Calculate displacement vector */
190             dx00             = _fjsp_sub_v2r8(ix0,jx0);
191             dy00             = _fjsp_sub_v2r8(iy0,jy0);
192             dz00             = _fjsp_sub_v2r8(iz0,jz0);
193             dx10             = _fjsp_sub_v2r8(ix1,jx0);
194             dy10             = _fjsp_sub_v2r8(iy1,jy0);
195             dz10             = _fjsp_sub_v2r8(iz1,jz0);
196             dx20             = _fjsp_sub_v2r8(ix2,jx0);
197             dy20             = _fjsp_sub_v2r8(iy2,jy0);
198             dz20             = _fjsp_sub_v2r8(iz2,jz0);
199
200             /* Calculate squared distance and things based on it */
201             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
202             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
203             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
204
205             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
206             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
207             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
208
209             /* Load parameters for j particles */
210             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
211             vdwjidx0A        = 2*vdwtype[jnrA+0];
212             vdwjidx0B        = 2*vdwtype[jnrB+0];
213
214             fjx0             = _fjsp_setzero_v2r8();
215             fjy0             = _fjsp_setzero_v2r8();
216             fjz0             = _fjsp_setzero_v2r8();
217
218             /**************************
219              * CALCULATE INTERACTIONS *
220              **************************/
221
222             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
223
224             /* Compute parameters for interactions between i and j atoms */
225             qq00             = _fjsp_mul_v2r8(iq0,jq0);
226             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
227                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
228
229             /* Calculate table index by multiplying r with table scale and truncate to integer */
230             rt               = _fjsp_mul_v2r8(r00,vftabscale);
231             itab_tmp         = _fjsp_dtox_v2r8(rt);
232             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
233             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
234             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
235
236             vfconv.i[0]     *= 12;
237             vfconv.i[1]     *= 12;
238
239             /* CUBIC SPLINE TABLE ELECTROSTATICS */
240             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
241             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
242             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
243             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
244             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
245             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
246             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
247             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
248             velec            = _fjsp_mul_v2r8(qq00,VV);
249             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
250             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
251
252             /* CUBIC SPLINE TABLE DISPERSION */
253             vfconv.i[0]       += 4;
254             vfconv.i[1]       += 4;
255             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
256             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
257             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
258             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
259             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
260             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
261             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
262             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
263             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
264             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
265             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
266
267             /* CUBIC SPLINE TABLE REPULSION */
268             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
269             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
270             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
271             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
272             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
273             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
274             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
275             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
276             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
277             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
278             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
279             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
280             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
281
282             /* Update potential sum for this i atom from the interaction with this j atom. */
283             velecsum         = _fjsp_add_v2r8(velecsum,velec);
284             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
285
286             fscal            = _fjsp_add_v2r8(felec,fvdw);
287
288             /* Update vectorial force */
289             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
290             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
291             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
292             
293             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
294             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
295             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
296
297             /**************************
298              * CALCULATE INTERACTIONS *
299              **************************/
300
301             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
302
303             /* Compute parameters for interactions between i and j atoms */
304             qq10             = _fjsp_mul_v2r8(iq1,jq0);
305
306             /* Calculate table index by multiplying r with table scale and truncate to integer */
307             rt               = _fjsp_mul_v2r8(r10,vftabscale);
308             itab_tmp         = _fjsp_dtox_v2r8(rt);
309             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
310             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
311             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
312
313             vfconv.i[0]     *= 12;
314             vfconv.i[1]     *= 12;
315
316             /* CUBIC SPLINE TABLE ELECTROSTATICS */
317             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
318             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
319             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
320             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
321             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
322             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
323             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
324             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
325             velec            = _fjsp_mul_v2r8(qq10,VV);
326             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
327             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
328
329             /* Update potential sum for this i atom from the interaction with this j atom. */
330             velecsum         = _fjsp_add_v2r8(velecsum,velec);
331
332             fscal            = felec;
333
334             /* Update vectorial force */
335             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
336             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
337             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
338             
339             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
340             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
341             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
342
343             /**************************
344              * CALCULATE INTERACTIONS *
345              **************************/
346
347             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
348
349             /* Compute parameters for interactions between i and j atoms */
350             qq20             = _fjsp_mul_v2r8(iq2,jq0);
351
352             /* Calculate table index by multiplying r with table scale and truncate to integer */
353             rt               = _fjsp_mul_v2r8(r20,vftabscale);
354             itab_tmp         = _fjsp_dtox_v2r8(rt);
355             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
356             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
357             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
358
359             vfconv.i[0]     *= 12;
360             vfconv.i[1]     *= 12;
361
362             /* CUBIC SPLINE TABLE ELECTROSTATICS */
363             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
364             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
365             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
366             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
367             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
368             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
369             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
370             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
371             velec            = _fjsp_mul_v2r8(qq20,VV);
372             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
373             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
374
375             /* Update potential sum for this i atom from the interaction with this j atom. */
376             velecsum         = _fjsp_add_v2r8(velecsum,velec);
377
378             fscal            = felec;
379
380             /* Update vectorial force */
381             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
382             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
383             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
384             
385             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
386             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
387             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
388
389             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
390
391             /* Inner loop uses 171 flops */
392         }
393
394         if(jidx<j_index_end)
395         {
396
397             jnrA             = jjnr[jidx];
398             j_coord_offsetA  = DIM*jnrA;
399
400             /* load j atom coordinates */
401             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
402                                               &jx0,&jy0,&jz0);
403
404             /* Calculate displacement vector */
405             dx00             = _fjsp_sub_v2r8(ix0,jx0);
406             dy00             = _fjsp_sub_v2r8(iy0,jy0);
407             dz00             = _fjsp_sub_v2r8(iz0,jz0);
408             dx10             = _fjsp_sub_v2r8(ix1,jx0);
409             dy10             = _fjsp_sub_v2r8(iy1,jy0);
410             dz10             = _fjsp_sub_v2r8(iz1,jz0);
411             dx20             = _fjsp_sub_v2r8(ix2,jx0);
412             dy20             = _fjsp_sub_v2r8(iy2,jy0);
413             dz20             = _fjsp_sub_v2r8(iz2,jz0);
414
415             /* Calculate squared distance and things based on it */
416             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
417             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
418             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
419
420             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
421             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
422             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
423
424             /* Load parameters for j particles */
425             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
426             vdwjidx0A        = 2*vdwtype[jnrA+0];
427
428             fjx0             = _fjsp_setzero_v2r8();
429             fjy0             = _fjsp_setzero_v2r8();
430             fjz0             = _fjsp_setzero_v2r8();
431
432             /**************************
433              * CALCULATE INTERACTIONS *
434              **************************/
435
436             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
437
438             /* Compute parameters for interactions between i and j atoms */
439             qq00             = _fjsp_mul_v2r8(iq0,jq0);
440             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
441
442             /* Calculate table index by multiplying r with table scale and truncate to integer */
443             rt               = _fjsp_mul_v2r8(r00,vftabscale);
444             itab_tmp         = _fjsp_dtox_v2r8(rt);
445             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
446             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
447             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
448
449             vfconv.i[0]     *= 12;
450             vfconv.i[1]     *= 12;
451
452             /* CUBIC SPLINE TABLE ELECTROSTATICS */
453             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
454             F                = _fjsp_setzero_v2r8();
455             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
456             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
457             H                = _fjsp_setzero_v2r8();
458             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
459             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
460             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
461             velec            = _fjsp_mul_v2r8(qq00,VV);
462             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
463             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
464
465             /* CUBIC SPLINE TABLE DISPERSION */
466             vfconv.i[0]       += 4;
467             vfconv.i[1]       += 4;
468             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
469             F                = _fjsp_setzero_v2r8();
470             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
471             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
472             H                = _fjsp_setzero_v2r8();
473             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
474             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
475             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
476             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
477             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
478             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
479
480             /* CUBIC SPLINE TABLE REPULSION */
481             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
482             F                = _fjsp_setzero_v2r8();
483             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
484             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
485             H                = _fjsp_setzero_v2r8();
486             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
487             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
488             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
489             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
490             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
491             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
492             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
493             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
494
495             /* Update potential sum for this i atom from the interaction with this j atom. */
496             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
497             velecsum         = _fjsp_add_v2r8(velecsum,velec);
498             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
499             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
500
501             fscal            = _fjsp_add_v2r8(felec,fvdw);
502
503             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
504
505             /* Update vectorial force */
506             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
507             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
508             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
509             
510             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
511             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
512             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
513
514             /**************************
515              * CALCULATE INTERACTIONS *
516              **************************/
517
518             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
519
520             /* Compute parameters for interactions between i and j atoms */
521             qq10             = _fjsp_mul_v2r8(iq1,jq0);
522
523             /* Calculate table index by multiplying r with table scale and truncate to integer */
524             rt               = _fjsp_mul_v2r8(r10,vftabscale);
525             itab_tmp         = _fjsp_dtox_v2r8(rt);
526             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
527             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
528             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
529
530             vfconv.i[0]     *= 12;
531             vfconv.i[1]     *= 12;
532
533             /* CUBIC SPLINE TABLE ELECTROSTATICS */
534             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
535             F                = _fjsp_setzero_v2r8();
536             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
537             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
538             H                = _fjsp_setzero_v2r8();
539             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
540             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
541             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
542             velec            = _fjsp_mul_v2r8(qq10,VV);
543             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
544             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
545
546             /* Update potential sum for this i atom from the interaction with this j atom. */
547             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
548             velecsum         = _fjsp_add_v2r8(velecsum,velec);
549
550             fscal            = felec;
551
552             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
553
554             /* Update vectorial force */
555             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
556             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
557             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
558             
559             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
560             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
561             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
562
563             /**************************
564              * CALCULATE INTERACTIONS *
565              **************************/
566
567             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
568
569             /* Compute parameters for interactions between i and j atoms */
570             qq20             = _fjsp_mul_v2r8(iq2,jq0);
571
572             /* Calculate table index by multiplying r with table scale and truncate to integer */
573             rt               = _fjsp_mul_v2r8(r20,vftabscale);
574             itab_tmp         = _fjsp_dtox_v2r8(rt);
575             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
576             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
577             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
578
579             vfconv.i[0]     *= 12;
580             vfconv.i[1]     *= 12;
581
582             /* CUBIC SPLINE TABLE ELECTROSTATICS */
583             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
584             F                = _fjsp_setzero_v2r8();
585             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
586             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
587             H                = _fjsp_setzero_v2r8();
588             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
589             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
590             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
591             velec            = _fjsp_mul_v2r8(qq20,VV);
592             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
593             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
594
595             /* Update potential sum for this i atom from the interaction with this j atom. */
596             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
597             velecsum         = _fjsp_add_v2r8(velecsum,velec);
598
599             fscal            = felec;
600
601             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
602
603             /* Update vectorial force */
604             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
605             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
606             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
607             
608             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
609             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
610             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
611
612             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
613
614             /* Inner loop uses 171 flops */
615         }
616
617         /* End of innermost loop */
618
619         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
620                                               f+i_coord_offset,fshift+i_shift_offset);
621
622         ggid                        = gid[iidx];
623         /* Update potential energies */
624         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
625         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
626
627         /* Increment number of inner iterations */
628         inneriter                  += j_index_end - j_index_start;
629
630         /* Outer loop uses 20 flops */
631     }
632
633     /* Increment number of outer iterations */
634     outeriter        += nri;
635
636     /* Update outer/inner flops */
637
638     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*171);
639 }
640 /*
641  * Gromacs nonbonded kernel:   nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
642  * Electrostatics interaction: CubicSplineTable
643  * VdW interaction:            CubicSplineTable
644  * Geometry:                   Water3-Particle
645  * Calculate force/pot:        Force
646  */
647 void
648 nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
649                     (t_nblist                    * gmx_restrict       nlist,
650                      rvec                        * gmx_restrict          xx,
651                      rvec                        * gmx_restrict          ff,
652                      t_forcerec                  * gmx_restrict          fr,
653                      t_mdatoms                   * gmx_restrict     mdatoms,
654                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
655                      t_nrnb                      * gmx_restrict        nrnb)
656 {
657     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
658      * just 0 for non-waters.
659      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
660      * jnr indices corresponding to data put in the four positions in the SIMD register.
661      */
662     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
663     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
664     int              jnrA,jnrB;
665     int              j_coord_offsetA,j_coord_offsetB;
666     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
667     real             rcutoff_scalar;
668     real             *shiftvec,*fshift,*x,*f;
669     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
670     int              vdwioffset0;
671     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
672     int              vdwioffset1;
673     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
674     int              vdwioffset2;
675     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
676     int              vdwjidx0A,vdwjidx0B;
677     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
678     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
679     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
680     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
681     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
682     real             *charge;
683     int              nvdwtype;
684     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
685     int              *vdwtype;
686     real             *vdwparam;
687     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
688     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
689     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
690     real             *vftab;
691     _fjsp_v2r8       itab_tmp;
692     _fjsp_v2r8       dummy_mask,cutoff_mask;
693     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
694     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
695     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
696
697     x                = xx[0];
698     f                = ff[0];
699
700     nri              = nlist->nri;
701     iinr             = nlist->iinr;
702     jindex           = nlist->jindex;
703     jjnr             = nlist->jjnr;
704     shiftidx         = nlist->shift;
705     gid              = nlist->gid;
706     shiftvec         = fr->shift_vec[0];
707     fshift           = fr->fshift[0];
708     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
709     charge           = mdatoms->chargeA;
710     nvdwtype         = fr->ntype;
711     vdwparam         = fr->nbfp;
712     vdwtype          = mdatoms->typeA;
713
714     vftab            = kernel_data->table_elec_vdw->data;
715     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_elec_vdw->scale);
716
717     /* Setup water-specific parameters */
718     inr              = nlist->iinr[0];
719     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
720     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
721     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
722     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
723
724     /* Avoid stupid compiler warnings */
725     jnrA = jnrB = 0;
726     j_coord_offsetA = 0;
727     j_coord_offsetB = 0;
728
729     outeriter        = 0;
730     inneriter        = 0;
731
732     /* Start outer loop over neighborlists */
733     for(iidx=0; iidx<nri; iidx++)
734     {
735         /* Load shift vector for this list */
736         i_shift_offset   = DIM*shiftidx[iidx];
737
738         /* Load limits for loop over neighbors */
739         j_index_start    = jindex[iidx];
740         j_index_end      = jindex[iidx+1];
741
742         /* Get outer coordinate index */
743         inr              = iinr[iidx];
744         i_coord_offset   = DIM*inr;
745
746         /* Load i particle coords and add shift vector */
747         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
748                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
749
750         fix0             = _fjsp_setzero_v2r8();
751         fiy0             = _fjsp_setzero_v2r8();
752         fiz0             = _fjsp_setzero_v2r8();
753         fix1             = _fjsp_setzero_v2r8();
754         fiy1             = _fjsp_setzero_v2r8();
755         fiz1             = _fjsp_setzero_v2r8();
756         fix2             = _fjsp_setzero_v2r8();
757         fiy2             = _fjsp_setzero_v2r8();
758         fiz2             = _fjsp_setzero_v2r8();
759
760         /* Start inner kernel loop */
761         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
762         {
763
764             /* Get j neighbor index, and coordinate index */
765             jnrA             = jjnr[jidx];
766             jnrB             = jjnr[jidx+1];
767             j_coord_offsetA  = DIM*jnrA;
768             j_coord_offsetB  = DIM*jnrB;
769
770             /* load j atom coordinates */
771             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
772                                               &jx0,&jy0,&jz0);
773
774             /* Calculate displacement vector */
775             dx00             = _fjsp_sub_v2r8(ix0,jx0);
776             dy00             = _fjsp_sub_v2r8(iy0,jy0);
777             dz00             = _fjsp_sub_v2r8(iz0,jz0);
778             dx10             = _fjsp_sub_v2r8(ix1,jx0);
779             dy10             = _fjsp_sub_v2r8(iy1,jy0);
780             dz10             = _fjsp_sub_v2r8(iz1,jz0);
781             dx20             = _fjsp_sub_v2r8(ix2,jx0);
782             dy20             = _fjsp_sub_v2r8(iy2,jy0);
783             dz20             = _fjsp_sub_v2r8(iz2,jz0);
784
785             /* Calculate squared distance and things based on it */
786             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
787             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
788             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
789
790             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
791             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
792             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
793
794             /* Load parameters for j particles */
795             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
796             vdwjidx0A        = 2*vdwtype[jnrA+0];
797             vdwjidx0B        = 2*vdwtype[jnrB+0];
798
799             fjx0             = _fjsp_setzero_v2r8();
800             fjy0             = _fjsp_setzero_v2r8();
801             fjz0             = _fjsp_setzero_v2r8();
802
803             /**************************
804              * CALCULATE INTERACTIONS *
805              **************************/
806
807             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
808
809             /* Compute parameters for interactions between i and j atoms */
810             qq00             = _fjsp_mul_v2r8(iq0,jq0);
811             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
812                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
813
814             /* Calculate table index by multiplying r with table scale and truncate to integer */
815             rt               = _fjsp_mul_v2r8(r00,vftabscale);
816             itab_tmp         = _fjsp_dtox_v2r8(rt);
817             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
818             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
819             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
820
821             vfconv.i[0]     *= 12;
822             vfconv.i[1]     *= 12;
823
824             /* CUBIC SPLINE TABLE ELECTROSTATICS */
825             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
826             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
827             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
828             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
829             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
830             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
831             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
832             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
833             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
834
835             /* CUBIC SPLINE TABLE DISPERSION */
836             vfconv.i[0]       += 4;
837             vfconv.i[1]       += 4;
838             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
839             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
840             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
841             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
842             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
843             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
844             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
845             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
846             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
847
848             /* CUBIC SPLINE TABLE REPULSION */
849             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
850             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
851             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
852             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
853             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
854             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
855             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
856             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
857             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
858             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
859
860             fscal            = _fjsp_add_v2r8(felec,fvdw);
861
862             /* Update vectorial force */
863             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
864             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
865             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
866             
867             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
868             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
869             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
870
871             /**************************
872              * CALCULATE INTERACTIONS *
873              **************************/
874
875             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
876
877             /* Compute parameters for interactions between i and j atoms */
878             qq10             = _fjsp_mul_v2r8(iq1,jq0);
879
880             /* Calculate table index by multiplying r with table scale and truncate to integer */
881             rt               = _fjsp_mul_v2r8(r10,vftabscale);
882             itab_tmp         = _fjsp_dtox_v2r8(rt);
883             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
884             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
885             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
886
887             vfconv.i[0]     *= 12;
888             vfconv.i[1]     *= 12;
889
890             /* CUBIC SPLINE TABLE ELECTROSTATICS */
891             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
892             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
893             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
894             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
895             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
896             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
897             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
898             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
899             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
900
901             fscal            = felec;
902
903             /* Update vectorial force */
904             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
905             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
906             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
907             
908             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
909             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
910             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
911
912             /**************************
913              * CALCULATE INTERACTIONS *
914              **************************/
915
916             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
917
918             /* Compute parameters for interactions between i and j atoms */
919             qq20             = _fjsp_mul_v2r8(iq2,jq0);
920
921             /* Calculate table index by multiplying r with table scale and truncate to integer */
922             rt               = _fjsp_mul_v2r8(r20,vftabscale);
923             itab_tmp         = _fjsp_dtox_v2r8(rt);
924             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
925             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
926             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
927
928             vfconv.i[0]     *= 12;
929             vfconv.i[1]     *= 12;
930
931             /* CUBIC SPLINE TABLE ELECTROSTATICS */
932             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
933             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
934             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
935             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
936             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] +2);
937             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
938             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
939             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
940             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
941
942             fscal            = felec;
943
944             /* Update vectorial force */
945             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
946             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
947             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
948             
949             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
950             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
951             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
952
953             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
954
955             /* Inner loop uses 151 flops */
956         }
957
958         if(jidx<j_index_end)
959         {
960
961             jnrA             = jjnr[jidx];
962             j_coord_offsetA  = DIM*jnrA;
963
964             /* load j atom coordinates */
965             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
966                                               &jx0,&jy0,&jz0);
967
968             /* Calculate displacement vector */
969             dx00             = _fjsp_sub_v2r8(ix0,jx0);
970             dy00             = _fjsp_sub_v2r8(iy0,jy0);
971             dz00             = _fjsp_sub_v2r8(iz0,jz0);
972             dx10             = _fjsp_sub_v2r8(ix1,jx0);
973             dy10             = _fjsp_sub_v2r8(iy1,jy0);
974             dz10             = _fjsp_sub_v2r8(iz1,jz0);
975             dx20             = _fjsp_sub_v2r8(ix2,jx0);
976             dy20             = _fjsp_sub_v2r8(iy2,jy0);
977             dz20             = _fjsp_sub_v2r8(iz2,jz0);
978
979             /* Calculate squared distance and things based on it */
980             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
981             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
982             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
983
984             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
985             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
986             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
987
988             /* Load parameters for j particles */
989             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
990             vdwjidx0A        = 2*vdwtype[jnrA+0];
991
992             fjx0             = _fjsp_setzero_v2r8();
993             fjy0             = _fjsp_setzero_v2r8();
994             fjz0             = _fjsp_setzero_v2r8();
995
996             /**************************
997              * CALCULATE INTERACTIONS *
998              **************************/
999
1000             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1001
1002             /* Compute parameters for interactions between i and j atoms */
1003             qq00             = _fjsp_mul_v2r8(iq0,jq0);
1004             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
1005
1006             /* Calculate table index by multiplying r with table scale and truncate to integer */
1007             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1008             itab_tmp         = _fjsp_dtox_v2r8(rt);
1009             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1010             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1011             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1012
1013             vfconv.i[0]     *= 12;
1014             vfconv.i[1]     *= 12;
1015
1016             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1017             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1018             F                = _fjsp_setzero_v2r8();
1019             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1020             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1021             H                = _fjsp_setzero_v2r8();
1022             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1023             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1024             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1025             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq00,FF),_fjsp_mul_v2r8(vftabscale,rinv00)));
1026
1027             /* CUBIC SPLINE TABLE DISPERSION */
1028             vfconv.i[0]       += 4;
1029             vfconv.i[1]       += 4;
1030             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1031             F                = _fjsp_setzero_v2r8();
1032             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1033             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1034             H                = _fjsp_setzero_v2r8();
1035             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1036             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1037             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1038             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1039
1040             /* CUBIC SPLINE TABLE REPULSION */
1041             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1042             F                = _fjsp_setzero_v2r8();
1043             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1044             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1045             H                = _fjsp_setzero_v2r8();
1046             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1047             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1048             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1049             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1050             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1051
1052             fscal            = _fjsp_add_v2r8(felec,fvdw);
1053
1054             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1055
1056             /* Update vectorial force */
1057             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1058             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1059             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1060             
1061             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1062             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1063             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1064
1065             /**************************
1066              * CALCULATE INTERACTIONS *
1067              **************************/
1068
1069             r10              = _fjsp_mul_v2r8(rsq10,rinv10);
1070
1071             /* Compute parameters for interactions between i and j atoms */
1072             qq10             = _fjsp_mul_v2r8(iq1,jq0);
1073
1074             /* Calculate table index by multiplying r with table scale and truncate to integer */
1075             rt               = _fjsp_mul_v2r8(r10,vftabscale);
1076             itab_tmp         = _fjsp_dtox_v2r8(rt);
1077             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1078             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1079             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1080
1081             vfconv.i[0]     *= 12;
1082             vfconv.i[1]     *= 12;
1083
1084             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1085             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1086             F                = _fjsp_setzero_v2r8();
1087             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1088             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1089             H                = _fjsp_setzero_v2r8();
1090             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1091             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1092             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1093             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq10,FF),_fjsp_mul_v2r8(vftabscale,rinv10)));
1094
1095             fscal            = felec;
1096
1097             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1098
1099             /* Update vectorial force */
1100             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1101             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1102             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1103             
1104             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1105             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1106             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1107
1108             /**************************
1109              * CALCULATE INTERACTIONS *
1110              **************************/
1111
1112             r20              = _fjsp_mul_v2r8(rsq20,rinv20);
1113
1114             /* Compute parameters for interactions between i and j atoms */
1115             qq20             = _fjsp_mul_v2r8(iq2,jq0);
1116
1117             /* Calculate table index by multiplying r with table scale and truncate to integer */
1118             rt               = _fjsp_mul_v2r8(r20,vftabscale);
1119             itab_tmp         = _fjsp_dtox_v2r8(rt);
1120             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1121             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1122             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1123
1124             vfconv.i[0]     *= 12;
1125             vfconv.i[1]     *= 12;
1126
1127             /* CUBIC SPLINE TABLE ELECTROSTATICS */
1128             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1129             F                = _fjsp_setzero_v2r8();
1130             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1131             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] +2);
1132             H                = _fjsp_setzero_v2r8();
1133             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1134             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(vfeps,H,G),F);
1135             FF               = _fjsp_madd_v2r8(_fjsp_madd_v2r8(twovfeps,H,G),vfeps,Fp);
1136             felec            = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_mul_v2r8(qq20,FF),_fjsp_mul_v2r8(vftabscale,rinv20)));
1137
1138             fscal            = felec;
1139
1140             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1141
1142             /* Update vectorial force */
1143             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1144             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1145             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1146             
1147             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1148             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1149             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1150
1151             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1152
1153             /* Inner loop uses 151 flops */
1154         }
1155
1156         /* End of innermost loop */
1157
1158         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1159                                               f+i_coord_offset,fshift+i_shift_offset);
1160
1161         /* Increment number of inner iterations */
1162         inneriter                  += j_index_end - j_index_start;
1163
1164         /* Outer loop uses 18 flops */
1165     }
1166
1167     /* Increment number of outer iterations */
1168     outeriter        += nri;
1169
1170     /* Update outer/inner flops */
1171
1172     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*151);
1173 }