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