00f24652c679346b7586a8441eb177f208314d57
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecRF_VdwCSTab_GeomW4W4_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013, 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 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "vec.h"
47 #include "nrnb.h"
48
49 #include "kernelutil_sparc64_hpc_ace_double.h"
50
51 /*
52  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwCSTab_GeomW4W4_VF_sparc64_hpc_ace_double
53  * Electrostatics interaction: ReactionField
54  * VdW interaction:            CubicSplineTable
55  * Geometry:                   Water4-Water4
56  * Calculate force/pot:        PotentialAndForce
57  */
58 void
59 nb_kernel_ElecRF_VdwCSTab_GeomW4W4_VF_sparc64_hpc_ace_double
60                     (t_nblist                    * gmx_restrict       nlist,
61                      rvec                        * gmx_restrict          xx,
62                      rvec                        * gmx_restrict          ff,
63                      t_forcerec                  * gmx_restrict          fr,
64                      t_mdatoms                   * gmx_restrict     mdatoms,
65                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66                      t_nrnb                      * gmx_restrict        nrnb)
67 {
68     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69      * just 0 for non-waters.
70      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
71      * jnr indices corresponding to data put in the four positions in the SIMD register.
72      */
73     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
74     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75     int              jnrA,jnrB;
76     int              j_coord_offsetA,j_coord_offsetB;
77     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
78     real             rcutoff_scalar;
79     real             *shiftvec,*fshift,*x,*f;
80     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81     int              vdwioffset0;
82     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
83     int              vdwioffset1;
84     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
85     int              vdwioffset2;
86     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
87     int              vdwioffset3;
88     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
89     int              vdwjidx0A,vdwjidx0B;
90     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91     int              vdwjidx1A,vdwjidx1B;
92     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
93     int              vdwjidx2A,vdwjidx2B;
94     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
95     int              vdwjidx3A,vdwjidx3B;
96     _fjsp_v2r8       jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
97     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
98     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
99     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
100     _fjsp_v2r8       dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
101     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
102     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
103     _fjsp_v2r8       dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
104     _fjsp_v2r8       dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
105     _fjsp_v2r8       dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
106     _fjsp_v2r8       dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
107     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
108     real             *charge;
109     int              nvdwtype;
110     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
111     int              *vdwtype;
112     real             *vdwparam;
113     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
114     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
115     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
116     real             *vftab;
117     _fjsp_v2r8       itab_tmp;
118     _fjsp_v2r8       dummy_mask,cutoff_mask;
119     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
120     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
121     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
122
123     x                = xx[0];
124     f                = ff[0];
125
126     nri              = nlist->nri;
127     iinr             = nlist->iinr;
128     jindex           = nlist->jindex;
129     jjnr             = nlist->jjnr;
130     shiftidx         = nlist->shift;
131     gid              = nlist->gid;
132     shiftvec         = fr->shift_vec[0];
133     fshift           = fr->fshift[0];
134     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
135     charge           = mdatoms->chargeA;
136     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
137     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
138     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
139     nvdwtype         = fr->ntype;
140     vdwparam         = fr->nbfp;
141     vdwtype          = mdatoms->typeA;
142
143     vftab            = kernel_data->table_vdw->data;
144     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
145
146     /* Setup water-specific parameters */
147     inr              = nlist->iinr[0];
148     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
149     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
150     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
151     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
152
153     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
154     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
155     jq3              = gmx_fjsp_set1_v2r8(charge[inr+3]);
156     vdwjidx0A        = 2*vdwtype[inr+0];
157     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
158     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
159     qq11             = _fjsp_mul_v2r8(iq1,jq1);
160     qq12             = _fjsp_mul_v2r8(iq1,jq2);
161     qq13             = _fjsp_mul_v2r8(iq1,jq3);
162     qq21             = _fjsp_mul_v2r8(iq2,jq1);
163     qq22             = _fjsp_mul_v2r8(iq2,jq2);
164     qq23             = _fjsp_mul_v2r8(iq2,jq3);
165     qq31             = _fjsp_mul_v2r8(iq3,jq1);
166     qq32             = _fjsp_mul_v2r8(iq3,jq2);
167     qq33             = _fjsp_mul_v2r8(iq3,jq3);
168
169     /* Avoid stupid compiler warnings */
170     jnrA = jnrB = 0;
171     j_coord_offsetA = 0;
172     j_coord_offsetB = 0;
173
174     outeriter        = 0;
175     inneriter        = 0;
176
177     /* Start outer loop over neighborlists */
178     for(iidx=0; iidx<nri; iidx++)
179     {
180         /* Load shift vector for this list */
181         i_shift_offset   = DIM*shiftidx[iidx];
182
183         /* Load limits for loop over neighbors */
184         j_index_start    = jindex[iidx];
185         j_index_end      = jindex[iidx+1];
186
187         /* Get outer coordinate index */
188         inr              = iinr[iidx];
189         i_coord_offset   = DIM*inr;
190
191         /* Load i particle coords and add shift vector */
192         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
193                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
194
195         fix0             = _fjsp_setzero_v2r8();
196         fiy0             = _fjsp_setzero_v2r8();
197         fiz0             = _fjsp_setzero_v2r8();
198         fix1             = _fjsp_setzero_v2r8();
199         fiy1             = _fjsp_setzero_v2r8();
200         fiz1             = _fjsp_setzero_v2r8();
201         fix2             = _fjsp_setzero_v2r8();
202         fiy2             = _fjsp_setzero_v2r8();
203         fiz2             = _fjsp_setzero_v2r8();
204         fix3             = _fjsp_setzero_v2r8();
205         fiy3             = _fjsp_setzero_v2r8();
206         fiz3             = _fjsp_setzero_v2r8();
207
208         /* Reset potential sums */
209         velecsum         = _fjsp_setzero_v2r8();
210         vvdwsum          = _fjsp_setzero_v2r8();
211
212         /* Start inner kernel loop */
213         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
214         {
215
216             /* Get j neighbor index, and coordinate index */
217             jnrA             = jjnr[jidx];
218             jnrB             = jjnr[jidx+1];
219             j_coord_offsetA  = DIM*jnrA;
220             j_coord_offsetB  = DIM*jnrB;
221
222             /* load j atom coordinates */
223             gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
224                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
225                                               &jy2,&jz2,&jx3,&jy3,&jz3);
226
227             /* Calculate displacement vector */
228             dx00             = _fjsp_sub_v2r8(ix0,jx0);
229             dy00             = _fjsp_sub_v2r8(iy0,jy0);
230             dz00             = _fjsp_sub_v2r8(iz0,jz0);
231             dx11             = _fjsp_sub_v2r8(ix1,jx1);
232             dy11             = _fjsp_sub_v2r8(iy1,jy1);
233             dz11             = _fjsp_sub_v2r8(iz1,jz1);
234             dx12             = _fjsp_sub_v2r8(ix1,jx2);
235             dy12             = _fjsp_sub_v2r8(iy1,jy2);
236             dz12             = _fjsp_sub_v2r8(iz1,jz2);
237             dx13             = _fjsp_sub_v2r8(ix1,jx3);
238             dy13             = _fjsp_sub_v2r8(iy1,jy3);
239             dz13             = _fjsp_sub_v2r8(iz1,jz3);
240             dx21             = _fjsp_sub_v2r8(ix2,jx1);
241             dy21             = _fjsp_sub_v2r8(iy2,jy1);
242             dz21             = _fjsp_sub_v2r8(iz2,jz1);
243             dx22             = _fjsp_sub_v2r8(ix2,jx2);
244             dy22             = _fjsp_sub_v2r8(iy2,jy2);
245             dz22             = _fjsp_sub_v2r8(iz2,jz2);
246             dx23             = _fjsp_sub_v2r8(ix2,jx3);
247             dy23             = _fjsp_sub_v2r8(iy2,jy3);
248             dz23             = _fjsp_sub_v2r8(iz2,jz3);
249             dx31             = _fjsp_sub_v2r8(ix3,jx1);
250             dy31             = _fjsp_sub_v2r8(iy3,jy1);
251             dz31             = _fjsp_sub_v2r8(iz3,jz1);
252             dx32             = _fjsp_sub_v2r8(ix3,jx2);
253             dy32             = _fjsp_sub_v2r8(iy3,jy2);
254             dz32             = _fjsp_sub_v2r8(iz3,jz2);
255             dx33             = _fjsp_sub_v2r8(ix3,jx3);
256             dy33             = _fjsp_sub_v2r8(iy3,jy3);
257             dz33             = _fjsp_sub_v2r8(iz3,jz3);
258
259             /* Calculate squared distance and things based on it */
260             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
261             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
262             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
263             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
264             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
265             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
266             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
267             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
268             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
269             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
270
271             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
272             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
273             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
274             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
275             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
276             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
277             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
278             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
279             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
280             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
281
282             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
283             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
284             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
285             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
286             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
287             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
288             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
289             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
290             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
291
292             fjx0             = _fjsp_setzero_v2r8();
293             fjy0             = _fjsp_setzero_v2r8();
294             fjz0             = _fjsp_setzero_v2r8();
295             fjx1             = _fjsp_setzero_v2r8();
296             fjy1             = _fjsp_setzero_v2r8();
297             fjz1             = _fjsp_setzero_v2r8();
298             fjx2             = _fjsp_setzero_v2r8();
299             fjy2             = _fjsp_setzero_v2r8();
300             fjz2             = _fjsp_setzero_v2r8();
301             fjx3             = _fjsp_setzero_v2r8();
302             fjy3             = _fjsp_setzero_v2r8();
303             fjz3             = _fjsp_setzero_v2r8();
304
305             /**************************
306              * CALCULATE INTERACTIONS *
307              **************************/
308
309             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
310
311             /* Calculate table index by multiplying r with table scale and truncate to integer */
312             rt               = _fjsp_mul_v2r8(r00,vftabscale);
313             itab_tmp         = _fjsp_dtox_v2r8(rt);
314             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
315             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
316             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
317
318             vfconv.i[0]     *= 8;
319             vfconv.i[1]     *= 8;
320
321             /* CUBIC SPLINE TABLE DISPERSION */
322             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
323             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
324             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
325             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
326             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
327             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
328             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
329             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
330             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
331             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
332             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
333
334             /* CUBIC SPLINE TABLE REPULSION */
335             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
336             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
337             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
338             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
339             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
340             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
341             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
342             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
343             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
344             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
345             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
346             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
347             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
348
349             /* Update potential sum for this i atom from the interaction with this j atom. */
350             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
351
352             fscal            = fvdw;
353
354             /* Update vectorial force */
355             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
356             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
357             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
358             
359             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
360             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
361             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
362
363             /**************************
364              * CALCULATE INTERACTIONS *
365              **************************/
366
367             /* REACTION-FIELD ELECTROSTATICS */
368             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq11,rinv11),crf));
369             felec            = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
370
371             /* Update potential sum for this i atom from the interaction with this j atom. */
372             velecsum         = _fjsp_add_v2r8(velecsum,velec);
373
374             fscal            = felec;
375
376             /* Update vectorial force */
377             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
378             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
379             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
380             
381             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
382             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
383             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
384
385             /**************************
386              * CALCULATE INTERACTIONS *
387              **************************/
388
389             /* REACTION-FIELD ELECTROSTATICS */
390             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq12,rinv12),crf));
391             felec            = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
392
393             /* Update potential sum for this i atom from the interaction with this j atom. */
394             velecsum         = _fjsp_add_v2r8(velecsum,velec);
395
396             fscal            = felec;
397
398             /* Update vectorial force */
399             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
400             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
401             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
402             
403             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
404             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
405             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
406
407             /**************************
408              * CALCULATE INTERACTIONS *
409              **************************/
410
411             /* REACTION-FIELD ELECTROSTATICS */
412             velec            = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq13,rinv13),crf));
413             felec            = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
414
415             /* Update potential sum for this i atom from the interaction with this j atom. */
416             velecsum         = _fjsp_add_v2r8(velecsum,velec);
417
418             fscal            = felec;
419
420             /* Update vectorial force */
421             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
422             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
423             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
424             
425             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
426             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
427             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
428
429             /**************************
430              * CALCULATE INTERACTIONS *
431              **************************/
432
433             /* REACTION-FIELD ELECTROSTATICS */
434             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq21,rinv21),crf));
435             felec            = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
436
437             /* Update potential sum for this i atom from the interaction with this j atom. */
438             velecsum         = _fjsp_add_v2r8(velecsum,velec);
439
440             fscal            = felec;
441
442             /* Update vectorial force */
443             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
444             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
445             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
446             
447             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
448             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
449             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
450
451             /**************************
452              * CALCULATE INTERACTIONS *
453              **************************/
454
455             /* REACTION-FIELD ELECTROSTATICS */
456             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq22,rinv22),crf));
457             felec            = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
458
459             /* Update potential sum for this i atom from the interaction with this j atom. */
460             velecsum         = _fjsp_add_v2r8(velecsum,velec);
461
462             fscal            = felec;
463
464             /* Update vectorial force */
465             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
466             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
467             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
468             
469             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
470             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
471             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
472
473             /**************************
474              * CALCULATE INTERACTIONS *
475              **************************/
476
477             /* REACTION-FIELD ELECTROSTATICS */
478             velec            = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq23,rinv23),crf));
479             felec            = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
480
481             /* Update potential sum for this i atom from the interaction with this j atom. */
482             velecsum         = _fjsp_add_v2r8(velecsum,velec);
483
484             fscal            = felec;
485
486             /* Update vectorial force */
487             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
488             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
489             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
490             
491             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
492             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
493             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
494
495             /**************************
496              * CALCULATE INTERACTIONS *
497              **************************/
498
499             /* REACTION-FIELD ELECTROSTATICS */
500             velec            = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq31,rinv31),crf));
501             felec            = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
502
503             /* Update potential sum for this i atom from the interaction with this j atom. */
504             velecsum         = _fjsp_add_v2r8(velecsum,velec);
505
506             fscal            = felec;
507
508             /* Update vectorial force */
509             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
510             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
511             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
512             
513             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
514             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
515             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
516
517             /**************************
518              * CALCULATE INTERACTIONS *
519              **************************/
520
521             /* REACTION-FIELD ELECTROSTATICS */
522             velec            = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq32,rinv32),crf));
523             felec            = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
524
525             /* Update potential sum for this i atom from the interaction with this j atom. */
526             velecsum         = _fjsp_add_v2r8(velecsum,velec);
527
528             fscal            = felec;
529
530             /* Update vectorial force */
531             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
532             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
533             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
534             
535             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
536             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
537             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
538
539             /**************************
540              * CALCULATE INTERACTIONS *
541              **************************/
542
543             /* REACTION-FIELD ELECTROSTATICS */
544             velec            = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq33,rinv33),crf));
545             felec            = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
546
547             /* Update potential sum for this i atom from the interaction with this j atom. */
548             velecsum         = _fjsp_add_v2r8(velecsum,velec);
549
550             fscal            = felec;
551
552             /* Update vectorial force */
553             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
554             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
555             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
556             
557             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
558             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
559             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
560
561             gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
562
563             /* Inner loop uses 377 flops */
564         }
565
566         if(jidx<j_index_end)
567         {
568
569             jnrA             = jjnr[jidx];
570             j_coord_offsetA  = DIM*jnrA;
571
572             /* load j atom coordinates */
573             gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
574                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
575                                               &jy2,&jz2,&jx3,&jy3,&jz3);
576
577             /* Calculate displacement vector */
578             dx00             = _fjsp_sub_v2r8(ix0,jx0);
579             dy00             = _fjsp_sub_v2r8(iy0,jy0);
580             dz00             = _fjsp_sub_v2r8(iz0,jz0);
581             dx11             = _fjsp_sub_v2r8(ix1,jx1);
582             dy11             = _fjsp_sub_v2r8(iy1,jy1);
583             dz11             = _fjsp_sub_v2r8(iz1,jz1);
584             dx12             = _fjsp_sub_v2r8(ix1,jx2);
585             dy12             = _fjsp_sub_v2r8(iy1,jy2);
586             dz12             = _fjsp_sub_v2r8(iz1,jz2);
587             dx13             = _fjsp_sub_v2r8(ix1,jx3);
588             dy13             = _fjsp_sub_v2r8(iy1,jy3);
589             dz13             = _fjsp_sub_v2r8(iz1,jz3);
590             dx21             = _fjsp_sub_v2r8(ix2,jx1);
591             dy21             = _fjsp_sub_v2r8(iy2,jy1);
592             dz21             = _fjsp_sub_v2r8(iz2,jz1);
593             dx22             = _fjsp_sub_v2r8(ix2,jx2);
594             dy22             = _fjsp_sub_v2r8(iy2,jy2);
595             dz22             = _fjsp_sub_v2r8(iz2,jz2);
596             dx23             = _fjsp_sub_v2r8(ix2,jx3);
597             dy23             = _fjsp_sub_v2r8(iy2,jy3);
598             dz23             = _fjsp_sub_v2r8(iz2,jz3);
599             dx31             = _fjsp_sub_v2r8(ix3,jx1);
600             dy31             = _fjsp_sub_v2r8(iy3,jy1);
601             dz31             = _fjsp_sub_v2r8(iz3,jz1);
602             dx32             = _fjsp_sub_v2r8(ix3,jx2);
603             dy32             = _fjsp_sub_v2r8(iy3,jy2);
604             dz32             = _fjsp_sub_v2r8(iz3,jz2);
605             dx33             = _fjsp_sub_v2r8(ix3,jx3);
606             dy33             = _fjsp_sub_v2r8(iy3,jy3);
607             dz33             = _fjsp_sub_v2r8(iz3,jz3);
608
609             /* Calculate squared distance and things based on it */
610             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
611             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
612             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
613             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
614             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
615             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
616             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
617             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
618             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
619             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
620
621             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
622             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
623             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
624             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
625             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
626             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
627             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
628             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
629             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
630             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
631
632             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
633             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
634             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
635             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
636             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
637             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
638             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
639             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
640             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
641
642             fjx0             = _fjsp_setzero_v2r8();
643             fjy0             = _fjsp_setzero_v2r8();
644             fjz0             = _fjsp_setzero_v2r8();
645             fjx1             = _fjsp_setzero_v2r8();
646             fjy1             = _fjsp_setzero_v2r8();
647             fjz1             = _fjsp_setzero_v2r8();
648             fjx2             = _fjsp_setzero_v2r8();
649             fjy2             = _fjsp_setzero_v2r8();
650             fjz2             = _fjsp_setzero_v2r8();
651             fjx3             = _fjsp_setzero_v2r8();
652             fjy3             = _fjsp_setzero_v2r8();
653             fjz3             = _fjsp_setzero_v2r8();
654
655             /**************************
656              * CALCULATE INTERACTIONS *
657              **************************/
658
659             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
660
661             /* Calculate table index by multiplying r with table scale and truncate to integer */
662             rt               = _fjsp_mul_v2r8(r00,vftabscale);
663             itab_tmp         = _fjsp_dtox_v2r8(rt);
664             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
665             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
666             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
667
668             vfconv.i[0]     *= 8;
669             vfconv.i[1]     *= 8;
670
671             /* CUBIC SPLINE TABLE DISPERSION */
672             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
673             F                = _fjsp_setzero_v2r8();
674             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
675             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
676             H                = _fjsp_setzero_v2r8();
677             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
678             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
679             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
680             vvdw6            = _fjsp_mul_v2r8(c6_00,VV);
681             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
682             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
683
684             /* CUBIC SPLINE TABLE REPULSION */
685             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
686             F                = _fjsp_setzero_v2r8();
687             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
688             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
689             H                = _fjsp_setzero_v2r8();
690             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
691             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
692             VV               = _fjsp_madd_v2r8(vfeps,Fp,Y);
693             vvdw12           = _fjsp_mul_v2r8(c12_00,VV);
694             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
695             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
696             vvdw             = _fjsp_add_v2r8(vvdw12,vvdw6);
697             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
698
699             /* Update potential sum for this i atom from the interaction with this j atom. */
700             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
701             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
702
703             fscal            = fvdw;
704
705             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
706
707             /* Update vectorial force */
708             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
709             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
710             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
711             
712             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
713             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
714             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
715
716             /**************************
717              * CALCULATE INTERACTIONS *
718              **************************/
719
720             /* REACTION-FIELD ELECTROSTATICS */
721             velec            = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq11,rinv11),crf));
722             felec            = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
723
724             /* Update potential sum for this i atom from the interaction with this j atom. */
725             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
726             velecsum         = _fjsp_add_v2r8(velecsum,velec);
727
728             fscal            = felec;
729
730             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
731
732             /* Update vectorial force */
733             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
734             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
735             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
736             
737             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
738             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
739             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
740
741             /**************************
742              * CALCULATE INTERACTIONS *
743              **************************/
744
745             /* REACTION-FIELD ELECTROSTATICS */
746             velec            = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq12,rinv12),crf));
747             felec            = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
748
749             /* Update potential sum for this i atom from the interaction with this j atom. */
750             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
751             velecsum         = _fjsp_add_v2r8(velecsum,velec);
752
753             fscal            = felec;
754
755             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
756
757             /* Update vectorial force */
758             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
759             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
760             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
761             
762             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
763             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
764             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
765
766             /**************************
767              * CALCULATE INTERACTIONS *
768              **************************/
769
770             /* REACTION-FIELD ELECTROSTATICS */
771             velec            = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq13,rinv13),crf));
772             felec            = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
773
774             /* Update potential sum for this i atom from the interaction with this j atom. */
775             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
776             velecsum         = _fjsp_add_v2r8(velecsum,velec);
777
778             fscal            = felec;
779
780             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
781
782             /* Update vectorial force */
783             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
784             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
785             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
786             
787             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
788             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
789             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
790
791             /**************************
792              * CALCULATE INTERACTIONS *
793              **************************/
794
795             /* REACTION-FIELD ELECTROSTATICS */
796             velec            = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq21,rinv21),crf));
797             felec            = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
798
799             /* Update potential sum for this i atom from the interaction with this j atom. */
800             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
801             velecsum         = _fjsp_add_v2r8(velecsum,velec);
802
803             fscal            = felec;
804
805             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
806
807             /* Update vectorial force */
808             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
809             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
810             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
811             
812             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
813             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
814             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
815
816             /**************************
817              * CALCULATE INTERACTIONS *
818              **************************/
819
820             /* REACTION-FIELD ELECTROSTATICS */
821             velec            = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq22,rinv22),crf));
822             felec            = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
823
824             /* Update potential sum for this i atom from the interaction with this j atom. */
825             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
826             velecsum         = _fjsp_add_v2r8(velecsum,velec);
827
828             fscal            = felec;
829
830             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
831
832             /* Update vectorial force */
833             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
834             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
835             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
836             
837             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
838             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
839             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
840
841             /**************************
842              * CALCULATE INTERACTIONS *
843              **************************/
844
845             /* REACTION-FIELD ELECTROSTATICS */
846             velec            = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq23,rinv23),crf));
847             felec            = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
848
849             /* Update potential sum for this i atom from the interaction with this j atom. */
850             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
851             velecsum         = _fjsp_add_v2r8(velecsum,velec);
852
853             fscal            = felec;
854
855             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
856
857             /* Update vectorial force */
858             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
859             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
860             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
861             
862             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
863             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
864             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
865
866             /**************************
867              * CALCULATE INTERACTIONS *
868              **************************/
869
870             /* REACTION-FIELD ELECTROSTATICS */
871             velec            = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq31,rinv31),crf));
872             felec            = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
873
874             /* Update potential sum for this i atom from the interaction with this j atom. */
875             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
876             velecsum         = _fjsp_add_v2r8(velecsum,velec);
877
878             fscal            = felec;
879
880             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
881
882             /* Update vectorial force */
883             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
884             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
885             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
886             
887             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
888             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
889             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
890
891             /**************************
892              * CALCULATE INTERACTIONS *
893              **************************/
894
895             /* REACTION-FIELD ELECTROSTATICS */
896             velec            = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq32,rinv32),crf));
897             felec            = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
898
899             /* Update potential sum for this i atom from the interaction with this j atom. */
900             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
901             velecsum         = _fjsp_add_v2r8(velecsum,velec);
902
903             fscal            = felec;
904
905             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
906
907             /* Update vectorial force */
908             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
909             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
910             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
911             
912             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
913             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
914             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
915
916             /**************************
917              * CALCULATE INTERACTIONS *
918              **************************/
919
920             /* REACTION-FIELD ELECTROSTATICS */
921             velec            = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq33,rinv33),crf));
922             felec            = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
923
924             /* Update potential sum for this i atom from the interaction with this j atom. */
925             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
926             velecsum         = _fjsp_add_v2r8(velecsum,velec);
927
928             fscal            = felec;
929
930             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
931
932             /* Update vectorial force */
933             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
934             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
935             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
936             
937             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
938             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
939             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
940
941             gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
942
943             /* Inner loop uses 377 flops */
944         }
945
946         /* End of innermost loop */
947
948         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
949                                               f+i_coord_offset,fshift+i_shift_offset);
950
951         ggid                        = gid[iidx];
952         /* Update potential energies */
953         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
954         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
955
956         /* Increment number of inner iterations */
957         inneriter                  += j_index_end - j_index_start;
958
959         /* Outer loop uses 26 flops */
960     }
961
962     /* Increment number of outer iterations */
963     outeriter        += nri;
964
965     /* Update outer/inner flops */
966
967     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*377);
968 }
969 /*
970  * Gromacs nonbonded kernel:   nb_kernel_ElecRF_VdwCSTab_GeomW4W4_F_sparc64_hpc_ace_double
971  * Electrostatics interaction: ReactionField
972  * VdW interaction:            CubicSplineTable
973  * Geometry:                   Water4-Water4
974  * Calculate force/pot:        Force
975  */
976 void
977 nb_kernel_ElecRF_VdwCSTab_GeomW4W4_F_sparc64_hpc_ace_double
978                     (t_nblist                    * gmx_restrict       nlist,
979                      rvec                        * gmx_restrict          xx,
980                      rvec                        * gmx_restrict          ff,
981                      t_forcerec                  * gmx_restrict          fr,
982                      t_mdatoms                   * gmx_restrict     mdatoms,
983                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
984                      t_nrnb                      * gmx_restrict        nrnb)
985 {
986     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
987      * just 0 for non-waters.
988      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
989      * jnr indices corresponding to data put in the four positions in the SIMD register.
990      */
991     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
992     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
993     int              jnrA,jnrB;
994     int              j_coord_offsetA,j_coord_offsetB;
995     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
996     real             rcutoff_scalar;
997     real             *shiftvec,*fshift,*x,*f;
998     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
999     int              vdwioffset0;
1000     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1001     int              vdwioffset1;
1002     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1003     int              vdwioffset2;
1004     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1005     int              vdwioffset3;
1006     _fjsp_v2r8       ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
1007     int              vdwjidx0A,vdwjidx0B;
1008     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1009     int              vdwjidx1A,vdwjidx1B;
1010     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1011     int              vdwjidx2A,vdwjidx2B;
1012     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1013     int              vdwjidx3A,vdwjidx3B;
1014     _fjsp_v2r8       jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
1015     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1016     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1017     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1018     _fjsp_v2r8       dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
1019     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1020     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1021     _fjsp_v2r8       dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
1022     _fjsp_v2r8       dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
1023     _fjsp_v2r8       dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
1024     _fjsp_v2r8       dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
1025     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
1026     real             *charge;
1027     int              nvdwtype;
1028     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1029     int              *vdwtype;
1030     real             *vdwparam;
1031     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
1032     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
1033     _fjsp_v2r8       rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
1034     real             *vftab;
1035     _fjsp_v2r8       itab_tmp;
1036     _fjsp_v2r8       dummy_mask,cutoff_mask;
1037     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
1038     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
1039     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
1040
1041     x                = xx[0];
1042     f                = ff[0];
1043
1044     nri              = nlist->nri;
1045     iinr             = nlist->iinr;
1046     jindex           = nlist->jindex;
1047     jjnr             = nlist->jjnr;
1048     shiftidx         = nlist->shift;
1049     gid              = nlist->gid;
1050     shiftvec         = fr->shift_vec[0];
1051     fshift           = fr->fshift[0];
1052     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
1053     charge           = mdatoms->chargeA;
1054     krf              = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
1055     krf2             = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
1056     crf              = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
1057     nvdwtype         = fr->ntype;
1058     vdwparam         = fr->nbfp;
1059     vdwtype          = mdatoms->typeA;
1060
1061     vftab            = kernel_data->table_vdw->data;
1062     vftabscale       = gmx_fjsp_set1_v2r8(kernel_data->table_vdw->scale);
1063
1064     /* Setup water-specific parameters */
1065     inr              = nlist->iinr[0];
1066     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
1067     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
1068     iq3              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
1069     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
1070
1071     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
1072     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
1073     jq3              = gmx_fjsp_set1_v2r8(charge[inr+3]);
1074     vdwjidx0A        = 2*vdwtype[inr+0];
1075     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1076     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1077     qq11             = _fjsp_mul_v2r8(iq1,jq1);
1078     qq12             = _fjsp_mul_v2r8(iq1,jq2);
1079     qq13             = _fjsp_mul_v2r8(iq1,jq3);
1080     qq21             = _fjsp_mul_v2r8(iq2,jq1);
1081     qq22             = _fjsp_mul_v2r8(iq2,jq2);
1082     qq23             = _fjsp_mul_v2r8(iq2,jq3);
1083     qq31             = _fjsp_mul_v2r8(iq3,jq1);
1084     qq32             = _fjsp_mul_v2r8(iq3,jq2);
1085     qq33             = _fjsp_mul_v2r8(iq3,jq3);
1086
1087     /* Avoid stupid compiler warnings */
1088     jnrA = jnrB = 0;
1089     j_coord_offsetA = 0;
1090     j_coord_offsetB = 0;
1091
1092     outeriter        = 0;
1093     inneriter        = 0;
1094
1095     /* Start outer loop over neighborlists */
1096     for(iidx=0; iidx<nri; iidx++)
1097     {
1098         /* Load shift vector for this list */
1099         i_shift_offset   = DIM*shiftidx[iidx];
1100
1101         /* Load limits for loop over neighbors */
1102         j_index_start    = jindex[iidx];
1103         j_index_end      = jindex[iidx+1];
1104
1105         /* Get outer coordinate index */
1106         inr              = iinr[iidx];
1107         i_coord_offset   = DIM*inr;
1108
1109         /* Load i particle coords and add shift vector */
1110         gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1111                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1112
1113         fix0             = _fjsp_setzero_v2r8();
1114         fiy0             = _fjsp_setzero_v2r8();
1115         fiz0             = _fjsp_setzero_v2r8();
1116         fix1             = _fjsp_setzero_v2r8();
1117         fiy1             = _fjsp_setzero_v2r8();
1118         fiz1             = _fjsp_setzero_v2r8();
1119         fix2             = _fjsp_setzero_v2r8();
1120         fiy2             = _fjsp_setzero_v2r8();
1121         fiz2             = _fjsp_setzero_v2r8();
1122         fix3             = _fjsp_setzero_v2r8();
1123         fiy3             = _fjsp_setzero_v2r8();
1124         fiz3             = _fjsp_setzero_v2r8();
1125
1126         /* Start inner kernel loop */
1127         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1128         {
1129
1130             /* Get j neighbor index, and coordinate index */
1131             jnrA             = jjnr[jidx];
1132             jnrB             = jjnr[jidx+1];
1133             j_coord_offsetA  = DIM*jnrA;
1134             j_coord_offsetB  = DIM*jnrB;
1135
1136             /* load j atom coordinates */
1137             gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1138                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1139                                               &jy2,&jz2,&jx3,&jy3,&jz3);
1140
1141             /* Calculate displacement vector */
1142             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1143             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1144             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1145             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1146             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1147             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1148             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1149             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1150             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1151             dx13             = _fjsp_sub_v2r8(ix1,jx3);
1152             dy13             = _fjsp_sub_v2r8(iy1,jy3);
1153             dz13             = _fjsp_sub_v2r8(iz1,jz3);
1154             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1155             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1156             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1157             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1158             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1159             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1160             dx23             = _fjsp_sub_v2r8(ix2,jx3);
1161             dy23             = _fjsp_sub_v2r8(iy2,jy3);
1162             dz23             = _fjsp_sub_v2r8(iz2,jz3);
1163             dx31             = _fjsp_sub_v2r8(ix3,jx1);
1164             dy31             = _fjsp_sub_v2r8(iy3,jy1);
1165             dz31             = _fjsp_sub_v2r8(iz3,jz1);
1166             dx32             = _fjsp_sub_v2r8(ix3,jx2);
1167             dy32             = _fjsp_sub_v2r8(iy3,jy2);
1168             dz32             = _fjsp_sub_v2r8(iz3,jz2);
1169             dx33             = _fjsp_sub_v2r8(ix3,jx3);
1170             dy33             = _fjsp_sub_v2r8(iy3,jy3);
1171             dz33             = _fjsp_sub_v2r8(iz3,jz3);
1172
1173             /* Calculate squared distance and things based on it */
1174             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1175             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1176             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1177             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1178             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1179             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1180             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1181             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1182             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1183             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1184
1185             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1186             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1187             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1188             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
1189             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1190             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1191             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
1192             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
1193             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
1194             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
1195
1196             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1197             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1198             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
1199             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1200             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1201             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
1202             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
1203             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
1204             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
1205
1206             fjx0             = _fjsp_setzero_v2r8();
1207             fjy0             = _fjsp_setzero_v2r8();
1208             fjz0             = _fjsp_setzero_v2r8();
1209             fjx1             = _fjsp_setzero_v2r8();
1210             fjy1             = _fjsp_setzero_v2r8();
1211             fjz1             = _fjsp_setzero_v2r8();
1212             fjx2             = _fjsp_setzero_v2r8();
1213             fjy2             = _fjsp_setzero_v2r8();
1214             fjz2             = _fjsp_setzero_v2r8();
1215             fjx3             = _fjsp_setzero_v2r8();
1216             fjy3             = _fjsp_setzero_v2r8();
1217             fjz3             = _fjsp_setzero_v2r8();
1218
1219             /**************************
1220              * CALCULATE INTERACTIONS *
1221              **************************/
1222
1223             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1224
1225             /* Calculate table index by multiplying r with table scale and truncate to integer */
1226             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1227             itab_tmp         = _fjsp_dtox_v2r8(rt);
1228             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1229             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1230             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1231
1232             vfconv.i[0]     *= 8;
1233             vfconv.i[1]     *= 8;
1234
1235             /* CUBIC SPLINE TABLE DISPERSION */
1236             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1237             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] );
1238             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1239             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1240             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 2 );
1241             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1242             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1243             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1244             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1245
1246             /* CUBIC SPLINE TABLE REPULSION */
1247             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1248             F                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 4 );
1249             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1250             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1251             H                = _fjsp_load_v2r8( vftab + vfconv.i[1] + 6 );
1252             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1253             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1254             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1255             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1256             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1257
1258             fscal            = fvdw;
1259
1260             /* Update vectorial force */
1261             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1262             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1263             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1264             
1265             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1266             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1267             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1268
1269             /**************************
1270              * CALCULATE INTERACTIONS *
1271              **************************/
1272
1273             /* REACTION-FIELD ELECTROSTATICS */
1274             felec            = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
1275
1276             fscal            = felec;
1277
1278             /* Update vectorial force */
1279             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1280             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1281             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1282             
1283             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1284             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1285             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1286
1287             /**************************
1288              * CALCULATE INTERACTIONS *
1289              **************************/
1290
1291             /* REACTION-FIELD ELECTROSTATICS */
1292             felec            = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
1293
1294             fscal            = felec;
1295
1296             /* Update vectorial force */
1297             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1298             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1299             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1300             
1301             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1302             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1303             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1304
1305             /**************************
1306              * CALCULATE INTERACTIONS *
1307              **************************/
1308
1309             /* REACTION-FIELD ELECTROSTATICS */
1310             felec            = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
1311
1312             fscal            = felec;
1313
1314             /* Update vectorial force */
1315             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
1316             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1317             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1318             
1319             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1320             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1321             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1322
1323             /**************************
1324              * CALCULATE INTERACTIONS *
1325              **************************/
1326
1327             /* REACTION-FIELD ELECTROSTATICS */
1328             felec            = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
1329
1330             fscal            = felec;
1331
1332             /* Update vectorial force */
1333             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1334             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1335             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1336             
1337             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1338             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1339             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1340
1341             /**************************
1342              * CALCULATE INTERACTIONS *
1343              **************************/
1344
1345             /* REACTION-FIELD ELECTROSTATICS */
1346             felec            = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
1347
1348             fscal            = felec;
1349
1350             /* Update vectorial force */
1351             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1352             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1353             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1354             
1355             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1356             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1357             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1358
1359             /**************************
1360              * CALCULATE INTERACTIONS *
1361              **************************/
1362
1363             /* REACTION-FIELD ELECTROSTATICS */
1364             felec            = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
1365
1366             fscal            = felec;
1367
1368             /* Update vectorial force */
1369             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
1370             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1371             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1372             
1373             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1374             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1375             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1376
1377             /**************************
1378              * CALCULATE INTERACTIONS *
1379              **************************/
1380
1381             /* REACTION-FIELD ELECTROSTATICS */
1382             felec            = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
1383
1384             fscal            = felec;
1385
1386             /* Update vectorial force */
1387             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
1388             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1389             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1390             
1391             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1392             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1393             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1394
1395             /**************************
1396              * CALCULATE INTERACTIONS *
1397              **************************/
1398
1399             /* REACTION-FIELD ELECTROSTATICS */
1400             felec            = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
1401
1402             fscal            = felec;
1403
1404             /* Update vectorial force */
1405             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
1406             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1407             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1408             
1409             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1410             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1411             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1412
1413             /**************************
1414              * CALCULATE INTERACTIONS *
1415              **************************/
1416
1417             /* REACTION-FIELD ELECTROSTATICS */
1418             felec            = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
1419
1420             fscal            = felec;
1421
1422             /* Update vectorial force */
1423             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
1424             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1425             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1426             
1427             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1428             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1429             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1430
1431             gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1432
1433             /* Inner loop uses 324 flops */
1434         }
1435
1436         if(jidx<j_index_end)
1437         {
1438
1439             jnrA             = jjnr[jidx];
1440             j_coord_offsetA  = DIM*jnrA;
1441
1442             /* load j atom coordinates */
1443             gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1444                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1445                                               &jy2,&jz2,&jx3,&jy3,&jz3);
1446
1447             /* Calculate displacement vector */
1448             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1449             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1450             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1451             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1452             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1453             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1454             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1455             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1456             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1457             dx13             = _fjsp_sub_v2r8(ix1,jx3);
1458             dy13             = _fjsp_sub_v2r8(iy1,jy3);
1459             dz13             = _fjsp_sub_v2r8(iz1,jz3);
1460             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1461             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1462             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1463             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1464             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1465             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1466             dx23             = _fjsp_sub_v2r8(ix2,jx3);
1467             dy23             = _fjsp_sub_v2r8(iy2,jy3);
1468             dz23             = _fjsp_sub_v2r8(iz2,jz3);
1469             dx31             = _fjsp_sub_v2r8(ix3,jx1);
1470             dy31             = _fjsp_sub_v2r8(iy3,jy1);
1471             dz31             = _fjsp_sub_v2r8(iz3,jz1);
1472             dx32             = _fjsp_sub_v2r8(ix3,jx2);
1473             dy32             = _fjsp_sub_v2r8(iy3,jy2);
1474             dz32             = _fjsp_sub_v2r8(iz3,jz2);
1475             dx33             = _fjsp_sub_v2r8(ix3,jx3);
1476             dy33             = _fjsp_sub_v2r8(iy3,jy3);
1477             dz33             = _fjsp_sub_v2r8(iz3,jz3);
1478
1479             /* Calculate squared distance and things based on it */
1480             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1481             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1482             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1483             rsq13            = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1484             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1485             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1486             rsq23            = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1487             rsq31            = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1488             rsq32            = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1489             rsq33            = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1490
1491             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1492             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1493             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1494             rinv13           = gmx_fjsp_invsqrt_v2r8(rsq13);
1495             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1496             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1497             rinv23           = gmx_fjsp_invsqrt_v2r8(rsq23);
1498             rinv31           = gmx_fjsp_invsqrt_v2r8(rsq31);
1499             rinv32           = gmx_fjsp_invsqrt_v2r8(rsq32);
1500             rinv33           = gmx_fjsp_invsqrt_v2r8(rsq33);
1501
1502             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1503             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1504             rinvsq13         = _fjsp_mul_v2r8(rinv13,rinv13);
1505             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1506             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1507             rinvsq23         = _fjsp_mul_v2r8(rinv23,rinv23);
1508             rinvsq31         = _fjsp_mul_v2r8(rinv31,rinv31);
1509             rinvsq32         = _fjsp_mul_v2r8(rinv32,rinv32);
1510             rinvsq33         = _fjsp_mul_v2r8(rinv33,rinv33);
1511
1512             fjx0             = _fjsp_setzero_v2r8();
1513             fjy0             = _fjsp_setzero_v2r8();
1514             fjz0             = _fjsp_setzero_v2r8();
1515             fjx1             = _fjsp_setzero_v2r8();
1516             fjy1             = _fjsp_setzero_v2r8();
1517             fjz1             = _fjsp_setzero_v2r8();
1518             fjx2             = _fjsp_setzero_v2r8();
1519             fjy2             = _fjsp_setzero_v2r8();
1520             fjz2             = _fjsp_setzero_v2r8();
1521             fjx3             = _fjsp_setzero_v2r8();
1522             fjy3             = _fjsp_setzero_v2r8();
1523             fjz3             = _fjsp_setzero_v2r8();
1524
1525             /**************************
1526              * CALCULATE INTERACTIONS *
1527              **************************/
1528
1529             r00              = _fjsp_mul_v2r8(rsq00,rinv00);
1530
1531             /* Calculate table index by multiplying r with table scale and truncate to integer */
1532             rt               = _fjsp_mul_v2r8(r00,vftabscale);
1533             itab_tmp         = _fjsp_dtox_v2r8(rt);
1534             vfeps            = _fjsp_sub_v2r8(rt, _fjsp_xtod_v2r8(itab_tmp));
1535             twovfeps         = _fjsp_add_v2r8(vfeps,vfeps);
1536             _fjsp_store_v2r8(&vfconv.simd,itab_tmp);
1537
1538             vfconv.i[0]     *= 8;
1539             vfconv.i[1]     *= 8;
1540
1541             /* CUBIC SPLINE TABLE DISPERSION */
1542             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] );
1543             F                = _fjsp_setzero_v2r8();
1544             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1545             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 2 );
1546             H                = _fjsp_setzero_v2r8();
1547             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1548             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1549             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1550             fvdw6            = _fjsp_mul_v2r8(c6_00,FF);
1551
1552             /* CUBIC SPLINE TABLE REPULSION */
1553             Y                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 4 );
1554             F                = _fjsp_setzero_v2r8();
1555             GMX_FJSP_TRANSPOSE2_V2R8(Y,F);
1556             G                = _fjsp_load_v2r8( vftab + vfconv.i[0] + 6 );
1557             H                = _fjsp_setzero_v2r8();
1558             GMX_FJSP_TRANSPOSE2_V2R8(G,H);
1559             Fp               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(H,vfeps,G),F);
1560             FF               = _fjsp_madd_v2r8(vfeps,_fjsp_madd_v2r8(twovfeps,H,G),Fp);
1561             fvdw12           = _fjsp_mul_v2r8(c12_00,FF);
1562             fvdw             = _fjsp_neg_v2r8(_fjsp_mul_v2r8(_fjsp_add_v2r8(fvdw6,fvdw12),_fjsp_mul_v2r8(vftabscale,rinv00)));
1563
1564             fscal            = fvdw;
1565
1566             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1567
1568             /* Update vectorial force */
1569             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1570             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1571             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1572             
1573             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1574             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1575             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1576
1577             /**************************
1578              * CALCULATE INTERACTIONS *
1579              **************************/
1580
1581             /* REACTION-FIELD ELECTROSTATICS */
1582             felec            = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
1583
1584             fscal            = felec;
1585
1586             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1587
1588             /* Update vectorial force */
1589             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1590             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1591             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1592             
1593             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1594             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1595             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1596
1597             /**************************
1598              * CALCULATE INTERACTIONS *
1599              **************************/
1600
1601             /* REACTION-FIELD ELECTROSTATICS */
1602             felec            = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
1603
1604             fscal            = felec;
1605
1606             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1607
1608             /* Update vectorial force */
1609             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1610             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1611             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1612             
1613             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1614             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1615             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1616
1617             /**************************
1618              * CALCULATE INTERACTIONS *
1619              **************************/
1620
1621             /* REACTION-FIELD ELECTROSTATICS */
1622             felec            = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
1623
1624             fscal            = felec;
1625
1626             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1627
1628             /* Update vectorial force */
1629             fix1             = _fjsp_madd_v2r8(dx13,fscal,fix1);
1630             fiy1             = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1631             fiz1             = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1632             
1633             fjx3             = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1634             fjy3             = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1635             fjz3             = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1636
1637             /**************************
1638              * CALCULATE INTERACTIONS *
1639              **************************/
1640
1641             /* REACTION-FIELD ELECTROSTATICS */
1642             felec            = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
1643
1644             fscal            = felec;
1645
1646             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1647
1648             /* Update vectorial force */
1649             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1650             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1651             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1652             
1653             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1654             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1655             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1656
1657             /**************************
1658              * CALCULATE INTERACTIONS *
1659              **************************/
1660
1661             /* REACTION-FIELD ELECTROSTATICS */
1662             felec            = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
1663
1664             fscal            = felec;
1665
1666             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1667
1668             /* Update vectorial force */
1669             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1670             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1671             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1672             
1673             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1674             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1675             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1676
1677             /**************************
1678              * CALCULATE INTERACTIONS *
1679              **************************/
1680
1681             /* REACTION-FIELD ELECTROSTATICS */
1682             felec            = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
1683
1684             fscal            = felec;
1685
1686             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1687
1688             /* Update vectorial force */
1689             fix2             = _fjsp_madd_v2r8(dx23,fscal,fix2);
1690             fiy2             = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1691             fiz2             = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1692             
1693             fjx3             = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1694             fjy3             = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1695             fjz3             = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1696
1697             /**************************
1698              * CALCULATE INTERACTIONS *
1699              **************************/
1700
1701             /* REACTION-FIELD ELECTROSTATICS */
1702             felec            = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
1703
1704             fscal            = felec;
1705
1706             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1707
1708             /* Update vectorial force */
1709             fix3             = _fjsp_madd_v2r8(dx31,fscal,fix3);
1710             fiy3             = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1711             fiz3             = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1712             
1713             fjx1             = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1714             fjy1             = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1715             fjz1             = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1716
1717             /**************************
1718              * CALCULATE INTERACTIONS *
1719              **************************/
1720
1721             /* REACTION-FIELD ELECTROSTATICS */
1722             felec            = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
1723
1724             fscal            = felec;
1725
1726             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1727
1728             /* Update vectorial force */
1729             fix3             = _fjsp_madd_v2r8(dx32,fscal,fix3);
1730             fiy3             = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1731             fiz3             = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1732             
1733             fjx2             = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1734             fjy2             = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1735             fjz2             = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1736
1737             /**************************
1738              * CALCULATE INTERACTIONS *
1739              **************************/
1740
1741             /* REACTION-FIELD ELECTROSTATICS */
1742             felec            = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
1743
1744             fscal            = felec;
1745
1746             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1747
1748             /* Update vectorial force */
1749             fix3             = _fjsp_madd_v2r8(dx33,fscal,fix3);
1750             fiy3             = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1751             fiz3             = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1752             
1753             fjx3             = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1754             fjy3             = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1755             fjz3             = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1756
1757             gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1758
1759             /* Inner loop uses 324 flops */
1760         }
1761
1762         /* End of innermost loop */
1763
1764         gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1765                                               f+i_coord_offset,fshift+i_shift_offset);
1766
1767         /* Increment number of inner iterations */
1768         inneriter                  += j_index_end - j_index_start;
1769
1770         /* Outer loop uses 24 flops */
1771     }
1772
1773     /* Increment number of outer iterations */
1774     outeriter        += nri;
1775
1776     /* Update outer/inner flops */
1777
1778     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*324);
1779 }