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_single kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_x86_avx_128_fma_single.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_VF_avx_128_fma_single
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_VF_avx_128_fma_single
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,C,D refer to j loop unrolling done with AVX_128, e.g. for the four 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;
73 int jnrA,jnrB,jnrC,jnrD;
74 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
75 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
76 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
78 real *shiftvec,*fshift,*x,*f;
79 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
81 __m128 fscal,rcutoff,rcutoff2,jidxall;
83 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
85 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
87 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
88 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
89 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
90 int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D;
91 __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
92 int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D;
93 __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
94 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
95 __m128 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
96 __m128 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
97 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
98 __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
99 __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
100 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
101 __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
102 __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
103 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
106 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
109 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
110 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
112 __m128i ifour = _mm_set1_epi32(4);
113 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
115 __m128 dummy_mask,cutoff_mask;
116 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
117 __m128 one = _mm_set1_ps(1.0);
118 __m128 two = _mm_set1_ps(2.0);
124 jindex = nlist->jindex;
126 shiftidx = nlist->shift;
128 shiftvec = fr->shift_vec[0];
129 fshift = fr->fshift[0];
130 facel = _mm_set1_ps(fr->ic->epsfac);
131 charge = mdatoms->chargeA;
132 krf = _mm_set1_ps(fr->ic->k_rf);
133 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
134 crf = _mm_set1_ps(fr->ic->c_rf);
135 nvdwtype = fr->ntype;
137 vdwtype = mdatoms->typeA;
139 vftab = kernel_data->table_vdw->data;
140 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
142 /* Setup water-specific parameters */
143 inr = nlist->iinr[0];
144 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
145 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
146 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
147 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
149 jq0 = _mm_set1_ps(charge[inr+0]);
150 jq1 = _mm_set1_ps(charge[inr+1]);
151 jq2 = _mm_set1_ps(charge[inr+2]);
152 vdwjidx0A = 2*vdwtype[inr+0];
153 qq00 = _mm_mul_ps(iq0,jq0);
154 c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]);
155 c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]);
156 qq01 = _mm_mul_ps(iq0,jq1);
157 qq02 = _mm_mul_ps(iq0,jq2);
158 qq10 = _mm_mul_ps(iq1,jq0);
159 qq11 = _mm_mul_ps(iq1,jq1);
160 qq12 = _mm_mul_ps(iq1,jq2);
161 qq20 = _mm_mul_ps(iq2,jq0);
162 qq21 = _mm_mul_ps(iq2,jq1);
163 qq22 = _mm_mul_ps(iq2,jq2);
165 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
166 rcutoff_scalar = fr->ic->rcoulomb;
167 rcutoff = _mm_set1_ps(rcutoff_scalar);
168 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
170 /* Avoid stupid compiler warnings */
171 jnrA = jnrB = jnrC = jnrD = 0;
180 for(iidx=0;iidx<4*DIM;iidx++)
185 /* Start outer loop over neighborlists */
186 for(iidx=0; iidx<nri; iidx++)
188 /* Load shift vector for this list */
189 i_shift_offset = DIM*shiftidx[iidx];
191 /* Load limits for loop over neighbors */
192 j_index_start = jindex[iidx];
193 j_index_end = jindex[iidx+1];
195 /* Get outer coordinate index */
197 i_coord_offset = DIM*inr;
199 /* Load i particle coords and add shift vector */
200 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
201 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
203 fix0 = _mm_setzero_ps();
204 fiy0 = _mm_setzero_ps();
205 fiz0 = _mm_setzero_ps();
206 fix1 = _mm_setzero_ps();
207 fiy1 = _mm_setzero_ps();
208 fiz1 = _mm_setzero_ps();
209 fix2 = _mm_setzero_ps();
210 fiy2 = _mm_setzero_ps();
211 fiz2 = _mm_setzero_ps();
213 /* Reset potential sums */
214 velecsum = _mm_setzero_ps();
215 vvdwsum = _mm_setzero_ps();
217 /* Start inner kernel loop */
218 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
221 /* Get j neighbor index, and coordinate index */
226 j_coord_offsetA = DIM*jnrA;
227 j_coord_offsetB = DIM*jnrB;
228 j_coord_offsetC = DIM*jnrC;
229 j_coord_offsetD = DIM*jnrD;
231 /* load j atom coordinates */
232 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
233 x+j_coord_offsetC,x+j_coord_offsetD,
234 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
236 /* Calculate displacement vector */
237 dx00 = _mm_sub_ps(ix0,jx0);
238 dy00 = _mm_sub_ps(iy0,jy0);
239 dz00 = _mm_sub_ps(iz0,jz0);
240 dx01 = _mm_sub_ps(ix0,jx1);
241 dy01 = _mm_sub_ps(iy0,jy1);
242 dz01 = _mm_sub_ps(iz0,jz1);
243 dx02 = _mm_sub_ps(ix0,jx2);
244 dy02 = _mm_sub_ps(iy0,jy2);
245 dz02 = _mm_sub_ps(iz0,jz2);
246 dx10 = _mm_sub_ps(ix1,jx0);
247 dy10 = _mm_sub_ps(iy1,jy0);
248 dz10 = _mm_sub_ps(iz1,jz0);
249 dx11 = _mm_sub_ps(ix1,jx1);
250 dy11 = _mm_sub_ps(iy1,jy1);
251 dz11 = _mm_sub_ps(iz1,jz1);
252 dx12 = _mm_sub_ps(ix1,jx2);
253 dy12 = _mm_sub_ps(iy1,jy2);
254 dz12 = _mm_sub_ps(iz1,jz2);
255 dx20 = _mm_sub_ps(ix2,jx0);
256 dy20 = _mm_sub_ps(iy2,jy0);
257 dz20 = _mm_sub_ps(iz2,jz0);
258 dx21 = _mm_sub_ps(ix2,jx1);
259 dy21 = _mm_sub_ps(iy2,jy1);
260 dz21 = _mm_sub_ps(iz2,jz1);
261 dx22 = _mm_sub_ps(ix2,jx2);
262 dy22 = _mm_sub_ps(iy2,jy2);
263 dz22 = _mm_sub_ps(iz2,jz2);
265 /* Calculate squared distance and things based on it */
266 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
267 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
268 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
269 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
270 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
271 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
272 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
273 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
274 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
276 rinv00 = avx128fma_invsqrt_f(rsq00);
277 rinv01 = avx128fma_invsqrt_f(rsq01);
278 rinv02 = avx128fma_invsqrt_f(rsq02);
279 rinv10 = avx128fma_invsqrt_f(rsq10);
280 rinv11 = avx128fma_invsqrt_f(rsq11);
281 rinv12 = avx128fma_invsqrt_f(rsq12);
282 rinv20 = avx128fma_invsqrt_f(rsq20);
283 rinv21 = avx128fma_invsqrt_f(rsq21);
284 rinv22 = avx128fma_invsqrt_f(rsq22);
286 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
287 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
288 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
289 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
290 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
291 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
292 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
293 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
294 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
296 fjx0 = _mm_setzero_ps();
297 fjy0 = _mm_setzero_ps();
298 fjz0 = _mm_setzero_ps();
299 fjx1 = _mm_setzero_ps();
300 fjy1 = _mm_setzero_ps();
301 fjz1 = _mm_setzero_ps();
302 fjx2 = _mm_setzero_ps();
303 fjy2 = _mm_setzero_ps();
304 fjz2 = _mm_setzero_ps();
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 if (gmx_mm_any_lt(rsq00,rcutoff2))
313 r00 = _mm_mul_ps(rsq00,rinv00);
315 /* Calculate table index by multiplying r with table scale and truncate to integer */
316 rt = _mm_mul_ps(r00,vftabscale);
317 vfitab = _mm_cvttps_epi32(rt);
319 vfeps = _mm_frcz_ps(rt);
321 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
323 twovfeps = _mm_add_ps(vfeps,vfeps);
324 vfitab = _mm_slli_epi32(vfitab,3);
326 /* REACTION-FIELD ELECTROSTATICS */
327 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
328 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
330 /* CUBIC SPLINE TABLE DISPERSION */
331 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
332 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
333 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
334 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
335 _MM_TRANSPOSE4_PS(Y,F,G,H);
336 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
337 VV = _mm_macc_ps(vfeps,Fp,Y);
338 vvdw6 = _mm_mul_ps(c6_00,VV);
339 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
340 fvdw6 = _mm_mul_ps(c6_00,FF);
342 /* CUBIC SPLINE TABLE REPULSION */
343 vfitab = _mm_add_epi32(vfitab,ifour);
344 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
345 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
346 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
347 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
348 _MM_TRANSPOSE4_PS(Y,F,G,H);
349 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
350 VV = _mm_macc_ps(vfeps,Fp,Y);
351 vvdw12 = _mm_mul_ps(c12_00,VV);
352 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
353 fvdw12 = _mm_mul_ps(c12_00,FF);
354 vvdw = _mm_add_ps(vvdw12,vvdw6);
355 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
357 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
359 /* Update potential sum for this i atom from the interaction with this j atom. */
360 velec = _mm_and_ps(velec,cutoff_mask);
361 velecsum = _mm_add_ps(velecsum,velec);
362 vvdw = _mm_and_ps(vvdw,cutoff_mask);
363 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
365 fscal = _mm_add_ps(felec,fvdw);
367 fscal = _mm_and_ps(fscal,cutoff_mask);
369 /* Update vectorial force */
370 fix0 = _mm_macc_ps(dx00,fscal,fix0);
371 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
372 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
374 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
375 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
376 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
380 /**************************
381 * CALCULATE INTERACTIONS *
382 **************************/
384 if (gmx_mm_any_lt(rsq01,rcutoff2))
387 /* REACTION-FIELD ELECTROSTATICS */
388 velec = _mm_mul_ps(qq01,_mm_sub_ps(_mm_macc_ps(krf,rsq01,rinv01),crf));
389 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
391 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
393 /* Update potential sum for this i atom from the interaction with this j atom. */
394 velec = _mm_and_ps(velec,cutoff_mask);
395 velecsum = _mm_add_ps(velecsum,velec);
399 fscal = _mm_and_ps(fscal,cutoff_mask);
401 /* Update vectorial force */
402 fix0 = _mm_macc_ps(dx01,fscal,fix0);
403 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
404 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
406 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
407 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
408 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
412 /**************************
413 * CALCULATE INTERACTIONS *
414 **************************/
416 if (gmx_mm_any_lt(rsq02,rcutoff2))
419 /* REACTION-FIELD ELECTROSTATICS */
420 velec = _mm_mul_ps(qq02,_mm_sub_ps(_mm_macc_ps(krf,rsq02,rinv02),crf));
421 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
423 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
425 /* Update potential sum for this i atom from the interaction with this j atom. */
426 velec = _mm_and_ps(velec,cutoff_mask);
427 velecsum = _mm_add_ps(velecsum,velec);
431 fscal = _mm_and_ps(fscal,cutoff_mask);
433 /* Update vectorial force */
434 fix0 = _mm_macc_ps(dx02,fscal,fix0);
435 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
436 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
438 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
439 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
440 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
444 /**************************
445 * CALCULATE INTERACTIONS *
446 **************************/
448 if (gmx_mm_any_lt(rsq10,rcutoff2))
451 /* REACTION-FIELD ELECTROSTATICS */
452 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_macc_ps(krf,rsq10,rinv10),crf));
453 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
455 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
457 /* Update potential sum for this i atom from the interaction with this j atom. */
458 velec = _mm_and_ps(velec,cutoff_mask);
459 velecsum = _mm_add_ps(velecsum,velec);
463 fscal = _mm_and_ps(fscal,cutoff_mask);
465 /* Update vectorial force */
466 fix1 = _mm_macc_ps(dx10,fscal,fix1);
467 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
468 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
470 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
471 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
472 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
476 /**************************
477 * CALCULATE INTERACTIONS *
478 **************************/
480 if (gmx_mm_any_lt(rsq11,rcutoff2))
483 /* REACTION-FIELD ELECTROSTATICS */
484 velec = _mm_mul_ps(qq11,_mm_sub_ps(_mm_macc_ps(krf,rsq11,rinv11),crf));
485 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
487 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
489 /* Update potential sum for this i atom from the interaction with this j atom. */
490 velec = _mm_and_ps(velec,cutoff_mask);
491 velecsum = _mm_add_ps(velecsum,velec);
495 fscal = _mm_and_ps(fscal,cutoff_mask);
497 /* Update vectorial force */
498 fix1 = _mm_macc_ps(dx11,fscal,fix1);
499 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
500 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
502 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
503 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
504 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
508 /**************************
509 * CALCULATE INTERACTIONS *
510 **************************/
512 if (gmx_mm_any_lt(rsq12,rcutoff2))
515 /* REACTION-FIELD ELECTROSTATICS */
516 velec = _mm_mul_ps(qq12,_mm_sub_ps(_mm_macc_ps(krf,rsq12,rinv12),crf));
517 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
519 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
521 /* Update potential sum for this i atom from the interaction with this j atom. */
522 velec = _mm_and_ps(velec,cutoff_mask);
523 velecsum = _mm_add_ps(velecsum,velec);
527 fscal = _mm_and_ps(fscal,cutoff_mask);
529 /* Update vectorial force */
530 fix1 = _mm_macc_ps(dx12,fscal,fix1);
531 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
532 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
534 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
535 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
536 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
540 /**************************
541 * CALCULATE INTERACTIONS *
542 **************************/
544 if (gmx_mm_any_lt(rsq20,rcutoff2))
547 /* REACTION-FIELD ELECTROSTATICS */
548 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_macc_ps(krf,rsq20,rinv20),crf));
549 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
551 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
553 /* Update potential sum for this i atom from the interaction with this j atom. */
554 velec = _mm_and_ps(velec,cutoff_mask);
555 velecsum = _mm_add_ps(velecsum,velec);
559 fscal = _mm_and_ps(fscal,cutoff_mask);
561 /* Update vectorial force */
562 fix2 = _mm_macc_ps(dx20,fscal,fix2);
563 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
564 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
566 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
567 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
568 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
572 /**************************
573 * CALCULATE INTERACTIONS *
574 **************************/
576 if (gmx_mm_any_lt(rsq21,rcutoff2))
579 /* REACTION-FIELD ELECTROSTATICS */
580 velec = _mm_mul_ps(qq21,_mm_sub_ps(_mm_macc_ps(krf,rsq21,rinv21),crf));
581 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
583 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
585 /* Update potential sum for this i atom from the interaction with this j atom. */
586 velec = _mm_and_ps(velec,cutoff_mask);
587 velecsum = _mm_add_ps(velecsum,velec);
591 fscal = _mm_and_ps(fscal,cutoff_mask);
593 /* Update vectorial force */
594 fix2 = _mm_macc_ps(dx21,fscal,fix2);
595 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
596 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
598 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
599 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
600 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
604 /**************************
605 * CALCULATE INTERACTIONS *
606 **************************/
608 if (gmx_mm_any_lt(rsq22,rcutoff2))
611 /* REACTION-FIELD ELECTROSTATICS */
612 velec = _mm_mul_ps(qq22,_mm_sub_ps(_mm_macc_ps(krf,rsq22,rinv22),crf));
613 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
615 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
617 /* Update potential sum for this i atom from the interaction with this j atom. */
618 velec = _mm_and_ps(velec,cutoff_mask);
619 velecsum = _mm_add_ps(velecsum,velec);
623 fscal = _mm_and_ps(fscal,cutoff_mask);
625 /* Update vectorial force */
626 fix2 = _mm_macc_ps(dx22,fscal,fix2);
627 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
628 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
630 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
631 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
632 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
636 fjptrA = f+j_coord_offsetA;
637 fjptrB = f+j_coord_offsetB;
638 fjptrC = f+j_coord_offsetC;
639 fjptrD = f+j_coord_offsetD;
641 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
642 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
644 /* Inner loop uses 387 flops */
650 /* Get j neighbor index, and coordinate index */
651 jnrlistA = jjnr[jidx];
652 jnrlistB = jjnr[jidx+1];
653 jnrlistC = jjnr[jidx+2];
654 jnrlistD = jjnr[jidx+3];
655 /* Sign of each element will be negative for non-real atoms.
656 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
657 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
659 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
660 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
661 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
662 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
663 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
664 j_coord_offsetA = DIM*jnrA;
665 j_coord_offsetB = DIM*jnrB;
666 j_coord_offsetC = DIM*jnrC;
667 j_coord_offsetD = DIM*jnrD;
669 /* load j atom coordinates */
670 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
671 x+j_coord_offsetC,x+j_coord_offsetD,
672 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
674 /* Calculate displacement vector */
675 dx00 = _mm_sub_ps(ix0,jx0);
676 dy00 = _mm_sub_ps(iy0,jy0);
677 dz00 = _mm_sub_ps(iz0,jz0);
678 dx01 = _mm_sub_ps(ix0,jx1);
679 dy01 = _mm_sub_ps(iy0,jy1);
680 dz01 = _mm_sub_ps(iz0,jz1);
681 dx02 = _mm_sub_ps(ix0,jx2);
682 dy02 = _mm_sub_ps(iy0,jy2);
683 dz02 = _mm_sub_ps(iz0,jz2);
684 dx10 = _mm_sub_ps(ix1,jx0);
685 dy10 = _mm_sub_ps(iy1,jy0);
686 dz10 = _mm_sub_ps(iz1,jz0);
687 dx11 = _mm_sub_ps(ix1,jx1);
688 dy11 = _mm_sub_ps(iy1,jy1);
689 dz11 = _mm_sub_ps(iz1,jz1);
690 dx12 = _mm_sub_ps(ix1,jx2);
691 dy12 = _mm_sub_ps(iy1,jy2);
692 dz12 = _mm_sub_ps(iz1,jz2);
693 dx20 = _mm_sub_ps(ix2,jx0);
694 dy20 = _mm_sub_ps(iy2,jy0);
695 dz20 = _mm_sub_ps(iz2,jz0);
696 dx21 = _mm_sub_ps(ix2,jx1);
697 dy21 = _mm_sub_ps(iy2,jy1);
698 dz21 = _mm_sub_ps(iz2,jz1);
699 dx22 = _mm_sub_ps(ix2,jx2);
700 dy22 = _mm_sub_ps(iy2,jy2);
701 dz22 = _mm_sub_ps(iz2,jz2);
703 /* Calculate squared distance and things based on it */
704 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
705 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
706 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
707 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
708 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
709 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
710 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
711 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
712 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
714 rinv00 = avx128fma_invsqrt_f(rsq00);
715 rinv01 = avx128fma_invsqrt_f(rsq01);
716 rinv02 = avx128fma_invsqrt_f(rsq02);
717 rinv10 = avx128fma_invsqrt_f(rsq10);
718 rinv11 = avx128fma_invsqrt_f(rsq11);
719 rinv12 = avx128fma_invsqrt_f(rsq12);
720 rinv20 = avx128fma_invsqrt_f(rsq20);
721 rinv21 = avx128fma_invsqrt_f(rsq21);
722 rinv22 = avx128fma_invsqrt_f(rsq22);
724 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
725 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
726 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
727 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
728 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
729 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
730 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
731 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
732 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
734 fjx0 = _mm_setzero_ps();
735 fjy0 = _mm_setzero_ps();
736 fjz0 = _mm_setzero_ps();
737 fjx1 = _mm_setzero_ps();
738 fjy1 = _mm_setzero_ps();
739 fjz1 = _mm_setzero_ps();
740 fjx2 = _mm_setzero_ps();
741 fjy2 = _mm_setzero_ps();
742 fjz2 = _mm_setzero_ps();
744 /**************************
745 * CALCULATE INTERACTIONS *
746 **************************/
748 if (gmx_mm_any_lt(rsq00,rcutoff2))
751 r00 = _mm_mul_ps(rsq00,rinv00);
752 r00 = _mm_andnot_ps(dummy_mask,r00);
754 /* Calculate table index by multiplying r with table scale and truncate to integer */
755 rt = _mm_mul_ps(r00,vftabscale);
756 vfitab = _mm_cvttps_epi32(rt);
758 vfeps = _mm_frcz_ps(rt);
760 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
762 twovfeps = _mm_add_ps(vfeps,vfeps);
763 vfitab = _mm_slli_epi32(vfitab,3);
765 /* REACTION-FIELD ELECTROSTATICS */
766 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
767 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
769 /* CUBIC SPLINE TABLE DISPERSION */
770 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
771 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
772 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
773 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
774 _MM_TRANSPOSE4_PS(Y,F,G,H);
775 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
776 VV = _mm_macc_ps(vfeps,Fp,Y);
777 vvdw6 = _mm_mul_ps(c6_00,VV);
778 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
779 fvdw6 = _mm_mul_ps(c6_00,FF);
781 /* CUBIC SPLINE TABLE REPULSION */
782 vfitab = _mm_add_epi32(vfitab,ifour);
783 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
784 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
785 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
786 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
787 _MM_TRANSPOSE4_PS(Y,F,G,H);
788 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
789 VV = _mm_macc_ps(vfeps,Fp,Y);
790 vvdw12 = _mm_mul_ps(c12_00,VV);
791 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
792 fvdw12 = _mm_mul_ps(c12_00,FF);
793 vvdw = _mm_add_ps(vvdw12,vvdw6);
794 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
796 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
798 /* Update potential sum for this i atom from the interaction with this j atom. */
799 velec = _mm_and_ps(velec,cutoff_mask);
800 velec = _mm_andnot_ps(dummy_mask,velec);
801 velecsum = _mm_add_ps(velecsum,velec);
802 vvdw = _mm_and_ps(vvdw,cutoff_mask);
803 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
804 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
806 fscal = _mm_add_ps(felec,fvdw);
808 fscal = _mm_and_ps(fscal,cutoff_mask);
810 fscal = _mm_andnot_ps(dummy_mask,fscal);
812 /* Update vectorial force */
813 fix0 = _mm_macc_ps(dx00,fscal,fix0);
814 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
815 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
817 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
818 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
819 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
823 /**************************
824 * CALCULATE INTERACTIONS *
825 **************************/
827 if (gmx_mm_any_lt(rsq01,rcutoff2))
830 /* REACTION-FIELD ELECTROSTATICS */
831 velec = _mm_mul_ps(qq01,_mm_sub_ps(_mm_macc_ps(krf,rsq01,rinv01),crf));
832 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
834 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
836 /* Update potential sum for this i atom from the interaction with this j atom. */
837 velec = _mm_and_ps(velec,cutoff_mask);
838 velec = _mm_andnot_ps(dummy_mask,velec);
839 velecsum = _mm_add_ps(velecsum,velec);
843 fscal = _mm_and_ps(fscal,cutoff_mask);
845 fscal = _mm_andnot_ps(dummy_mask,fscal);
847 /* Update vectorial force */
848 fix0 = _mm_macc_ps(dx01,fscal,fix0);
849 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
850 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
852 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
853 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
854 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
858 /**************************
859 * CALCULATE INTERACTIONS *
860 **************************/
862 if (gmx_mm_any_lt(rsq02,rcutoff2))
865 /* REACTION-FIELD ELECTROSTATICS */
866 velec = _mm_mul_ps(qq02,_mm_sub_ps(_mm_macc_ps(krf,rsq02,rinv02),crf));
867 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
869 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
871 /* Update potential sum for this i atom from the interaction with this j atom. */
872 velec = _mm_and_ps(velec,cutoff_mask);
873 velec = _mm_andnot_ps(dummy_mask,velec);
874 velecsum = _mm_add_ps(velecsum,velec);
878 fscal = _mm_and_ps(fscal,cutoff_mask);
880 fscal = _mm_andnot_ps(dummy_mask,fscal);
882 /* Update vectorial force */
883 fix0 = _mm_macc_ps(dx02,fscal,fix0);
884 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
885 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
887 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
888 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
889 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
897 if (gmx_mm_any_lt(rsq10,rcutoff2))
900 /* REACTION-FIELD ELECTROSTATICS */
901 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_macc_ps(krf,rsq10,rinv10),crf));
902 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
904 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
906 /* Update potential sum for this i atom from the interaction with this j atom. */
907 velec = _mm_and_ps(velec,cutoff_mask);
908 velec = _mm_andnot_ps(dummy_mask,velec);
909 velecsum = _mm_add_ps(velecsum,velec);
913 fscal = _mm_and_ps(fscal,cutoff_mask);
915 fscal = _mm_andnot_ps(dummy_mask,fscal);
917 /* Update vectorial force */
918 fix1 = _mm_macc_ps(dx10,fscal,fix1);
919 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
920 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
922 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
923 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
924 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
928 /**************************
929 * CALCULATE INTERACTIONS *
930 **************************/
932 if (gmx_mm_any_lt(rsq11,rcutoff2))
935 /* REACTION-FIELD ELECTROSTATICS */
936 velec = _mm_mul_ps(qq11,_mm_sub_ps(_mm_macc_ps(krf,rsq11,rinv11),crf));
937 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
939 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
941 /* Update potential sum for this i atom from the interaction with this j atom. */
942 velec = _mm_and_ps(velec,cutoff_mask);
943 velec = _mm_andnot_ps(dummy_mask,velec);
944 velecsum = _mm_add_ps(velecsum,velec);
948 fscal = _mm_and_ps(fscal,cutoff_mask);
950 fscal = _mm_andnot_ps(dummy_mask,fscal);
952 /* Update vectorial force */
953 fix1 = _mm_macc_ps(dx11,fscal,fix1);
954 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
955 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
957 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
958 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
959 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
963 /**************************
964 * CALCULATE INTERACTIONS *
965 **************************/
967 if (gmx_mm_any_lt(rsq12,rcutoff2))
970 /* REACTION-FIELD ELECTROSTATICS */
971 velec = _mm_mul_ps(qq12,_mm_sub_ps(_mm_macc_ps(krf,rsq12,rinv12),crf));
972 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
974 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
976 /* Update potential sum for this i atom from the interaction with this j atom. */
977 velec = _mm_and_ps(velec,cutoff_mask);
978 velec = _mm_andnot_ps(dummy_mask,velec);
979 velecsum = _mm_add_ps(velecsum,velec);
983 fscal = _mm_and_ps(fscal,cutoff_mask);
985 fscal = _mm_andnot_ps(dummy_mask,fscal);
987 /* Update vectorial force */
988 fix1 = _mm_macc_ps(dx12,fscal,fix1);
989 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
990 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
992 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
993 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
994 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
998 /**************************
999 * CALCULATE INTERACTIONS *
1000 **************************/
1002 if (gmx_mm_any_lt(rsq20,rcutoff2))
1005 /* REACTION-FIELD ELECTROSTATICS */
1006 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_macc_ps(krf,rsq20,rinv20),crf));
1007 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1009 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1011 /* Update potential sum for this i atom from the interaction with this j atom. */
1012 velec = _mm_and_ps(velec,cutoff_mask);
1013 velec = _mm_andnot_ps(dummy_mask,velec);
1014 velecsum = _mm_add_ps(velecsum,velec);
1018 fscal = _mm_and_ps(fscal,cutoff_mask);
1020 fscal = _mm_andnot_ps(dummy_mask,fscal);
1022 /* Update vectorial force */
1023 fix2 = _mm_macc_ps(dx20,fscal,fix2);
1024 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
1025 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
1027 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
1028 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
1029 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
1033 /**************************
1034 * CALCULATE INTERACTIONS *
1035 **************************/
1037 if (gmx_mm_any_lt(rsq21,rcutoff2))
1040 /* REACTION-FIELD ELECTROSTATICS */
1041 velec = _mm_mul_ps(qq21,_mm_sub_ps(_mm_macc_ps(krf,rsq21,rinv21),crf));
1042 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
1044 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
1046 /* Update potential sum for this i atom from the interaction with this j atom. */
1047 velec = _mm_and_ps(velec,cutoff_mask);
1048 velec = _mm_andnot_ps(dummy_mask,velec);
1049 velecsum = _mm_add_ps(velecsum,velec);
1053 fscal = _mm_and_ps(fscal,cutoff_mask);
1055 fscal = _mm_andnot_ps(dummy_mask,fscal);
1057 /* Update vectorial force */
1058 fix2 = _mm_macc_ps(dx21,fscal,fix2);
1059 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
1060 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
1062 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
1063 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
1064 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
1068 /**************************
1069 * CALCULATE INTERACTIONS *
1070 **************************/
1072 if (gmx_mm_any_lt(rsq22,rcutoff2))
1075 /* REACTION-FIELD ELECTROSTATICS */
1076 velec = _mm_mul_ps(qq22,_mm_sub_ps(_mm_macc_ps(krf,rsq22,rinv22),crf));
1077 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
1079 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
1081 /* Update potential sum for this i atom from the interaction with this j atom. */
1082 velec = _mm_and_ps(velec,cutoff_mask);
1083 velec = _mm_andnot_ps(dummy_mask,velec);
1084 velecsum = _mm_add_ps(velecsum,velec);
1088 fscal = _mm_and_ps(fscal,cutoff_mask);
1090 fscal = _mm_andnot_ps(dummy_mask,fscal);
1092 /* Update vectorial force */
1093 fix2 = _mm_macc_ps(dx22,fscal,fix2);
1094 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
1095 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
1097 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
1098 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
1099 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
1103 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1104 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1105 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1106 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1108 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
1109 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1111 /* Inner loop uses 388 flops */
1114 /* End of innermost loop */
1116 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1117 f+i_coord_offset,fshift+i_shift_offset);
1120 /* Update potential energies */
1121 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
1122 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
1124 /* Increment number of inner iterations */
1125 inneriter += j_index_end - j_index_start;
1127 /* Outer loop uses 20 flops */
1130 /* Increment number of outer iterations */
1133 /* Update outer/inner flops */
1135 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*388);
1138 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_avx_128_fma_single
1139 * Electrostatics interaction: ReactionField
1140 * VdW interaction: CubicSplineTable
1141 * Geometry: Water3-Water3
1142 * Calculate force/pot: Force
1145 nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_avx_128_fma_single
1146 (t_nblist * gmx_restrict nlist,
1147 rvec * gmx_restrict xx,
1148 rvec * gmx_restrict ff,
1149 struct t_forcerec * gmx_restrict fr,
1150 t_mdatoms * gmx_restrict mdatoms,
1151 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
1152 t_nrnb * gmx_restrict nrnb)
1154 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1155 * just 0 for non-waters.
1156 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
1157 * jnr indices corresponding to data put in the four positions in the SIMD register.
1159 int i_shift_offset,i_coord_offset,outeriter,inneriter;
1160 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1161 int jnrA,jnrB,jnrC,jnrD;
1162 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
1163 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
1164 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
1165 real rcutoff_scalar;
1166 real *shiftvec,*fshift,*x,*f;
1167 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
1168 real scratch[4*DIM];
1169 __m128 fscal,rcutoff,rcutoff2,jidxall;
1171 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1173 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1175 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1176 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
1177 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1178 int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D;
1179 __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1180 int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D;
1181 __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1182 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1183 __m128 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
1184 __m128 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
1185 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
1186 __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1187 __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1188 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
1189 __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1190 __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1191 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
1194 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1197 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
1198 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
1200 __m128i ifour = _mm_set1_epi32(4);
1201 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
1203 __m128 dummy_mask,cutoff_mask;
1204 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
1205 __m128 one = _mm_set1_ps(1.0);
1206 __m128 two = _mm_set1_ps(2.0);
1212 jindex = nlist->jindex;
1214 shiftidx = nlist->shift;
1216 shiftvec = fr->shift_vec[0];
1217 fshift = fr->fshift[0];
1218 facel = _mm_set1_ps(fr->ic->epsfac);
1219 charge = mdatoms->chargeA;
1220 krf = _mm_set1_ps(fr->ic->k_rf);
1221 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
1222 crf = _mm_set1_ps(fr->ic->c_rf);
1223 nvdwtype = fr->ntype;
1224 vdwparam = fr->nbfp;
1225 vdwtype = mdatoms->typeA;
1227 vftab = kernel_data->table_vdw->data;
1228 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
1230 /* Setup water-specific parameters */
1231 inr = nlist->iinr[0];
1232 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
1233 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
1234 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
1235 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
1237 jq0 = _mm_set1_ps(charge[inr+0]);
1238 jq1 = _mm_set1_ps(charge[inr+1]);
1239 jq2 = _mm_set1_ps(charge[inr+2]);
1240 vdwjidx0A = 2*vdwtype[inr+0];
1241 qq00 = _mm_mul_ps(iq0,jq0);
1242 c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]);
1243 c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]);
1244 qq01 = _mm_mul_ps(iq0,jq1);
1245 qq02 = _mm_mul_ps(iq0,jq2);
1246 qq10 = _mm_mul_ps(iq1,jq0);
1247 qq11 = _mm_mul_ps(iq1,jq1);
1248 qq12 = _mm_mul_ps(iq1,jq2);
1249 qq20 = _mm_mul_ps(iq2,jq0);
1250 qq21 = _mm_mul_ps(iq2,jq1);
1251 qq22 = _mm_mul_ps(iq2,jq2);
1253 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
1254 rcutoff_scalar = fr->ic->rcoulomb;
1255 rcutoff = _mm_set1_ps(rcutoff_scalar);
1256 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
1258 /* Avoid stupid compiler warnings */
1259 jnrA = jnrB = jnrC = jnrD = 0;
1260 j_coord_offsetA = 0;
1261 j_coord_offsetB = 0;
1262 j_coord_offsetC = 0;
1263 j_coord_offsetD = 0;
1268 for(iidx=0;iidx<4*DIM;iidx++)
1270 scratch[iidx] = 0.0;
1273 /* Start outer loop over neighborlists */
1274 for(iidx=0; iidx<nri; iidx++)
1276 /* Load shift vector for this list */
1277 i_shift_offset = DIM*shiftidx[iidx];
1279 /* Load limits for loop over neighbors */
1280 j_index_start = jindex[iidx];
1281 j_index_end = jindex[iidx+1];
1283 /* Get outer coordinate index */
1285 i_coord_offset = DIM*inr;
1287 /* Load i particle coords and add shift vector */
1288 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
1289 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
1291 fix0 = _mm_setzero_ps();
1292 fiy0 = _mm_setzero_ps();
1293 fiz0 = _mm_setzero_ps();
1294 fix1 = _mm_setzero_ps();
1295 fiy1 = _mm_setzero_ps();
1296 fiz1 = _mm_setzero_ps();
1297 fix2 = _mm_setzero_ps();
1298 fiy2 = _mm_setzero_ps();
1299 fiz2 = _mm_setzero_ps();
1301 /* Start inner kernel loop */
1302 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
1305 /* Get j neighbor index, and coordinate index */
1307 jnrB = jjnr[jidx+1];
1308 jnrC = jjnr[jidx+2];
1309 jnrD = jjnr[jidx+3];
1310 j_coord_offsetA = DIM*jnrA;
1311 j_coord_offsetB = DIM*jnrB;
1312 j_coord_offsetC = DIM*jnrC;
1313 j_coord_offsetD = DIM*jnrD;
1315 /* load j atom coordinates */
1316 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1317 x+j_coord_offsetC,x+j_coord_offsetD,
1318 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1320 /* Calculate displacement vector */
1321 dx00 = _mm_sub_ps(ix0,jx0);
1322 dy00 = _mm_sub_ps(iy0,jy0);
1323 dz00 = _mm_sub_ps(iz0,jz0);
1324 dx01 = _mm_sub_ps(ix0,jx1);
1325 dy01 = _mm_sub_ps(iy0,jy1);
1326 dz01 = _mm_sub_ps(iz0,jz1);
1327 dx02 = _mm_sub_ps(ix0,jx2);
1328 dy02 = _mm_sub_ps(iy0,jy2);
1329 dz02 = _mm_sub_ps(iz0,jz2);
1330 dx10 = _mm_sub_ps(ix1,jx0);
1331 dy10 = _mm_sub_ps(iy1,jy0);
1332 dz10 = _mm_sub_ps(iz1,jz0);
1333 dx11 = _mm_sub_ps(ix1,jx1);
1334 dy11 = _mm_sub_ps(iy1,jy1);
1335 dz11 = _mm_sub_ps(iz1,jz1);
1336 dx12 = _mm_sub_ps(ix1,jx2);
1337 dy12 = _mm_sub_ps(iy1,jy2);
1338 dz12 = _mm_sub_ps(iz1,jz2);
1339 dx20 = _mm_sub_ps(ix2,jx0);
1340 dy20 = _mm_sub_ps(iy2,jy0);
1341 dz20 = _mm_sub_ps(iz2,jz0);
1342 dx21 = _mm_sub_ps(ix2,jx1);
1343 dy21 = _mm_sub_ps(iy2,jy1);
1344 dz21 = _mm_sub_ps(iz2,jz1);
1345 dx22 = _mm_sub_ps(ix2,jx2);
1346 dy22 = _mm_sub_ps(iy2,jy2);
1347 dz22 = _mm_sub_ps(iz2,jz2);
1349 /* Calculate squared distance and things based on it */
1350 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1351 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
1352 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
1353 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1354 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
1355 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
1356 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1357 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
1358 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
1360 rinv00 = avx128fma_invsqrt_f(rsq00);
1361 rinv01 = avx128fma_invsqrt_f(rsq01);
1362 rinv02 = avx128fma_invsqrt_f(rsq02);
1363 rinv10 = avx128fma_invsqrt_f(rsq10);
1364 rinv11 = avx128fma_invsqrt_f(rsq11);
1365 rinv12 = avx128fma_invsqrt_f(rsq12);
1366 rinv20 = avx128fma_invsqrt_f(rsq20);
1367 rinv21 = avx128fma_invsqrt_f(rsq21);
1368 rinv22 = avx128fma_invsqrt_f(rsq22);
1370 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
1371 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
1372 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
1373 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
1374 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
1375 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
1376 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
1377 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
1378 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
1380 fjx0 = _mm_setzero_ps();
1381 fjy0 = _mm_setzero_ps();
1382 fjz0 = _mm_setzero_ps();
1383 fjx1 = _mm_setzero_ps();
1384 fjy1 = _mm_setzero_ps();
1385 fjz1 = _mm_setzero_ps();
1386 fjx2 = _mm_setzero_ps();
1387 fjy2 = _mm_setzero_ps();
1388 fjz2 = _mm_setzero_ps();
1390 /**************************
1391 * CALCULATE INTERACTIONS *
1392 **************************/
1394 if (gmx_mm_any_lt(rsq00,rcutoff2))
1397 r00 = _mm_mul_ps(rsq00,rinv00);
1399 /* Calculate table index by multiplying r with table scale and truncate to integer */
1400 rt = _mm_mul_ps(r00,vftabscale);
1401 vfitab = _mm_cvttps_epi32(rt);
1403 vfeps = _mm_frcz_ps(rt);
1405 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
1407 twovfeps = _mm_add_ps(vfeps,vfeps);
1408 vfitab = _mm_slli_epi32(vfitab,3);
1410 /* REACTION-FIELD ELECTROSTATICS */
1411 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
1413 /* CUBIC SPLINE TABLE DISPERSION */
1414 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1415 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1416 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1417 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1418 _MM_TRANSPOSE4_PS(Y,F,G,H);
1419 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1420 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1421 fvdw6 = _mm_mul_ps(c6_00,FF);
1423 /* CUBIC SPLINE TABLE REPULSION */
1424 vfitab = _mm_add_epi32(vfitab,ifour);
1425 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1426 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1427 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1428 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1429 _MM_TRANSPOSE4_PS(Y,F,G,H);
1430 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1431 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1432 fvdw12 = _mm_mul_ps(c12_00,FF);
1433 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1435 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
1437 fscal = _mm_add_ps(felec,fvdw);
1439 fscal = _mm_and_ps(fscal,cutoff_mask);
1441 /* Update vectorial force */
1442 fix0 = _mm_macc_ps(dx00,fscal,fix0);
1443 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
1444 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
1446 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
1447 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
1448 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
1452 /**************************
1453 * CALCULATE INTERACTIONS *
1454 **************************/
1456 if (gmx_mm_any_lt(rsq01,rcutoff2))
1459 /* REACTION-FIELD ELECTROSTATICS */
1460 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
1462 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
1466 fscal = _mm_and_ps(fscal,cutoff_mask);
1468 /* Update vectorial force */
1469 fix0 = _mm_macc_ps(dx01,fscal,fix0);
1470 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
1471 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
1473 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
1474 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
1475 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
1479 /**************************
1480 * CALCULATE INTERACTIONS *
1481 **************************/
1483 if (gmx_mm_any_lt(rsq02,rcutoff2))
1486 /* REACTION-FIELD ELECTROSTATICS */
1487 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
1489 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
1493 fscal = _mm_and_ps(fscal,cutoff_mask);
1495 /* Update vectorial force */
1496 fix0 = _mm_macc_ps(dx02,fscal,fix0);
1497 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
1498 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
1500 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
1501 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
1502 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
1506 /**************************
1507 * CALCULATE INTERACTIONS *
1508 **************************/
1510 if (gmx_mm_any_lt(rsq10,rcutoff2))
1513 /* REACTION-FIELD ELECTROSTATICS */
1514 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
1516 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1520 fscal = _mm_and_ps(fscal,cutoff_mask);
1522 /* Update vectorial force */
1523 fix1 = _mm_macc_ps(dx10,fscal,fix1);
1524 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
1525 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
1527 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
1528 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
1529 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
1533 /**************************
1534 * CALCULATE INTERACTIONS *
1535 **************************/
1537 if (gmx_mm_any_lt(rsq11,rcutoff2))
1540 /* REACTION-FIELD ELECTROSTATICS */
1541 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
1543 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
1547 fscal = _mm_and_ps(fscal,cutoff_mask);
1549 /* Update vectorial force */
1550 fix1 = _mm_macc_ps(dx11,fscal,fix1);
1551 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
1552 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
1554 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
1555 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
1556 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
1560 /**************************
1561 * CALCULATE INTERACTIONS *
1562 **************************/
1564 if (gmx_mm_any_lt(rsq12,rcutoff2))
1567 /* REACTION-FIELD ELECTROSTATICS */
1568 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
1570 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
1574 fscal = _mm_and_ps(fscal,cutoff_mask);
1576 /* Update vectorial force */
1577 fix1 = _mm_macc_ps(dx12,fscal,fix1);
1578 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
1579 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
1581 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
1582 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
1583 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
1587 /**************************
1588 * CALCULATE INTERACTIONS *
1589 **************************/
1591 if (gmx_mm_any_lt(rsq20,rcutoff2))
1594 /* REACTION-FIELD ELECTROSTATICS */
1595 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1597 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1601 fscal = _mm_and_ps(fscal,cutoff_mask);
1603 /* Update vectorial force */
1604 fix2 = _mm_macc_ps(dx20,fscal,fix2);
1605 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
1606 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
1608 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
1609 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
1610 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
1614 /**************************
1615 * CALCULATE INTERACTIONS *
1616 **************************/
1618 if (gmx_mm_any_lt(rsq21,rcutoff2))
1621 /* REACTION-FIELD ELECTROSTATICS */
1622 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
1624 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
1628 fscal = _mm_and_ps(fscal,cutoff_mask);
1630 /* Update vectorial force */
1631 fix2 = _mm_macc_ps(dx21,fscal,fix2);
1632 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
1633 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
1635 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
1636 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
1637 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
1641 /**************************
1642 * CALCULATE INTERACTIONS *
1643 **************************/
1645 if (gmx_mm_any_lt(rsq22,rcutoff2))
1648 /* REACTION-FIELD ELECTROSTATICS */
1649 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
1651 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
1655 fscal = _mm_and_ps(fscal,cutoff_mask);
1657 /* Update vectorial force */
1658 fix2 = _mm_macc_ps(dx22,fscal,fix2);
1659 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
1660 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
1662 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
1663 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
1664 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
1668 fjptrA = f+j_coord_offsetA;
1669 fjptrB = f+j_coord_offsetB;
1670 fjptrC = f+j_coord_offsetC;
1671 fjptrD = f+j_coord_offsetD;
1673 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
1674 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1676 /* Inner loop uses 324 flops */
1679 if(jidx<j_index_end)
1682 /* Get j neighbor index, and coordinate index */
1683 jnrlistA = jjnr[jidx];
1684 jnrlistB = jjnr[jidx+1];
1685 jnrlistC = jjnr[jidx+2];
1686 jnrlistD = jjnr[jidx+3];
1687 /* Sign of each element will be negative for non-real atoms.
1688 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
1689 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
1691 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
1692 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
1693 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
1694 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
1695 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
1696 j_coord_offsetA = DIM*jnrA;
1697 j_coord_offsetB = DIM*jnrB;
1698 j_coord_offsetC = DIM*jnrC;
1699 j_coord_offsetD = DIM*jnrD;
1701 /* load j atom coordinates */
1702 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1703 x+j_coord_offsetC,x+j_coord_offsetD,
1704 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1706 /* Calculate displacement vector */
1707 dx00 = _mm_sub_ps(ix0,jx0);
1708 dy00 = _mm_sub_ps(iy0,jy0);
1709 dz00 = _mm_sub_ps(iz0,jz0);
1710 dx01 = _mm_sub_ps(ix0,jx1);
1711 dy01 = _mm_sub_ps(iy0,jy1);
1712 dz01 = _mm_sub_ps(iz0,jz1);
1713 dx02 = _mm_sub_ps(ix0,jx2);
1714 dy02 = _mm_sub_ps(iy0,jy2);
1715 dz02 = _mm_sub_ps(iz0,jz2);
1716 dx10 = _mm_sub_ps(ix1,jx0);
1717 dy10 = _mm_sub_ps(iy1,jy0);
1718 dz10 = _mm_sub_ps(iz1,jz0);
1719 dx11 = _mm_sub_ps(ix1,jx1);
1720 dy11 = _mm_sub_ps(iy1,jy1);
1721 dz11 = _mm_sub_ps(iz1,jz1);
1722 dx12 = _mm_sub_ps(ix1,jx2);
1723 dy12 = _mm_sub_ps(iy1,jy2);
1724 dz12 = _mm_sub_ps(iz1,jz2);
1725 dx20 = _mm_sub_ps(ix2,jx0);
1726 dy20 = _mm_sub_ps(iy2,jy0);
1727 dz20 = _mm_sub_ps(iz2,jz0);
1728 dx21 = _mm_sub_ps(ix2,jx1);
1729 dy21 = _mm_sub_ps(iy2,jy1);
1730 dz21 = _mm_sub_ps(iz2,jz1);
1731 dx22 = _mm_sub_ps(ix2,jx2);
1732 dy22 = _mm_sub_ps(iy2,jy2);
1733 dz22 = _mm_sub_ps(iz2,jz2);
1735 /* Calculate squared distance and things based on it */
1736 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1737 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
1738 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
1739 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1740 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
1741 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
1742 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1743 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
1744 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
1746 rinv00 = avx128fma_invsqrt_f(rsq00);
1747 rinv01 = avx128fma_invsqrt_f(rsq01);
1748 rinv02 = avx128fma_invsqrt_f(rsq02);
1749 rinv10 = avx128fma_invsqrt_f(rsq10);
1750 rinv11 = avx128fma_invsqrt_f(rsq11);
1751 rinv12 = avx128fma_invsqrt_f(rsq12);
1752 rinv20 = avx128fma_invsqrt_f(rsq20);
1753 rinv21 = avx128fma_invsqrt_f(rsq21);
1754 rinv22 = avx128fma_invsqrt_f(rsq22);
1756 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
1757 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
1758 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
1759 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
1760 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
1761 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
1762 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
1763 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
1764 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
1766 fjx0 = _mm_setzero_ps();
1767 fjy0 = _mm_setzero_ps();
1768 fjz0 = _mm_setzero_ps();
1769 fjx1 = _mm_setzero_ps();
1770 fjy1 = _mm_setzero_ps();
1771 fjz1 = _mm_setzero_ps();
1772 fjx2 = _mm_setzero_ps();
1773 fjy2 = _mm_setzero_ps();
1774 fjz2 = _mm_setzero_ps();
1776 /**************************
1777 * CALCULATE INTERACTIONS *
1778 **************************/
1780 if (gmx_mm_any_lt(rsq00,rcutoff2))
1783 r00 = _mm_mul_ps(rsq00,rinv00);
1784 r00 = _mm_andnot_ps(dummy_mask,r00);
1786 /* Calculate table index by multiplying r with table scale and truncate to integer */
1787 rt = _mm_mul_ps(r00,vftabscale);
1788 vfitab = _mm_cvttps_epi32(rt);
1790 vfeps = _mm_frcz_ps(rt);
1792 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
1794 twovfeps = _mm_add_ps(vfeps,vfeps);
1795 vfitab = _mm_slli_epi32(vfitab,3);
1797 /* REACTION-FIELD ELECTROSTATICS */
1798 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
1800 /* CUBIC SPLINE TABLE DISPERSION */
1801 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1802 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1803 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1804 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1805 _MM_TRANSPOSE4_PS(Y,F,G,H);
1806 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1807 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1808 fvdw6 = _mm_mul_ps(c6_00,FF);
1810 /* CUBIC SPLINE TABLE REPULSION */
1811 vfitab = _mm_add_epi32(vfitab,ifour);
1812 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1813 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1814 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1815 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1816 _MM_TRANSPOSE4_PS(Y,F,G,H);
1817 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1818 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1819 fvdw12 = _mm_mul_ps(c12_00,FF);
1820 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1822 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
1824 fscal = _mm_add_ps(felec,fvdw);
1826 fscal = _mm_and_ps(fscal,cutoff_mask);
1828 fscal = _mm_andnot_ps(dummy_mask,fscal);
1830 /* Update vectorial force */
1831 fix0 = _mm_macc_ps(dx00,fscal,fix0);
1832 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
1833 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
1835 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
1836 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
1837 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
1841 /**************************
1842 * CALCULATE INTERACTIONS *
1843 **************************/
1845 if (gmx_mm_any_lt(rsq01,rcutoff2))
1848 /* REACTION-FIELD ELECTROSTATICS */
1849 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
1851 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
1855 fscal = _mm_and_ps(fscal,cutoff_mask);
1857 fscal = _mm_andnot_ps(dummy_mask,fscal);
1859 /* Update vectorial force */
1860 fix0 = _mm_macc_ps(dx01,fscal,fix0);
1861 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
1862 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
1864 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
1865 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
1866 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
1870 /**************************
1871 * CALCULATE INTERACTIONS *
1872 **************************/
1874 if (gmx_mm_any_lt(rsq02,rcutoff2))
1877 /* REACTION-FIELD ELECTROSTATICS */
1878 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
1880 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
1884 fscal = _mm_and_ps(fscal,cutoff_mask);
1886 fscal = _mm_andnot_ps(dummy_mask,fscal);
1888 /* Update vectorial force */
1889 fix0 = _mm_macc_ps(dx02,fscal,fix0);
1890 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
1891 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
1893 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
1894 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
1895 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
1899 /**************************
1900 * CALCULATE INTERACTIONS *
1901 **************************/
1903 if (gmx_mm_any_lt(rsq10,rcutoff2))
1906 /* REACTION-FIELD ELECTROSTATICS */
1907 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
1909 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1913 fscal = _mm_and_ps(fscal,cutoff_mask);
1915 fscal = _mm_andnot_ps(dummy_mask,fscal);
1917 /* Update vectorial force */
1918 fix1 = _mm_macc_ps(dx10,fscal,fix1);
1919 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
1920 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
1922 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
1923 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
1924 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
1928 /**************************
1929 * CALCULATE INTERACTIONS *
1930 **************************/
1932 if (gmx_mm_any_lt(rsq11,rcutoff2))
1935 /* REACTION-FIELD ELECTROSTATICS */
1936 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
1938 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
1942 fscal = _mm_and_ps(fscal,cutoff_mask);
1944 fscal = _mm_andnot_ps(dummy_mask,fscal);
1946 /* Update vectorial force */
1947 fix1 = _mm_macc_ps(dx11,fscal,fix1);
1948 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
1949 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
1951 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
1952 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
1953 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
1957 /**************************
1958 * CALCULATE INTERACTIONS *
1959 **************************/
1961 if (gmx_mm_any_lt(rsq12,rcutoff2))
1964 /* REACTION-FIELD ELECTROSTATICS */
1965 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
1967 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
1971 fscal = _mm_and_ps(fscal,cutoff_mask);
1973 fscal = _mm_andnot_ps(dummy_mask,fscal);
1975 /* Update vectorial force */
1976 fix1 = _mm_macc_ps(dx12,fscal,fix1);
1977 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
1978 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
1980 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
1981 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
1982 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
1986 /**************************
1987 * CALCULATE INTERACTIONS *
1988 **************************/
1990 if (gmx_mm_any_lt(rsq20,rcutoff2))
1993 /* REACTION-FIELD ELECTROSTATICS */
1994 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1996 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
2000 fscal = _mm_and_ps(fscal,cutoff_mask);
2002 fscal = _mm_andnot_ps(dummy_mask,fscal);
2004 /* Update vectorial force */
2005 fix2 = _mm_macc_ps(dx20,fscal,fix2);
2006 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
2007 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
2009 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
2010 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
2011 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
2015 /**************************
2016 * CALCULATE INTERACTIONS *
2017 **************************/
2019 if (gmx_mm_any_lt(rsq21,rcutoff2))
2022 /* REACTION-FIELD ELECTROSTATICS */
2023 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
2025 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
2029 fscal = _mm_and_ps(fscal,cutoff_mask);
2031 fscal = _mm_andnot_ps(dummy_mask,fscal);
2033 /* Update vectorial force */
2034 fix2 = _mm_macc_ps(dx21,fscal,fix2);
2035 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
2036 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
2038 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
2039 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
2040 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
2044 /**************************
2045 * CALCULATE INTERACTIONS *
2046 **************************/
2048 if (gmx_mm_any_lt(rsq22,rcutoff2))
2051 /* REACTION-FIELD ELECTROSTATICS */
2052 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
2054 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
2058 fscal = _mm_and_ps(fscal,cutoff_mask);
2060 fscal = _mm_andnot_ps(dummy_mask,fscal);
2062 /* Update vectorial force */
2063 fix2 = _mm_macc_ps(dx22,fscal,fix2);
2064 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
2065 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
2067 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
2068 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
2069 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
2073 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
2074 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
2075 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
2076 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
2078 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
2079 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
2081 /* Inner loop uses 325 flops */
2084 /* End of innermost loop */
2086 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
2087 f+i_coord_offset,fshift+i_shift_offset);
2089 /* Increment number of inner iterations */
2090 inneriter += j_index_end - j_index_start;
2092 /* Outer loop uses 18 flops */
2095 /* Increment number of outer iterations */
2098 /* Update outer/inner flops */
2100 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*325);