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