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 "types/simple.h"
44 #include "gromacs/math/vec.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_ElecGB_VdwCSTab_GeomP1P1_VF_avx_128_fma_single
52 * Electrostatics interaction: GeneralizedBorn
53 * VdW interaction: CubicSplineTable
54 * Geometry: Particle-Particle
55 * Calculate force/pot: PotentialAndForce
58 nb_kernel_ElecGB_VdwCSTab_GeomP1P1_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;
85 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
86 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
87 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
88 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
91 __m128 vgb,fgb,vgbsum,dvdasum,gbscale,gbtabscale,isaprod,gbqqfactor,gbinvepsdiff,gbeps,twogbeps,dvdatmp;
92 __m128 minushalf = _mm_set1_ps(-0.5);
93 real *invsqrta,*dvda,*gbtab;
95 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
99 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
101 __m128i ifour = _mm_set1_epi32(4);
102 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
104 __m128 dummy_mask,cutoff_mask;
105 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
106 __m128 one = _mm_set1_ps(1.0);
107 __m128 two = _mm_set1_ps(2.0);
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
119 facel = _mm_set1_ps(fr->epsfac);
120 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 vftab = kernel_data->table_vdw->data;
126 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
128 invsqrta = fr->invsqrta;
130 gbtabscale = _mm_set1_ps(fr->gbtab.scale);
131 gbtab = fr->gbtab.data;
132 gbinvepsdiff = _mm_set1_ps((1.0/fr->epsilon_r) - (1.0/fr->gb_epsilon_solvent));
134 /* Avoid stupid compiler warnings */
135 jnrA = jnrB = jnrC = jnrD = 0;
144 for(iidx=0;iidx<4*DIM;iidx++)
149 /* Start outer loop over neighborlists */
150 for(iidx=0; iidx<nri; iidx++)
152 /* Load shift vector for this list */
153 i_shift_offset = DIM*shiftidx[iidx];
155 /* Load limits for loop over neighbors */
156 j_index_start = jindex[iidx];
157 j_index_end = jindex[iidx+1];
159 /* Get outer coordinate index */
161 i_coord_offset = DIM*inr;
163 /* Load i particle coords and add shift vector */
164 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
166 fix0 = _mm_setzero_ps();
167 fiy0 = _mm_setzero_ps();
168 fiz0 = _mm_setzero_ps();
170 /* Load parameters for i particles */
171 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
172 isai0 = _mm_load1_ps(invsqrta+inr+0);
173 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
175 /* Reset potential sums */
176 velecsum = _mm_setzero_ps();
177 vgbsum = _mm_setzero_ps();
178 vvdwsum = _mm_setzero_ps();
179 dvdasum = _mm_setzero_ps();
181 /* Start inner kernel loop */
182 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
185 /* Get j neighbor index, and coordinate index */
190 j_coord_offsetA = DIM*jnrA;
191 j_coord_offsetB = DIM*jnrB;
192 j_coord_offsetC = DIM*jnrC;
193 j_coord_offsetD = DIM*jnrD;
195 /* load j atom coordinates */
196 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
197 x+j_coord_offsetC,x+j_coord_offsetD,
200 /* Calculate displacement vector */
201 dx00 = _mm_sub_ps(ix0,jx0);
202 dy00 = _mm_sub_ps(iy0,jy0);
203 dz00 = _mm_sub_ps(iz0,jz0);
205 /* Calculate squared distance and things based on it */
206 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
208 rinv00 = gmx_mm_invsqrt_ps(rsq00);
210 /* Load parameters for j particles */
211 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
212 charge+jnrC+0,charge+jnrD+0);
213 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
214 invsqrta+jnrC+0,invsqrta+jnrD+0);
215 vdwjidx0A = 2*vdwtype[jnrA+0];
216 vdwjidx0B = 2*vdwtype[jnrB+0];
217 vdwjidx0C = 2*vdwtype[jnrC+0];
218 vdwjidx0D = 2*vdwtype[jnrD+0];
220 /**************************
221 * CALCULATE INTERACTIONS *
222 **************************/
224 r00 = _mm_mul_ps(rsq00,rinv00);
226 /* Compute parameters for interactions between i and j atoms */
227 qq00 = _mm_mul_ps(iq0,jq0);
228 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
229 vdwparam+vdwioffset0+vdwjidx0B,
230 vdwparam+vdwioffset0+vdwjidx0C,
231 vdwparam+vdwioffset0+vdwjidx0D,
234 /* Calculate table index by multiplying r with table scale and truncate to integer */
235 rt = _mm_mul_ps(r00,vftabscale);
236 vfitab = _mm_cvttps_epi32(rt);
238 vfeps = _mm_frcz_ps(rt);
240 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
242 twovfeps = _mm_add_ps(vfeps,vfeps);
243 vfitab = _mm_slli_epi32(vfitab,3);
245 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
246 isaprod = _mm_mul_ps(isai0,isaj0);
247 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
248 gbscale = _mm_mul_ps(isaprod,gbtabscale);
250 /* Calculate generalized born table index - this is a separate table from the normal one,
251 * but we use the same procedure by multiplying r with scale and truncating to integer.
253 rt = _mm_mul_ps(r00,gbscale);
254 gbitab = _mm_cvttps_epi32(rt);
256 gbeps = _mm_frcz_ps(rt);
258 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
260 gbitab = _mm_slli_epi32(gbitab,2);
262 Y = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,0) );
263 F = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,1) );
264 G = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,2) );
265 H = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,3) );
266 _MM_TRANSPOSE4_PS(Y,F,G,H);
267 Fp = _mm_macc_ps(gbeps,_mm_macc_ps(gbeps,H,G),F);
268 VV = _mm_macc_ps(gbeps,Fp,Y);
269 vgb = _mm_mul_ps(gbqqfactor,VV);
271 twogbeps = _mm_add_ps(gbeps,gbeps);
272 FF = _mm_macc_ps(_mm_macc_ps(twogbeps,H,G),gbeps,Fp);
273 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
274 dvdatmp = _mm_mul_ps(minushalf,_mm_macc_ps(fgb,r00,vgb));
275 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
280 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
281 velec = _mm_mul_ps(qq00,rinv00);
282 felec = _mm_mul_ps(_mm_msub_ps(velec,rinv00,fgb),rinv00);
284 /* CUBIC SPLINE TABLE DISPERSION */
285 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
286 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
287 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
288 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
289 _MM_TRANSPOSE4_PS(Y,F,G,H);
290 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
291 VV = _mm_macc_ps(vfeps,Fp,Y);
292 vvdw6 = _mm_mul_ps(c6_00,VV);
293 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
294 fvdw6 = _mm_mul_ps(c6_00,FF);
296 /* CUBIC SPLINE TABLE REPULSION */
297 vfitab = _mm_add_epi32(vfitab,ifour);
298 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
299 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
300 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
301 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
302 _MM_TRANSPOSE4_PS(Y,F,G,H);
303 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
304 VV = _mm_macc_ps(vfeps,Fp,Y);
305 vvdw12 = _mm_mul_ps(c12_00,VV);
306 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
307 fvdw12 = _mm_mul_ps(c12_00,FF);
308 vvdw = _mm_add_ps(vvdw12,vvdw6);
309 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
311 /* Update potential sum for this i atom from the interaction with this j atom. */
312 velecsum = _mm_add_ps(velecsum,velec);
313 vgbsum = _mm_add_ps(vgbsum,vgb);
314 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
316 fscal = _mm_add_ps(felec,fvdw);
318 /* Update vectorial force */
319 fix0 = _mm_macc_ps(dx00,fscal,fix0);
320 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
321 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
323 fjptrA = f+j_coord_offsetA;
324 fjptrB = f+j_coord_offsetB;
325 fjptrC = f+j_coord_offsetC;
326 fjptrD = f+j_coord_offsetD;
327 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
328 _mm_mul_ps(dx00,fscal),
329 _mm_mul_ps(dy00,fscal),
330 _mm_mul_ps(dz00,fscal));
332 /* Inner loop uses 95 flops */
338 /* Get j neighbor index, and coordinate index */
339 jnrlistA = jjnr[jidx];
340 jnrlistB = jjnr[jidx+1];
341 jnrlistC = jjnr[jidx+2];
342 jnrlistD = jjnr[jidx+3];
343 /* Sign of each element will be negative for non-real atoms.
344 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
345 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
347 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
348 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
349 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
350 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
351 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
352 j_coord_offsetA = DIM*jnrA;
353 j_coord_offsetB = DIM*jnrB;
354 j_coord_offsetC = DIM*jnrC;
355 j_coord_offsetD = DIM*jnrD;
357 /* load j atom coordinates */
358 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
359 x+j_coord_offsetC,x+j_coord_offsetD,
362 /* Calculate displacement vector */
363 dx00 = _mm_sub_ps(ix0,jx0);
364 dy00 = _mm_sub_ps(iy0,jy0);
365 dz00 = _mm_sub_ps(iz0,jz0);
367 /* Calculate squared distance and things based on it */
368 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
370 rinv00 = gmx_mm_invsqrt_ps(rsq00);
372 /* Load parameters for j particles */
373 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
374 charge+jnrC+0,charge+jnrD+0);
375 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
376 invsqrta+jnrC+0,invsqrta+jnrD+0);
377 vdwjidx0A = 2*vdwtype[jnrA+0];
378 vdwjidx0B = 2*vdwtype[jnrB+0];
379 vdwjidx0C = 2*vdwtype[jnrC+0];
380 vdwjidx0D = 2*vdwtype[jnrD+0];
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 r00 = _mm_mul_ps(rsq00,rinv00);
387 r00 = _mm_andnot_ps(dummy_mask,r00);
389 /* Compute parameters for interactions between i and j atoms */
390 qq00 = _mm_mul_ps(iq0,jq0);
391 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
392 vdwparam+vdwioffset0+vdwjidx0B,
393 vdwparam+vdwioffset0+vdwjidx0C,
394 vdwparam+vdwioffset0+vdwjidx0D,
397 /* Calculate table index by multiplying r with table scale and truncate to integer */
398 rt = _mm_mul_ps(r00,vftabscale);
399 vfitab = _mm_cvttps_epi32(rt);
401 vfeps = _mm_frcz_ps(rt);
403 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
405 twovfeps = _mm_add_ps(vfeps,vfeps);
406 vfitab = _mm_slli_epi32(vfitab,3);
408 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
409 isaprod = _mm_mul_ps(isai0,isaj0);
410 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
411 gbscale = _mm_mul_ps(isaprod,gbtabscale);
413 /* Calculate generalized born table index - this is a separate table from the normal one,
414 * but we use the same procedure by multiplying r with scale and truncating to integer.
416 rt = _mm_mul_ps(r00,gbscale);
417 gbitab = _mm_cvttps_epi32(rt);
419 gbeps = _mm_frcz_ps(rt);
421 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
423 gbitab = _mm_slli_epi32(gbitab,2);
425 Y = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,0) );
426 F = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,1) );
427 G = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,2) );
428 H = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,3) );
429 _MM_TRANSPOSE4_PS(Y,F,G,H);
430 Fp = _mm_macc_ps(gbeps,_mm_macc_ps(gbeps,H,G),F);
431 VV = _mm_macc_ps(gbeps,Fp,Y);
432 vgb = _mm_mul_ps(gbqqfactor,VV);
434 twogbeps = _mm_add_ps(gbeps,gbeps);
435 FF = _mm_macc_ps(_mm_macc_ps(twogbeps,H,G),gbeps,Fp);
436 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
437 dvdatmp = _mm_mul_ps(minushalf,_mm_macc_ps(fgb,r00,vgb));
438 dvdatmp = _mm_andnot_ps(dummy_mask,dvdatmp);
439 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
440 /* The pointers to scratch make sure that this code with compilers that take gmx_restrict seriously (e.g. icc 13) really can't screw things up. */
441 fjptrA = (jnrlistA>=0) ? dvda+jnrA : scratch;
442 fjptrB = (jnrlistB>=0) ? dvda+jnrB : scratch;
443 fjptrC = (jnrlistC>=0) ? dvda+jnrC : scratch;
444 fjptrD = (jnrlistD>=0) ? dvda+jnrD : scratch;
445 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
446 velec = _mm_mul_ps(qq00,rinv00);
447 felec = _mm_mul_ps(_mm_msub_ps(velec,rinv00,fgb),rinv00);
449 /* CUBIC SPLINE TABLE DISPERSION */
450 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
451 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
452 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
453 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
454 _MM_TRANSPOSE4_PS(Y,F,G,H);
455 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
456 VV = _mm_macc_ps(vfeps,Fp,Y);
457 vvdw6 = _mm_mul_ps(c6_00,VV);
458 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
459 fvdw6 = _mm_mul_ps(c6_00,FF);
461 /* CUBIC SPLINE TABLE REPULSION */
462 vfitab = _mm_add_epi32(vfitab,ifour);
463 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
464 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
465 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
466 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
467 _MM_TRANSPOSE4_PS(Y,F,G,H);
468 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
469 VV = _mm_macc_ps(vfeps,Fp,Y);
470 vvdw12 = _mm_mul_ps(c12_00,VV);
471 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
472 fvdw12 = _mm_mul_ps(c12_00,FF);
473 vvdw = _mm_add_ps(vvdw12,vvdw6);
474 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
476 /* Update potential sum for this i atom from the interaction with this j atom. */
477 velec = _mm_andnot_ps(dummy_mask,velec);
478 velecsum = _mm_add_ps(velecsum,velec);
479 vgb = _mm_andnot_ps(dummy_mask,vgb);
480 vgbsum = _mm_add_ps(vgbsum,vgb);
481 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
482 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
484 fscal = _mm_add_ps(felec,fvdw);
486 fscal = _mm_andnot_ps(dummy_mask,fscal);
488 /* Update vectorial force */
489 fix0 = _mm_macc_ps(dx00,fscal,fix0);
490 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
491 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
493 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
494 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
495 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
496 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
497 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
498 _mm_mul_ps(dx00,fscal),
499 _mm_mul_ps(dy00,fscal),
500 _mm_mul_ps(dz00,fscal));
502 /* Inner loop uses 96 flops */
505 /* End of innermost loop */
507 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
508 f+i_coord_offset,fshift+i_shift_offset);
511 /* Update potential energies */
512 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
513 gmx_mm_update_1pot_ps(vgbsum,kernel_data->energygrp_polarization+ggid);
514 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
515 dvdasum = _mm_mul_ps(dvdasum, _mm_mul_ps(isai0,isai0));
516 gmx_mm_update_1pot_ps(dvdasum,dvda+inr);
518 /* Increment number of inner iterations */
519 inneriter += j_index_end - j_index_start;
521 /* Outer loop uses 10 flops */
524 /* Increment number of outer iterations */
527 /* Update outer/inner flops */
529 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*10 + inneriter*96);
532 * Gromacs nonbonded kernel: nb_kernel_ElecGB_VdwCSTab_GeomP1P1_F_avx_128_fma_single
533 * Electrostatics interaction: GeneralizedBorn
534 * VdW interaction: CubicSplineTable
535 * Geometry: Particle-Particle
536 * Calculate force/pot: Force
539 nb_kernel_ElecGB_VdwCSTab_GeomP1P1_F_avx_128_fma_single
540 (t_nblist * gmx_restrict nlist,
541 rvec * gmx_restrict xx,
542 rvec * gmx_restrict ff,
543 t_forcerec * gmx_restrict fr,
544 t_mdatoms * gmx_restrict mdatoms,
545 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
546 t_nrnb * gmx_restrict nrnb)
548 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
549 * just 0 for non-waters.
550 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
551 * jnr indices corresponding to data put in the four positions in the SIMD register.
553 int i_shift_offset,i_coord_offset,outeriter,inneriter;
554 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
555 int jnrA,jnrB,jnrC,jnrD;
556 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
557 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
558 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
560 real *shiftvec,*fshift,*x,*f;
561 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
563 __m128 fscal,rcutoff,rcutoff2,jidxall;
565 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
566 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
567 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
568 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
569 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
572 __m128 vgb,fgb,vgbsum,dvdasum,gbscale,gbtabscale,isaprod,gbqqfactor,gbinvepsdiff,gbeps,twogbeps,dvdatmp;
573 __m128 minushalf = _mm_set1_ps(-0.5);
574 real *invsqrta,*dvda,*gbtab;
576 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
579 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
580 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
582 __m128i ifour = _mm_set1_epi32(4);
583 __m128 rt,vfeps,twovfeps,vftabscale,Y,F,G,H,Fp,VV,FF;
585 __m128 dummy_mask,cutoff_mask;
586 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
587 __m128 one = _mm_set1_ps(1.0);
588 __m128 two = _mm_set1_ps(2.0);
594 jindex = nlist->jindex;
596 shiftidx = nlist->shift;
598 shiftvec = fr->shift_vec[0];
599 fshift = fr->fshift[0];
600 facel = _mm_set1_ps(fr->epsfac);
601 charge = mdatoms->chargeA;
602 nvdwtype = fr->ntype;
604 vdwtype = mdatoms->typeA;
606 vftab = kernel_data->table_vdw->data;
607 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
609 invsqrta = fr->invsqrta;
611 gbtabscale = _mm_set1_ps(fr->gbtab.scale);
612 gbtab = fr->gbtab.data;
613 gbinvepsdiff = _mm_set1_ps((1.0/fr->epsilon_r) - (1.0/fr->gb_epsilon_solvent));
615 /* Avoid stupid compiler warnings */
616 jnrA = jnrB = jnrC = jnrD = 0;
625 for(iidx=0;iidx<4*DIM;iidx++)
630 /* Start outer loop over neighborlists */
631 for(iidx=0; iidx<nri; iidx++)
633 /* Load shift vector for this list */
634 i_shift_offset = DIM*shiftidx[iidx];
636 /* Load limits for loop over neighbors */
637 j_index_start = jindex[iidx];
638 j_index_end = jindex[iidx+1];
640 /* Get outer coordinate index */
642 i_coord_offset = DIM*inr;
644 /* Load i particle coords and add shift vector */
645 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
647 fix0 = _mm_setzero_ps();
648 fiy0 = _mm_setzero_ps();
649 fiz0 = _mm_setzero_ps();
651 /* Load parameters for i particles */
652 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
653 isai0 = _mm_load1_ps(invsqrta+inr+0);
654 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
656 dvdasum = _mm_setzero_ps();
658 /* Start inner kernel loop */
659 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
662 /* Get j neighbor index, and coordinate index */
667 j_coord_offsetA = DIM*jnrA;
668 j_coord_offsetB = DIM*jnrB;
669 j_coord_offsetC = DIM*jnrC;
670 j_coord_offsetD = DIM*jnrD;
672 /* load j atom coordinates */
673 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
674 x+j_coord_offsetC,x+j_coord_offsetD,
677 /* Calculate displacement vector */
678 dx00 = _mm_sub_ps(ix0,jx0);
679 dy00 = _mm_sub_ps(iy0,jy0);
680 dz00 = _mm_sub_ps(iz0,jz0);
682 /* Calculate squared distance and things based on it */
683 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
685 rinv00 = gmx_mm_invsqrt_ps(rsq00);
687 /* Load parameters for j particles */
688 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
689 charge+jnrC+0,charge+jnrD+0);
690 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
691 invsqrta+jnrC+0,invsqrta+jnrD+0);
692 vdwjidx0A = 2*vdwtype[jnrA+0];
693 vdwjidx0B = 2*vdwtype[jnrB+0];
694 vdwjidx0C = 2*vdwtype[jnrC+0];
695 vdwjidx0D = 2*vdwtype[jnrD+0];
697 /**************************
698 * CALCULATE INTERACTIONS *
699 **************************/
701 r00 = _mm_mul_ps(rsq00,rinv00);
703 /* Compute parameters for interactions between i and j atoms */
704 qq00 = _mm_mul_ps(iq0,jq0);
705 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
706 vdwparam+vdwioffset0+vdwjidx0B,
707 vdwparam+vdwioffset0+vdwjidx0C,
708 vdwparam+vdwioffset0+vdwjidx0D,
711 /* Calculate table index by multiplying r with table scale and truncate to integer */
712 rt = _mm_mul_ps(r00,vftabscale);
713 vfitab = _mm_cvttps_epi32(rt);
715 vfeps = _mm_frcz_ps(rt);
717 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
719 twovfeps = _mm_add_ps(vfeps,vfeps);
720 vfitab = _mm_slli_epi32(vfitab,3);
722 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
723 isaprod = _mm_mul_ps(isai0,isaj0);
724 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
725 gbscale = _mm_mul_ps(isaprod,gbtabscale);
727 /* Calculate generalized born table index - this is a separate table from the normal one,
728 * but we use the same procedure by multiplying r with scale and truncating to integer.
730 rt = _mm_mul_ps(r00,gbscale);
731 gbitab = _mm_cvttps_epi32(rt);
733 gbeps = _mm_frcz_ps(rt);
735 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
737 gbitab = _mm_slli_epi32(gbitab,2);
739 Y = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,0) );
740 F = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,1) );
741 G = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,2) );
742 H = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,3) );
743 _MM_TRANSPOSE4_PS(Y,F,G,H);
744 Fp = _mm_macc_ps(gbeps,_mm_macc_ps(gbeps,H,G),F);
745 VV = _mm_macc_ps(gbeps,Fp,Y);
746 vgb = _mm_mul_ps(gbqqfactor,VV);
748 twogbeps = _mm_add_ps(gbeps,gbeps);
749 FF = _mm_macc_ps(_mm_macc_ps(twogbeps,H,G),gbeps,Fp);
750 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
751 dvdatmp = _mm_mul_ps(minushalf,_mm_macc_ps(fgb,r00,vgb));
752 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
757 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
758 velec = _mm_mul_ps(qq00,rinv00);
759 felec = _mm_mul_ps(_mm_msub_ps(velec,rinv00,fgb),rinv00);
761 /* CUBIC SPLINE TABLE DISPERSION */
762 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
763 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
764 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
765 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
766 _MM_TRANSPOSE4_PS(Y,F,G,H);
767 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
768 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
769 fvdw6 = _mm_mul_ps(c6_00,FF);
771 /* CUBIC SPLINE TABLE REPULSION */
772 vfitab = _mm_add_epi32(vfitab,ifour);
773 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
774 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
775 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
776 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
777 _MM_TRANSPOSE4_PS(Y,F,G,H);
778 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
779 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
780 fvdw12 = _mm_mul_ps(c12_00,FF);
781 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
783 fscal = _mm_add_ps(felec,fvdw);
785 /* Update vectorial force */
786 fix0 = _mm_macc_ps(dx00,fscal,fix0);
787 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
788 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
790 fjptrA = f+j_coord_offsetA;
791 fjptrB = f+j_coord_offsetB;
792 fjptrC = f+j_coord_offsetC;
793 fjptrD = f+j_coord_offsetD;
794 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
795 _mm_mul_ps(dx00,fscal),
796 _mm_mul_ps(dy00,fscal),
797 _mm_mul_ps(dz00,fscal));
799 /* Inner loop uses 85 flops */
805 /* Get j neighbor index, and coordinate index */
806 jnrlistA = jjnr[jidx];
807 jnrlistB = jjnr[jidx+1];
808 jnrlistC = jjnr[jidx+2];
809 jnrlistD = jjnr[jidx+3];
810 /* Sign of each element will be negative for non-real atoms.
811 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
812 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
814 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
815 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
816 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
817 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
818 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
819 j_coord_offsetA = DIM*jnrA;
820 j_coord_offsetB = DIM*jnrB;
821 j_coord_offsetC = DIM*jnrC;
822 j_coord_offsetD = DIM*jnrD;
824 /* load j atom coordinates */
825 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
826 x+j_coord_offsetC,x+j_coord_offsetD,
829 /* Calculate displacement vector */
830 dx00 = _mm_sub_ps(ix0,jx0);
831 dy00 = _mm_sub_ps(iy0,jy0);
832 dz00 = _mm_sub_ps(iz0,jz0);
834 /* Calculate squared distance and things based on it */
835 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
837 rinv00 = gmx_mm_invsqrt_ps(rsq00);
839 /* Load parameters for j particles */
840 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
841 charge+jnrC+0,charge+jnrD+0);
842 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
843 invsqrta+jnrC+0,invsqrta+jnrD+0);
844 vdwjidx0A = 2*vdwtype[jnrA+0];
845 vdwjidx0B = 2*vdwtype[jnrB+0];
846 vdwjidx0C = 2*vdwtype[jnrC+0];
847 vdwjidx0D = 2*vdwtype[jnrD+0];
849 /**************************
850 * CALCULATE INTERACTIONS *
851 **************************/
853 r00 = _mm_mul_ps(rsq00,rinv00);
854 r00 = _mm_andnot_ps(dummy_mask,r00);
856 /* Compute parameters for interactions between i and j atoms */
857 qq00 = _mm_mul_ps(iq0,jq0);
858 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
859 vdwparam+vdwioffset0+vdwjidx0B,
860 vdwparam+vdwioffset0+vdwjidx0C,
861 vdwparam+vdwioffset0+vdwjidx0D,
864 /* Calculate table index by multiplying r with table scale and truncate to integer */
865 rt = _mm_mul_ps(r00,vftabscale);
866 vfitab = _mm_cvttps_epi32(rt);
868 vfeps = _mm_frcz_ps(rt);
870 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
872 twovfeps = _mm_add_ps(vfeps,vfeps);
873 vfitab = _mm_slli_epi32(vfitab,3);
875 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
876 isaprod = _mm_mul_ps(isai0,isaj0);
877 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
878 gbscale = _mm_mul_ps(isaprod,gbtabscale);
880 /* Calculate generalized born table index - this is a separate table from the normal one,
881 * but we use the same procedure by multiplying r with scale and truncating to integer.
883 rt = _mm_mul_ps(r00,gbscale);
884 gbitab = _mm_cvttps_epi32(rt);
886 gbeps = _mm_frcz_ps(rt);
888 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR));
890 gbitab = _mm_slli_epi32(gbitab,2);
892 Y = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,0) );
893 F = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,1) );
894 G = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,2) );
895 H = _mm_load_ps( gbtab + _mm_extract_epi32(gbitab,3) );
896 _MM_TRANSPOSE4_PS(Y,F,G,H);
897 Fp = _mm_macc_ps(gbeps,_mm_macc_ps(gbeps,H,G),F);
898 VV = _mm_macc_ps(gbeps,Fp,Y);
899 vgb = _mm_mul_ps(gbqqfactor,VV);
901 twogbeps = _mm_add_ps(gbeps,gbeps);
902 FF = _mm_macc_ps(_mm_macc_ps(twogbeps,H,G),gbeps,Fp);
903 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
904 dvdatmp = _mm_mul_ps(minushalf,_mm_macc_ps(fgb,r00,vgb));
905 dvdatmp = _mm_andnot_ps(dummy_mask,dvdatmp);
906 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
907 /* The pointers to scratch make sure that this code with compilers that take gmx_restrict seriously (e.g. icc 13) really can't screw things up. */
908 fjptrA = (jnrlistA>=0) ? dvda+jnrA : scratch;
909 fjptrB = (jnrlistB>=0) ? dvda+jnrB : scratch;
910 fjptrC = (jnrlistC>=0) ? dvda+jnrC : scratch;
911 fjptrD = (jnrlistD>=0) ? dvda+jnrD : scratch;
912 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
913 velec = _mm_mul_ps(qq00,rinv00);
914 felec = _mm_mul_ps(_mm_msub_ps(velec,rinv00,fgb),rinv00);
916 /* CUBIC SPLINE TABLE DISPERSION */
917 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
918 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
919 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
920 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
921 _MM_TRANSPOSE4_PS(Y,F,G,H);
922 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
923 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
924 fvdw6 = _mm_mul_ps(c6_00,FF);
926 /* CUBIC SPLINE TABLE REPULSION */
927 vfitab = _mm_add_epi32(vfitab,ifour);
928 Y = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,0) );
929 F = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,1) );
930 G = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,2) );
931 H = _mm_load_ps( vftab + _mm_extract_epi32(vfitab,3) );
932 _MM_TRANSPOSE4_PS(Y,F,G,H);
933 Fp = _mm_macc_ps(vfeps,_mm_macc_ps(H,vfeps,G),F);
934 FF = _mm_macc_ps(vfeps,_mm_macc_ps(twovfeps,H,G),Fp);
935 fvdw12 = _mm_mul_ps(c12_00,FF);
936 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
938 fscal = _mm_add_ps(felec,fvdw);
940 fscal = _mm_andnot_ps(dummy_mask,fscal);
942 /* Update vectorial force */
943 fix0 = _mm_macc_ps(dx00,fscal,fix0);
944 fiy0 = _mm_macc_ps(dy00,fscal,fiy0);
945 fiz0 = _mm_macc_ps(dz00,fscal,fiz0);
947 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
948 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
949 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
950 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
951 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,
952 _mm_mul_ps(dx00,fscal),
953 _mm_mul_ps(dy00,fscal),
954 _mm_mul_ps(dz00,fscal));
956 /* Inner loop uses 86 flops */
959 /* End of innermost loop */
961 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
962 f+i_coord_offset,fshift+i_shift_offset);
964 dvdasum = _mm_mul_ps(dvdasum, _mm_mul_ps(isai0,isai0));
965 gmx_mm_update_1pot_ps(dvdasum,dvda+inr);
967 /* Increment number of inner iterations */
968 inneriter += j_index_end - j_index_start;
970 /* Outer loop uses 7 flops */
973 /* Increment number of outer iterations */
976 /* Update outer/inner flops */
978 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*86);