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