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