2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS avx_128_fma_single kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "gromacs/simd/math_x86_avx_128_fma_single.h"
48 #include "kernelutil_x86_avx_128_fma_single.h"
51 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_VF_avx_128_fma_single
52 * Electrostatics interaction: ReactionField
53 * VdW interaction: CubicSplineTable
54 * Geometry: Water3-Water3
55 * Calculate force/pot: PotentialAndForce
58 nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_VF_avx_128_fma_single
59 (t_nblist * gmx_restrict nlist,
60 rvec * gmx_restrict xx,
61 rvec * gmx_restrict ff,
62 t_forcerec * gmx_restrict fr,
63 t_mdatoms * gmx_restrict mdatoms,
64 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
65 t_nrnb * gmx_restrict nrnb)
67 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
68 * just 0 for non-waters.
69 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
70 * jnr indices corresponding to data put in the four positions in the SIMD register.
72 int i_shift_offset,i_coord_offset,outeriter,inneriter;
73 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int jnrA,jnrB,jnrC,jnrD;
75 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
76 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
77 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real *shiftvec,*fshift,*x,*f;
80 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
82 __m128 fscal,rcutoff,rcutoff2,jidxall;
84 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
86 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
88 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
89 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
90 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
91 int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D;
92 __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
93 int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D;
94 __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
95 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96 __m128 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
97 __m128 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
98 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
99 __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
100 __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
101 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
102 __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
103 __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
104 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
107 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
110 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
111 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
113 __m128i ifour = _mm_set1_epi32(4);
114 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
116 __m128 dummy_mask,cutoff_mask;
117 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
118 __m128 one = _mm_set1_ps(1.0);
119 __m128 two = _mm_set1_ps(2.0);
125 jindex = nlist->jindex;
127 shiftidx = nlist->shift;
129 shiftvec = fr->shift_vec[0];
130 fshift = fr->fshift[0];
131 facel = _mm_set1_ps(fr->epsfac);
132 charge = mdatoms->chargeA;
133 krf = _mm_set1_ps(fr->ic->k_rf);
134 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
135 crf = _mm_set1_ps(fr->ic->c_rf);
136 nvdwtype = fr->ntype;
138 vdwtype = mdatoms->typeA;
140 vftab = kernel_data->table_vdw->data;
141 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
143 /* Setup water-specific parameters */
144 inr = nlist->iinr[0];
145 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
146 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
147 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
148 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
150 jq0 = _mm_set1_ps(charge[inr+0]);
151 jq1 = _mm_set1_ps(charge[inr+1]);
152 jq2 = _mm_set1_ps(charge[inr+2]);
153 vdwjidx0A = 2*vdwtype[inr+0];
154 qq00 = _mm_mul_ps(iq0,jq0);
155 c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]);
156 c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]);
157 qq01 = _mm_mul_ps(iq0,jq1);
158 qq02 = _mm_mul_ps(iq0,jq2);
159 qq10 = _mm_mul_ps(iq1,jq0);
160 qq11 = _mm_mul_ps(iq1,jq1);
161 qq12 = _mm_mul_ps(iq1,jq2);
162 qq20 = _mm_mul_ps(iq2,jq0);
163 qq21 = _mm_mul_ps(iq2,jq1);
164 qq22 = _mm_mul_ps(iq2,jq2);
166 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
167 rcutoff_scalar = fr->rcoulomb;
168 rcutoff = _mm_set1_ps(rcutoff_scalar);
169 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
171 /* Avoid stupid compiler warnings */
172 jnrA = jnrB = jnrC = jnrD = 0;
181 for(iidx=0;iidx<4*DIM;iidx++)
186 /* Start outer loop over neighborlists */
187 for(iidx=0; iidx<nri; iidx++)
189 /* Load shift vector for this list */
190 i_shift_offset = DIM*shiftidx[iidx];
192 /* Load limits for loop over neighbors */
193 j_index_start = jindex[iidx];
194 j_index_end = jindex[iidx+1];
196 /* Get outer coordinate index */
198 i_coord_offset = DIM*inr;
200 /* Load i particle coords and add shift vector */
201 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
202 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
204 fix0 = _mm_setzero_ps();
205 fiy0 = _mm_setzero_ps();
206 fiz0 = _mm_setzero_ps();
207 fix1 = _mm_setzero_ps();
208 fiy1 = _mm_setzero_ps();
209 fiz1 = _mm_setzero_ps();
210 fix2 = _mm_setzero_ps();
211 fiy2 = _mm_setzero_ps();
212 fiz2 = _mm_setzero_ps();
214 /* Reset potential sums */
215 velecsum = _mm_setzero_ps();
216 vvdwsum = _mm_setzero_ps();
218 /* Start inner kernel loop */
219 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
222 /* Get j neighbor index, and coordinate index */
227 j_coord_offsetA = DIM*jnrA;
228 j_coord_offsetB = DIM*jnrB;
229 j_coord_offsetC = DIM*jnrC;
230 j_coord_offsetD = DIM*jnrD;
232 /* load j atom coordinates */
233 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
234 x+j_coord_offsetC,x+j_coord_offsetD,
235 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
237 /* Calculate displacement vector */
238 dx00 = _mm_sub_ps(ix0,jx0);
239 dy00 = _mm_sub_ps(iy0,jy0);
240 dz00 = _mm_sub_ps(iz0,jz0);
241 dx01 = _mm_sub_ps(ix0,jx1);
242 dy01 = _mm_sub_ps(iy0,jy1);
243 dz01 = _mm_sub_ps(iz0,jz1);
244 dx02 = _mm_sub_ps(ix0,jx2);
245 dy02 = _mm_sub_ps(iy0,jy2);
246 dz02 = _mm_sub_ps(iz0,jz2);
247 dx10 = _mm_sub_ps(ix1,jx0);
248 dy10 = _mm_sub_ps(iy1,jy0);
249 dz10 = _mm_sub_ps(iz1,jz0);
250 dx11 = _mm_sub_ps(ix1,jx1);
251 dy11 = _mm_sub_ps(iy1,jy1);
252 dz11 = _mm_sub_ps(iz1,jz1);
253 dx12 = _mm_sub_ps(ix1,jx2);
254 dy12 = _mm_sub_ps(iy1,jy2);
255 dz12 = _mm_sub_ps(iz1,jz2);
256 dx20 = _mm_sub_ps(ix2,jx0);
257 dy20 = _mm_sub_ps(iy2,jy0);
258 dz20 = _mm_sub_ps(iz2,jz0);
259 dx21 = _mm_sub_ps(ix2,jx1);
260 dy21 = _mm_sub_ps(iy2,jy1);
261 dz21 = _mm_sub_ps(iz2,jz1);
262 dx22 = _mm_sub_ps(ix2,jx2);
263 dy22 = _mm_sub_ps(iy2,jy2);
264 dz22 = _mm_sub_ps(iz2,jz2);
266 /* Calculate squared distance and things based on it */
267 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
268 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
269 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
270 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
271 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
272 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
273 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
274 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
275 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
277 rinv00 = gmx_mm_invsqrt_ps(rsq00);
278 rinv01 = gmx_mm_invsqrt_ps(rsq01);
279 rinv02 = gmx_mm_invsqrt_ps(rsq02);
280 rinv10 = gmx_mm_invsqrt_ps(rsq10);
281 rinv11 = gmx_mm_invsqrt_ps(rsq11);
282 rinv12 = gmx_mm_invsqrt_ps(rsq12);
283 rinv20 = gmx_mm_invsqrt_ps(rsq20);
284 rinv21 = gmx_mm_invsqrt_ps(rsq21);
285 rinv22 = gmx_mm_invsqrt_ps(rsq22);
287 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
288 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
289 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
290 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
291 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
292 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
293 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
294 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
295 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
297 fjx0 = _mm_setzero_ps();
298 fjy0 = _mm_setzero_ps();
299 fjz0 = _mm_setzero_ps();
300 fjx1 = _mm_setzero_ps();
301 fjy1 = _mm_setzero_ps();
302 fjz1 = _mm_setzero_ps();
303 fjx2 = _mm_setzero_ps();
304 fjy2 = _mm_setzero_ps();
305 fjz2 = _mm_setzero_ps();
307 /**************************
308 * CALCULATE INTERACTIONS *
309 **************************/
311 if (gmx_mm_any_lt(rsq00,rcutoff2))
314 r00 = _mm_mul_ps(rsq00,rinv00);
316 /* Calculate table index by multiplying r with table scale and truncate to integer */
317 rt = _mm_mul_ps(r00,vftabscale);
318 vfitab = _mm_cvttps_epi32(rt);
320 vfeps = _mm_frcz_ps(rt);
322 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
324 twovfeps = _mm_add_ps(vfeps,vfeps);
325 vfitab = _mm_slli_epi32(vfitab,3);
327 /* REACTION-FIELD ELECTROSTATICS */
328 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
329 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
331 /* CUBIC SPLINE TABLE DISPERSION */
332 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
333 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
334 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
335 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
336 _MM_TRANSPOSE4_PS(Y,F,G,H);
337 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
338 VV = _mm_macc_ps(vfeps,Fp,Y);
339 vvdw6 = _mm_mul_ps(c6_00,VV);
340 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
341 fvdw6 = _mm_mul_ps(c6_00,FF);
343 /* CUBIC SPLINE TABLE REPULSION */
344 vfitab = _mm_add_epi32(vfitab,ifour);
345 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
346 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
347 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
348 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
349 _MM_TRANSPOSE4_PS(Y,F,G,H);
350 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
351 VV = _mm_macc_ps(vfeps,Fp,Y);
352 vvdw12 = _mm_mul_ps(c12_00,VV);
353 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
354 fvdw12 = _mm_mul_ps(c12_00,FF);
355 vvdw = _mm_add_ps(vvdw12,vvdw6);
356 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
358 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
360 /* Update potential sum for this i atom from the interaction with this j atom. */
361 velec = _mm_and_ps(velec,cutoff_mask);
362 velecsum = _mm_add_ps(velecsum,velec);
363 vvdw = _mm_and_ps(vvdw,cutoff_mask);
364 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
366 fscal = _mm_add_ps(felec,fvdw);
368 fscal = _mm_and_ps(fscal,cutoff_mask);
370 /* Update vectorial force */
371 fix0 = _mm_macc_ps(dx00,fscal,fix0);
372 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
373 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
375 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
376 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
377 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
381 /**************************
382 * CALCULATE INTERACTIONS *
383 **************************/
385 if (gmx_mm_any_lt(rsq01,rcutoff2))
388 /* REACTION-FIELD ELECTROSTATICS */
389 velec = _mm_mul_ps(qq01,_mm_sub_ps(_mm_macc_ps(krf,rsq01,rinv01),crf));
390 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
392 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
394 /* Update potential sum for this i atom from the interaction with this j atom. */
395 velec = _mm_and_ps(velec,cutoff_mask);
396 velecsum = _mm_add_ps(velecsum,velec);
400 fscal = _mm_and_ps(fscal,cutoff_mask);
402 /* Update vectorial force */
403 fix0 = _mm_macc_ps(dx01,fscal,fix0);
404 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
405 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
407 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
408 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
409 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
413 /**************************
414 * CALCULATE INTERACTIONS *
415 **************************/
417 if (gmx_mm_any_lt(rsq02,rcutoff2))
420 /* REACTION-FIELD ELECTROSTATICS */
421 velec = _mm_mul_ps(qq02,_mm_sub_ps(_mm_macc_ps(krf,rsq02,rinv02),crf));
422 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
424 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
426 /* Update potential sum for this i atom from the interaction with this j atom. */
427 velec = _mm_and_ps(velec,cutoff_mask);
428 velecsum = _mm_add_ps(velecsum,velec);
432 fscal = _mm_and_ps(fscal,cutoff_mask);
434 /* Update vectorial force */
435 fix0 = _mm_macc_ps(dx02,fscal,fix0);
436 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
437 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
439 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
440 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
441 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
445 /**************************
446 * CALCULATE INTERACTIONS *
447 **************************/
449 if (gmx_mm_any_lt(rsq10,rcutoff2))
452 /* REACTION-FIELD ELECTROSTATICS */
453 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_macc_ps(krf,rsq10,rinv10),crf));
454 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
456 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
458 /* Update potential sum for this i atom from the interaction with this j atom. */
459 velec = _mm_and_ps(velec,cutoff_mask);
460 velecsum = _mm_add_ps(velecsum,velec);
464 fscal = _mm_and_ps(fscal,cutoff_mask);
466 /* Update vectorial force */
467 fix1 = _mm_macc_ps(dx10,fscal,fix1);
468 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
469 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
471 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
472 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
473 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
481 if (gmx_mm_any_lt(rsq11,rcutoff2))
484 /* REACTION-FIELD ELECTROSTATICS */
485 velec = _mm_mul_ps(qq11,_mm_sub_ps(_mm_macc_ps(krf,rsq11,rinv11),crf));
486 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
488 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
490 /* Update potential sum for this i atom from the interaction with this j atom. */
491 velec = _mm_and_ps(velec,cutoff_mask);
492 velecsum = _mm_add_ps(velecsum,velec);
496 fscal = _mm_and_ps(fscal,cutoff_mask);
498 /* Update vectorial force */
499 fix1 = _mm_macc_ps(dx11,fscal,fix1);
500 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
501 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
503 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
504 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
505 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
509 /**************************
510 * CALCULATE INTERACTIONS *
511 **************************/
513 if (gmx_mm_any_lt(rsq12,rcutoff2))
516 /* REACTION-FIELD ELECTROSTATICS */
517 velec = _mm_mul_ps(qq12,_mm_sub_ps(_mm_macc_ps(krf,rsq12,rinv12),crf));
518 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
520 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
522 /* Update potential sum for this i atom from the interaction with this j atom. */
523 velec = _mm_and_ps(velec,cutoff_mask);
524 velecsum = _mm_add_ps(velecsum,velec);
528 fscal = _mm_and_ps(fscal,cutoff_mask);
530 /* Update vectorial force */
531 fix1 = _mm_macc_ps(dx12,fscal,fix1);
532 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
533 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
535 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
536 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
537 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
541 /**************************
542 * CALCULATE INTERACTIONS *
543 **************************/
545 if (gmx_mm_any_lt(rsq20,rcutoff2))
548 /* REACTION-FIELD ELECTROSTATICS */
549 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_macc_ps(krf,rsq20,rinv20),crf));
550 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
552 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
554 /* Update potential sum for this i atom from the interaction with this j atom. */
555 velec = _mm_and_ps(velec,cutoff_mask);
556 velecsum = _mm_add_ps(velecsum,velec);
560 fscal = _mm_and_ps(fscal,cutoff_mask);
562 /* Update vectorial force */
563 fix2 = _mm_macc_ps(dx20,fscal,fix2);
564 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
565 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
567 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
568 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
569 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
573 /**************************
574 * CALCULATE INTERACTIONS *
575 **************************/
577 if (gmx_mm_any_lt(rsq21,rcutoff2))
580 /* REACTION-FIELD ELECTROSTATICS */
581 velec = _mm_mul_ps(qq21,_mm_sub_ps(_mm_macc_ps(krf,rsq21,rinv21),crf));
582 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
584 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
586 /* Update potential sum for this i atom from the interaction with this j atom. */
587 velec = _mm_and_ps(velec,cutoff_mask);
588 velecsum = _mm_add_ps(velecsum,velec);
592 fscal = _mm_and_ps(fscal,cutoff_mask);
594 /* Update vectorial force */
595 fix2 = _mm_macc_ps(dx21,fscal,fix2);
596 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
597 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
599 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
600 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
601 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
605 /**************************
606 * CALCULATE INTERACTIONS *
607 **************************/
609 if (gmx_mm_any_lt(rsq22,rcutoff2))
612 /* REACTION-FIELD ELECTROSTATICS */
613 velec = _mm_mul_ps(qq22,_mm_sub_ps(_mm_macc_ps(krf,rsq22,rinv22),crf));
614 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
616 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
618 /* Update potential sum for this i atom from the interaction with this j atom. */
619 velec = _mm_and_ps(velec,cutoff_mask);
620 velecsum = _mm_add_ps(velecsum,velec);
624 fscal = _mm_and_ps(fscal,cutoff_mask);
626 /* Update vectorial force */
627 fix2 = _mm_macc_ps(dx22,fscal,fix2);
628 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
629 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
631 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
632 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
633 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
637 fjptrA = f+j_coord_offsetA;
638 fjptrB = f+j_coord_offsetB;
639 fjptrC = f+j_coord_offsetC;
640 fjptrD = f+j_coord_offsetD;
642 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
643 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
645 /* Inner loop uses 387 flops */
651 /* Get j neighbor index, and coordinate index */
652 jnrlistA = jjnr[jidx];
653 jnrlistB = jjnr[jidx+1];
654 jnrlistC = jjnr[jidx+2];
655 jnrlistD = jjnr[jidx+3];
656 /* Sign of each element will be negative for non-real atoms.
657 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
658 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
660 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
661 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
662 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
663 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
664 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
665 j_coord_offsetA = DIM*jnrA;
666 j_coord_offsetB = DIM*jnrB;
667 j_coord_offsetC = DIM*jnrC;
668 j_coord_offsetD = DIM*jnrD;
670 /* load j atom coordinates */
671 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
672 x+j_coord_offsetC,x+j_coord_offsetD,
673 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
675 /* Calculate displacement vector */
676 dx00 = _mm_sub_ps(ix0,jx0);
677 dy00 = _mm_sub_ps(iy0,jy0);
678 dz00 = _mm_sub_ps(iz0,jz0);
679 dx01 = _mm_sub_ps(ix0,jx1);
680 dy01 = _mm_sub_ps(iy0,jy1);
681 dz01 = _mm_sub_ps(iz0,jz1);
682 dx02 = _mm_sub_ps(ix0,jx2);
683 dy02 = _mm_sub_ps(iy0,jy2);
684 dz02 = _mm_sub_ps(iz0,jz2);
685 dx10 = _mm_sub_ps(ix1,jx0);
686 dy10 = _mm_sub_ps(iy1,jy0);
687 dz10 = _mm_sub_ps(iz1,jz0);
688 dx11 = _mm_sub_ps(ix1,jx1);
689 dy11 = _mm_sub_ps(iy1,jy1);
690 dz11 = _mm_sub_ps(iz1,jz1);
691 dx12 = _mm_sub_ps(ix1,jx2);
692 dy12 = _mm_sub_ps(iy1,jy2);
693 dz12 = _mm_sub_ps(iz1,jz2);
694 dx20 = _mm_sub_ps(ix2,jx0);
695 dy20 = _mm_sub_ps(iy2,jy0);
696 dz20 = _mm_sub_ps(iz2,jz0);
697 dx21 = _mm_sub_ps(ix2,jx1);
698 dy21 = _mm_sub_ps(iy2,jy1);
699 dz21 = _mm_sub_ps(iz2,jz1);
700 dx22 = _mm_sub_ps(ix2,jx2);
701 dy22 = _mm_sub_ps(iy2,jy2);
702 dz22 = _mm_sub_ps(iz2,jz2);
704 /* Calculate squared distance and things based on it */
705 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
706 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
707 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
708 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
709 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
710 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
711 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
712 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
713 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
715 rinv00 = gmx_mm_invsqrt_ps(rsq00);
716 rinv01 = gmx_mm_invsqrt_ps(rsq01);
717 rinv02 = gmx_mm_invsqrt_ps(rsq02);
718 rinv10 = gmx_mm_invsqrt_ps(rsq10);
719 rinv11 = gmx_mm_invsqrt_ps(rsq11);
720 rinv12 = gmx_mm_invsqrt_ps(rsq12);
721 rinv20 = gmx_mm_invsqrt_ps(rsq20);
722 rinv21 = gmx_mm_invsqrt_ps(rsq21);
723 rinv22 = gmx_mm_invsqrt_ps(rsq22);
725 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
726 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
727 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
728 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
729 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
730 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
731 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
732 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
733 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
735 fjx0 = _mm_setzero_ps();
736 fjy0 = _mm_setzero_ps();
737 fjz0 = _mm_setzero_ps();
738 fjx1 = _mm_setzero_ps();
739 fjy1 = _mm_setzero_ps();
740 fjz1 = _mm_setzero_ps();
741 fjx2 = _mm_setzero_ps();
742 fjy2 = _mm_setzero_ps();
743 fjz2 = _mm_setzero_ps();
745 /**************************
746 * CALCULATE INTERACTIONS *
747 **************************/
749 if (gmx_mm_any_lt(rsq00,rcutoff2))
752 r00 = _mm_mul_ps(rsq00,rinv00);
753 r00 = _mm_andnot_ps(dummy_mask,r00);
755 /* Calculate table index by multiplying r with table scale and truncate to integer */
756 rt = _mm_mul_ps(r00,vftabscale);
757 vfitab = _mm_cvttps_epi32(rt);
759 vfeps = _mm_frcz_ps(rt);
761 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
763 twovfeps = _mm_add_ps(vfeps,vfeps);
764 vfitab = _mm_slli_epi32(vfitab,3);
766 /* REACTION-FIELD ELECTROSTATICS */
767 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_macc_ps(krf,rsq00,rinv00),crf));
768 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
770 /* CUBIC SPLINE TABLE DISPERSION */
771 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
772 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
773 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
774 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
775 _MM_TRANSPOSE4_PS(Y,F,G,H);
776 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
777 VV = _mm_macc_ps(vfeps,Fp,Y);
778 vvdw6 = _mm_mul_ps(c6_00,VV);
779 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
780 fvdw6 = _mm_mul_ps(c6_00,FF);
782 /* CUBIC SPLINE TABLE REPULSION */
783 vfitab = _mm_add_epi32(vfitab,ifour);
784 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
785 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
786 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
787 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
788 _MM_TRANSPOSE4_PS(Y,F,G,H);
789 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
790 VV = _mm_macc_ps(vfeps,Fp,Y);
791 vvdw12 = _mm_mul_ps(c12_00,VV);
792 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
793 fvdw12 = _mm_mul_ps(c12_00,FF);
794 vvdw = _mm_add_ps(vvdw12,vvdw6);
795 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
797 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
799 /* Update potential sum for this i atom from the interaction with this j atom. */
800 velec = _mm_and_ps(velec,cutoff_mask);
801 velec = _mm_andnot_ps(dummy_mask,velec);
802 velecsum = _mm_add_ps(velecsum,velec);
803 vvdw = _mm_and_ps(vvdw,cutoff_mask);
804 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
805 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
807 fscal = _mm_add_ps(felec,fvdw);
809 fscal = _mm_and_ps(fscal,cutoff_mask);
811 fscal = _mm_andnot_ps(dummy_mask,fscal);
813 /* Update vectorial force */
814 fix0 = _mm_macc_ps(dx00,fscal,fix0);
815 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
816 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
818 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
819 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
820 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
824 /**************************
825 * CALCULATE INTERACTIONS *
826 **************************/
828 if (gmx_mm_any_lt(rsq01,rcutoff2))
831 /* REACTION-FIELD ELECTROSTATICS */
832 velec = _mm_mul_ps(qq01,_mm_sub_ps(_mm_macc_ps(krf,rsq01,rinv01),crf));
833 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
835 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
837 /* Update potential sum for this i atom from the interaction with this j atom. */
838 velec = _mm_and_ps(velec,cutoff_mask);
839 velec = _mm_andnot_ps(dummy_mask,velec);
840 velecsum = _mm_add_ps(velecsum,velec);
844 fscal = _mm_and_ps(fscal,cutoff_mask);
846 fscal = _mm_andnot_ps(dummy_mask,fscal);
848 /* Update vectorial force */
849 fix0 = _mm_macc_ps(dx01,fscal,fix0);
850 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
851 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
853 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
854 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
855 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
859 /**************************
860 * CALCULATE INTERACTIONS *
861 **************************/
863 if (gmx_mm_any_lt(rsq02,rcutoff2))
866 /* REACTION-FIELD ELECTROSTATICS */
867 velec = _mm_mul_ps(qq02,_mm_sub_ps(_mm_macc_ps(krf,rsq02,rinv02),crf));
868 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
870 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
872 /* Update potential sum for this i atom from the interaction with this j atom. */
873 velec = _mm_and_ps(velec,cutoff_mask);
874 velec = _mm_andnot_ps(dummy_mask,velec);
875 velecsum = _mm_add_ps(velecsum,velec);
879 fscal = _mm_and_ps(fscal,cutoff_mask);
881 fscal = _mm_andnot_ps(dummy_mask,fscal);
883 /* Update vectorial force */
884 fix0 = _mm_macc_ps(dx02,fscal,fix0);
885 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
886 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
888 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
889 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
890 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
894 /**************************
895 * CALCULATE INTERACTIONS *
896 **************************/
898 if (gmx_mm_any_lt(rsq10,rcutoff2))
901 /* REACTION-FIELD ELECTROSTATICS */
902 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_macc_ps(krf,rsq10,rinv10),crf));
903 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
905 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
907 /* Update potential sum for this i atom from the interaction with this j atom. */
908 velec = _mm_and_ps(velec,cutoff_mask);
909 velec = _mm_andnot_ps(dummy_mask,velec);
910 velecsum = _mm_add_ps(velecsum,velec);
914 fscal = _mm_and_ps(fscal,cutoff_mask);
916 fscal = _mm_andnot_ps(dummy_mask,fscal);
918 /* Update vectorial force */
919 fix1 = _mm_macc_ps(dx10,fscal,fix1);
920 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
921 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
923 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
924 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
925 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
929 /**************************
930 * CALCULATE INTERACTIONS *
931 **************************/
933 if (gmx_mm_any_lt(rsq11,rcutoff2))
936 /* REACTION-FIELD ELECTROSTATICS */
937 velec = _mm_mul_ps(qq11,_mm_sub_ps(_mm_macc_ps(krf,rsq11,rinv11),crf));
938 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
940 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
942 /* Update potential sum for this i atom from the interaction with this j atom. */
943 velec = _mm_and_ps(velec,cutoff_mask);
944 velec = _mm_andnot_ps(dummy_mask,velec);
945 velecsum = _mm_add_ps(velecsum,velec);
949 fscal = _mm_and_ps(fscal,cutoff_mask);
951 fscal = _mm_andnot_ps(dummy_mask,fscal);
953 /* Update vectorial force */
954 fix1 = _mm_macc_ps(dx11,fscal,fix1);
955 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
956 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
958 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
959 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
960 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
964 /**************************
965 * CALCULATE INTERACTIONS *
966 **************************/
968 if (gmx_mm_any_lt(rsq12,rcutoff2))
971 /* REACTION-FIELD ELECTROSTATICS */
972 velec = _mm_mul_ps(qq12,_mm_sub_ps(_mm_macc_ps(krf,rsq12,rinv12),crf));
973 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
975 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
977 /* Update potential sum for this i atom from the interaction with this j atom. */
978 velec = _mm_and_ps(velec,cutoff_mask);
979 velec = _mm_andnot_ps(dummy_mask,velec);
980 velecsum = _mm_add_ps(velecsum,velec);
984 fscal = _mm_and_ps(fscal,cutoff_mask);
986 fscal = _mm_andnot_ps(dummy_mask,fscal);
988 /* Update vectorial force */
989 fix1 = _mm_macc_ps(dx12,fscal,fix1);
990 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
991 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
993 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
994 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
995 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
999 /**************************
1000 * CALCULATE INTERACTIONS *
1001 **************************/
1003 if (gmx_mm_any_lt(rsq20,rcutoff2))
1006 /* REACTION-FIELD ELECTROSTATICS */
1007 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_macc_ps(krf,rsq20,rinv20),crf));
1008 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1010 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1012 /* Update potential sum for this i atom from the interaction with this j atom. */
1013 velec = _mm_and_ps(velec,cutoff_mask);
1014 velec = _mm_andnot_ps(dummy_mask,velec);
1015 velecsum = _mm_add_ps(velecsum,velec);
1019 fscal = _mm_and_ps(fscal,cutoff_mask);
1021 fscal = _mm_andnot_ps(dummy_mask,fscal);
1023 /* Update vectorial force */
1024 fix2 = _mm_macc_ps(dx20,fscal,fix2);
1025 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
1026 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
1028 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
1029 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
1030 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
1034 /**************************
1035 * CALCULATE INTERACTIONS *
1036 **************************/
1038 if (gmx_mm_any_lt(rsq21,rcutoff2))
1041 /* REACTION-FIELD ELECTROSTATICS */
1042 velec = _mm_mul_ps(qq21,_mm_sub_ps(_mm_macc_ps(krf,rsq21,rinv21),crf));
1043 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
1045 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
1047 /* Update potential sum for this i atom from the interaction with this j atom. */
1048 velec = _mm_and_ps(velec,cutoff_mask);
1049 velec = _mm_andnot_ps(dummy_mask,velec);
1050 velecsum = _mm_add_ps(velecsum,velec);
1054 fscal = _mm_and_ps(fscal,cutoff_mask);
1056 fscal = _mm_andnot_ps(dummy_mask,fscal);
1058 /* Update vectorial force */
1059 fix2 = _mm_macc_ps(dx21,fscal,fix2);
1060 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
1061 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
1063 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
1064 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
1065 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
1069 /**************************
1070 * CALCULATE INTERACTIONS *
1071 **************************/
1073 if (gmx_mm_any_lt(rsq22,rcutoff2))
1076 /* REACTION-FIELD ELECTROSTATICS */
1077 velec = _mm_mul_ps(qq22,_mm_sub_ps(_mm_macc_ps(krf,rsq22,rinv22),crf));
1078 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
1080 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
1082 /* Update potential sum for this i atom from the interaction with this j atom. */
1083 velec = _mm_and_ps(velec,cutoff_mask);
1084 velec = _mm_andnot_ps(dummy_mask,velec);
1085 velecsum = _mm_add_ps(velecsum,velec);
1089 fscal = _mm_and_ps(fscal,cutoff_mask);
1091 fscal = _mm_andnot_ps(dummy_mask,fscal);
1093 /* Update vectorial force */
1094 fix2 = _mm_macc_ps(dx22,fscal,fix2);
1095 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
1096 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
1098 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
1099 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
1100 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
1104 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1105 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1106 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1107 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1109 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
1110 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1112 /* Inner loop uses 388 flops */
1115 /* End of innermost loop */
1117 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1118 f+i_coord_offset,fshift+i_shift_offset);
1121 /* Update potential energies */
1122 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
1123 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
1125 /* Increment number of inner iterations */
1126 inneriter += j_index_end - j_index_start;
1128 /* Outer loop uses 20 flops */
1131 /* Increment number of outer iterations */
1134 /* Update outer/inner flops */
1136 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*388);
1139 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_avx_128_fma_single
1140 * Electrostatics interaction: ReactionField
1141 * VdW interaction: CubicSplineTable
1142 * Geometry: Water3-Water3
1143 * Calculate force/pot: Force
1146 nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_avx_128_fma_single
1147 (t_nblist * gmx_restrict nlist,
1148 rvec * gmx_restrict xx,
1149 rvec * gmx_restrict ff,
1150 t_forcerec * gmx_restrict fr,
1151 t_mdatoms * gmx_restrict mdatoms,
1152 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
1153 t_nrnb * gmx_restrict nrnb)
1155 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
1156 * just 0 for non-waters.
1157 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
1158 * jnr indices corresponding to data put in the four positions in the SIMD register.
1160 int i_shift_offset,i_coord_offset,outeriter,inneriter;
1161 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
1162 int jnrA,jnrB,jnrC,jnrD;
1163 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
1164 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
1165 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
1166 real rcutoff_scalar;
1167 real *shiftvec,*fshift,*x,*f;
1168 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
1169 real scratch[4*DIM];
1170 __m128 fscal,rcutoff,rcutoff2,jidxall;
1172 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
1174 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
1176 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
1177 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
1178 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
1179 int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D;
1180 __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
1181 int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D;
1182 __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
1183 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
1184 __m128 dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
1185 __m128 dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
1186 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
1187 __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
1188 __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
1189 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
1190 __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
1191 __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
1192 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
1195 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
1198 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
1199 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
1201 __m128i ifour = _mm_set1_epi32(4);
1202 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
1204 __m128 dummy_mask,cutoff_mask;
1205 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
1206 __m128 one = _mm_set1_ps(1.0);
1207 __m128 two = _mm_set1_ps(2.0);
1213 jindex = nlist->jindex;
1215 shiftidx = nlist->shift;
1217 shiftvec = fr->shift_vec[0];
1218 fshift = fr->fshift[0];
1219 facel = _mm_set1_ps(fr->epsfac);
1220 charge = mdatoms->chargeA;
1221 krf = _mm_set1_ps(fr->ic->k_rf);
1222 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
1223 crf = _mm_set1_ps(fr->ic->c_rf);
1224 nvdwtype = fr->ntype;
1225 vdwparam = fr->nbfp;
1226 vdwtype = mdatoms->typeA;
1228 vftab = kernel_data->table_vdw->data;
1229 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
1231 /* Setup water-specific parameters */
1232 inr = nlist->iinr[0];
1233 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
1234 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
1235 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
1236 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
1238 jq0 = _mm_set1_ps(charge[inr+0]);
1239 jq1 = _mm_set1_ps(charge[inr+1]);
1240 jq2 = _mm_set1_ps(charge[inr+2]);
1241 vdwjidx0A = 2*vdwtype[inr+0];
1242 qq00 = _mm_mul_ps(iq0,jq0);
1243 c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]);
1244 c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]);
1245 qq01 = _mm_mul_ps(iq0,jq1);
1246 qq02 = _mm_mul_ps(iq0,jq2);
1247 qq10 = _mm_mul_ps(iq1,jq0);
1248 qq11 = _mm_mul_ps(iq1,jq1);
1249 qq12 = _mm_mul_ps(iq1,jq2);
1250 qq20 = _mm_mul_ps(iq2,jq0);
1251 qq21 = _mm_mul_ps(iq2,jq1);
1252 qq22 = _mm_mul_ps(iq2,jq2);
1254 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
1255 rcutoff_scalar = fr->rcoulomb;
1256 rcutoff = _mm_set1_ps(rcutoff_scalar);
1257 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
1259 /* Avoid stupid compiler warnings */
1260 jnrA = jnrB = jnrC = jnrD = 0;
1261 j_coord_offsetA = 0;
1262 j_coord_offsetB = 0;
1263 j_coord_offsetC = 0;
1264 j_coord_offsetD = 0;
1269 for(iidx=0;iidx<4*DIM;iidx++)
1271 scratch[iidx] = 0.0;
1274 /* Start outer loop over neighborlists */
1275 for(iidx=0; iidx<nri; iidx++)
1277 /* Load shift vector for this list */
1278 i_shift_offset = DIM*shiftidx[iidx];
1280 /* Load limits for loop over neighbors */
1281 j_index_start = jindex[iidx];
1282 j_index_end = jindex[iidx+1];
1284 /* Get outer coordinate index */
1286 i_coord_offset = DIM*inr;
1288 /* Load i particle coords and add shift vector */
1289 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
1290 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
1292 fix0 = _mm_setzero_ps();
1293 fiy0 = _mm_setzero_ps();
1294 fiz0 = _mm_setzero_ps();
1295 fix1 = _mm_setzero_ps();
1296 fiy1 = _mm_setzero_ps();
1297 fiz1 = _mm_setzero_ps();
1298 fix2 = _mm_setzero_ps();
1299 fiy2 = _mm_setzero_ps();
1300 fiz2 = _mm_setzero_ps();
1302 /* Start inner kernel loop */
1303 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
1306 /* Get j neighbor index, and coordinate index */
1308 jnrB = jjnr[jidx+1];
1309 jnrC = jjnr[jidx+2];
1310 jnrD = jjnr[jidx+3];
1311 j_coord_offsetA = DIM*jnrA;
1312 j_coord_offsetB = DIM*jnrB;
1313 j_coord_offsetC = DIM*jnrC;
1314 j_coord_offsetD = DIM*jnrD;
1316 /* load j atom coordinates */
1317 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1318 x+j_coord_offsetC,x+j_coord_offsetD,
1319 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1321 /* Calculate displacement vector */
1322 dx00 = _mm_sub_ps(ix0,jx0);
1323 dy00 = _mm_sub_ps(iy0,jy0);
1324 dz00 = _mm_sub_ps(iz0,jz0);
1325 dx01 = _mm_sub_ps(ix0,jx1);
1326 dy01 = _mm_sub_ps(iy0,jy1);
1327 dz01 = _mm_sub_ps(iz0,jz1);
1328 dx02 = _mm_sub_ps(ix0,jx2);
1329 dy02 = _mm_sub_ps(iy0,jy2);
1330 dz02 = _mm_sub_ps(iz0,jz2);
1331 dx10 = _mm_sub_ps(ix1,jx0);
1332 dy10 = _mm_sub_ps(iy1,jy0);
1333 dz10 = _mm_sub_ps(iz1,jz0);
1334 dx11 = _mm_sub_ps(ix1,jx1);
1335 dy11 = _mm_sub_ps(iy1,jy1);
1336 dz11 = _mm_sub_ps(iz1,jz1);
1337 dx12 = _mm_sub_ps(ix1,jx2);
1338 dy12 = _mm_sub_ps(iy1,jy2);
1339 dz12 = _mm_sub_ps(iz1,jz2);
1340 dx20 = _mm_sub_ps(ix2,jx0);
1341 dy20 = _mm_sub_ps(iy2,jy0);
1342 dz20 = _mm_sub_ps(iz2,jz0);
1343 dx21 = _mm_sub_ps(ix2,jx1);
1344 dy21 = _mm_sub_ps(iy2,jy1);
1345 dz21 = _mm_sub_ps(iz2,jz1);
1346 dx22 = _mm_sub_ps(ix2,jx2);
1347 dy22 = _mm_sub_ps(iy2,jy2);
1348 dz22 = _mm_sub_ps(iz2,jz2);
1350 /* Calculate squared distance and things based on it */
1351 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1352 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
1353 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
1354 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1355 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
1356 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
1357 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1358 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
1359 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
1361 rinv00 = gmx_mm_invsqrt_ps(rsq00);
1362 rinv01 = gmx_mm_invsqrt_ps(rsq01);
1363 rinv02 = gmx_mm_invsqrt_ps(rsq02);
1364 rinv10 = gmx_mm_invsqrt_ps(rsq10);
1365 rinv11 = gmx_mm_invsqrt_ps(rsq11);
1366 rinv12 = gmx_mm_invsqrt_ps(rsq12);
1367 rinv20 = gmx_mm_invsqrt_ps(rsq20);
1368 rinv21 = gmx_mm_invsqrt_ps(rsq21);
1369 rinv22 = gmx_mm_invsqrt_ps(rsq22);
1371 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
1372 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
1373 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
1374 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
1375 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
1376 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
1377 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
1378 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
1379 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
1381 fjx0 = _mm_setzero_ps();
1382 fjy0 = _mm_setzero_ps();
1383 fjz0 = _mm_setzero_ps();
1384 fjx1 = _mm_setzero_ps();
1385 fjy1 = _mm_setzero_ps();
1386 fjz1 = _mm_setzero_ps();
1387 fjx2 = _mm_setzero_ps();
1388 fjy2 = _mm_setzero_ps();
1389 fjz2 = _mm_setzero_ps();
1391 /**************************
1392 * CALCULATE INTERACTIONS *
1393 **************************/
1395 if (gmx_mm_any_lt(rsq00,rcutoff2))
1398 r00 = _mm_mul_ps(rsq00,rinv00);
1400 /* Calculate table index by multiplying r with table scale and truncate to integer */
1401 rt = _mm_mul_ps(r00,vftabscale);
1402 vfitab = _mm_cvttps_epi32(rt);
1404 vfeps = _mm_frcz_ps(rt);
1406 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
1408 twovfeps = _mm_add_ps(vfeps,vfeps);
1409 vfitab = _mm_slli_epi32(vfitab,3);
1411 /* REACTION-FIELD ELECTROSTATICS */
1412 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
1414 /* CUBIC SPLINE TABLE DISPERSION */
1415 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1416 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1417 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1418 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1419 _MM_TRANSPOSE4_PS(Y,F,G,H);
1420 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1421 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1422 fvdw6 = _mm_mul_ps(c6_00,FF);
1424 /* CUBIC SPLINE TABLE REPULSION */
1425 vfitab = _mm_add_epi32(vfitab,ifour);
1426 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1427 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1428 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1429 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1430 _MM_TRANSPOSE4_PS(Y,F,G,H);
1431 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1432 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1433 fvdw12 = _mm_mul_ps(c12_00,FF);
1434 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1436 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
1438 fscal = _mm_add_ps(felec,fvdw);
1440 fscal = _mm_and_ps(fscal,cutoff_mask);
1442 /* Update vectorial force */
1443 fix0 = _mm_macc_ps(dx00,fscal,fix0);
1444 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
1445 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
1447 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
1448 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
1449 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
1453 /**************************
1454 * CALCULATE INTERACTIONS *
1455 **************************/
1457 if (gmx_mm_any_lt(rsq01,rcutoff2))
1460 /* REACTION-FIELD ELECTROSTATICS */
1461 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
1463 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
1467 fscal = _mm_and_ps(fscal,cutoff_mask);
1469 /* Update vectorial force */
1470 fix0 = _mm_macc_ps(dx01,fscal,fix0);
1471 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
1472 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
1474 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
1475 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
1476 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
1480 /**************************
1481 * CALCULATE INTERACTIONS *
1482 **************************/
1484 if (gmx_mm_any_lt(rsq02,rcutoff2))
1487 /* REACTION-FIELD ELECTROSTATICS */
1488 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
1490 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
1494 fscal = _mm_and_ps(fscal,cutoff_mask);
1496 /* Update vectorial force */
1497 fix0 = _mm_macc_ps(dx02,fscal,fix0);
1498 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
1499 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
1501 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
1502 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
1503 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
1507 /**************************
1508 * CALCULATE INTERACTIONS *
1509 **************************/
1511 if (gmx_mm_any_lt(rsq10,rcutoff2))
1514 /* REACTION-FIELD ELECTROSTATICS */
1515 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
1517 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1521 fscal = _mm_and_ps(fscal,cutoff_mask);
1523 /* Update vectorial force */
1524 fix1 = _mm_macc_ps(dx10,fscal,fix1);
1525 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
1526 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
1528 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
1529 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
1530 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
1534 /**************************
1535 * CALCULATE INTERACTIONS *
1536 **************************/
1538 if (gmx_mm_any_lt(rsq11,rcutoff2))
1541 /* REACTION-FIELD ELECTROSTATICS */
1542 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
1544 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
1548 fscal = _mm_and_ps(fscal,cutoff_mask);
1550 /* Update vectorial force */
1551 fix1 = _mm_macc_ps(dx11,fscal,fix1);
1552 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
1553 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
1555 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
1556 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
1557 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
1561 /**************************
1562 * CALCULATE INTERACTIONS *
1563 **************************/
1565 if (gmx_mm_any_lt(rsq12,rcutoff2))
1568 /* REACTION-FIELD ELECTROSTATICS */
1569 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
1571 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
1575 fscal = _mm_and_ps(fscal,cutoff_mask);
1577 /* Update vectorial force */
1578 fix1 = _mm_macc_ps(dx12,fscal,fix1);
1579 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
1580 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
1582 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
1583 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
1584 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
1588 /**************************
1589 * CALCULATE INTERACTIONS *
1590 **************************/
1592 if (gmx_mm_any_lt(rsq20,rcutoff2))
1595 /* REACTION-FIELD ELECTROSTATICS */
1596 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1598 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1602 fscal = _mm_and_ps(fscal,cutoff_mask);
1604 /* Update vectorial force */
1605 fix2 = _mm_macc_ps(dx20,fscal,fix2);
1606 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
1607 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
1609 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
1610 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
1611 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
1615 /**************************
1616 * CALCULATE INTERACTIONS *
1617 **************************/
1619 if (gmx_mm_any_lt(rsq21,rcutoff2))
1622 /* REACTION-FIELD ELECTROSTATICS */
1623 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
1625 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
1629 fscal = _mm_and_ps(fscal,cutoff_mask);
1631 /* Update vectorial force */
1632 fix2 = _mm_macc_ps(dx21,fscal,fix2);
1633 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
1634 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
1636 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
1637 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
1638 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
1642 /**************************
1643 * CALCULATE INTERACTIONS *
1644 **************************/
1646 if (gmx_mm_any_lt(rsq22,rcutoff2))
1649 /* REACTION-FIELD ELECTROSTATICS */
1650 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
1652 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
1656 fscal = _mm_and_ps(fscal,cutoff_mask);
1658 /* Update vectorial force */
1659 fix2 = _mm_macc_ps(dx22,fscal,fix2);
1660 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
1661 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
1663 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
1664 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
1665 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
1669 fjptrA = f+j_coord_offsetA;
1670 fjptrB = f+j_coord_offsetB;
1671 fjptrC = f+j_coord_offsetC;
1672 fjptrD = f+j_coord_offsetD;
1674 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
1675 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1677 /* Inner loop uses 324 flops */
1680 if(jidx<j_index_end)
1683 /* Get j neighbor index, and coordinate index */
1684 jnrlistA = jjnr[jidx];
1685 jnrlistB = jjnr[jidx+1];
1686 jnrlistC = jjnr[jidx+2];
1687 jnrlistD = jjnr[jidx+3];
1688 /* Sign of each element will be negative for non-real atoms.
1689 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
1690 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
1692 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
1693 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
1694 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
1695 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
1696 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
1697 j_coord_offsetA = DIM*jnrA;
1698 j_coord_offsetB = DIM*jnrB;
1699 j_coord_offsetC = DIM*jnrC;
1700 j_coord_offsetD = DIM*jnrD;
1702 /* load j atom coordinates */
1703 gmx_mm_load_3rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1704 x+j_coord_offsetC,x+j_coord_offsetD,
1705 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1707 /* Calculate displacement vector */
1708 dx00 = _mm_sub_ps(ix0,jx0);
1709 dy00 = _mm_sub_ps(iy0,jy0);
1710 dz00 = _mm_sub_ps(iz0,jz0);
1711 dx01 = _mm_sub_ps(ix0,jx1);
1712 dy01 = _mm_sub_ps(iy0,jy1);
1713 dz01 = _mm_sub_ps(iz0,jz1);
1714 dx02 = _mm_sub_ps(ix0,jx2);
1715 dy02 = _mm_sub_ps(iy0,jy2);
1716 dz02 = _mm_sub_ps(iz0,jz2);
1717 dx10 = _mm_sub_ps(ix1,jx0);
1718 dy10 = _mm_sub_ps(iy1,jy0);
1719 dz10 = _mm_sub_ps(iz1,jz0);
1720 dx11 = _mm_sub_ps(ix1,jx1);
1721 dy11 = _mm_sub_ps(iy1,jy1);
1722 dz11 = _mm_sub_ps(iz1,jz1);
1723 dx12 = _mm_sub_ps(ix1,jx2);
1724 dy12 = _mm_sub_ps(iy1,jy2);
1725 dz12 = _mm_sub_ps(iz1,jz2);
1726 dx20 = _mm_sub_ps(ix2,jx0);
1727 dy20 = _mm_sub_ps(iy2,jy0);
1728 dz20 = _mm_sub_ps(iz2,jz0);
1729 dx21 = _mm_sub_ps(ix2,jx1);
1730 dy21 = _mm_sub_ps(iy2,jy1);
1731 dz21 = _mm_sub_ps(iz2,jz1);
1732 dx22 = _mm_sub_ps(ix2,jx2);
1733 dy22 = _mm_sub_ps(iy2,jy2);
1734 dz22 = _mm_sub_ps(iz2,jz2);
1736 /* Calculate squared distance and things based on it */
1737 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1738 rsq01 = gmx_mm_calc_rsq_ps(dx01,dy01,dz01);
1739 rsq02 = gmx_mm_calc_rsq_ps(dx02,dy02,dz02);
1740 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1741 rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11);
1742 rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12);
1743 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1744 rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21);
1745 rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22);
1747 rinv00 = gmx_mm_invsqrt_ps(rsq00);
1748 rinv01 = gmx_mm_invsqrt_ps(rsq01);
1749 rinv02 = gmx_mm_invsqrt_ps(rsq02);
1750 rinv10 = gmx_mm_invsqrt_ps(rsq10);
1751 rinv11 = gmx_mm_invsqrt_ps(rsq11);
1752 rinv12 = gmx_mm_invsqrt_ps(rsq12);
1753 rinv20 = gmx_mm_invsqrt_ps(rsq20);
1754 rinv21 = gmx_mm_invsqrt_ps(rsq21);
1755 rinv22 = gmx_mm_invsqrt_ps(rsq22);
1757 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
1758 rinvsq01 = _mm_mul_ps(rinv01,rinv01);
1759 rinvsq02 = _mm_mul_ps(rinv02,rinv02);
1760 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
1761 rinvsq11 = _mm_mul_ps(rinv11,rinv11);
1762 rinvsq12 = _mm_mul_ps(rinv12,rinv12);
1763 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
1764 rinvsq21 = _mm_mul_ps(rinv21,rinv21);
1765 rinvsq22 = _mm_mul_ps(rinv22,rinv22);
1767 fjx0 = _mm_setzero_ps();
1768 fjy0 = _mm_setzero_ps();
1769 fjz0 = _mm_setzero_ps();
1770 fjx1 = _mm_setzero_ps();
1771 fjy1 = _mm_setzero_ps();
1772 fjz1 = _mm_setzero_ps();
1773 fjx2 = _mm_setzero_ps();
1774 fjy2 = _mm_setzero_ps();
1775 fjz2 = _mm_setzero_ps();
1777 /**************************
1778 * CALCULATE INTERACTIONS *
1779 **************************/
1781 if (gmx_mm_any_lt(rsq00,rcutoff2))
1784 r00 = _mm_mul_ps(rsq00,rinv00);
1785 r00 = _mm_andnot_ps(dummy_mask,r00);
1787 /* Calculate table index by multiplying r with table scale and truncate to integer */
1788 rt = _mm_mul_ps(r00,vftabscale);
1789 vfitab = _mm_cvttps_epi32(rt);
1791 vfeps = _mm_frcz_ps(rt);
1793 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
1795 twovfeps = _mm_add_ps(vfeps,vfeps);
1796 vfitab = _mm_slli_epi32(vfitab,3);
1798 /* REACTION-FIELD ELECTROSTATICS */
1799 felec = _mm_mul_ps(qq00,_mm_msub_ps(rinv00,rinvsq00,krf2));
1801 /* CUBIC SPLINE TABLE DISPERSION */
1802 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1803 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1804 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1805 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1806 _MM_TRANSPOSE4_PS(Y,F,G,H);
1807 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1808 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1809 fvdw6 = _mm_mul_ps(c6_00,FF);
1811 /* CUBIC SPLINE TABLE REPULSION */
1812 vfitab = _mm_add_epi32(vfitab,ifour);
1813 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
1814 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
1815 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
1816 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
1817 _MM_TRANSPOSE4_PS(Y,F,G,H);
1818 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
1819 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
1820 fvdw12 = _mm_mul_ps(c12_00,FF);
1821 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1823 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
1825 fscal = _mm_add_ps(felec,fvdw);
1827 fscal = _mm_and_ps(fscal,cutoff_mask);
1829 fscal = _mm_andnot_ps(dummy_mask,fscal);
1831 /* Update vectorial force */
1832 fix0 = _mm_macc_ps(dx00,fscal,fix0);
1833 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
1834 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
1836 fjx0 = _mm_macc_ps(dx00,fscal,fjx0);
1837 fjy0 = _mm_macc_ps(dy00,fscal,fjy0);
1838 fjz0 = _mm_macc_ps(dz00,fscal,fjz0);
1842 /**************************
1843 * CALCULATE INTERACTIONS *
1844 **************************/
1846 if (gmx_mm_any_lt(rsq01,rcutoff2))
1849 /* REACTION-FIELD ELECTROSTATICS */
1850 felec = _mm_mul_ps(qq01,_mm_msub_ps(rinv01,rinvsq01,krf2));
1852 cutoff_mask = _mm_cmplt_ps(rsq01,rcutoff2);
1856 fscal = _mm_and_ps(fscal,cutoff_mask);
1858 fscal = _mm_andnot_ps(dummy_mask,fscal);
1860 /* Update vectorial force */
1861 fix0 = _mm_macc_ps(dx01,fscal,fix0);
1862 fiy0 = _mm_macc_ps(dy01,fscal,fiy0);
1863 fiz0 = _mm_macc_ps(dz01,fscal,fiz0);
1865 fjx1 = _mm_macc_ps(dx01,fscal,fjx1);
1866 fjy1 = _mm_macc_ps(dy01,fscal,fjy1);
1867 fjz1 = _mm_macc_ps(dz01,fscal,fjz1);
1871 /**************************
1872 * CALCULATE INTERACTIONS *
1873 **************************/
1875 if (gmx_mm_any_lt(rsq02,rcutoff2))
1878 /* REACTION-FIELD ELECTROSTATICS */
1879 felec = _mm_mul_ps(qq02,_mm_msub_ps(rinv02,rinvsq02,krf2));
1881 cutoff_mask = _mm_cmplt_ps(rsq02,rcutoff2);
1885 fscal = _mm_and_ps(fscal,cutoff_mask);
1887 fscal = _mm_andnot_ps(dummy_mask,fscal);
1889 /* Update vectorial force */
1890 fix0 = _mm_macc_ps(dx02,fscal,fix0);
1891 fiy0 = _mm_macc_ps(dy02,fscal,fiy0);
1892 fiz0 = _mm_macc_ps(dz02,fscal,fiz0);
1894 fjx2 = _mm_macc_ps(dx02,fscal,fjx2);
1895 fjy2 = _mm_macc_ps(dy02,fscal,fjy2);
1896 fjz2 = _mm_macc_ps(dz02,fscal,fjz2);
1900 /**************************
1901 * CALCULATE INTERACTIONS *
1902 **************************/
1904 if (gmx_mm_any_lt(rsq10,rcutoff2))
1907 /* REACTION-FIELD ELECTROSTATICS */
1908 felec = _mm_mul_ps(qq10,_mm_msub_ps(rinv10,rinvsq10,krf2));
1910 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1914 fscal = _mm_and_ps(fscal,cutoff_mask);
1916 fscal = _mm_andnot_ps(dummy_mask,fscal);
1918 /* Update vectorial force */
1919 fix1 = _mm_macc_ps(dx10,fscal,fix1);
1920 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
1921 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
1923 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
1924 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
1925 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
1929 /**************************
1930 * CALCULATE INTERACTIONS *
1931 **************************/
1933 if (gmx_mm_any_lt(rsq11,rcutoff2))
1936 /* REACTION-FIELD ELECTROSTATICS */
1937 felec = _mm_mul_ps(qq11,_mm_msub_ps(rinv11,rinvsq11,krf2));
1939 cutoff_mask = _mm_cmplt_ps(rsq11,rcutoff2);
1943 fscal = _mm_and_ps(fscal,cutoff_mask);
1945 fscal = _mm_andnot_ps(dummy_mask,fscal);
1947 /* Update vectorial force */
1948 fix1 = _mm_macc_ps(dx11,fscal,fix1);
1949 fiy1 = _mm_macc_ps(dy11,fscal,fiy1);
1950 fiz1 = _mm_macc_ps(dz11,fscal,fiz1);
1952 fjx1 = _mm_macc_ps(dx11,fscal,fjx1);
1953 fjy1 = _mm_macc_ps(dy11,fscal,fjy1);
1954 fjz1 = _mm_macc_ps(dz11,fscal,fjz1);
1958 /**************************
1959 * CALCULATE INTERACTIONS *
1960 **************************/
1962 if (gmx_mm_any_lt(rsq12,rcutoff2))
1965 /* REACTION-FIELD ELECTROSTATICS */
1966 felec = _mm_mul_ps(qq12,_mm_msub_ps(rinv12,rinvsq12,krf2));
1968 cutoff_mask = _mm_cmplt_ps(rsq12,rcutoff2);
1972 fscal = _mm_and_ps(fscal,cutoff_mask);
1974 fscal = _mm_andnot_ps(dummy_mask,fscal);
1976 /* Update vectorial force */
1977 fix1 = _mm_macc_ps(dx12,fscal,fix1);
1978 fiy1 = _mm_macc_ps(dy12,fscal,fiy1);
1979 fiz1 = _mm_macc_ps(dz12,fscal,fiz1);
1981 fjx2 = _mm_macc_ps(dx12,fscal,fjx2);
1982 fjy2 = _mm_macc_ps(dy12,fscal,fjy2);
1983 fjz2 = _mm_macc_ps(dz12,fscal,fjz2);
1987 /**************************
1988 * CALCULATE INTERACTIONS *
1989 **************************/
1991 if (gmx_mm_any_lt(rsq20,rcutoff2))
1994 /* REACTION-FIELD ELECTROSTATICS */
1995 felec = _mm_mul_ps(qq20,_mm_msub_ps(rinv20,rinvsq20,krf2));
1997 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
2001 fscal = _mm_and_ps(fscal,cutoff_mask);
2003 fscal = _mm_andnot_ps(dummy_mask,fscal);
2005 /* Update vectorial force */
2006 fix2 = _mm_macc_ps(dx20,fscal,fix2);
2007 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
2008 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
2010 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
2011 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
2012 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
2016 /**************************
2017 * CALCULATE INTERACTIONS *
2018 **************************/
2020 if (gmx_mm_any_lt(rsq21,rcutoff2))
2023 /* REACTION-FIELD ELECTROSTATICS */
2024 felec = _mm_mul_ps(qq21,_mm_msub_ps(rinv21,rinvsq21,krf2));
2026 cutoff_mask = _mm_cmplt_ps(rsq21,rcutoff2);
2030 fscal = _mm_and_ps(fscal,cutoff_mask);
2032 fscal = _mm_andnot_ps(dummy_mask,fscal);
2034 /* Update vectorial force */
2035 fix2 = _mm_macc_ps(dx21,fscal,fix2);
2036 fiy2 = _mm_macc_ps(dy21,fscal,fiy2);
2037 fiz2 = _mm_macc_ps(dz21,fscal,fiz2);
2039 fjx1 = _mm_macc_ps(dx21,fscal,fjx1);
2040 fjy1 = _mm_macc_ps(dy21,fscal,fjy1);
2041 fjz1 = _mm_macc_ps(dz21,fscal,fjz1);
2045 /**************************
2046 * CALCULATE INTERACTIONS *
2047 **************************/
2049 if (gmx_mm_any_lt(rsq22,rcutoff2))
2052 /* REACTION-FIELD ELECTROSTATICS */
2053 felec = _mm_mul_ps(qq22,_mm_msub_ps(rinv22,rinvsq22,krf2));
2055 cutoff_mask = _mm_cmplt_ps(rsq22,rcutoff2);
2059 fscal = _mm_and_ps(fscal,cutoff_mask);
2061 fscal = _mm_andnot_ps(dummy_mask,fscal);
2063 /* Update vectorial force */
2064 fix2 = _mm_macc_ps(dx22,fscal,fix2);
2065 fiy2 = _mm_macc_ps(dy22,fscal,fiy2);
2066 fiz2 = _mm_macc_ps(dz22,fscal,fiz2);
2068 fjx2 = _mm_macc_ps(dx22,fscal,fjx2);
2069 fjy2 = _mm_macc_ps(dy22,fscal,fjy2);
2070 fjz2 = _mm_macc_ps(dz22,fscal,fjz2);
2074 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
2075 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
2076 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
2077 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
2079 gmx_mm_decrement_3rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
2080 fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
2082 /* Inner loop uses 325 flops */
2085 /* End of innermost loop */
2087 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
2088 f+i_coord_offset,fshift+i_shift_offset);
2090 /* Increment number of inner iterations */
2091 inneriter += j_index_end - j_index_start;
2093 /* Outer loop uses 18 flops */
2096 /* Increment number of outer iterations */
2099 /* Update outer/inner flops */
2101 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*325);