2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, 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.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_x86_avx_128_fma_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
85 int vdwjidx0A,vdwjidx0B;
86 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 int vdwjidx1A,vdwjidx1B;
88 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
89 int vdwjidx2A,vdwjidx2B;
90 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
91 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
92 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
93 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
94 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
95 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
96 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
97 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
98 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
99 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
100 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
103 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
106 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
107 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
108 __m128d dummy_mask,cutoff_mask;
109 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
110 __m128d one = _mm_set1_pd(1.0);
111 __m128d two = _mm_set1_pd(2.0);
117 jindex = nlist->jindex;
119 shiftidx = nlist->shift;
121 shiftvec = fr->shift_vec[0];
122 fshift = fr->fshift[0];
123 facel = _mm_set1_pd(fr->ic->epsfac);
124 charge = mdatoms->chargeA;
125 krf = _mm_set1_pd(fr->ic->k_rf);
126 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
127 crf = _mm_set1_pd(fr->ic->c_rf);
128 nvdwtype = fr->ntype;
130 vdwtype = mdatoms->typeA;
132 /* Setup water-specific parameters */
133 inr = nlist->iinr[0];
134 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
135 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
136 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
137 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
139 jq0 = _mm_set1_pd(charge[inr+0]);
140 jq1 = _mm_set1_pd(charge[inr+1]);
141 jq2 = _mm_set1_pd(charge[inr+2]);
142 vdwjidx0A = 2*vdwtype[inr+0];
143 qq00 = _mm_mul_pd(iq0,jq0);
144 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
145 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
146 qq01 = _mm_mul_pd(iq0,jq1);
147 qq02 = _mm_mul_pd(iq0,jq2);
148 qq10 = _mm_mul_pd(iq1,jq0);
149 qq11 = _mm_mul_pd(iq1,jq1);
150 qq12 = _mm_mul_pd(iq1,jq2);
151 qq20 = _mm_mul_pd(iq2,jq0);
152 qq21 = _mm_mul_pd(iq2,jq1);
153 qq22 = _mm_mul_pd(iq2,jq2);
155 /* Avoid stupid compiler warnings */
163 /* Start outer loop over neighborlists */
164 for(iidx=0; iidx<nri; iidx++)
166 /* Load shift vector for this list */
167 i_shift_offset = DIM*shiftidx[iidx];
169 /* Load limits for loop over neighbors */
170 j_index_start = jindex[iidx];
171 j_index_end = jindex[iidx+1];
173 /* Get outer coordinate index */
175 i_coord_offset = DIM*inr;
177 /* Load i particle coords and add shift vector */
178 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
179 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
181 fix0 = _mm_setzero_pd();
182 fiy0 = _mm_setzero_pd();
183 fiz0 = _mm_setzero_pd();
184 fix1 = _mm_setzero_pd();
185 fiy1 = _mm_setzero_pd();
186 fiz1 = _mm_setzero_pd();
187 fix2 = _mm_setzero_pd();
188 fiy2 = _mm_setzero_pd();
189 fiz2 = _mm_setzero_pd();
191 /* Reset potential sums */
192 velecsum = _mm_setzero_pd();
193 vvdwsum = _mm_setzero_pd();
195 /* Start inner kernel loop */
196 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
199 /* Get j neighbor index, and coordinate index */
202 j_coord_offsetA = DIM*jnrA;
203 j_coord_offsetB = DIM*jnrB;
205 /* load j atom coordinates */
206 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
207 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
209 /* Calculate displacement vector */
210 dx00 = _mm_sub_pd(ix0,jx0);
211 dy00 = _mm_sub_pd(iy0,jy0);
212 dz00 = _mm_sub_pd(iz0,jz0);
213 dx01 = _mm_sub_pd(ix0,jx1);
214 dy01 = _mm_sub_pd(iy0,jy1);
215 dz01 = _mm_sub_pd(iz0,jz1);
216 dx02 = _mm_sub_pd(ix0,jx2);
217 dy02 = _mm_sub_pd(iy0,jy2);
218 dz02 = _mm_sub_pd(iz0,jz2);
219 dx10 = _mm_sub_pd(ix1,jx0);
220 dy10 = _mm_sub_pd(iy1,jy0);
221 dz10 = _mm_sub_pd(iz1,jz0);
222 dx11 = _mm_sub_pd(ix1,jx1);
223 dy11 = _mm_sub_pd(iy1,jy1);
224 dz11 = _mm_sub_pd(iz1,jz1);
225 dx12 = _mm_sub_pd(ix1,jx2);
226 dy12 = _mm_sub_pd(iy1,jy2);
227 dz12 = _mm_sub_pd(iz1,jz2);
228 dx20 = _mm_sub_pd(ix2,jx0);
229 dy20 = _mm_sub_pd(iy2,jy0);
230 dz20 = _mm_sub_pd(iz2,jz0);
231 dx21 = _mm_sub_pd(ix2,jx1);
232 dy21 = _mm_sub_pd(iy2,jy1);
233 dz21 = _mm_sub_pd(iz2,jz1);
234 dx22 = _mm_sub_pd(ix2,jx2);
235 dy22 = _mm_sub_pd(iy2,jy2);
236 dz22 = _mm_sub_pd(iz2,jz2);
238 /* Calculate squared distance and things based on it */
239 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
240 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
241 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
242 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
243 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
244 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
245 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
246 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
247 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
249 rinv00 = avx128fma_invsqrt_d(rsq00);
250 rinv01 = avx128fma_invsqrt_d(rsq01);
251 rinv02 = avx128fma_invsqrt_d(rsq02);
252 rinv10 = avx128fma_invsqrt_d(rsq10);
253 rinv11 = avx128fma_invsqrt_d(rsq11);
254 rinv12 = avx128fma_invsqrt_d(rsq12);
255 rinv20 = avx128fma_invsqrt_d(rsq20);
256 rinv21 = avx128fma_invsqrt_d(rsq21);
257 rinv22 = avx128fma_invsqrt_d(rsq22);
259 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
260 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
261 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
262 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
263 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
264 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
265 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
266 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
267 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
269 fjx0 = _mm_setzero_pd();
270 fjy0 = _mm_setzero_pd();
271 fjz0 = _mm_setzero_pd();
272 fjx1 = _mm_setzero_pd();
273 fjy1 = _mm_setzero_pd();
274 fjz1 = _mm_setzero_pd();
275 fjx2 = _mm_setzero_pd();
276 fjy2 = _mm_setzero_pd();
277 fjz2 = _mm_setzero_pd();
279 /**************************
280 * CALCULATE INTERACTIONS *
281 **************************/
283 /* REACTION-FIELD ELECTROSTATICS */
284 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
285 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
287 /* LENNARD-JONES DISPERSION/REPULSION */
289 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
290 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
291 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
292 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
293 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
295 /* Update potential sum for this i atom from the interaction with this j atom. */
296 velecsum = _mm_add_pd(velecsum,velec);
297 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
299 fscal = _mm_add_pd(felec,fvdw);
301 /* Update vectorial force */
302 fix0 = _mm_macc_pd(dx00,fscal,fix0);
303 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
304 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
306 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
307 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
308 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
310 /**************************
311 * CALCULATE INTERACTIONS *
312 **************************/
314 /* REACTION-FIELD ELECTROSTATICS */
315 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
316 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
318 /* Update potential sum for this i atom from the interaction with this j atom. */
319 velecsum = _mm_add_pd(velecsum,velec);
323 /* Update vectorial force */
324 fix0 = _mm_macc_pd(dx01,fscal,fix0);
325 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
326 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
328 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
329 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
330 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
332 /**************************
333 * CALCULATE INTERACTIONS *
334 **************************/
336 /* REACTION-FIELD ELECTROSTATICS */
337 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
338 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
340 /* Update potential sum for this i atom from the interaction with this j atom. */
341 velecsum = _mm_add_pd(velecsum,velec);
345 /* Update vectorial force */
346 fix0 = _mm_macc_pd(dx02,fscal,fix0);
347 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
348 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
350 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
351 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
352 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
358 /* REACTION-FIELD ELECTROSTATICS */
359 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
360 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
362 /* Update potential sum for this i atom from the interaction with this j atom. */
363 velecsum = _mm_add_pd(velecsum,velec);
367 /* Update vectorial force */
368 fix1 = _mm_macc_pd(dx10,fscal,fix1);
369 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
370 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
372 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
373 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
374 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
376 /**************************
377 * CALCULATE INTERACTIONS *
378 **************************/
380 /* REACTION-FIELD ELECTROSTATICS */
381 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
382 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
384 /* Update potential sum for this i atom from the interaction with this j atom. */
385 velecsum = _mm_add_pd(velecsum,velec);
389 /* Update vectorial force */
390 fix1 = _mm_macc_pd(dx11,fscal,fix1);
391 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
392 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
394 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
395 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
396 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
398 /**************************
399 * CALCULATE INTERACTIONS *
400 **************************/
402 /* REACTION-FIELD ELECTROSTATICS */
403 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
404 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
406 /* Update potential sum for this i atom from the interaction with this j atom. */
407 velecsum = _mm_add_pd(velecsum,velec);
411 /* Update vectorial force */
412 fix1 = _mm_macc_pd(dx12,fscal,fix1);
413 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
414 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
416 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
417 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
418 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* REACTION-FIELD ELECTROSTATICS */
425 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
426 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
428 /* Update potential sum for this i atom from the interaction with this j atom. */
429 velecsum = _mm_add_pd(velecsum,velec);
433 /* Update vectorial force */
434 fix2 = _mm_macc_pd(dx20,fscal,fix2);
435 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
436 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
438 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
439 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
440 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
442 /**************************
443 * CALCULATE INTERACTIONS *
444 **************************/
446 /* REACTION-FIELD ELECTROSTATICS */
447 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
448 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
450 /* Update potential sum for this i atom from the interaction with this j atom. */
451 velecsum = _mm_add_pd(velecsum,velec);
455 /* Update vectorial force */
456 fix2 = _mm_macc_pd(dx21,fscal,fix2);
457 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
458 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
460 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
461 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
462 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
464 /**************************
465 * CALCULATE INTERACTIONS *
466 **************************/
468 /* REACTION-FIELD ELECTROSTATICS */
469 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
470 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
472 /* Update potential sum for this i atom from the interaction with this j atom. */
473 velecsum = _mm_add_pd(velecsum,velec);
477 /* Update vectorial force */
478 fix2 = _mm_macc_pd(dx22,fscal,fix2);
479 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
480 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
482 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
483 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
484 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
486 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
488 /* Inner loop uses 327 flops */
495 j_coord_offsetA = DIM*jnrA;
497 /* load j atom coordinates */
498 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
499 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
501 /* Calculate displacement vector */
502 dx00 = _mm_sub_pd(ix0,jx0);
503 dy00 = _mm_sub_pd(iy0,jy0);
504 dz00 = _mm_sub_pd(iz0,jz0);
505 dx01 = _mm_sub_pd(ix0,jx1);
506 dy01 = _mm_sub_pd(iy0,jy1);
507 dz01 = _mm_sub_pd(iz0,jz1);
508 dx02 = _mm_sub_pd(ix0,jx2);
509 dy02 = _mm_sub_pd(iy0,jy2);
510 dz02 = _mm_sub_pd(iz0,jz2);
511 dx10 = _mm_sub_pd(ix1,jx0);
512 dy10 = _mm_sub_pd(iy1,jy0);
513 dz10 = _mm_sub_pd(iz1,jz0);
514 dx11 = _mm_sub_pd(ix1,jx1);
515 dy11 = _mm_sub_pd(iy1,jy1);
516 dz11 = _mm_sub_pd(iz1,jz1);
517 dx12 = _mm_sub_pd(ix1,jx2);
518 dy12 = _mm_sub_pd(iy1,jy2);
519 dz12 = _mm_sub_pd(iz1,jz2);
520 dx20 = _mm_sub_pd(ix2,jx0);
521 dy20 = _mm_sub_pd(iy2,jy0);
522 dz20 = _mm_sub_pd(iz2,jz0);
523 dx21 = _mm_sub_pd(ix2,jx1);
524 dy21 = _mm_sub_pd(iy2,jy1);
525 dz21 = _mm_sub_pd(iz2,jz1);
526 dx22 = _mm_sub_pd(ix2,jx2);
527 dy22 = _mm_sub_pd(iy2,jy2);
528 dz22 = _mm_sub_pd(iz2,jz2);
530 /* Calculate squared distance and things based on it */
531 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
532 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
533 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
534 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
535 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
536 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
537 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
538 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
539 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
541 rinv00 = avx128fma_invsqrt_d(rsq00);
542 rinv01 = avx128fma_invsqrt_d(rsq01);
543 rinv02 = avx128fma_invsqrt_d(rsq02);
544 rinv10 = avx128fma_invsqrt_d(rsq10);
545 rinv11 = avx128fma_invsqrt_d(rsq11);
546 rinv12 = avx128fma_invsqrt_d(rsq12);
547 rinv20 = avx128fma_invsqrt_d(rsq20);
548 rinv21 = avx128fma_invsqrt_d(rsq21);
549 rinv22 = avx128fma_invsqrt_d(rsq22);
551 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
552 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
553 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
554 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
555 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
556 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
557 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
558 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
559 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
561 fjx0 = _mm_setzero_pd();
562 fjy0 = _mm_setzero_pd();
563 fjz0 = _mm_setzero_pd();
564 fjx1 = _mm_setzero_pd();
565 fjy1 = _mm_setzero_pd();
566 fjz1 = _mm_setzero_pd();
567 fjx2 = _mm_setzero_pd();
568 fjy2 = _mm_setzero_pd();
569 fjz2 = _mm_setzero_pd();
571 /**************************
572 * CALCULATE INTERACTIONS *
573 **************************/
575 /* REACTION-FIELD ELECTROSTATICS */
576 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
577 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
579 /* LENNARD-JONES DISPERSION/REPULSION */
581 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
582 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
583 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
584 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
585 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
587 /* Update potential sum for this i atom from the interaction with this j atom. */
588 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
589 velecsum = _mm_add_pd(velecsum,velec);
590 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
591 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
593 fscal = _mm_add_pd(felec,fvdw);
595 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
597 /* Update vectorial force */
598 fix0 = _mm_macc_pd(dx00,fscal,fix0);
599 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
600 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
602 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
603 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
604 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
606 /**************************
607 * CALCULATE INTERACTIONS *
608 **************************/
610 /* REACTION-FIELD ELECTROSTATICS */
611 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
612 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
614 /* Update potential sum for this i atom from the interaction with this j atom. */
615 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
616 velecsum = _mm_add_pd(velecsum,velec);
620 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
622 /* Update vectorial force */
623 fix0 = _mm_macc_pd(dx01,fscal,fix0);
624 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
625 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
627 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
628 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
629 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
631 /**************************
632 * CALCULATE INTERACTIONS *
633 **************************/
635 /* REACTION-FIELD ELECTROSTATICS */
636 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
637 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
639 /* Update potential sum for this i atom from the interaction with this j atom. */
640 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
641 velecsum = _mm_add_pd(velecsum,velec);
645 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
647 /* Update vectorial force */
648 fix0 = _mm_macc_pd(dx02,fscal,fix0);
649 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
650 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
652 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
653 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
654 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
656 /**************************
657 * CALCULATE INTERACTIONS *
658 **************************/
660 /* REACTION-FIELD ELECTROSTATICS */
661 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
662 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
664 /* Update potential sum for this i atom from the interaction with this j atom. */
665 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
666 velecsum = _mm_add_pd(velecsum,velec);
670 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
672 /* Update vectorial force */
673 fix1 = _mm_macc_pd(dx10,fscal,fix1);
674 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
675 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
677 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
678 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
679 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
681 /**************************
682 * CALCULATE INTERACTIONS *
683 **************************/
685 /* REACTION-FIELD ELECTROSTATICS */
686 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
687 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
689 /* Update potential sum for this i atom from the interaction with this j atom. */
690 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
691 velecsum = _mm_add_pd(velecsum,velec);
695 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
697 /* Update vectorial force */
698 fix1 = _mm_macc_pd(dx11,fscal,fix1);
699 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
700 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
702 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
703 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
704 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
706 /**************************
707 * CALCULATE INTERACTIONS *
708 **************************/
710 /* REACTION-FIELD ELECTROSTATICS */
711 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
712 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
714 /* Update potential sum for this i atom from the interaction with this j atom. */
715 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
716 velecsum = _mm_add_pd(velecsum,velec);
720 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
722 /* Update vectorial force */
723 fix1 = _mm_macc_pd(dx12,fscal,fix1);
724 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
725 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
727 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
728 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
729 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
731 /**************************
732 * CALCULATE INTERACTIONS *
733 **************************/
735 /* REACTION-FIELD ELECTROSTATICS */
736 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
737 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
739 /* Update potential sum for this i atom from the interaction with this j atom. */
740 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
741 velecsum = _mm_add_pd(velecsum,velec);
745 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
747 /* Update vectorial force */
748 fix2 = _mm_macc_pd(dx20,fscal,fix2);
749 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
750 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
752 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
753 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
754 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
756 /**************************
757 * CALCULATE INTERACTIONS *
758 **************************/
760 /* REACTION-FIELD ELECTROSTATICS */
761 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
762 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
764 /* Update potential sum for this i atom from the interaction with this j atom. */
765 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
766 velecsum = _mm_add_pd(velecsum,velec);
770 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
772 /* Update vectorial force */
773 fix2 = _mm_macc_pd(dx21,fscal,fix2);
774 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
775 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
777 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
778 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
779 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
781 /**************************
782 * CALCULATE INTERACTIONS *
783 **************************/
785 /* REACTION-FIELD ELECTROSTATICS */
786 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
787 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
789 /* Update potential sum for this i atom from the interaction with this j atom. */
790 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
791 velecsum = _mm_add_pd(velecsum,velec);
795 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
797 /* Update vectorial force */
798 fix2 = _mm_macc_pd(dx22,fscal,fix2);
799 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
800 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
802 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
803 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
804 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
806 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
808 /* Inner loop uses 327 flops */
811 /* End of innermost loop */
813 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
814 f+i_coord_offset,fshift+i_shift_offset);
817 /* Update potential energies */
818 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
819 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
821 /* Increment number of inner iterations */
822 inneriter += j_index_end - j_index_start;
824 /* Outer loop uses 20 flops */
827 /* Increment number of outer iterations */
830 /* Update outer/inner flops */
832 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*327);
835 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
836 * Electrostatics interaction: ReactionField
837 * VdW interaction: LennardJones
838 * Geometry: Water3-Water3
839 * Calculate force/pot: Force
842 nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
843 (t_nblist * gmx_restrict nlist,
844 rvec * gmx_restrict xx,
845 rvec * gmx_restrict ff,
846 struct t_forcerec * gmx_restrict fr,
847 t_mdatoms * gmx_restrict mdatoms,
848 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
849 t_nrnb * gmx_restrict nrnb)
851 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
852 * just 0 for non-waters.
853 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
854 * jnr indices corresponding to data put in the four positions in the SIMD register.
856 int i_shift_offset,i_coord_offset,outeriter,inneriter;
857 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
859 int j_coord_offsetA,j_coord_offsetB;
860 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
862 real *shiftvec,*fshift,*x,*f;
863 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
865 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
867 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
869 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
870 int vdwjidx0A,vdwjidx0B;
871 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
872 int vdwjidx1A,vdwjidx1B;
873 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
874 int vdwjidx2A,vdwjidx2B;
875 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
876 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
877 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
878 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
879 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
880 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
881 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
882 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
883 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
884 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
885 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
888 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
891 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
892 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
893 __m128d dummy_mask,cutoff_mask;
894 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
895 __m128d one = _mm_set1_pd(1.0);
896 __m128d two = _mm_set1_pd(2.0);
902 jindex = nlist->jindex;
904 shiftidx = nlist->shift;
906 shiftvec = fr->shift_vec[0];
907 fshift = fr->fshift[0];
908 facel = _mm_set1_pd(fr->ic->epsfac);
909 charge = mdatoms->chargeA;
910 krf = _mm_set1_pd(fr->ic->k_rf);
911 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
912 crf = _mm_set1_pd(fr->ic->c_rf);
913 nvdwtype = fr->ntype;
915 vdwtype = mdatoms->typeA;
917 /* Setup water-specific parameters */
918 inr = nlist->iinr[0];
919 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
920 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
921 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
922 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
924 jq0 = _mm_set1_pd(charge[inr+0]);
925 jq1 = _mm_set1_pd(charge[inr+1]);
926 jq2 = _mm_set1_pd(charge[inr+2]);
927 vdwjidx0A = 2*vdwtype[inr+0];
928 qq00 = _mm_mul_pd(iq0,jq0);
929 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
930 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
931 qq01 = _mm_mul_pd(iq0,jq1);
932 qq02 = _mm_mul_pd(iq0,jq2);
933 qq10 = _mm_mul_pd(iq1,jq0);
934 qq11 = _mm_mul_pd(iq1,jq1);
935 qq12 = _mm_mul_pd(iq1,jq2);
936 qq20 = _mm_mul_pd(iq2,jq0);
937 qq21 = _mm_mul_pd(iq2,jq1);
938 qq22 = _mm_mul_pd(iq2,jq2);
940 /* Avoid stupid compiler warnings */
948 /* Start outer loop over neighborlists */
949 for(iidx=0; iidx<nri; iidx++)
951 /* Load shift vector for this list */
952 i_shift_offset = DIM*shiftidx[iidx];
954 /* Load limits for loop over neighbors */
955 j_index_start = jindex[iidx];
956 j_index_end = jindex[iidx+1];
958 /* Get outer coordinate index */
960 i_coord_offset = DIM*inr;
962 /* Load i particle coords and add shift vector */
963 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
964 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
966 fix0 = _mm_setzero_pd();
967 fiy0 = _mm_setzero_pd();
968 fiz0 = _mm_setzero_pd();
969 fix1 = _mm_setzero_pd();
970 fiy1 = _mm_setzero_pd();
971 fiz1 = _mm_setzero_pd();
972 fix2 = _mm_setzero_pd();
973 fiy2 = _mm_setzero_pd();
974 fiz2 = _mm_setzero_pd();
976 /* Start inner kernel loop */
977 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
980 /* Get j neighbor index, and coordinate index */
983 j_coord_offsetA = DIM*jnrA;
984 j_coord_offsetB = DIM*jnrB;
986 /* load j atom coordinates */
987 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
988 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
990 /* Calculate displacement vector */
991 dx00 = _mm_sub_pd(ix0,jx0);
992 dy00 = _mm_sub_pd(iy0,jy0);
993 dz00 = _mm_sub_pd(iz0,jz0);
994 dx01 = _mm_sub_pd(ix0,jx1);
995 dy01 = _mm_sub_pd(iy0,jy1);
996 dz01 = _mm_sub_pd(iz0,jz1);
997 dx02 = _mm_sub_pd(ix0,jx2);
998 dy02 = _mm_sub_pd(iy0,jy2);
999 dz02 = _mm_sub_pd(iz0,jz2);
1000 dx10 = _mm_sub_pd(ix1,jx0);
1001 dy10 = _mm_sub_pd(iy1,jy0);
1002 dz10 = _mm_sub_pd(iz1,jz0);
1003 dx11 = _mm_sub_pd(ix1,jx1);
1004 dy11 = _mm_sub_pd(iy1,jy1);
1005 dz11 = _mm_sub_pd(iz1,jz1);
1006 dx12 = _mm_sub_pd(ix1,jx2);
1007 dy12 = _mm_sub_pd(iy1,jy2);
1008 dz12 = _mm_sub_pd(iz1,jz2);
1009 dx20 = _mm_sub_pd(ix2,jx0);
1010 dy20 = _mm_sub_pd(iy2,jy0);
1011 dz20 = _mm_sub_pd(iz2,jz0);
1012 dx21 = _mm_sub_pd(ix2,jx1);
1013 dy21 = _mm_sub_pd(iy2,jy1);
1014 dz21 = _mm_sub_pd(iz2,jz1);
1015 dx22 = _mm_sub_pd(ix2,jx2);
1016 dy22 = _mm_sub_pd(iy2,jy2);
1017 dz22 = _mm_sub_pd(iz2,jz2);
1019 /* Calculate squared distance and things based on it */
1020 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1021 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1022 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1023 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1024 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1025 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1026 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1027 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1028 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1030 rinv00 = avx128fma_invsqrt_d(rsq00);
1031 rinv01 = avx128fma_invsqrt_d(rsq01);
1032 rinv02 = avx128fma_invsqrt_d(rsq02);
1033 rinv10 = avx128fma_invsqrt_d(rsq10);
1034 rinv11 = avx128fma_invsqrt_d(rsq11);
1035 rinv12 = avx128fma_invsqrt_d(rsq12);
1036 rinv20 = avx128fma_invsqrt_d(rsq20);
1037 rinv21 = avx128fma_invsqrt_d(rsq21);
1038 rinv22 = avx128fma_invsqrt_d(rsq22);
1040 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1041 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1042 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1043 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1044 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1045 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1046 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1047 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1048 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1050 fjx0 = _mm_setzero_pd();
1051 fjy0 = _mm_setzero_pd();
1052 fjz0 = _mm_setzero_pd();
1053 fjx1 = _mm_setzero_pd();
1054 fjy1 = _mm_setzero_pd();
1055 fjz1 = _mm_setzero_pd();
1056 fjx2 = _mm_setzero_pd();
1057 fjy2 = _mm_setzero_pd();
1058 fjz2 = _mm_setzero_pd();
1060 /**************************
1061 * CALCULATE INTERACTIONS *
1062 **************************/
1064 /* REACTION-FIELD ELECTROSTATICS */
1065 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1067 /* LENNARD-JONES DISPERSION/REPULSION */
1069 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1070 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1072 fscal = _mm_add_pd(felec,fvdw);
1074 /* Update vectorial force */
1075 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1076 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1077 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1079 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1080 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1081 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1083 /**************************
1084 * CALCULATE INTERACTIONS *
1085 **************************/
1087 /* REACTION-FIELD ELECTROSTATICS */
1088 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1092 /* Update vectorial force */
1093 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1094 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1095 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1097 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1098 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1099 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1101 /**************************
1102 * CALCULATE INTERACTIONS *
1103 **************************/
1105 /* REACTION-FIELD ELECTROSTATICS */
1106 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1110 /* Update vectorial force */
1111 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1112 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1113 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1115 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1116 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1117 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1119 /**************************
1120 * CALCULATE INTERACTIONS *
1121 **************************/
1123 /* REACTION-FIELD ELECTROSTATICS */
1124 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1128 /* Update vectorial force */
1129 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1130 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1131 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1133 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1134 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1135 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1137 /**************************
1138 * CALCULATE INTERACTIONS *
1139 **************************/
1141 /* REACTION-FIELD ELECTROSTATICS */
1142 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1146 /* Update vectorial force */
1147 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1148 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1149 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1151 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1152 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1153 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1155 /**************************
1156 * CALCULATE INTERACTIONS *
1157 **************************/
1159 /* REACTION-FIELD ELECTROSTATICS */
1160 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1164 /* Update vectorial force */
1165 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1166 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1167 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1169 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1170 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1171 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1173 /**************************
1174 * CALCULATE INTERACTIONS *
1175 **************************/
1177 /* REACTION-FIELD ELECTROSTATICS */
1178 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1182 /* Update vectorial force */
1183 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1184 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1185 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1187 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1188 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1189 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1191 /**************************
1192 * CALCULATE INTERACTIONS *
1193 **************************/
1195 /* REACTION-FIELD ELECTROSTATICS */
1196 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1200 /* Update vectorial force */
1201 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1202 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1203 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1205 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1206 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1207 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1209 /**************************
1210 * CALCULATE INTERACTIONS *
1211 **************************/
1213 /* REACTION-FIELD ELECTROSTATICS */
1214 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1218 /* Update vectorial force */
1219 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1220 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1221 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1223 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1224 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1225 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1227 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1229 /* Inner loop uses 277 flops */
1232 if(jidx<j_index_end)
1236 j_coord_offsetA = DIM*jnrA;
1238 /* load j atom coordinates */
1239 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
1240 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1242 /* Calculate displacement vector */
1243 dx00 = _mm_sub_pd(ix0,jx0);
1244 dy00 = _mm_sub_pd(iy0,jy0);
1245 dz00 = _mm_sub_pd(iz0,jz0);
1246 dx01 = _mm_sub_pd(ix0,jx1);
1247 dy01 = _mm_sub_pd(iy0,jy1);
1248 dz01 = _mm_sub_pd(iz0,jz1);
1249 dx02 = _mm_sub_pd(ix0,jx2);
1250 dy02 = _mm_sub_pd(iy0,jy2);
1251 dz02 = _mm_sub_pd(iz0,jz2);
1252 dx10 = _mm_sub_pd(ix1,jx0);
1253 dy10 = _mm_sub_pd(iy1,jy0);
1254 dz10 = _mm_sub_pd(iz1,jz0);
1255 dx11 = _mm_sub_pd(ix1,jx1);
1256 dy11 = _mm_sub_pd(iy1,jy1);
1257 dz11 = _mm_sub_pd(iz1,jz1);
1258 dx12 = _mm_sub_pd(ix1,jx2);
1259 dy12 = _mm_sub_pd(iy1,jy2);
1260 dz12 = _mm_sub_pd(iz1,jz2);
1261 dx20 = _mm_sub_pd(ix2,jx0);
1262 dy20 = _mm_sub_pd(iy2,jy0);
1263 dz20 = _mm_sub_pd(iz2,jz0);
1264 dx21 = _mm_sub_pd(ix2,jx1);
1265 dy21 = _mm_sub_pd(iy2,jy1);
1266 dz21 = _mm_sub_pd(iz2,jz1);
1267 dx22 = _mm_sub_pd(ix2,jx2);
1268 dy22 = _mm_sub_pd(iy2,jy2);
1269 dz22 = _mm_sub_pd(iz2,jz2);
1271 /* Calculate squared distance and things based on it */
1272 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1273 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1274 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1275 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1276 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1277 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1278 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1279 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1280 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1282 rinv00 = avx128fma_invsqrt_d(rsq00);
1283 rinv01 = avx128fma_invsqrt_d(rsq01);
1284 rinv02 = avx128fma_invsqrt_d(rsq02);
1285 rinv10 = avx128fma_invsqrt_d(rsq10);
1286 rinv11 = avx128fma_invsqrt_d(rsq11);
1287 rinv12 = avx128fma_invsqrt_d(rsq12);
1288 rinv20 = avx128fma_invsqrt_d(rsq20);
1289 rinv21 = avx128fma_invsqrt_d(rsq21);
1290 rinv22 = avx128fma_invsqrt_d(rsq22);
1292 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1293 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1294 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1295 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1296 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1297 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1298 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1299 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1300 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1302 fjx0 = _mm_setzero_pd();
1303 fjy0 = _mm_setzero_pd();
1304 fjz0 = _mm_setzero_pd();
1305 fjx1 = _mm_setzero_pd();
1306 fjy1 = _mm_setzero_pd();
1307 fjz1 = _mm_setzero_pd();
1308 fjx2 = _mm_setzero_pd();
1309 fjy2 = _mm_setzero_pd();
1310 fjz2 = _mm_setzero_pd();
1312 /**************************
1313 * CALCULATE INTERACTIONS *
1314 **************************/
1316 /* REACTION-FIELD ELECTROSTATICS */
1317 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1319 /* LENNARD-JONES DISPERSION/REPULSION */
1321 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1322 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1324 fscal = _mm_add_pd(felec,fvdw);
1326 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1328 /* Update vectorial force */
1329 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1330 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1331 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1333 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1334 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1335 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1337 /**************************
1338 * CALCULATE INTERACTIONS *
1339 **************************/
1341 /* REACTION-FIELD ELECTROSTATICS */
1342 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1346 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1348 /* Update vectorial force */
1349 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1350 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1351 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1353 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1354 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1355 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1357 /**************************
1358 * CALCULATE INTERACTIONS *
1359 **************************/
1361 /* REACTION-FIELD ELECTROSTATICS */
1362 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1366 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1368 /* Update vectorial force */
1369 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1370 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1371 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1373 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1374 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1375 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1377 /**************************
1378 * CALCULATE INTERACTIONS *
1379 **************************/
1381 /* REACTION-FIELD ELECTROSTATICS */
1382 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1386 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1388 /* Update vectorial force */
1389 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1390 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1391 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1393 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1394 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1395 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1397 /**************************
1398 * CALCULATE INTERACTIONS *
1399 **************************/
1401 /* REACTION-FIELD ELECTROSTATICS */
1402 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1406 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1408 /* Update vectorial force */
1409 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1410 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1411 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1413 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1414 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1415 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1417 /**************************
1418 * CALCULATE INTERACTIONS *
1419 **************************/
1421 /* REACTION-FIELD ELECTROSTATICS */
1422 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1426 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1428 /* Update vectorial force */
1429 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1430 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1431 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1433 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1434 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1435 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1437 /**************************
1438 * CALCULATE INTERACTIONS *
1439 **************************/
1441 /* REACTION-FIELD ELECTROSTATICS */
1442 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1446 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1448 /* Update vectorial force */
1449 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1450 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1451 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1453 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1454 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1455 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1457 /**************************
1458 * CALCULATE INTERACTIONS *
1459 **************************/
1461 /* REACTION-FIELD ELECTROSTATICS */
1462 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1466 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1468 /* Update vectorial force */
1469 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1470 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1471 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1473 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1474 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1475 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1477 /**************************
1478 * CALCULATE INTERACTIONS *
1479 **************************/
1481 /* REACTION-FIELD ELECTROSTATICS */
1482 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1486 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1488 /* Update vectorial force */
1489 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1490 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1491 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1493 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1494 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1495 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1497 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1499 /* Inner loop uses 277 flops */
1502 /* End of innermost loop */
1504 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1505 f+i_coord_offset,fshift+i_shift_offset);
1507 /* Increment number of inner iterations */
1508 inneriter += j_index_end - j_index_start;
1510 /* Outer loop uses 18 flops */
1513 /* Increment number of outer iterations */
1516 /* Update outer/inner flops */
1518 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*277);