2 * This file is part of the GROMACS molecular simulation package.
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.
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.
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.
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.
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.
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.
36 * Note: this file was generated by the GROMACS avx_128_fma_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "gromacs/simd/math_x86_avx_128_fma_double.h"
48 #include "kernelutil_x86_avx_128_fma_double.h"
51 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
52 * Electrostatics interaction: ReactionField
53 * VdW interaction: LennardJones
54 * Geometry: Water3-Water3
55 * Calculate force/pot: PotentialAndForce
58 nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
59 (t_nblist * gmx_restrict nlist,
60 rvec * gmx_restrict xx,
61 rvec * gmx_restrict ff,
62 t_forcerec * gmx_restrict fr,
63 t_mdatoms * gmx_restrict mdatoms,
64 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
65 t_nrnb * gmx_restrict nrnb)
67 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
68 * just 0 for non-waters.
69 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
70 * jnr indices corresponding to data put in the four positions in the SIMD register.
72 int i_shift_offset,i_coord_offset,outeriter,inneriter;
73 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75 int j_coord_offsetA,j_coord_offsetB;
76 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
78 real *shiftvec,*fshift,*x,*f;
79 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
83 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
85 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 int vdwjidx0A,vdwjidx0B;
87 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
88 int vdwjidx1A,vdwjidx1B;
89 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
90 int vdwjidx2A,vdwjidx2B;
91 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
92 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
93 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
94 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
95 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
96 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
97 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
98 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
99 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
100 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
101 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
104 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
107 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
108 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
109 __m128d dummy_mask,cutoff_mask;
110 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
111 __m128d one = _mm_set1_pd(1.0);
112 __m128d two = _mm_set1_pd(2.0);
118 jindex = nlist->jindex;
120 shiftidx = nlist->shift;
122 shiftvec = fr->shift_vec[0];
123 fshift = fr->fshift[0];
124 facel = _mm_set1_pd(fr->epsfac);
125 charge = mdatoms->chargeA;
126 krf = _mm_set1_pd(fr->ic->k_rf);
127 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
128 crf = _mm_set1_pd(fr->ic->c_rf);
129 nvdwtype = fr->ntype;
131 vdwtype = mdatoms->typeA;
133 /* Setup water-specific parameters */
134 inr = nlist->iinr[0];
135 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
136 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
137 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
138 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
140 jq0 = _mm_set1_pd(charge[inr+0]);
141 jq1 = _mm_set1_pd(charge[inr+1]);
142 jq2 = _mm_set1_pd(charge[inr+2]);
143 vdwjidx0A = 2*vdwtype[inr+0];
144 qq00 = _mm_mul_pd(iq0,jq0);
145 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
146 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
147 qq01 = _mm_mul_pd(iq0,jq1);
148 qq02 = _mm_mul_pd(iq0,jq2);
149 qq10 = _mm_mul_pd(iq1,jq0);
150 qq11 = _mm_mul_pd(iq1,jq1);
151 qq12 = _mm_mul_pd(iq1,jq2);
152 qq20 = _mm_mul_pd(iq2,jq0);
153 qq21 = _mm_mul_pd(iq2,jq1);
154 qq22 = _mm_mul_pd(iq2,jq2);
156 /* Avoid stupid compiler warnings */
164 /* Start outer loop over neighborlists */
165 for(iidx=0; iidx<nri; iidx++)
167 /* Load shift vector for this list */
168 i_shift_offset = DIM*shiftidx[iidx];
170 /* Load limits for loop over neighbors */
171 j_index_start = jindex[iidx];
172 j_index_end = jindex[iidx+1];
174 /* Get outer coordinate index */
176 i_coord_offset = DIM*inr;
178 /* Load i particle coords and add shift vector */
179 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
180 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
182 fix0 = _mm_setzero_pd();
183 fiy0 = _mm_setzero_pd();
184 fiz0 = _mm_setzero_pd();
185 fix1 = _mm_setzero_pd();
186 fiy1 = _mm_setzero_pd();
187 fiz1 = _mm_setzero_pd();
188 fix2 = _mm_setzero_pd();
189 fiy2 = _mm_setzero_pd();
190 fiz2 = _mm_setzero_pd();
192 /* Reset potential sums */
193 velecsum = _mm_setzero_pd();
194 vvdwsum = _mm_setzero_pd();
196 /* Start inner kernel loop */
197 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
200 /* Get j neighbor index, and coordinate index */
203 j_coord_offsetA = DIM*jnrA;
204 j_coord_offsetB = DIM*jnrB;
206 /* load j atom coordinates */
207 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
208 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
210 /* Calculate displacement vector */
211 dx00 = _mm_sub_pd(ix0,jx0);
212 dy00 = _mm_sub_pd(iy0,jy0);
213 dz00 = _mm_sub_pd(iz0,jz0);
214 dx01 = _mm_sub_pd(ix0,jx1);
215 dy01 = _mm_sub_pd(iy0,jy1);
216 dz01 = _mm_sub_pd(iz0,jz1);
217 dx02 = _mm_sub_pd(ix0,jx2);
218 dy02 = _mm_sub_pd(iy0,jy2);
219 dz02 = _mm_sub_pd(iz0,jz2);
220 dx10 = _mm_sub_pd(ix1,jx0);
221 dy10 = _mm_sub_pd(iy1,jy0);
222 dz10 = _mm_sub_pd(iz1,jz0);
223 dx11 = _mm_sub_pd(ix1,jx1);
224 dy11 = _mm_sub_pd(iy1,jy1);
225 dz11 = _mm_sub_pd(iz1,jz1);
226 dx12 = _mm_sub_pd(ix1,jx2);
227 dy12 = _mm_sub_pd(iy1,jy2);
228 dz12 = _mm_sub_pd(iz1,jz2);
229 dx20 = _mm_sub_pd(ix2,jx0);
230 dy20 = _mm_sub_pd(iy2,jy0);
231 dz20 = _mm_sub_pd(iz2,jz0);
232 dx21 = _mm_sub_pd(ix2,jx1);
233 dy21 = _mm_sub_pd(iy2,jy1);
234 dz21 = _mm_sub_pd(iz2,jz1);
235 dx22 = _mm_sub_pd(ix2,jx2);
236 dy22 = _mm_sub_pd(iy2,jy2);
237 dz22 = _mm_sub_pd(iz2,jz2);
239 /* Calculate squared distance and things based on it */
240 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
241 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
242 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
243 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
244 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
245 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
246 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
247 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
248 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
250 rinv00 = gmx_mm_invsqrt_pd(rsq00);
251 rinv01 = gmx_mm_invsqrt_pd(rsq01);
252 rinv02 = gmx_mm_invsqrt_pd(rsq02);
253 rinv10 = gmx_mm_invsqrt_pd(rsq10);
254 rinv11 = gmx_mm_invsqrt_pd(rsq11);
255 rinv12 = gmx_mm_invsqrt_pd(rsq12);
256 rinv20 = gmx_mm_invsqrt_pd(rsq20);
257 rinv21 = gmx_mm_invsqrt_pd(rsq21);
258 rinv22 = gmx_mm_invsqrt_pd(rsq22);
260 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
261 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
262 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
263 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
264 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
265 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
266 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
267 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
268 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
270 fjx0 = _mm_setzero_pd();
271 fjy0 = _mm_setzero_pd();
272 fjz0 = _mm_setzero_pd();
273 fjx1 = _mm_setzero_pd();
274 fjy1 = _mm_setzero_pd();
275 fjz1 = _mm_setzero_pd();
276 fjx2 = _mm_setzero_pd();
277 fjy2 = _mm_setzero_pd();
278 fjz2 = _mm_setzero_pd();
280 /**************************
281 * CALCULATE INTERACTIONS *
282 **************************/
284 /* REACTION-FIELD ELECTROSTATICS */
285 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
286 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
288 /* LENNARD-JONES DISPERSION/REPULSION */
290 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
291 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
292 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
293 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
294 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
296 /* Update potential sum for this i atom from the interaction with this j atom. */
297 velecsum = _mm_add_pd(velecsum,velec);
298 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
300 fscal = _mm_add_pd(felec,fvdw);
302 /* Update vectorial force */
303 fix0 = _mm_macc_pd(dx00,fscal,fix0);
304 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
305 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
307 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
308 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
309 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
311 /**************************
312 * CALCULATE INTERACTIONS *
313 **************************/
315 /* REACTION-FIELD ELECTROSTATICS */
316 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
317 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
319 /* Update potential sum for this i atom from the interaction with this j atom. */
320 velecsum = _mm_add_pd(velecsum,velec);
324 /* Update vectorial force */
325 fix0 = _mm_macc_pd(dx01,fscal,fix0);
326 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
327 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
329 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
330 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
331 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
333 /**************************
334 * CALCULATE INTERACTIONS *
335 **************************/
337 /* REACTION-FIELD ELECTROSTATICS */
338 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
339 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
341 /* Update potential sum for this i atom from the interaction with this j atom. */
342 velecsum = _mm_add_pd(velecsum,velec);
346 /* Update vectorial force */
347 fix0 = _mm_macc_pd(dx02,fscal,fix0);
348 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
349 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
351 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
352 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
353 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
355 /**************************
356 * CALCULATE INTERACTIONS *
357 **************************/
359 /* REACTION-FIELD ELECTROSTATICS */
360 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
361 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
363 /* Update potential sum for this i atom from the interaction with this j atom. */
364 velecsum = _mm_add_pd(velecsum,velec);
368 /* Update vectorial force */
369 fix1 = _mm_macc_pd(dx10,fscal,fix1);
370 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
371 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
373 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
374 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
375 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
377 /**************************
378 * CALCULATE INTERACTIONS *
379 **************************/
381 /* REACTION-FIELD ELECTROSTATICS */
382 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
383 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
385 /* Update potential sum for this i atom from the interaction with this j atom. */
386 velecsum = _mm_add_pd(velecsum,velec);
390 /* Update vectorial force */
391 fix1 = _mm_macc_pd(dx11,fscal,fix1);
392 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
393 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
395 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
396 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
397 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
399 /**************************
400 * CALCULATE INTERACTIONS *
401 **************************/
403 /* REACTION-FIELD ELECTROSTATICS */
404 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
405 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
407 /* Update potential sum for this i atom from the interaction with this j atom. */
408 velecsum = _mm_add_pd(velecsum,velec);
412 /* Update vectorial force */
413 fix1 = _mm_macc_pd(dx12,fscal,fix1);
414 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
415 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
417 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
418 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
419 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
421 /**************************
422 * CALCULATE INTERACTIONS *
423 **************************/
425 /* REACTION-FIELD ELECTROSTATICS */
426 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
427 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
429 /* Update potential sum for this i atom from the interaction with this j atom. */
430 velecsum = _mm_add_pd(velecsum,velec);
434 /* Update vectorial force */
435 fix2 = _mm_macc_pd(dx20,fscal,fix2);
436 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
437 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
439 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
440 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
441 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
443 /**************************
444 * CALCULATE INTERACTIONS *
445 **************************/
447 /* REACTION-FIELD ELECTROSTATICS */
448 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
449 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
451 /* Update potential sum for this i atom from the interaction with this j atom. */
452 velecsum = _mm_add_pd(velecsum,velec);
456 /* Update vectorial force */
457 fix2 = _mm_macc_pd(dx21,fscal,fix2);
458 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
459 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
461 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
462 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
463 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
465 /**************************
466 * CALCULATE INTERACTIONS *
467 **************************/
469 /* REACTION-FIELD ELECTROSTATICS */
470 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
471 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
473 /* Update potential sum for this i atom from the interaction with this j atom. */
474 velecsum = _mm_add_pd(velecsum,velec);
478 /* Update vectorial force */
479 fix2 = _mm_macc_pd(dx22,fscal,fix2);
480 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
481 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
483 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
484 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
485 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
487 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
489 /* Inner loop uses 327 flops */
496 j_coord_offsetA = DIM*jnrA;
498 /* load j atom coordinates */
499 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
500 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
502 /* Calculate displacement vector */
503 dx00 = _mm_sub_pd(ix0,jx0);
504 dy00 = _mm_sub_pd(iy0,jy0);
505 dz00 = _mm_sub_pd(iz0,jz0);
506 dx01 = _mm_sub_pd(ix0,jx1);
507 dy01 = _mm_sub_pd(iy0,jy1);
508 dz01 = _mm_sub_pd(iz0,jz1);
509 dx02 = _mm_sub_pd(ix0,jx2);
510 dy02 = _mm_sub_pd(iy0,jy2);
511 dz02 = _mm_sub_pd(iz0,jz2);
512 dx10 = _mm_sub_pd(ix1,jx0);
513 dy10 = _mm_sub_pd(iy1,jy0);
514 dz10 = _mm_sub_pd(iz1,jz0);
515 dx11 = _mm_sub_pd(ix1,jx1);
516 dy11 = _mm_sub_pd(iy1,jy1);
517 dz11 = _mm_sub_pd(iz1,jz1);
518 dx12 = _mm_sub_pd(ix1,jx2);
519 dy12 = _mm_sub_pd(iy1,jy2);
520 dz12 = _mm_sub_pd(iz1,jz2);
521 dx20 = _mm_sub_pd(ix2,jx0);
522 dy20 = _mm_sub_pd(iy2,jy0);
523 dz20 = _mm_sub_pd(iz2,jz0);
524 dx21 = _mm_sub_pd(ix2,jx1);
525 dy21 = _mm_sub_pd(iy2,jy1);
526 dz21 = _mm_sub_pd(iz2,jz1);
527 dx22 = _mm_sub_pd(ix2,jx2);
528 dy22 = _mm_sub_pd(iy2,jy2);
529 dz22 = _mm_sub_pd(iz2,jz2);
531 /* Calculate squared distance and things based on it */
532 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
533 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
534 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
535 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
536 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
537 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
538 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
539 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
540 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
542 rinv00 = gmx_mm_invsqrt_pd(rsq00);
543 rinv01 = gmx_mm_invsqrt_pd(rsq01);
544 rinv02 = gmx_mm_invsqrt_pd(rsq02);
545 rinv10 = gmx_mm_invsqrt_pd(rsq10);
546 rinv11 = gmx_mm_invsqrt_pd(rsq11);
547 rinv12 = gmx_mm_invsqrt_pd(rsq12);
548 rinv20 = gmx_mm_invsqrt_pd(rsq20);
549 rinv21 = gmx_mm_invsqrt_pd(rsq21);
550 rinv22 = gmx_mm_invsqrt_pd(rsq22);
552 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
553 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
554 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
555 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
556 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
557 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
558 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
559 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
560 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
562 fjx0 = _mm_setzero_pd();
563 fjy0 = _mm_setzero_pd();
564 fjz0 = _mm_setzero_pd();
565 fjx1 = _mm_setzero_pd();
566 fjy1 = _mm_setzero_pd();
567 fjz1 = _mm_setzero_pd();
568 fjx2 = _mm_setzero_pd();
569 fjy2 = _mm_setzero_pd();
570 fjz2 = _mm_setzero_pd();
572 /**************************
573 * CALCULATE INTERACTIONS *
574 **************************/
576 /* REACTION-FIELD ELECTROSTATICS */
577 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
578 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
580 /* LENNARD-JONES DISPERSION/REPULSION */
582 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
583 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
584 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
585 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
586 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
588 /* Update potential sum for this i atom from the interaction with this j atom. */
589 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
590 velecsum = _mm_add_pd(velecsum,velec);
591 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
592 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
594 fscal = _mm_add_pd(felec,fvdw);
596 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
598 /* Update vectorial force */
599 fix0 = _mm_macc_pd(dx00,fscal,fix0);
600 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
601 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
603 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
604 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
605 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
607 /**************************
608 * CALCULATE INTERACTIONS *
609 **************************/
611 /* REACTION-FIELD ELECTROSTATICS */
612 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
613 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
615 /* Update potential sum for this i atom from the interaction with this j atom. */
616 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
617 velecsum = _mm_add_pd(velecsum,velec);
621 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
623 /* Update vectorial force */
624 fix0 = _mm_macc_pd(dx01,fscal,fix0);
625 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
626 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
628 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
629 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
630 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
632 /**************************
633 * CALCULATE INTERACTIONS *
634 **************************/
636 /* REACTION-FIELD ELECTROSTATICS */
637 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
638 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
640 /* Update potential sum for this i atom from the interaction with this j atom. */
641 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
642 velecsum = _mm_add_pd(velecsum,velec);
646 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
648 /* Update vectorial force */
649 fix0 = _mm_macc_pd(dx02,fscal,fix0);
650 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
651 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
653 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
654 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
655 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
657 /**************************
658 * CALCULATE INTERACTIONS *
659 **************************/
661 /* REACTION-FIELD ELECTROSTATICS */
662 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
663 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
665 /* Update potential sum for this i atom from the interaction with this j atom. */
666 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
667 velecsum = _mm_add_pd(velecsum,velec);
671 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
673 /* Update vectorial force */
674 fix1 = _mm_macc_pd(dx10,fscal,fix1);
675 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
676 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
678 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
679 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
680 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
682 /**************************
683 * CALCULATE INTERACTIONS *
684 **************************/
686 /* REACTION-FIELD ELECTROSTATICS */
687 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
688 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
690 /* Update potential sum for this i atom from the interaction with this j atom. */
691 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
692 velecsum = _mm_add_pd(velecsum,velec);
696 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
698 /* Update vectorial force */
699 fix1 = _mm_macc_pd(dx11,fscal,fix1);
700 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
701 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
703 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
704 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
705 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
707 /**************************
708 * CALCULATE INTERACTIONS *
709 **************************/
711 /* REACTION-FIELD ELECTROSTATICS */
712 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
713 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
715 /* Update potential sum for this i atom from the interaction with this j atom. */
716 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
717 velecsum = _mm_add_pd(velecsum,velec);
721 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
723 /* Update vectorial force */
724 fix1 = _mm_macc_pd(dx12,fscal,fix1);
725 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
726 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
728 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
729 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
730 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
732 /**************************
733 * CALCULATE INTERACTIONS *
734 **************************/
736 /* REACTION-FIELD ELECTROSTATICS */
737 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
738 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
740 /* Update potential sum for this i atom from the interaction with this j atom. */
741 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
742 velecsum = _mm_add_pd(velecsum,velec);
746 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
748 /* Update vectorial force */
749 fix2 = _mm_macc_pd(dx20,fscal,fix2);
750 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
751 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
753 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
754 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
755 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
757 /**************************
758 * CALCULATE INTERACTIONS *
759 **************************/
761 /* REACTION-FIELD ELECTROSTATICS */
762 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
763 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
765 /* Update potential sum for this i atom from the interaction with this j atom. */
766 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
767 velecsum = _mm_add_pd(velecsum,velec);
771 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
773 /* Update vectorial force */
774 fix2 = _mm_macc_pd(dx21,fscal,fix2);
775 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
776 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
778 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
779 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
780 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
782 /**************************
783 * CALCULATE INTERACTIONS *
784 **************************/
786 /* REACTION-FIELD ELECTROSTATICS */
787 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
788 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
790 /* Update potential sum for this i atom from the interaction with this j atom. */
791 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
792 velecsum = _mm_add_pd(velecsum,velec);
796 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
798 /* Update vectorial force */
799 fix2 = _mm_macc_pd(dx22,fscal,fix2);
800 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
801 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
803 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
804 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
805 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
807 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
809 /* Inner loop uses 327 flops */
812 /* End of innermost loop */
814 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
815 f+i_coord_offset,fshift+i_shift_offset);
818 /* Update potential energies */
819 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
820 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
822 /* Increment number of inner iterations */
823 inneriter += j_index_end - j_index_start;
825 /* Outer loop uses 20 flops */
828 /* Increment number of outer iterations */
831 /* Update outer/inner flops */
833 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*327);
836 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
837 * Electrostatics interaction: ReactionField
838 * VdW interaction: LennardJones
839 * Geometry: Water3-Water3
840 * Calculate force/pot: Force
843 nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
844 (t_nblist * gmx_restrict nlist,
845 rvec * gmx_restrict xx,
846 rvec * gmx_restrict ff,
847 t_forcerec * gmx_restrict fr,
848 t_mdatoms * gmx_restrict mdatoms,
849 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
850 t_nrnb * gmx_restrict nrnb)
852 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
853 * just 0 for non-waters.
854 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
855 * jnr indices corresponding to data put in the four positions in the SIMD register.
857 int i_shift_offset,i_coord_offset,outeriter,inneriter;
858 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
860 int j_coord_offsetA,j_coord_offsetB;
861 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
863 real *shiftvec,*fshift,*x,*f;
864 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
866 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
868 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
870 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
871 int vdwjidx0A,vdwjidx0B;
872 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
873 int vdwjidx1A,vdwjidx1B;
874 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
875 int vdwjidx2A,vdwjidx2B;
876 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
877 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
878 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
879 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
880 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
881 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
882 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
883 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
884 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
885 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
886 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
889 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
892 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
893 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
894 __m128d dummy_mask,cutoff_mask;
895 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
896 __m128d one = _mm_set1_pd(1.0);
897 __m128d two = _mm_set1_pd(2.0);
903 jindex = nlist->jindex;
905 shiftidx = nlist->shift;
907 shiftvec = fr->shift_vec[0];
908 fshift = fr->fshift[0];
909 facel = _mm_set1_pd(fr->epsfac);
910 charge = mdatoms->chargeA;
911 krf = _mm_set1_pd(fr->ic->k_rf);
912 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
913 crf = _mm_set1_pd(fr->ic->c_rf);
914 nvdwtype = fr->ntype;
916 vdwtype = mdatoms->typeA;
918 /* Setup water-specific parameters */
919 inr = nlist->iinr[0];
920 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
921 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
922 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
923 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
925 jq0 = _mm_set1_pd(charge[inr+0]);
926 jq1 = _mm_set1_pd(charge[inr+1]);
927 jq2 = _mm_set1_pd(charge[inr+2]);
928 vdwjidx0A = 2*vdwtype[inr+0];
929 qq00 = _mm_mul_pd(iq0,jq0);
930 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
931 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
932 qq01 = _mm_mul_pd(iq0,jq1);
933 qq02 = _mm_mul_pd(iq0,jq2);
934 qq10 = _mm_mul_pd(iq1,jq0);
935 qq11 = _mm_mul_pd(iq1,jq1);
936 qq12 = _mm_mul_pd(iq1,jq2);
937 qq20 = _mm_mul_pd(iq2,jq0);
938 qq21 = _mm_mul_pd(iq2,jq1);
939 qq22 = _mm_mul_pd(iq2,jq2);
941 /* Avoid stupid compiler warnings */
949 /* Start outer loop over neighborlists */
950 for(iidx=0; iidx<nri; iidx++)
952 /* Load shift vector for this list */
953 i_shift_offset = DIM*shiftidx[iidx];
955 /* Load limits for loop over neighbors */
956 j_index_start = jindex[iidx];
957 j_index_end = jindex[iidx+1];
959 /* Get outer coordinate index */
961 i_coord_offset = DIM*inr;
963 /* Load i particle coords and add shift vector */
964 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
965 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
967 fix0 = _mm_setzero_pd();
968 fiy0 = _mm_setzero_pd();
969 fiz0 = _mm_setzero_pd();
970 fix1 = _mm_setzero_pd();
971 fiy1 = _mm_setzero_pd();
972 fiz1 = _mm_setzero_pd();
973 fix2 = _mm_setzero_pd();
974 fiy2 = _mm_setzero_pd();
975 fiz2 = _mm_setzero_pd();
977 /* Start inner kernel loop */
978 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
981 /* Get j neighbor index, and coordinate index */
984 j_coord_offsetA = DIM*jnrA;
985 j_coord_offsetB = DIM*jnrB;
987 /* load j atom coordinates */
988 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
989 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
991 /* Calculate displacement vector */
992 dx00 = _mm_sub_pd(ix0,jx0);
993 dy00 = _mm_sub_pd(iy0,jy0);
994 dz00 = _mm_sub_pd(iz0,jz0);
995 dx01 = _mm_sub_pd(ix0,jx1);
996 dy01 = _mm_sub_pd(iy0,jy1);
997 dz01 = _mm_sub_pd(iz0,jz1);
998 dx02 = _mm_sub_pd(ix0,jx2);
999 dy02 = _mm_sub_pd(iy0,jy2);
1000 dz02 = _mm_sub_pd(iz0,jz2);
1001 dx10 = _mm_sub_pd(ix1,jx0);
1002 dy10 = _mm_sub_pd(iy1,jy0);
1003 dz10 = _mm_sub_pd(iz1,jz0);
1004 dx11 = _mm_sub_pd(ix1,jx1);
1005 dy11 = _mm_sub_pd(iy1,jy1);
1006 dz11 = _mm_sub_pd(iz1,jz1);
1007 dx12 = _mm_sub_pd(ix1,jx2);
1008 dy12 = _mm_sub_pd(iy1,jy2);
1009 dz12 = _mm_sub_pd(iz1,jz2);
1010 dx20 = _mm_sub_pd(ix2,jx0);
1011 dy20 = _mm_sub_pd(iy2,jy0);
1012 dz20 = _mm_sub_pd(iz2,jz0);
1013 dx21 = _mm_sub_pd(ix2,jx1);
1014 dy21 = _mm_sub_pd(iy2,jy1);
1015 dz21 = _mm_sub_pd(iz2,jz1);
1016 dx22 = _mm_sub_pd(ix2,jx2);
1017 dy22 = _mm_sub_pd(iy2,jy2);
1018 dz22 = _mm_sub_pd(iz2,jz2);
1020 /* Calculate squared distance and things based on it */
1021 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1022 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1023 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1024 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1025 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1026 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1027 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1028 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1029 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1031 rinv00 = gmx_mm_invsqrt_pd(rsq00);
1032 rinv01 = gmx_mm_invsqrt_pd(rsq01);
1033 rinv02 = gmx_mm_invsqrt_pd(rsq02);
1034 rinv10 = gmx_mm_invsqrt_pd(rsq10);
1035 rinv11 = gmx_mm_invsqrt_pd(rsq11);
1036 rinv12 = gmx_mm_invsqrt_pd(rsq12);
1037 rinv20 = gmx_mm_invsqrt_pd(rsq20);
1038 rinv21 = gmx_mm_invsqrt_pd(rsq21);
1039 rinv22 = gmx_mm_invsqrt_pd(rsq22);
1041 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1042 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1043 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1044 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1045 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1046 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1047 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1048 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1049 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1051 fjx0 = _mm_setzero_pd();
1052 fjy0 = _mm_setzero_pd();
1053 fjz0 = _mm_setzero_pd();
1054 fjx1 = _mm_setzero_pd();
1055 fjy1 = _mm_setzero_pd();
1056 fjz1 = _mm_setzero_pd();
1057 fjx2 = _mm_setzero_pd();
1058 fjy2 = _mm_setzero_pd();
1059 fjz2 = _mm_setzero_pd();
1061 /**************************
1062 * CALCULATE INTERACTIONS *
1063 **************************/
1065 /* REACTION-FIELD ELECTROSTATICS */
1066 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1068 /* LENNARD-JONES DISPERSION/REPULSION */
1070 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1071 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1073 fscal = _mm_add_pd(felec,fvdw);
1075 /* Update vectorial force */
1076 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1077 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1078 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1080 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1081 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1082 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1084 /**************************
1085 * CALCULATE INTERACTIONS *
1086 **************************/
1088 /* REACTION-FIELD ELECTROSTATICS */
1089 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1093 /* Update vectorial force */
1094 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1095 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1096 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1098 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1099 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1100 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1102 /**************************
1103 * CALCULATE INTERACTIONS *
1104 **************************/
1106 /* REACTION-FIELD ELECTROSTATICS */
1107 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1111 /* Update vectorial force */
1112 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1113 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1114 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1116 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1117 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1118 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1120 /**************************
1121 * CALCULATE INTERACTIONS *
1122 **************************/
1124 /* REACTION-FIELD ELECTROSTATICS */
1125 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1129 /* Update vectorial force */
1130 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1131 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1132 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1134 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1135 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1136 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1138 /**************************
1139 * CALCULATE INTERACTIONS *
1140 **************************/
1142 /* REACTION-FIELD ELECTROSTATICS */
1143 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1147 /* Update vectorial force */
1148 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1149 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1150 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1152 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1153 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1154 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1156 /**************************
1157 * CALCULATE INTERACTIONS *
1158 **************************/
1160 /* REACTION-FIELD ELECTROSTATICS */
1161 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1165 /* Update vectorial force */
1166 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1167 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1168 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1170 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1171 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1172 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1174 /**************************
1175 * CALCULATE INTERACTIONS *
1176 **************************/
1178 /* REACTION-FIELD ELECTROSTATICS */
1179 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1183 /* Update vectorial force */
1184 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1185 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1186 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1188 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1189 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1190 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1192 /**************************
1193 * CALCULATE INTERACTIONS *
1194 **************************/
1196 /* REACTION-FIELD ELECTROSTATICS */
1197 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1201 /* Update vectorial force */
1202 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1203 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1204 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1206 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1207 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1208 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1210 /**************************
1211 * CALCULATE INTERACTIONS *
1212 **************************/
1214 /* REACTION-FIELD ELECTROSTATICS */
1215 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1219 /* Update vectorial force */
1220 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1221 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1222 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1224 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1225 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1226 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1228 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1230 /* Inner loop uses 277 flops */
1233 if(jidx<j_index_end)
1237 j_coord_offsetA = DIM*jnrA;
1239 /* load j atom coordinates */
1240 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
1241 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1243 /* Calculate displacement vector */
1244 dx00 = _mm_sub_pd(ix0,jx0);
1245 dy00 = _mm_sub_pd(iy0,jy0);
1246 dz00 = _mm_sub_pd(iz0,jz0);
1247 dx01 = _mm_sub_pd(ix0,jx1);
1248 dy01 = _mm_sub_pd(iy0,jy1);
1249 dz01 = _mm_sub_pd(iz0,jz1);
1250 dx02 = _mm_sub_pd(ix0,jx2);
1251 dy02 = _mm_sub_pd(iy0,jy2);
1252 dz02 = _mm_sub_pd(iz0,jz2);
1253 dx10 = _mm_sub_pd(ix1,jx0);
1254 dy10 = _mm_sub_pd(iy1,jy0);
1255 dz10 = _mm_sub_pd(iz1,jz0);
1256 dx11 = _mm_sub_pd(ix1,jx1);
1257 dy11 = _mm_sub_pd(iy1,jy1);
1258 dz11 = _mm_sub_pd(iz1,jz1);
1259 dx12 = _mm_sub_pd(ix1,jx2);
1260 dy12 = _mm_sub_pd(iy1,jy2);
1261 dz12 = _mm_sub_pd(iz1,jz2);
1262 dx20 = _mm_sub_pd(ix2,jx0);
1263 dy20 = _mm_sub_pd(iy2,jy0);
1264 dz20 = _mm_sub_pd(iz2,jz0);
1265 dx21 = _mm_sub_pd(ix2,jx1);
1266 dy21 = _mm_sub_pd(iy2,jy1);
1267 dz21 = _mm_sub_pd(iz2,jz1);
1268 dx22 = _mm_sub_pd(ix2,jx2);
1269 dy22 = _mm_sub_pd(iy2,jy2);
1270 dz22 = _mm_sub_pd(iz2,jz2);
1272 /* Calculate squared distance and things based on it */
1273 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1274 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1275 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1276 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1277 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1278 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1279 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1280 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1281 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1283 rinv00 = gmx_mm_invsqrt_pd(rsq00);
1284 rinv01 = gmx_mm_invsqrt_pd(rsq01);
1285 rinv02 = gmx_mm_invsqrt_pd(rsq02);
1286 rinv10 = gmx_mm_invsqrt_pd(rsq10);
1287 rinv11 = gmx_mm_invsqrt_pd(rsq11);
1288 rinv12 = gmx_mm_invsqrt_pd(rsq12);
1289 rinv20 = gmx_mm_invsqrt_pd(rsq20);
1290 rinv21 = gmx_mm_invsqrt_pd(rsq21);
1291 rinv22 = gmx_mm_invsqrt_pd(rsq22);
1293 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1294 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1295 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1296 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1297 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1298 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1299 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1300 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1301 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1303 fjx0 = _mm_setzero_pd();
1304 fjy0 = _mm_setzero_pd();
1305 fjz0 = _mm_setzero_pd();
1306 fjx1 = _mm_setzero_pd();
1307 fjy1 = _mm_setzero_pd();
1308 fjz1 = _mm_setzero_pd();
1309 fjx2 = _mm_setzero_pd();
1310 fjy2 = _mm_setzero_pd();
1311 fjz2 = _mm_setzero_pd();
1313 /**************************
1314 * CALCULATE INTERACTIONS *
1315 **************************/
1317 /* REACTION-FIELD ELECTROSTATICS */
1318 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1320 /* LENNARD-JONES DISPERSION/REPULSION */
1322 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1323 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1325 fscal = _mm_add_pd(felec,fvdw);
1327 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1329 /* Update vectorial force */
1330 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1331 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1332 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1334 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1335 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1336 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1338 /**************************
1339 * CALCULATE INTERACTIONS *
1340 **************************/
1342 /* REACTION-FIELD ELECTROSTATICS */
1343 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1347 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1349 /* Update vectorial force */
1350 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1351 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1352 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1354 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1355 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1356 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1358 /**************************
1359 * CALCULATE INTERACTIONS *
1360 **************************/
1362 /* REACTION-FIELD ELECTROSTATICS */
1363 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1367 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1369 /* Update vectorial force */
1370 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1371 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1372 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1374 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1375 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1376 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1378 /**************************
1379 * CALCULATE INTERACTIONS *
1380 **************************/
1382 /* REACTION-FIELD ELECTROSTATICS */
1383 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1387 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1389 /* Update vectorial force */
1390 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1391 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1392 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1394 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1395 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1396 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1398 /**************************
1399 * CALCULATE INTERACTIONS *
1400 **************************/
1402 /* REACTION-FIELD ELECTROSTATICS */
1403 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1407 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1409 /* Update vectorial force */
1410 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1411 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1412 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1414 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1415 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1416 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1418 /**************************
1419 * CALCULATE INTERACTIONS *
1420 **************************/
1422 /* REACTION-FIELD ELECTROSTATICS */
1423 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1427 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1429 /* Update vectorial force */
1430 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1431 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1432 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1434 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1435 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1436 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1438 /**************************
1439 * CALCULATE INTERACTIONS *
1440 **************************/
1442 /* REACTION-FIELD ELECTROSTATICS */
1443 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1447 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1449 /* Update vectorial force */
1450 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1451 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1452 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1454 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1455 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1456 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1458 /**************************
1459 * CALCULATE INTERACTIONS *
1460 **************************/
1462 /* REACTION-FIELD ELECTROSTATICS */
1463 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1467 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1469 /* Update vectorial force */
1470 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1471 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1472 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1474 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1475 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1476 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1478 /**************************
1479 * CALCULATE INTERACTIONS *
1480 **************************/
1482 /* REACTION-FIELD ELECTROSTATICS */
1483 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1487 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1489 /* Update vectorial force */
1490 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1491 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1492 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1494 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1495 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1496 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1498 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1500 /* Inner loop uses 277 flops */
1503 /* End of innermost loop */
1505 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1506 f+i_coord_offset,fshift+i_shift_offset);
1508 /* Increment number of inner iterations */
1509 inneriter += j_index_end - j_index_start;
1511 /* Outer loop uses 18 flops */
1514 /* Increment number of outer iterations */
1517 /* Update outer/inner flops */
1519 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*277);