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