415754b1c81701eb4cf485ef6b2ff27e390f16d1
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecRF_VdwCSTab_GeomW3P1_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
37  */
38 #include "config.h"
39
40 #include <math.h>
41
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/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                      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->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_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
397
398             /* Calculate table index by multiplying r with table scale and truncate to integer */
399             rt               = _fjsp_mul_v2r8(r00,vftabscale);
400             itab_tmp         = _fjsp_dtox_v2r8(rt);
401             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
402             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
403             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
404
405             vfconv.i[0]     *= 8;
406             vfconv.i[1]     *= 8;
407
408             /* REACTION-FIELD ELECTROSTATICS */
409             velec            = _fjsp_mul_v2r8(qq00,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq00,rinv00),crf));
410             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
411
412             /* CUBIC SPLINE TABLE DISPERSION */
413             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
414             F                = _fjsp_setzero_v2r8();
415             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
416             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
417             H                = _fjsp_setzero_v2r8();
418             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
419             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
420             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
421             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
422             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
423             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
424
425             /* CUBIC SPLINE TABLE REPULSION */
426             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
427             F                = _fjsp_setzero_v2r8();
428             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
429             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
430             H                = _fjsp_setzero_v2r8();
431             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
432             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
433             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
434             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
435             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
436             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
437             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
438             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
439
440             /* Update potential sum for this i atom from the interaction with this j atom. */
441             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
442             velecsum         = _fjsp_add_v2r8(velecsum,velec);
443             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
444             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
445
446             fscal            = _fjsp_add_v2r8(felec,fvdw);
447
448             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
449
450             /* Update vectorial force */
451             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
452             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
453             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
454             
455             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
456             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
457             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
458
459             /**************************
460              * CALCULATE INTERACTIONS *
461              **************************/
462
463             /* Compute parameters for interactions between i and j atoms */
464             qq10             = _fjsp_mul_v2r8(iq1,jq0);
465
466             /* REACTION-FIELD ELECTROSTATICS */
467             velec            = _fjsp_mul_v2r8(qq10,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq10,rinv10),crf));
468             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
469
470             /* Update potential sum for this i atom from the interaction with this j atom. */
471             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
472             velecsum         = _fjsp_add_v2r8(velecsum,velec);
473
474             fscal            = felec;
475
476             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
477
478             /* Update vectorial force */
479             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
480             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
481             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
482             
483             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
484             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
485             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
486
487             /**************************
488              * CALCULATE INTERACTIONS *
489              **************************/
490
491             /* Compute parameters for interactions between i and j atoms */
492             qq20             = _fjsp_mul_v2r8(iq2,jq0);
493
494             /* REACTION-FIELD ELECTROSTATICS */
495             velec            = _fjsp_mul_v2r8(qq20,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq20,rinv20),crf));
496             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
497
498             /* Update potential sum for this i atom from the interaction with this j atom. */
499             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
500             velecsum         = _fjsp_add_v2r8(velecsum,velec);
501
502             fscal            = felec;
503
504             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
505
506             /* Update vectorial force */
507             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
508             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
509             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
510             
511             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
512             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
513             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
514
515             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
516
517             /* Inner loop uses 143 flops */
518         }
519
520         /* End of innermost loop */
521
522         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
523                                               f+i_coord_offset,fshift+i_shift_offset);
524
525         ggid                        = gid[iidx];
526         /* Update potential energies */
527         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
528         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
529
530         /* Increment number of inner iterations */
531         inneriter                  += j_index_end - j_index_start;
532
533         /* Outer loop uses 20 flops */
534     }
535
536     /* Increment number of outer iterations */
537     outeriter        += nri;
538
539     /* Update outer/inner flops */
540
541     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*143);
542 }
543 /*
544  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
545  * Electrostatics interaction: ReactionField
546  * VdW interaction:            CubicSplineTable
547  * Geometry:                   Water3-Particle
548  * Calculate force/pot:        Force
549  */
550 void
551 nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_sparc64_hpc_ace_double
552                     (t_nblist                    * gmx_restrict       nlist,
553                      rvec                        * gmx_restrict          xx,
554                      rvec                        * gmx_restrict          ff,
555                      t_forcerec                  * gmx_restrict          fr,
556                      t_mdatoms                   * gmx_restrict     mdatoms,
557                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
558                      t_nrnb                      * gmx_restrict        nrnb)
559 {
560     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
561      * just 0 for non-waters.
562      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
563      * jnr indices corresponding to data put in the four positions in the SIMD register.
564      */
565     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
566     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
567     int              jnrA,jnrB;
568     int              j_coord_offsetA,j_coord_offsetB;
569     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
570     real             rcutoff_scalar;
571     real             *shiftvec,*fshift,*x,*f;
572     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
573     int              vdwioffset0;
574     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
575     int              vdwioffset1;
576     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
577     int              vdwioffset2;
578     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
579     int              vdwjidx0A,vdwjidx0B;
580     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
581     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
582     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
583     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
584     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
585     real             *charge;
586     int              nvdwtype;
587     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
588     int              *vdwtype;
589     real             *vdwparam;
590     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
591     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
592     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
593     real             *vftab;
594     _fjsp_v2r8       itab_tmp;
595     _fjsp_v2r8       dummy_mask,cutoff_mask;
596     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
597     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
598     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
599
600     x                = xx[0];
601     f                = ff[0];
602
603     nri              = nlist->nri;
604     iinr             = nlist->iinr;
605     jindex           = nlist->jindex;
606     jjnr             = nlist->jjnr;
607     shiftidx         = nlist->shift;
608     gid              = nlist->gid;
609     shiftvec         = fr->shift_vec[0];
610     fshift           = fr->fshift[0];
611     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
612     charge           = mdatoms->chargeA;
613     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
614     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
615     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
616     nvdwtype         = fr->ntype;
617     vdwparam         = fr->nbfp;
618     vdwtype          = mdatoms->typeA;
619
620     vftab            = kernel_data->table_vdw->data;
621     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
622
623     /* Setup water-specific parameters */
624     inr              = nlist->iinr[0];
625     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
626     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
627     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
628     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
629
630     /* Avoid stupid compiler warnings */
631     jnrA = jnrB = 0;
632     j_coord_offsetA = 0;
633     j_coord_offsetB = 0;
634
635     outeriter        = 0;
636     inneriter        = 0;
637
638     /* Start outer loop over neighborlists */
639     for(iidx=0; iidx<nri; iidx++)
640     {
641         /* Load shift vector for this list */
642         i_shift_offset   = DIM*shiftidx[iidx];
643
644         /* Load limits for loop over neighbors */
645         j_index_start    = jindex[iidx];
646         j_index_end      = jindex[iidx+1];
647
648         /* Get outer coordinate index */
649         inr              = iinr[iidx];
650         i_coord_offset   = DIM*inr;
651
652         /* Load i particle coords and add shift vector */
653         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
654                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
655
656         fix0             = _fjsp_setzero_v2r8();
657         fiy0             = _fjsp_setzero_v2r8();
658         fiz0             = _fjsp_setzero_v2r8();
659         fix1             = _fjsp_setzero_v2r8();
660         fiy1             = _fjsp_setzero_v2r8();
661         fiz1             = _fjsp_setzero_v2r8();
662         fix2             = _fjsp_setzero_v2r8();
663         fiy2             = _fjsp_setzero_v2r8();
664         fiz2             = _fjsp_setzero_v2r8();
665
666         /* Start inner kernel loop */
667         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
668         {
669
670             /* Get j neighbor index, and coordinate index */
671             jnrA             = jjnr[jidx];
672             jnrB             = jjnr[jidx+1];
673             j_coord_offsetA  = DIM*jnrA;
674             j_coord_offsetB  = DIM*jnrB;
675
676             /* load j atom coordinates */
677             gmx_fjsp_load_1rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
678                                               &jx0,&jy0,&jz0);
679
680             /* Calculate displacement vector */
681             dx00             = _fjsp_sub_v2r8(ix0,jx0);
682             dy00             = _fjsp_sub_v2r8(iy0,jy0);
683             dz00             = _fjsp_sub_v2r8(iz0,jz0);
684             dx10             = _fjsp_sub_v2r8(ix1,jx0);
685             dy10             = _fjsp_sub_v2r8(iy1,jy0);
686             dz10             = _fjsp_sub_v2r8(iz1,jz0);
687             dx20             = _fjsp_sub_v2r8(ix2,jx0);
688             dy20             = _fjsp_sub_v2r8(iy2,jy0);
689             dz20             = _fjsp_sub_v2r8(iz2,jz0);
690
691             /* Calculate squared distance and things based on it */
692             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
693             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
694             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
695
696             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
697             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
698             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
699
700             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
701             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
702             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
703
704             /* Load parameters for j particles */
705             jq0              = gmx_fjsp_load_2real_swizzle_v2r8(charge+jnrA+0,charge+jnrB+0);
706             vdwjidx0A        = 2*vdwtype[jnrA+0];
707             vdwjidx0B        = 2*vdwtype[jnrB+0];
708
709             fjx0             = _fjsp_setzero_v2r8();
710             fjy0             = _fjsp_setzero_v2r8();
711             fjz0             = _fjsp_setzero_v2r8();
712
713             /**************************
714              * CALCULATE INTERACTIONS *
715              **************************/
716
717             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
718
719             /* Compute parameters for interactions between i and j atoms */
720             qq00             = _fjsp_mul_v2r8(iq0,jq0);
721             gmx_fjsp_load_2pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,
722                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
723
724             /* Calculate table index by multiplying r with table scale and truncate to integer */
725             rt               = _fjsp_mul_v2r8(r00,vftabscale);
726             itab_tmp         = _fjsp_dtox_v2r8(rt);
727             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
728             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
729             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
730
731             vfconv.i[0]     *= 8;
732             vfconv.i[1]     *= 8;
733
734             /* REACTION-FIELD ELECTROSTATICS */
735             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
736
737             /* CUBIC SPLINE TABLE DISPERSION */
738             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
739             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
740             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
741             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
742             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
743             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
744             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
745             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
746             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
747
748             /* CUBIC SPLINE TABLE REPULSION */
749             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
750             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
751             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
752             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
753             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
754             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
755             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
756             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
757             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
758             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
759
760             fscal            = _fjsp_add_v2r8(felec,fvdw);
761
762             /* Update vectorial force */
763             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
764             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
765             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
766             
767             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
768             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
769             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
770
771             /**************************
772              * CALCULATE INTERACTIONS *
773              **************************/
774
775             /* Compute parameters for interactions between i and j atoms */
776             qq10             = _fjsp_mul_v2r8(iq1,jq0);
777
778             /* REACTION-FIELD ELECTROSTATICS */
779             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
780
781             fscal            = felec;
782
783             /* Update vectorial force */
784             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
785             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
786             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
787             
788             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
789             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
790             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
791
792             /**************************
793              * CALCULATE INTERACTIONS *
794              **************************/
795
796             /* Compute parameters for interactions between i and j atoms */
797             qq20             = _fjsp_mul_v2r8(iq2,jq0);
798
799             /* REACTION-FIELD ELECTROSTATICS */
800             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
801
802             fscal            = felec;
803
804             /* Update vectorial force */
805             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
806             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
807             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
808             
809             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
810             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
811             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
812
813             gmx_fjsp_decrement_1rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
814
815             /* Inner loop uses 120 flops */
816         }
817
818         if(jidx<j_index_end)
819         {
820
821             jnrA             = jjnr[jidx];
822             j_coord_offsetA  = DIM*jnrA;
823
824             /* load j atom coordinates */
825             gmx_fjsp_load_1rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
826                                               &jx0,&jy0,&jz0);
827
828             /* Calculate displacement vector */
829             dx00             = _fjsp_sub_v2r8(ix0,jx0);
830             dy00             = _fjsp_sub_v2r8(iy0,jy0);
831             dz00             = _fjsp_sub_v2r8(iz0,jz0);
832             dx10             = _fjsp_sub_v2r8(ix1,jx0);
833             dy10             = _fjsp_sub_v2r8(iy1,jy0);
834             dz10             = _fjsp_sub_v2r8(iz1,jz0);
835             dx20             = _fjsp_sub_v2r8(ix2,jx0);
836             dy20             = _fjsp_sub_v2r8(iy2,jy0);
837             dz20             = _fjsp_sub_v2r8(iz2,jz0);
838
839             /* Calculate squared distance and things based on it */
840             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
841             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
842             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
843
844             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
845             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
846             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
847
848             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
849             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
850             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
851
852             /* Load parameters for j particles */
853             jq0              = _fjsp_loadl_v2r8(_fjsp_setzero_v2r8(),charge+jnrA+0);
854             vdwjidx0A        = 2*vdwtype[jnrA+0];
855
856             fjx0             = _fjsp_setzero_v2r8();
857             fjy0             = _fjsp_setzero_v2r8();
858             fjz0             = _fjsp_setzero_v2r8();
859
860             /**************************
861              * CALCULATE INTERACTIONS *
862              **************************/
863
864             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
865
866             /* Compute parameters for interactions between i and j atoms */
867             qq00             = _fjsp_mul_v2r8(iq0,jq0);
868             gmx_fjsp_load_1pair_swizzle_v2r8(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
869
870             /* Calculate table index by multiplying r with table scale and truncate to integer */
871             rt               = _fjsp_mul_v2r8(r00,vftabscale);
872             itab_tmp         = _fjsp_dtox_v2r8(rt);
873             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
874             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
875             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
876
877             vfconv.i[0]     *= 8;
878             vfconv.i[1]     *= 8;
879
880             /* REACTION-FIELD ELECTROSTATICS */
881             felec            = _fjsp_mul_v2r8(qq00,_fjsp_msub_v2r8(rinv00,rinvsq00,krf2));
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             /* REACTION-FIELD ELECTROSTATICS */
927             felec            = _fjsp_mul_v2r8(qq10,_fjsp_msub_v2r8(rinv10,rinvsq10,krf2));
928
929             fscal            = felec;
930
931             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
932
933             /* Update vectorial force */
934             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
935             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
936             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
937             
938             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
939             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
940             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
941
942             /**************************
943              * CALCULATE INTERACTIONS *
944              **************************/
945
946             /* Compute parameters for interactions between i and j atoms */
947             qq20             = _fjsp_mul_v2r8(iq2,jq0);
948
949             /* REACTION-FIELD ELECTROSTATICS */
950             felec            = _fjsp_mul_v2r8(qq20,_fjsp_msub_v2r8(rinv20,rinvsq20,krf2));
951
952             fscal            = felec;
953
954             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
955
956             /* Update vectorial force */
957             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
958             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
959             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
960             
961             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
962             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
963             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
964
965             gmx_fjsp_decrement_1rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0);
966
967             /* Inner loop uses 120 flops */
968         }
969
970         /* End of innermost loop */
971
972         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
973                                               f+i_coord_offset,fshift+i_shift_offset);
974
975         /* Increment number of inner iterations */
976         inneriter                  += j_index_end - j_index_start;
977
978         /* Outer loop uses 18 flops */
979     }
980
981     /* Increment number of outer iterations */
982     outeriter        += nri;
983
984     /* Update outer/inner flops */
985
986     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*120);
987 }