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