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