40afe10fc28bf526d5c86bf6a56852e5b16945ce
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sparc64_hpc_ace_double / nb_kernel_ElecCoul_VdwLJ_GeomW3W3_sparc64_hpc_ace_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*
36  * Note: this file was generated by the GROMACS sparc64_hpc_ace_double kernel generator.
37  */
38 #include "config.h"
39
40 #include <math.h>
41
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
46
47 #include "kernelutil_sparc64_hpc_ace_double.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwLJ_GeomW3W3_VF_sparc64_hpc_ace_double
51  * Electrostatics interaction: Coulomb
52  * VdW interaction:            LennardJones
53  * Geometry:                   Water3-Water3
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecCoul_VdwLJ_GeomW3W3_VF_sparc64_hpc_ace_double
58                     (t_nblist                    * gmx_restrict       nlist,
59                      rvec                        * gmx_restrict          xx,
60                      rvec                        * gmx_restrict          ff,
61                      t_forcerec                  * gmx_restrict          fr,
62                      t_mdatoms                   * gmx_restrict     mdatoms,
63                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64                      t_nrnb                      * gmx_restrict        nrnb)
65 {
66     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67      * just 0 for non-waters.
68      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
69      * jnr indices corresponding to data put in the four positions in the SIMD register.
70      */
71     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
72     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
73     int              jnrA,jnrB;
74     int              j_coord_offsetA,j_coord_offsetB;
75     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
76     real             rcutoff_scalar;
77     real             *shiftvec,*fshift,*x,*f;
78     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
79     int              vdwioffset0;
80     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81     int              vdwioffset1;
82     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
83     int              vdwioffset2;
84     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85     int              vdwjidx0A,vdwjidx0B;
86     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87     int              vdwjidx1A,vdwjidx1B;
88     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
89     int              vdwjidx2A,vdwjidx2B;
90     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
91     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92     _fjsp_v2r8       dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
93     _fjsp_v2r8       dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
94     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
95     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
96     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
97     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
98     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
99     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
100     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
101     real             *charge;
102     int              nvdwtype;
103     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
104     int              *vdwtype;
105     real             *vdwparam;
106     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
107     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
108     _fjsp_v2r8       itab_tmp;
109     _fjsp_v2r8       dummy_mask,cutoff_mask;
110     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
111     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
112     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
113
114     x                = xx[0];
115     f                = ff[0];
116
117     nri              = nlist->nri;
118     iinr             = nlist->iinr;
119     jindex           = nlist->jindex;
120     jjnr             = nlist->jjnr;
121     shiftidx         = nlist->shift;
122     gid              = nlist->gid;
123     shiftvec         = fr->shift_vec[0];
124     fshift           = fr->fshift[0];
125     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
126     charge           = mdatoms->chargeA;
127     nvdwtype         = fr->ntype;
128     vdwparam         = fr->nbfp;
129     vdwtype          = mdatoms->typeA;
130
131     /* Setup water-specific parameters */
132     inr              = nlist->iinr[0];
133     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
134     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
135     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
136     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
137
138     jq0              = gmx_fjsp_set1_v2r8(charge[inr+0]);
139     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
140     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
141     vdwjidx0A        = 2*vdwtype[inr+0];
142     qq00             = _fjsp_mul_v2r8(iq0,jq0);
143     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
144     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
145     qq01             = _fjsp_mul_v2r8(iq0,jq1);
146     qq02             = _fjsp_mul_v2r8(iq0,jq2);
147     qq10             = _fjsp_mul_v2r8(iq1,jq0);
148     qq11             = _fjsp_mul_v2r8(iq1,jq1);
149     qq12             = _fjsp_mul_v2r8(iq1,jq2);
150     qq20             = _fjsp_mul_v2r8(iq2,jq0);
151     qq21             = _fjsp_mul_v2r8(iq2,jq1);
152     qq22             = _fjsp_mul_v2r8(iq2,jq2);
153
154     /* Avoid stupid compiler warnings */
155     jnrA = jnrB = 0;
156     j_coord_offsetA = 0;
157     j_coord_offsetB = 0;
158
159     outeriter        = 0;
160     inneriter        = 0;
161
162     /* Start outer loop over neighborlists */
163     for(iidx=0; iidx<nri; iidx++)
164     {
165         /* Load shift vector for this list */
166         i_shift_offset   = DIM*shiftidx[iidx];
167
168         /* Load limits for loop over neighbors */
169         j_index_start    = jindex[iidx];
170         j_index_end      = jindex[iidx+1];
171
172         /* Get outer coordinate index */
173         inr              = iinr[iidx];
174         i_coord_offset   = DIM*inr;
175
176         /* Load i particle coords and add shift vector */
177         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
178                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
179
180         fix0             = _fjsp_setzero_v2r8();
181         fiy0             = _fjsp_setzero_v2r8();
182         fiz0             = _fjsp_setzero_v2r8();
183         fix1             = _fjsp_setzero_v2r8();
184         fiy1             = _fjsp_setzero_v2r8();
185         fiz1             = _fjsp_setzero_v2r8();
186         fix2             = _fjsp_setzero_v2r8();
187         fiy2             = _fjsp_setzero_v2r8();
188         fiz2             = _fjsp_setzero_v2r8();
189
190         /* Reset potential sums */
191         velecsum         = _fjsp_setzero_v2r8();
192         vvdwsum          = _fjsp_setzero_v2r8();
193
194         /* Start inner kernel loop */
195         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
196         {
197
198             /* Get j neighbor index, and coordinate index */
199             jnrA             = jjnr[jidx];
200             jnrB             = jjnr[jidx+1];
201             j_coord_offsetA  = DIM*jnrA;
202             j_coord_offsetB  = DIM*jnrB;
203
204             /* load j atom coordinates */
205             gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
206                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
207
208             /* Calculate displacement vector */
209             dx00             = _fjsp_sub_v2r8(ix0,jx0);
210             dy00             = _fjsp_sub_v2r8(iy0,jy0);
211             dz00             = _fjsp_sub_v2r8(iz0,jz0);
212             dx01             = _fjsp_sub_v2r8(ix0,jx1);
213             dy01             = _fjsp_sub_v2r8(iy0,jy1);
214             dz01             = _fjsp_sub_v2r8(iz0,jz1);
215             dx02             = _fjsp_sub_v2r8(ix0,jx2);
216             dy02             = _fjsp_sub_v2r8(iy0,jy2);
217             dz02             = _fjsp_sub_v2r8(iz0,jz2);
218             dx10             = _fjsp_sub_v2r8(ix1,jx0);
219             dy10             = _fjsp_sub_v2r8(iy1,jy0);
220             dz10             = _fjsp_sub_v2r8(iz1,jz0);
221             dx11             = _fjsp_sub_v2r8(ix1,jx1);
222             dy11             = _fjsp_sub_v2r8(iy1,jy1);
223             dz11             = _fjsp_sub_v2r8(iz1,jz1);
224             dx12             = _fjsp_sub_v2r8(ix1,jx2);
225             dy12             = _fjsp_sub_v2r8(iy1,jy2);
226             dz12             = _fjsp_sub_v2r8(iz1,jz2);
227             dx20             = _fjsp_sub_v2r8(ix2,jx0);
228             dy20             = _fjsp_sub_v2r8(iy2,jy0);
229             dz20             = _fjsp_sub_v2r8(iz2,jz0);
230             dx21             = _fjsp_sub_v2r8(ix2,jx1);
231             dy21             = _fjsp_sub_v2r8(iy2,jy1);
232             dz21             = _fjsp_sub_v2r8(iz2,jz1);
233             dx22             = _fjsp_sub_v2r8(ix2,jx2);
234             dy22             = _fjsp_sub_v2r8(iy2,jy2);
235             dz22             = _fjsp_sub_v2r8(iz2,jz2);
236
237             /* Calculate squared distance and things based on it */
238             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
239             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
240             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
241             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
242             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
243             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
244             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
245             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
246             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
247
248             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
249             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
250             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
251             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
252             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
253             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
254             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
255             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
256             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
257
258             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
259             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
260             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
261             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
262             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
263             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
264             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
265             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
266             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
267
268             fjx0             = _fjsp_setzero_v2r8();
269             fjy0             = _fjsp_setzero_v2r8();
270             fjz0             = _fjsp_setzero_v2r8();
271             fjx1             = _fjsp_setzero_v2r8();
272             fjy1             = _fjsp_setzero_v2r8();
273             fjz1             = _fjsp_setzero_v2r8();
274             fjx2             = _fjsp_setzero_v2r8();
275             fjy2             = _fjsp_setzero_v2r8();
276             fjz2             = _fjsp_setzero_v2r8();
277
278             /**************************
279              * CALCULATE INTERACTIONS *
280              **************************/
281
282             /* COULOMB ELECTROSTATICS */
283             velec            = _fjsp_mul_v2r8(qq00,rinv00);
284             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
285
286             /* LENNARD-JONES DISPERSION/REPULSION */
287
288             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
289             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
290             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
291             vvdw             = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
292             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
293
294             /* Update potential sum for this i atom from the interaction with this j atom. */
295             velecsum         = _fjsp_add_v2r8(velecsum,velec);
296             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
297
298             fscal            = _fjsp_add_v2r8(felec,fvdw);
299
300             /* Update vectorial force */
301             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
302             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
303             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
304             
305             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
306             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
307             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
308
309             /**************************
310              * CALCULATE INTERACTIONS *
311              **************************/
312
313             /* COULOMB ELECTROSTATICS */
314             velec            = _fjsp_mul_v2r8(qq01,rinv01);
315             felec            = _fjsp_mul_v2r8(velec,rinvsq01);
316
317             /* Update potential sum for this i atom from the interaction with this j atom. */
318             velecsum         = _fjsp_add_v2r8(velecsum,velec);
319
320             fscal            = felec;
321
322             /* Update vectorial force */
323             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
324             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
325             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
326             
327             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
328             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
329             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
330
331             /**************************
332              * CALCULATE INTERACTIONS *
333              **************************/
334
335             /* COULOMB ELECTROSTATICS */
336             velec            = _fjsp_mul_v2r8(qq02,rinv02);
337             felec            = _fjsp_mul_v2r8(velec,rinvsq02);
338
339             /* Update potential sum for this i atom from the interaction with this j atom. */
340             velecsum         = _fjsp_add_v2r8(velecsum,velec);
341
342             fscal            = felec;
343
344             /* Update vectorial force */
345             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
346             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
347             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
348             
349             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
350             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
351             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
352
353             /**************************
354              * CALCULATE INTERACTIONS *
355              **************************/
356
357             /* COULOMB ELECTROSTATICS */
358             velec            = _fjsp_mul_v2r8(qq10,rinv10);
359             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
360
361             /* Update potential sum for this i atom from the interaction with this j atom. */
362             velecsum         = _fjsp_add_v2r8(velecsum,velec);
363
364             fscal            = felec;
365
366             /* Update vectorial force */
367             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
368             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
369             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
370             
371             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
372             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
373             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
374
375             /**************************
376              * CALCULATE INTERACTIONS *
377              **************************/
378
379             /* COULOMB ELECTROSTATICS */
380             velec            = _fjsp_mul_v2r8(qq11,rinv11);
381             felec            = _fjsp_mul_v2r8(velec,rinvsq11);
382
383             /* Update potential sum for this i atom from the interaction with this j atom. */
384             velecsum         = _fjsp_add_v2r8(velecsum,velec);
385
386             fscal            = felec;
387
388             /* Update vectorial force */
389             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
390             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
391             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
392             
393             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
394             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
395             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
396
397             /**************************
398              * CALCULATE INTERACTIONS *
399              **************************/
400
401             /* COULOMB ELECTROSTATICS */
402             velec            = _fjsp_mul_v2r8(qq12,rinv12);
403             felec            = _fjsp_mul_v2r8(velec,rinvsq12);
404
405             /* Update potential sum for this i atom from the interaction with this j atom. */
406             velecsum         = _fjsp_add_v2r8(velecsum,velec);
407
408             fscal            = felec;
409
410             /* Update vectorial force */
411             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
412             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
413             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
414             
415             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
416             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
417             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
418
419             /**************************
420              * CALCULATE INTERACTIONS *
421              **************************/
422
423             /* COULOMB ELECTROSTATICS */
424             velec            = _fjsp_mul_v2r8(qq20,rinv20);
425             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
426
427             /* Update potential sum for this i atom from the interaction with this j atom. */
428             velecsum         = _fjsp_add_v2r8(velecsum,velec);
429
430             fscal            = felec;
431
432             /* Update vectorial force */
433             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
434             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
435             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
436             
437             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
438             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
439             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
440
441             /**************************
442              * CALCULATE INTERACTIONS *
443              **************************/
444
445             /* COULOMB ELECTROSTATICS */
446             velec            = _fjsp_mul_v2r8(qq21,rinv21);
447             felec            = _fjsp_mul_v2r8(velec,rinvsq21);
448
449             /* Update potential sum for this i atom from the interaction with this j atom. */
450             velecsum         = _fjsp_add_v2r8(velecsum,velec);
451
452             fscal            = felec;
453
454             /* Update vectorial force */
455             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
456             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
457             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
458             
459             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
460             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
461             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
462
463             /**************************
464              * CALCULATE INTERACTIONS *
465              **************************/
466
467             /* COULOMB ELECTROSTATICS */
468             velec            = _fjsp_mul_v2r8(qq22,rinv22);
469             felec            = _fjsp_mul_v2r8(velec,rinvsq22);
470
471             /* Update potential sum for this i atom from the interaction with this j atom. */
472             velecsum         = _fjsp_add_v2r8(velecsum,velec);
473
474             fscal            = felec;
475
476             /* Update vectorial force */
477             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
478             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
479             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
480             
481             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
482             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
483             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
484
485             gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
486
487             /* Inner loop uses 291 flops */
488         }
489
490         if(jidx<j_index_end)
491         {
492
493             jnrA             = jjnr[jidx];
494             j_coord_offsetA  = DIM*jnrA;
495
496             /* load j atom coordinates */
497             gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
498                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
499
500             /* Calculate displacement vector */
501             dx00             = _fjsp_sub_v2r8(ix0,jx0);
502             dy00             = _fjsp_sub_v2r8(iy0,jy0);
503             dz00             = _fjsp_sub_v2r8(iz0,jz0);
504             dx01             = _fjsp_sub_v2r8(ix0,jx1);
505             dy01             = _fjsp_sub_v2r8(iy0,jy1);
506             dz01             = _fjsp_sub_v2r8(iz0,jz1);
507             dx02             = _fjsp_sub_v2r8(ix0,jx2);
508             dy02             = _fjsp_sub_v2r8(iy0,jy2);
509             dz02             = _fjsp_sub_v2r8(iz0,jz2);
510             dx10             = _fjsp_sub_v2r8(ix1,jx0);
511             dy10             = _fjsp_sub_v2r8(iy1,jy0);
512             dz10             = _fjsp_sub_v2r8(iz1,jz0);
513             dx11             = _fjsp_sub_v2r8(ix1,jx1);
514             dy11             = _fjsp_sub_v2r8(iy1,jy1);
515             dz11             = _fjsp_sub_v2r8(iz1,jz1);
516             dx12             = _fjsp_sub_v2r8(ix1,jx2);
517             dy12             = _fjsp_sub_v2r8(iy1,jy2);
518             dz12             = _fjsp_sub_v2r8(iz1,jz2);
519             dx20             = _fjsp_sub_v2r8(ix2,jx0);
520             dy20             = _fjsp_sub_v2r8(iy2,jy0);
521             dz20             = _fjsp_sub_v2r8(iz2,jz0);
522             dx21             = _fjsp_sub_v2r8(ix2,jx1);
523             dy21             = _fjsp_sub_v2r8(iy2,jy1);
524             dz21             = _fjsp_sub_v2r8(iz2,jz1);
525             dx22             = _fjsp_sub_v2r8(ix2,jx2);
526             dy22             = _fjsp_sub_v2r8(iy2,jy2);
527             dz22             = _fjsp_sub_v2r8(iz2,jz2);
528
529             /* Calculate squared distance and things based on it */
530             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
531             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
532             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
533             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
534             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
535             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
536             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
537             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
538             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
539
540             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
541             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
542             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
543             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
544             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
545             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
546             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
547             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
548             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
549
550             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
551             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
552             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
553             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
554             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
555             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
556             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
557             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
558             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
559
560             fjx0             = _fjsp_setzero_v2r8();
561             fjy0             = _fjsp_setzero_v2r8();
562             fjz0             = _fjsp_setzero_v2r8();
563             fjx1             = _fjsp_setzero_v2r8();
564             fjy1             = _fjsp_setzero_v2r8();
565             fjz1             = _fjsp_setzero_v2r8();
566             fjx2             = _fjsp_setzero_v2r8();
567             fjy2             = _fjsp_setzero_v2r8();
568             fjz2             = _fjsp_setzero_v2r8();
569
570             /**************************
571              * CALCULATE INTERACTIONS *
572              **************************/
573
574             /* COULOMB ELECTROSTATICS */
575             velec            = _fjsp_mul_v2r8(qq00,rinv00);
576             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
577
578             /* LENNARD-JONES DISPERSION/REPULSION */
579
580             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
581             vvdw6            = _fjsp_mul_v2r8(c6_00,rinvsix);
582             vvdw12           = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
583             vvdw             = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
584             fvdw             = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
585
586             /* Update potential sum for this i atom from the interaction with this j atom. */
587             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
588             velecsum         = _fjsp_add_v2r8(velecsum,velec);
589             vvdw             = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
590             vvdwsum          = _fjsp_add_v2r8(vvdwsum,vvdw);
591
592             fscal            = _fjsp_add_v2r8(felec,fvdw);
593
594             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
595
596             /* Update vectorial force */
597             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
598             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
599             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
600             
601             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
602             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
603             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
604
605             /**************************
606              * CALCULATE INTERACTIONS *
607              **************************/
608
609             /* COULOMB ELECTROSTATICS */
610             velec            = _fjsp_mul_v2r8(qq01,rinv01);
611             felec            = _fjsp_mul_v2r8(velec,rinvsq01);
612
613             /* Update potential sum for this i atom from the interaction with this j atom. */
614             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
615             velecsum         = _fjsp_add_v2r8(velecsum,velec);
616
617             fscal            = felec;
618
619             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
620
621             /* Update vectorial force */
622             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
623             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
624             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
625             
626             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
627             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
628             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
629
630             /**************************
631              * CALCULATE INTERACTIONS *
632              **************************/
633
634             /* COULOMB ELECTROSTATICS */
635             velec            = _fjsp_mul_v2r8(qq02,rinv02);
636             felec            = _fjsp_mul_v2r8(velec,rinvsq02);
637
638             /* Update potential sum for this i atom from the interaction with this j atom. */
639             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
640             velecsum         = _fjsp_add_v2r8(velecsum,velec);
641
642             fscal            = felec;
643
644             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
645
646             /* Update vectorial force */
647             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
648             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
649             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
650             
651             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
652             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
653             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
654
655             /**************************
656              * CALCULATE INTERACTIONS *
657              **************************/
658
659             /* COULOMB ELECTROSTATICS */
660             velec            = _fjsp_mul_v2r8(qq10,rinv10);
661             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
662
663             /* Update potential sum for this i atom from the interaction with this j atom. */
664             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
665             velecsum         = _fjsp_add_v2r8(velecsum,velec);
666
667             fscal            = felec;
668
669             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
670
671             /* Update vectorial force */
672             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
673             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
674             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
675             
676             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
677             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
678             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
679
680             /**************************
681              * CALCULATE INTERACTIONS *
682              **************************/
683
684             /* COULOMB ELECTROSTATICS */
685             velec            = _fjsp_mul_v2r8(qq11,rinv11);
686             felec            = _fjsp_mul_v2r8(velec,rinvsq11);
687
688             /* Update potential sum for this i atom from the interaction with this j atom. */
689             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
690             velecsum         = _fjsp_add_v2r8(velecsum,velec);
691
692             fscal            = felec;
693
694             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
695
696             /* Update vectorial force */
697             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
698             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
699             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
700             
701             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
702             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
703             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
704
705             /**************************
706              * CALCULATE INTERACTIONS *
707              **************************/
708
709             /* COULOMB ELECTROSTATICS */
710             velec            = _fjsp_mul_v2r8(qq12,rinv12);
711             felec            = _fjsp_mul_v2r8(velec,rinvsq12);
712
713             /* Update potential sum for this i atom from the interaction with this j atom. */
714             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
715             velecsum         = _fjsp_add_v2r8(velecsum,velec);
716
717             fscal            = felec;
718
719             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
720
721             /* Update vectorial force */
722             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
723             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
724             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
725             
726             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
727             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
728             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
729
730             /**************************
731              * CALCULATE INTERACTIONS *
732              **************************/
733
734             /* COULOMB ELECTROSTATICS */
735             velec            = _fjsp_mul_v2r8(qq20,rinv20);
736             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
737
738             /* Update potential sum for this i atom from the interaction with this j atom. */
739             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
740             velecsum         = _fjsp_add_v2r8(velecsum,velec);
741
742             fscal            = felec;
743
744             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
745
746             /* Update vectorial force */
747             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
748             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
749             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
750             
751             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
752             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
753             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
754
755             /**************************
756              * CALCULATE INTERACTIONS *
757              **************************/
758
759             /* COULOMB ELECTROSTATICS */
760             velec            = _fjsp_mul_v2r8(qq21,rinv21);
761             felec            = _fjsp_mul_v2r8(velec,rinvsq21);
762
763             /* Update potential sum for this i atom from the interaction with this j atom. */
764             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
765             velecsum         = _fjsp_add_v2r8(velecsum,velec);
766
767             fscal            = felec;
768
769             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
770
771             /* Update vectorial force */
772             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
773             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
774             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
775             
776             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
777             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
778             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
779
780             /**************************
781              * CALCULATE INTERACTIONS *
782              **************************/
783
784             /* COULOMB ELECTROSTATICS */
785             velec            = _fjsp_mul_v2r8(qq22,rinv22);
786             felec            = _fjsp_mul_v2r8(velec,rinvsq22);
787
788             /* Update potential sum for this i atom from the interaction with this j atom. */
789             velec            = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
790             velecsum         = _fjsp_add_v2r8(velecsum,velec);
791
792             fscal            = felec;
793
794             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
795
796             /* Update vectorial force */
797             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
798             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
799             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
800             
801             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
802             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
803             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
804
805             gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
806
807             /* Inner loop uses 291 flops */
808         }
809
810         /* End of innermost loop */
811
812         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
813                                               f+i_coord_offset,fshift+i_shift_offset);
814
815         ggid                        = gid[iidx];
816         /* Update potential energies */
817         gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
818         gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
819
820         /* Increment number of inner iterations */
821         inneriter                  += j_index_end - j_index_start;
822
823         /* Outer loop uses 20 flops */
824     }
825
826     /* Increment number of outer iterations */
827     outeriter        += nri;
828
829     /* Update outer/inner flops */
830
831     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*291);
832 }
833 /*
834  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwLJ_GeomW3W3_F_sparc64_hpc_ace_double
835  * Electrostatics interaction: Coulomb
836  * VdW interaction:            LennardJones
837  * Geometry:                   Water3-Water3
838  * Calculate force/pot:        Force
839  */
840 void
841 nb_kernel_ElecCoul_VdwLJ_GeomW3W3_F_sparc64_hpc_ace_double
842                     (t_nblist                    * gmx_restrict       nlist,
843                      rvec                        * gmx_restrict          xx,
844                      rvec                        * gmx_restrict          ff,
845                      t_forcerec                  * gmx_restrict          fr,
846                      t_mdatoms                   * gmx_restrict     mdatoms,
847                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
848                      t_nrnb                      * gmx_restrict        nrnb)
849 {
850     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
851      * just 0 for non-waters.
852      * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
853      * jnr indices corresponding to data put in the four positions in the SIMD register.
854      */
855     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
856     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
857     int              jnrA,jnrB;
858     int              j_coord_offsetA,j_coord_offsetB;
859     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
860     real             rcutoff_scalar;
861     real             *shiftvec,*fshift,*x,*f;
862     _fjsp_v2r8       tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
863     int              vdwioffset0;
864     _fjsp_v2r8       ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
865     int              vdwioffset1;
866     _fjsp_v2r8       ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
867     int              vdwioffset2;
868     _fjsp_v2r8       ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
869     int              vdwjidx0A,vdwjidx0B;
870     _fjsp_v2r8       jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
871     int              vdwjidx1A,vdwjidx1B;
872     _fjsp_v2r8       jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
873     int              vdwjidx2A,vdwjidx2B;
874     _fjsp_v2r8       jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
875     _fjsp_v2r8       dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
876     _fjsp_v2r8       dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
877     _fjsp_v2r8       dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
878     _fjsp_v2r8       dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
879     _fjsp_v2r8       dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
880     _fjsp_v2r8       dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
881     _fjsp_v2r8       dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
882     _fjsp_v2r8       dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
883     _fjsp_v2r8       dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
884     _fjsp_v2r8       velec,felec,velecsum,facel,crf,krf,krf2;
885     real             *charge;
886     int              nvdwtype;
887     _fjsp_v2r8       rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
888     int              *vdwtype;
889     real             *vdwparam;
890     _fjsp_v2r8       one_sixth   = gmx_fjsp_set1_v2r8(1.0/6.0);
891     _fjsp_v2r8       one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
892     _fjsp_v2r8       itab_tmp;
893     _fjsp_v2r8       dummy_mask,cutoff_mask;
894     _fjsp_v2r8       one     = gmx_fjsp_set1_v2r8(1.0);
895     _fjsp_v2r8       two     = gmx_fjsp_set1_v2r8(2.0);
896     union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
897
898     x                = xx[0];
899     f                = ff[0];
900
901     nri              = nlist->nri;
902     iinr             = nlist->iinr;
903     jindex           = nlist->jindex;
904     jjnr             = nlist->jjnr;
905     shiftidx         = nlist->shift;
906     gid              = nlist->gid;
907     shiftvec         = fr->shift_vec[0];
908     fshift           = fr->fshift[0];
909     facel            = gmx_fjsp_set1_v2r8(fr->epsfac);
910     charge           = mdatoms->chargeA;
911     nvdwtype         = fr->ntype;
912     vdwparam         = fr->nbfp;
913     vdwtype          = mdatoms->typeA;
914
915     /* Setup water-specific parameters */
916     inr              = nlist->iinr[0];
917     iq0              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+0]));
918     iq1              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
919     iq2              = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
920     vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
921
922     jq0              = gmx_fjsp_set1_v2r8(charge[inr+0]);
923     jq1              = gmx_fjsp_set1_v2r8(charge[inr+1]);
924     jq2              = gmx_fjsp_set1_v2r8(charge[inr+2]);
925     vdwjidx0A        = 2*vdwtype[inr+0];
926     qq00             = _fjsp_mul_v2r8(iq0,jq0);
927     c6_00            = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
928     c12_00           = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
929     qq01             = _fjsp_mul_v2r8(iq0,jq1);
930     qq02             = _fjsp_mul_v2r8(iq0,jq2);
931     qq10             = _fjsp_mul_v2r8(iq1,jq0);
932     qq11             = _fjsp_mul_v2r8(iq1,jq1);
933     qq12             = _fjsp_mul_v2r8(iq1,jq2);
934     qq20             = _fjsp_mul_v2r8(iq2,jq0);
935     qq21             = _fjsp_mul_v2r8(iq2,jq1);
936     qq22             = _fjsp_mul_v2r8(iq2,jq2);
937
938     /* Avoid stupid compiler warnings */
939     jnrA = jnrB = 0;
940     j_coord_offsetA = 0;
941     j_coord_offsetB = 0;
942
943     outeriter        = 0;
944     inneriter        = 0;
945
946     /* Start outer loop over neighborlists */
947     for(iidx=0; iidx<nri; iidx++)
948     {
949         /* Load shift vector for this list */
950         i_shift_offset   = DIM*shiftidx[iidx];
951
952         /* Load limits for loop over neighbors */
953         j_index_start    = jindex[iidx];
954         j_index_end      = jindex[iidx+1];
955
956         /* Get outer coordinate index */
957         inr              = iinr[iidx];
958         i_coord_offset   = DIM*inr;
959
960         /* Load i particle coords and add shift vector */
961         gmx_fjsp_load_shift_and_3rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
962                                                  &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
963
964         fix0             = _fjsp_setzero_v2r8();
965         fiy0             = _fjsp_setzero_v2r8();
966         fiz0             = _fjsp_setzero_v2r8();
967         fix1             = _fjsp_setzero_v2r8();
968         fiy1             = _fjsp_setzero_v2r8();
969         fiz1             = _fjsp_setzero_v2r8();
970         fix2             = _fjsp_setzero_v2r8();
971         fiy2             = _fjsp_setzero_v2r8();
972         fiz2             = _fjsp_setzero_v2r8();
973
974         /* Start inner kernel loop */
975         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
976         {
977
978             /* Get j neighbor index, and coordinate index */
979             jnrA             = jjnr[jidx];
980             jnrB             = jjnr[jidx+1];
981             j_coord_offsetA  = DIM*jnrA;
982             j_coord_offsetB  = DIM*jnrB;
983
984             /* load j atom coordinates */
985             gmx_fjsp_load_3rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
986                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
987
988             /* Calculate displacement vector */
989             dx00             = _fjsp_sub_v2r8(ix0,jx0);
990             dy00             = _fjsp_sub_v2r8(iy0,jy0);
991             dz00             = _fjsp_sub_v2r8(iz0,jz0);
992             dx01             = _fjsp_sub_v2r8(ix0,jx1);
993             dy01             = _fjsp_sub_v2r8(iy0,jy1);
994             dz01             = _fjsp_sub_v2r8(iz0,jz1);
995             dx02             = _fjsp_sub_v2r8(ix0,jx2);
996             dy02             = _fjsp_sub_v2r8(iy0,jy2);
997             dz02             = _fjsp_sub_v2r8(iz0,jz2);
998             dx10             = _fjsp_sub_v2r8(ix1,jx0);
999             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1000             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1001             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1002             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1003             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1004             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1005             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1006             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1007             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1008             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1009             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1010             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1011             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1012             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1013             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1014             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1015             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1016
1017             /* Calculate squared distance and things based on it */
1018             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1019             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1020             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1021             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1022             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1023             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1024             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1025             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1026             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1027
1028             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1029             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
1030             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
1031             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1032             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1033             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1034             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1035             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1036             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1037
1038             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
1039             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
1040             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
1041             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
1042             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1043             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1044             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
1045             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1046             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1047
1048             fjx0             = _fjsp_setzero_v2r8();
1049             fjy0             = _fjsp_setzero_v2r8();
1050             fjz0             = _fjsp_setzero_v2r8();
1051             fjx1             = _fjsp_setzero_v2r8();
1052             fjy1             = _fjsp_setzero_v2r8();
1053             fjz1             = _fjsp_setzero_v2r8();
1054             fjx2             = _fjsp_setzero_v2r8();
1055             fjy2             = _fjsp_setzero_v2r8();
1056             fjz2             = _fjsp_setzero_v2r8();
1057
1058             /**************************
1059              * CALCULATE INTERACTIONS *
1060              **************************/
1061
1062             /* COULOMB ELECTROSTATICS */
1063             velec            = _fjsp_mul_v2r8(qq00,rinv00);
1064             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
1065
1066             /* LENNARD-JONES DISPERSION/REPULSION */
1067
1068             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1069             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1070
1071             fscal            = _fjsp_add_v2r8(felec,fvdw);
1072
1073             /* Update vectorial force */
1074             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1075             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1076             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1077             
1078             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1079             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1080             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1081
1082             /**************************
1083              * CALCULATE INTERACTIONS *
1084              **************************/
1085
1086             /* COULOMB ELECTROSTATICS */
1087             velec            = _fjsp_mul_v2r8(qq01,rinv01);
1088             felec            = _fjsp_mul_v2r8(velec,rinvsq01);
1089
1090             fscal            = felec;
1091
1092             /* Update vectorial force */
1093             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
1094             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1095             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1096             
1097             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1098             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1099             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1100
1101             /**************************
1102              * CALCULATE INTERACTIONS *
1103              **************************/
1104
1105             /* COULOMB ELECTROSTATICS */
1106             velec            = _fjsp_mul_v2r8(qq02,rinv02);
1107             felec            = _fjsp_mul_v2r8(velec,rinvsq02);
1108
1109             fscal            = felec;
1110
1111             /* Update vectorial force */
1112             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
1113             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1114             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1115             
1116             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1117             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1118             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1119
1120             /**************************
1121              * CALCULATE INTERACTIONS *
1122              **************************/
1123
1124             /* COULOMB ELECTROSTATICS */
1125             velec            = _fjsp_mul_v2r8(qq10,rinv10);
1126             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
1127
1128             fscal            = felec;
1129
1130             /* Update vectorial force */
1131             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1132             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1133             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1134             
1135             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1136             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1137             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1138
1139             /**************************
1140              * CALCULATE INTERACTIONS *
1141              **************************/
1142
1143             /* COULOMB ELECTROSTATICS */
1144             velec            = _fjsp_mul_v2r8(qq11,rinv11);
1145             felec            = _fjsp_mul_v2r8(velec,rinvsq11);
1146
1147             fscal            = felec;
1148
1149             /* Update vectorial force */
1150             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1151             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1152             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1153             
1154             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1155             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1156             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1157
1158             /**************************
1159              * CALCULATE INTERACTIONS *
1160              **************************/
1161
1162             /* COULOMB ELECTROSTATICS */
1163             velec            = _fjsp_mul_v2r8(qq12,rinv12);
1164             felec            = _fjsp_mul_v2r8(velec,rinvsq12);
1165
1166             fscal            = felec;
1167
1168             /* Update vectorial force */
1169             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1170             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1171             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1172             
1173             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1174             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1175             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1176
1177             /**************************
1178              * CALCULATE INTERACTIONS *
1179              **************************/
1180
1181             /* COULOMB ELECTROSTATICS */
1182             velec            = _fjsp_mul_v2r8(qq20,rinv20);
1183             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
1184
1185             fscal            = felec;
1186
1187             /* Update vectorial force */
1188             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1189             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1190             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1191             
1192             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1193             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1194             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1195
1196             /**************************
1197              * CALCULATE INTERACTIONS *
1198              **************************/
1199
1200             /* COULOMB ELECTROSTATICS */
1201             velec            = _fjsp_mul_v2r8(qq21,rinv21);
1202             felec            = _fjsp_mul_v2r8(velec,rinvsq21);
1203
1204             fscal            = felec;
1205
1206             /* Update vectorial force */
1207             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1208             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1209             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1210             
1211             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1212             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1213             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1214
1215             /**************************
1216              * CALCULATE INTERACTIONS *
1217              **************************/
1218
1219             /* COULOMB ELECTROSTATICS */
1220             velec            = _fjsp_mul_v2r8(qq22,rinv22);
1221             felec            = _fjsp_mul_v2r8(velec,rinvsq22);
1222
1223             fscal            = felec;
1224
1225             /* Update vectorial force */
1226             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1227             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1228             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1229             
1230             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1231             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1232             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1233
1234             gmx_fjsp_decrement_3rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1235
1236             /* Inner loop uses 277 flops */
1237         }
1238
1239         if(jidx<j_index_end)
1240         {
1241
1242             jnrA             = jjnr[jidx];
1243             j_coord_offsetA  = DIM*jnrA;
1244
1245             /* load j atom coordinates */
1246             gmx_fjsp_load_3rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1247                                               &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1248
1249             /* Calculate displacement vector */
1250             dx00             = _fjsp_sub_v2r8(ix0,jx0);
1251             dy00             = _fjsp_sub_v2r8(iy0,jy0);
1252             dz00             = _fjsp_sub_v2r8(iz0,jz0);
1253             dx01             = _fjsp_sub_v2r8(ix0,jx1);
1254             dy01             = _fjsp_sub_v2r8(iy0,jy1);
1255             dz01             = _fjsp_sub_v2r8(iz0,jz1);
1256             dx02             = _fjsp_sub_v2r8(ix0,jx2);
1257             dy02             = _fjsp_sub_v2r8(iy0,jy2);
1258             dz02             = _fjsp_sub_v2r8(iz0,jz2);
1259             dx10             = _fjsp_sub_v2r8(ix1,jx0);
1260             dy10             = _fjsp_sub_v2r8(iy1,jy0);
1261             dz10             = _fjsp_sub_v2r8(iz1,jz0);
1262             dx11             = _fjsp_sub_v2r8(ix1,jx1);
1263             dy11             = _fjsp_sub_v2r8(iy1,jy1);
1264             dz11             = _fjsp_sub_v2r8(iz1,jz1);
1265             dx12             = _fjsp_sub_v2r8(ix1,jx2);
1266             dy12             = _fjsp_sub_v2r8(iy1,jy2);
1267             dz12             = _fjsp_sub_v2r8(iz1,jz2);
1268             dx20             = _fjsp_sub_v2r8(ix2,jx0);
1269             dy20             = _fjsp_sub_v2r8(iy2,jy0);
1270             dz20             = _fjsp_sub_v2r8(iz2,jz0);
1271             dx21             = _fjsp_sub_v2r8(ix2,jx1);
1272             dy21             = _fjsp_sub_v2r8(iy2,jy1);
1273             dz21             = _fjsp_sub_v2r8(iz2,jz1);
1274             dx22             = _fjsp_sub_v2r8(ix2,jx2);
1275             dy22             = _fjsp_sub_v2r8(iy2,jy2);
1276             dz22             = _fjsp_sub_v2r8(iz2,jz2);
1277
1278             /* Calculate squared distance and things based on it */
1279             rsq00            = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1280             rsq01            = gmx_fjsp_calc_rsq_v2r8(dx01,dy01,dz01);
1281             rsq02            = gmx_fjsp_calc_rsq_v2r8(dx02,dy02,dz02);
1282             rsq10            = gmx_fjsp_calc_rsq_v2r8(dx10,dy10,dz10);
1283             rsq11            = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1284             rsq12            = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1285             rsq20            = gmx_fjsp_calc_rsq_v2r8(dx20,dy20,dz20);
1286             rsq21            = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1287             rsq22            = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1288
1289             rinv00           = gmx_fjsp_invsqrt_v2r8(rsq00);
1290             rinv01           = gmx_fjsp_invsqrt_v2r8(rsq01);
1291             rinv02           = gmx_fjsp_invsqrt_v2r8(rsq02);
1292             rinv10           = gmx_fjsp_invsqrt_v2r8(rsq10);
1293             rinv11           = gmx_fjsp_invsqrt_v2r8(rsq11);
1294             rinv12           = gmx_fjsp_invsqrt_v2r8(rsq12);
1295             rinv20           = gmx_fjsp_invsqrt_v2r8(rsq20);
1296             rinv21           = gmx_fjsp_invsqrt_v2r8(rsq21);
1297             rinv22           = gmx_fjsp_invsqrt_v2r8(rsq22);
1298
1299             rinvsq00         = _fjsp_mul_v2r8(rinv00,rinv00);
1300             rinvsq01         = _fjsp_mul_v2r8(rinv01,rinv01);
1301             rinvsq02         = _fjsp_mul_v2r8(rinv02,rinv02);
1302             rinvsq10         = _fjsp_mul_v2r8(rinv10,rinv10);
1303             rinvsq11         = _fjsp_mul_v2r8(rinv11,rinv11);
1304             rinvsq12         = _fjsp_mul_v2r8(rinv12,rinv12);
1305             rinvsq20         = _fjsp_mul_v2r8(rinv20,rinv20);
1306             rinvsq21         = _fjsp_mul_v2r8(rinv21,rinv21);
1307             rinvsq22         = _fjsp_mul_v2r8(rinv22,rinv22);
1308
1309             fjx0             = _fjsp_setzero_v2r8();
1310             fjy0             = _fjsp_setzero_v2r8();
1311             fjz0             = _fjsp_setzero_v2r8();
1312             fjx1             = _fjsp_setzero_v2r8();
1313             fjy1             = _fjsp_setzero_v2r8();
1314             fjz1             = _fjsp_setzero_v2r8();
1315             fjx2             = _fjsp_setzero_v2r8();
1316             fjy2             = _fjsp_setzero_v2r8();
1317             fjz2             = _fjsp_setzero_v2r8();
1318
1319             /**************************
1320              * CALCULATE INTERACTIONS *
1321              **************************/
1322
1323             /* COULOMB ELECTROSTATICS */
1324             velec            = _fjsp_mul_v2r8(qq00,rinv00);
1325             felec            = _fjsp_mul_v2r8(velec,rinvsq00);
1326
1327             /* LENNARD-JONES DISPERSION/REPULSION */
1328
1329             rinvsix          = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1330             fvdw             = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1331
1332             fscal            = _fjsp_add_v2r8(felec,fvdw);
1333
1334             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1335
1336             /* Update vectorial force */
1337             fix0             = _fjsp_madd_v2r8(dx00,fscal,fix0);
1338             fiy0             = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1339             fiz0             = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1340             
1341             fjx0             = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1342             fjy0             = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1343             fjz0             = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1344
1345             /**************************
1346              * CALCULATE INTERACTIONS *
1347              **************************/
1348
1349             /* COULOMB ELECTROSTATICS */
1350             velec            = _fjsp_mul_v2r8(qq01,rinv01);
1351             felec            = _fjsp_mul_v2r8(velec,rinvsq01);
1352
1353             fscal            = felec;
1354
1355             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1356
1357             /* Update vectorial force */
1358             fix0             = _fjsp_madd_v2r8(dx01,fscal,fix0);
1359             fiy0             = _fjsp_madd_v2r8(dy01,fscal,fiy0);
1360             fiz0             = _fjsp_madd_v2r8(dz01,fscal,fiz0);
1361             
1362             fjx1             = _fjsp_madd_v2r8(dx01,fscal,fjx1);
1363             fjy1             = _fjsp_madd_v2r8(dy01,fscal,fjy1);
1364             fjz1             = _fjsp_madd_v2r8(dz01,fscal,fjz1);
1365
1366             /**************************
1367              * CALCULATE INTERACTIONS *
1368              **************************/
1369
1370             /* COULOMB ELECTROSTATICS */
1371             velec            = _fjsp_mul_v2r8(qq02,rinv02);
1372             felec            = _fjsp_mul_v2r8(velec,rinvsq02);
1373
1374             fscal            = felec;
1375
1376             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1377
1378             /* Update vectorial force */
1379             fix0             = _fjsp_madd_v2r8(dx02,fscal,fix0);
1380             fiy0             = _fjsp_madd_v2r8(dy02,fscal,fiy0);
1381             fiz0             = _fjsp_madd_v2r8(dz02,fscal,fiz0);
1382             
1383             fjx2             = _fjsp_madd_v2r8(dx02,fscal,fjx2);
1384             fjy2             = _fjsp_madd_v2r8(dy02,fscal,fjy2);
1385             fjz2             = _fjsp_madd_v2r8(dz02,fscal,fjz2);
1386
1387             /**************************
1388              * CALCULATE INTERACTIONS *
1389              **************************/
1390
1391             /* COULOMB ELECTROSTATICS */
1392             velec            = _fjsp_mul_v2r8(qq10,rinv10);
1393             felec            = _fjsp_mul_v2r8(velec,rinvsq10);
1394
1395             fscal            = felec;
1396
1397             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1398
1399             /* Update vectorial force */
1400             fix1             = _fjsp_madd_v2r8(dx10,fscal,fix1);
1401             fiy1             = _fjsp_madd_v2r8(dy10,fscal,fiy1);
1402             fiz1             = _fjsp_madd_v2r8(dz10,fscal,fiz1);
1403             
1404             fjx0             = _fjsp_madd_v2r8(dx10,fscal,fjx0);
1405             fjy0             = _fjsp_madd_v2r8(dy10,fscal,fjy0);
1406             fjz0             = _fjsp_madd_v2r8(dz10,fscal,fjz0);
1407
1408             /**************************
1409              * CALCULATE INTERACTIONS *
1410              **************************/
1411
1412             /* COULOMB ELECTROSTATICS */
1413             velec            = _fjsp_mul_v2r8(qq11,rinv11);
1414             felec            = _fjsp_mul_v2r8(velec,rinvsq11);
1415
1416             fscal            = felec;
1417
1418             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1419
1420             /* Update vectorial force */
1421             fix1             = _fjsp_madd_v2r8(dx11,fscal,fix1);
1422             fiy1             = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1423             fiz1             = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1424             
1425             fjx1             = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1426             fjy1             = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1427             fjz1             = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1428
1429             /**************************
1430              * CALCULATE INTERACTIONS *
1431              **************************/
1432
1433             /* COULOMB ELECTROSTATICS */
1434             velec            = _fjsp_mul_v2r8(qq12,rinv12);
1435             felec            = _fjsp_mul_v2r8(velec,rinvsq12);
1436
1437             fscal            = felec;
1438
1439             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1440
1441             /* Update vectorial force */
1442             fix1             = _fjsp_madd_v2r8(dx12,fscal,fix1);
1443             fiy1             = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1444             fiz1             = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1445             
1446             fjx2             = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1447             fjy2             = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1448             fjz2             = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1449
1450             /**************************
1451              * CALCULATE INTERACTIONS *
1452              **************************/
1453
1454             /* COULOMB ELECTROSTATICS */
1455             velec            = _fjsp_mul_v2r8(qq20,rinv20);
1456             felec            = _fjsp_mul_v2r8(velec,rinvsq20);
1457
1458             fscal            = felec;
1459
1460             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1461
1462             /* Update vectorial force */
1463             fix2             = _fjsp_madd_v2r8(dx20,fscal,fix2);
1464             fiy2             = _fjsp_madd_v2r8(dy20,fscal,fiy2);
1465             fiz2             = _fjsp_madd_v2r8(dz20,fscal,fiz2);
1466             
1467             fjx0             = _fjsp_madd_v2r8(dx20,fscal,fjx0);
1468             fjy0             = _fjsp_madd_v2r8(dy20,fscal,fjy0);
1469             fjz0             = _fjsp_madd_v2r8(dz20,fscal,fjz0);
1470
1471             /**************************
1472              * CALCULATE INTERACTIONS *
1473              **************************/
1474
1475             /* COULOMB ELECTROSTATICS */
1476             velec            = _fjsp_mul_v2r8(qq21,rinv21);
1477             felec            = _fjsp_mul_v2r8(velec,rinvsq21);
1478
1479             fscal            = felec;
1480
1481             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1482
1483             /* Update vectorial force */
1484             fix2             = _fjsp_madd_v2r8(dx21,fscal,fix2);
1485             fiy2             = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1486             fiz2             = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1487             
1488             fjx1             = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1489             fjy1             = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1490             fjz1             = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1491
1492             /**************************
1493              * CALCULATE INTERACTIONS *
1494              **************************/
1495
1496             /* COULOMB ELECTROSTATICS */
1497             velec            = _fjsp_mul_v2r8(qq22,rinv22);
1498             felec            = _fjsp_mul_v2r8(velec,rinvsq22);
1499
1500             fscal            = felec;
1501
1502             fscal            = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1503
1504             /* Update vectorial force */
1505             fix2             = _fjsp_madd_v2r8(dx22,fscal,fix2);
1506             fiy2             = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1507             fiz2             = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1508             
1509             fjx2             = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1510             fjy2             = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1511             fjz2             = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1512
1513             gmx_fjsp_decrement_3rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1514
1515             /* Inner loop uses 277 flops */
1516         }
1517
1518         /* End of innermost loop */
1519
1520         gmx_fjsp_update_iforce_3atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1521                                               f+i_coord_offset,fshift+i_shift_offset);
1522
1523         /* Increment number of inner iterations */
1524         inneriter                  += j_index_end - j_index_start;
1525
1526         /* Outer loop uses 18 flops */
1527     }
1528
1529     /* Increment number of outer iterations */
1530     outeriter        += nri;
1531
1532     /* Update outer/inner flops */
1533
1534     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*277);
1535 }