2 * Note: this file was generated by the Gromacs sse4_1_single kernel generator.
4 * This source code is part of
8 * Copyright (c) 2001-2012, The GROMACS Development Team
10 * Gromacs is a library for molecular simulation and trajectory analysis,
11 * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12 * a full list of developers and information, check out http://www.gromacs.org
14 * This program is free software; you can redistribute it and/or modify it under
15 * the terms of the GNU Lesser General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option) any
19 * To help fund GROMACS development, we humbly ask that you cite
20 * the papers people have written on it - you can find them on the website.
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
33 #include "gmx_math_x86_sse4_1_single.h"
34 #include "kernelutil_x86_sse4_1_single.h"
37 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4P1_VF_sse4_1_single
38 * Electrostatics interaction: Coulomb
39 * VdW interaction: LennardJones
40 * Geometry: Water4-Particle
41 * Calculate force/pot: PotentialAndForce
44 nb_kernel_ElecCoul_VdwLJ_GeomW4P1_VF_sse4_1_single
45 (t_nblist * gmx_restrict nlist,
46 rvec * gmx_restrict xx,
47 rvec * gmx_restrict ff,
48 t_forcerec * gmx_restrict fr,
49 t_mdatoms * gmx_restrict mdatoms,
50 nb_kernel_data_t * gmx_restrict kernel_data,
51 t_nrnb * gmx_restrict nrnb)
53 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
54 * just 0 for non-waters.
55 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
56 * jnr indices corresponding to data put in the four positions in the SIMD register.
58 int i_shift_offset,i_coord_offset,outeriter,inneriter;
59 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
60 int jnrA,jnrB,jnrC,jnrD;
61 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
62 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
63 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
65 real *shiftvec,*fshift,*x,*f;
66 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
68 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
70 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
72 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
74 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
76 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
77 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
78 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
79 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
80 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
81 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
82 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
83 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
86 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
89 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
90 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
91 __m128 dummy_mask,cutoff_mask;
92 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
93 __m128 one = _mm_set1_ps(1.0);
94 __m128 two = _mm_set1_ps(2.0);
100 jindex = nlist->jindex;
102 shiftidx = nlist->shift;
104 shiftvec = fr->shift_vec[0];
105 fshift = fr->fshift[0];
106 facel = _mm_set1_ps(fr->epsfac);
107 charge = mdatoms->chargeA;
108 nvdwtype = fr->ntype;
110 vdwtype = mdatoms->typeA;
112 /* Setup water-specific parameters */
113 inr = nlist->iinr[0];
114 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
115 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
116 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
117 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
119 /* Avoid stupid compiler warnings */
120 jnrA = jnrB = jnrC = jnrD = 0;
129 for(iidx=0;iidx<4*DIM;iidx++)
134 /* Start outer loop over neighborlists */
135 for(iidx=0; iidx<nri; iidx++)
137 /* Load shift vector for this list */
138 i_shift_offset = DIM*shiftidx[iidx];
140 /* Load limits for loop over neighbors */
141 j_index_start = jindex[iidx];
142 j_index_end = jindex[iidx+1];
144 /* Get outer coordinate index */
146 i_coord_offset = DIM*inr;
148 /* Load i particle coords and add shift vector */
149 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
150 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
152 fix0 = _mm_setzero_ps();
153 fiy0 = _mm_setzero_ps();
154 fiz0 = _mm_setzero_ps();
155 fix1 = _mm_setzero_ps();
156 fiy1 = _mm_setzero_ps();
157 fiz1 = _mm_setzero_ps();
158 fix2 = _mm_setzero_ps();
159 fiy2 = _mm_setzero_ps();
160 fiz2 = _mm_setzero_ps();
161 fix3 = _mm_setzero_ps();
162 fiy3 = _mm_setzero_ps();
163 fiz3 = _mm_setzero_ps();
165 /* Reset potential sums */
166 velecsum = _mm_setzero_ps();
167 vvdwsum = _mm_setzero_ps();
169 /* Start inner kernel loop */
170 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
173 /* Get j neighbor index, and coordinate index */
178 j_coord_offsetA = DIM*jnrA;
179 j_coord_offsetB = DIM*jnrB;
180 j_coord_offsetC = DIM*jnrC;
181 j_coord_offsetD = DIM*jnrD;
183 /* load j atom coordinates */
184 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
185 x+j_coord_offsetC,x+j_coord_offsetD,
188 /* Calculate displacement vector */
189 dx00 = _mm_sub_ps(ix0,jx0);
190 dy00 = _mm_sub_ps(iy0,jy0);
191 dz00 = _mm_sub_ps(iz0,jz0);
192 dx10 = _mm_sub_ps(ix1,jx0);
193 dy10 = _mm_sub_ps(iy1,jy0);
194 dz10 = _mm_sub_ps(iz1,jz0);
195 dx20 = _mm_sub_ps(ix2,jx0);
196 dy20 = _mm_sub_ps(iy2,jy0);
197 dz20 = _mm_sub_ps(iz2,jz0);
198 dx30 = _mm_sub_ps(ix3,jx0);
199 dy30 = _mm_sub_ps(iy3,jy0);
200 dz30 = _mm_sub_ps(iz3,jz0);
202 /* Calculate squared distance and things based on it */
203 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
204 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
205 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
206 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
208 rinv10 = gmx_mm_invsqrt_ps(rsq10);
209 rinv20 = gmx_mm_invsqrt_ps(rsq20);
210 rinv30 = gmx_mm_invsqrt_ps(rsq30);
212 rinvsq00 = gmx_mm_inv_ps(rsq00);
213 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
214 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
215 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
217 /* Load parameters for j particles */
218 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
219 charge+jnrC+0,charge+jnrD+0);
220 vdwjidx0A = 2*vdwtype[jnrA+0];
221 vdwjidx0B = 2*vdwtype[jnrB+0];
222 vdwjidx0C = 2*vdwtype[jnrC+0];
223 vdwjidx0D = 2*vdwtype[jnrD+0];
225 fjx0 = _mm_setzero_ps();
226 fjy0 = _mm_setzero_ps();
227 fjz0 = _mm_setzero_ps();
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
233 /* Compute parameters for interactions between i and j atoms */
234 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
235 vdwparam+vdwioffset0+vdwjidx0B,
236 vdwparam+vdwioffset0+vdwjidx0C,
237 vdwparam+vdwioffset0+vdwjidx0D,
240 /* LENNARD-JONES DISPERSION/REPULSION */
242 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
243 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
244 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
245 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
246 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
248 /* Update potential sum for this i atom from the interaction with this j atom. */
249 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
253 /* Calculate temporary vectorial force */
254 tx = _mm_mul_ps(fscal,dx00);
255 ty = _mm_mul_ps(fscal,dy00);
256 tz = _mm_mul_ps(fscal,dz00);
258 /* Update vectorial force */
259 fix0 = _mm_add_ps(fix0,tx);
260 fiy0 = _mm_add_ps(fiy0,ty);
261 fiz0 = _mm_add_ps(fiz0,tz);
263 fjx0 = _mm_add_ps(fjx0,tx);
264 fjy0 = _mm_add_ps(fjy0,ty);
265 fjz0 = _mm_add_ps(fjz0,tz);
267 /**************************
268 * CALCULATE INTERACTIONS *
269 **************************/
271 /* Compute parameters for interactions between i and j atoms */
272 qq10 = _mm_mul_ps(iq1,jq0);
274 /* COULOMB ELECTROSTATICS */
275 velec = _mm_mul_ps(qq10,rinv10);
276 felec = _mm_mul_ps(velec,rinvsq10);
278 /* Update potential sum for this i atom from the interaction with this j atom. */
279 velecsum = _mm_add_ps(velecsum,velec);
283 /* Calculate temporary vectorial force */
284 tx = _mm_mul_ps(fscal,dx10);
285 ty = _mm_mul_ps(fscal,dy10);
286 tz = _mm_mul_ps(fscal,dz10);
288 /* Update vectorial force */
289 fix1 = _mm_add_ps(fix1,tx);
290 fiy1 = _mm_add_ps(fiy1,ty);
291 fiz1 = _mm_add_ps(fiz1,tz);
293 fjx0 = _mm_add_ps(fjx0,tx);
294 fjy0 = _mm_add_ps(fjy0,ty);
295 fjz0 = _mm_add_ps(fjz0,tz);
297 /**************************
298 * CALCULATE INTERACTIONS *
299 **************************/
301 /* Compute parameters for interactions between i and j atoms */
302 qq20 = _mm_mul_ps(iq2,jq0);
304 /* COULOMB ELECTROSTATICS */
305 velec = _mm_mul_ps(qq20,rinv20);
306 felec = _mm_mul_ps(velec,rinvsq20);
308 /* Update potential sum for this i atom from the interaction with this j atom. */
309 velecsum = _mm_add_ps(velecsum,velec);
313 /* Calculate temporary vectorial force */
314 tx = _mm_mul_ps(fscal,dx20);
315 ty = _mm_mul_ps(fscal,dy20);
316 tz = _mm_mul_ps(fscal,dz20);
318 /* Update vectorial force */
319 fix2 = _mm_add_ps(fix2,tx);
320 fiy2 = _mm_add_ps(fiy2,ty);
321 fiz2 = _mm_add_ps(fiz2,tz);
323 fjx0 = _mm_add_ps(fjx0,tx);
324 fjy0 = _mm_add_ps(fjy0,ty);
325 fjz0 = _mm_add_ps(fjz0,tz);
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
331 /* Compute parameters for interactions between i and j atoms */
332 qq30 = _mm_mul_ps(iq3,jq0);
334 /* COULOMB ELECTROSTATICS */
335 velec = _mm_mul_ps(qq30,rinv30);
336 felec = _mm_mul_ps(velec,rinvsq30);
338 /* Update potential sum for this i atom from the interaction with this j atom. */
339 velecsum = _mm_add_ps(velecsum,velec);
343 /* Calculate temporary vectorial force */
344 tx = _mm_mul_ps(fscal,dx30);
345 ty = _mm_mul_ps(fscal,dy30);
346 tz = _mm_mul_ps(fscal,dz30);
348 /* Update vectorial force */
349 fix3 = _mm_add_ps(fix3,tx);
350 fiy3 = _mm_add_ps(fiy3,ty);
351 fiz3 = _mm_add_ps(fiz3,tz);
353 fjx0 = _mm_add_ps(fjx0,tx);
354 fjy0 = _mm_add_ps(fjy0,ty);
355 fjz0 = _mm_add_ps(fjz0,tz);
357 fjptrA = f+j_coord_offsetA;
358 fjptrB = f+j_coord_offsetB;
359 fjptrC = f+j_coord_offsetC;
360 fjptrD = f+j_coord_offsetD;
362 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
364 /* Inner loop uses 116 flops */
370 /* Get j neighbor index, and coordinate index */
371 jnrlistA = jjnr[jidx];
372 jnrlistB = jjnr[jidx+1];
373 jnrlistC = jjnr[jidx+2];
374 jnrlistD = jjnr[jidx+3];
375 /* Sign of each element will be negative for non-real atoms.
376 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
377 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
379 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
380 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
381 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
382 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
383 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
384 j_coord_offsetA = DIM*jnrA;
385 j_coord_offsetB = DIM*jnrB;
386 j_coord_offsetC = DIM*jnrC;
387 j_coord_offsetD = DIM*jnrD;
389 /* load j atom coordinates */
390 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
391 x+j_coord_offsetC,x+j_coord_offsetD,
394 /* Calculate displacement vector */
395 dx00 = _mm_sub_ps(ix0,jx0);
396 dy00 = _mm_sub_ps(iy0,jy0);
397 dz00 = _mm_sub_ps(iz0,jz0);
398 dx10 = _mm_sub_ps(ix1,jx0);
399 dy10 = _mm_sub_ps(iy1,jy0);
400 dz10 = _mm_sub_ps(iz1,jz0);
401 dx20 = _mm_sub_ps(ix2,jx0);
402 dy20 = _mm_sub_ps(iy2,jy0);
403 dz20 = _mm_sub_ps(iz2,jz0);
404 dx30 = _mm_sub_ps(ix3,jx0);
405 dy30 = _mm_sub_ps(iy3,jy0);
406 dz30 = _mm_sub_ps(iz3,jz0);
408 /* Calculate squared distance and things based on it */
409 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
410 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
411 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
412 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
414 rinv10 = gmx_mm_invsqrt_ps(rsq10);
415 rinv20 = gmx_mm_invsqrt_ps(rsq20);
416 rinv30 = gmx_mm_invsqrt_ps(rsq30);
418 rinvsq00 = gmx_mm_inv_ps(rsq00);
419 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
420 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
421 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
423 /* Load parameters for j particles */
424 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
425 charge+jnrC+0,charge+jnrD+0);
426 vdwjidx0A = 2*vdwtype[jnrA+0];
427 vdwjidx0B = 2*vdwtype[jnrB+0];
428 vdwjidx0C = 2*vdwtype[jnrC+0];
429 vdwjidx0D = 2*vdwtype[jnrD+0];
431 fjx0 = _mm_setzero_ps();
432 fjy0 = _mm_setzero_ps();
433 fjz0 = _mm_setzero_ps();
435 /**************************
436 * CALCULATE INTERACTIONS *
437 **************************/
439 /* Compute parameters for interactions between i and j atoms */
440 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
441 vdwparam+vdwioffset0+vdwjidx0B,
442 vdwparam+vdwioffset0+vdwjidx0C,
443 vdwparam+vdwioffset0+vdwjidx0D,
446 /* LENNARD-JONES DISPERSION/REPULSION */
448 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
449 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
450 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
451 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
452 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
454 /* Update potential sum for this i atom from the interaction with this j atom. */
455 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
456 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
460 fscal = _mm_andnot_ps(dummy_mask,fscal);
462 /* Calculate temporary vectorial force */
463 tx = _mm_mul_ps(fscal,dx00);
464 ty = _mm_mul_ps(fscal,dy00);
465 tz = _mm_mul_ps(fscal,dz00);
467 /* Update vectorial force */
468 fix0 = _mm_add_ps(fix0,tx);
469 fiy0 = _mm_add_ps(fiy0,ty);
470 fiz0 = _mm_add_ps(fiz0,tz);
472 fjx0 = _mm_add_ps(fjx0,tx);
473 fjy0 = _mm_add_ps(fjy0,ty);
474 fjz0 = _mm_add_ps(fjz0,tz);
476 /**************************
477 * CALCULATE INTERACTIONS *
478 **************************/
480 /* Compute parameters for interactions between i and j atoms */
481 qq10 = _mm_mul_ps(iq1,jq0);
483 /* COULOMB ELECTROSTATICS */
484 velec = _mm_mul_ps(qq10,rinv10);
485 felec = _mm_mul_ps(velec,rinvsq10);
487 /* Update potential sum for this i atom from the interaction with this j atom. */
488 velec = _mm_andnot_ps(dummy_mask,velec);
489 velecsum = _mm_add_ps(velecsum,velec);
493 fscal = _mm_andnot_ps(dummy_mask,fscal);
495 /* Calculate temporary vectorial force */
496 tx = _mm_mul_ps(fscal,dx10);
497 ty = _mm_mul_ps(fscal,dy10);
498 tz = _mm_mul_ps(fscal,dz10);
500 /* Update vectorial force */
501 fix1 = _mm_add_ps(fix1,tx);
502 fiy1 = _mm_add_ps(fiy1,ty);
503 fiz1 = _mm_add_ps(fiz1,tz);
505 fjx0 = _mm_add_ps(fjx0,tx);
506 fjy0 = _mm_add_ps(fjy0,ty);
507 fjz0 = _mm_add_ps(fjz0,tz);
509 /**************************
510 * CALCULATE INTERACTIONS *
511 **************************/
513 /* Compute parameters for interactions between i and j atoms */
514 qq20 = _mm_mul_ps(iq2,jq0);
516 /* COULOMB ELECTROSTATICS */
517 velec = _mm_mul_ps(qq20,rinv20);
518 felec = _mm_mul_ps(velec,rinvsq20);
520 /* Update potential sum for this i atom from the interaction with this j atom. */
521 velec = _mm_andnot_ps(dummy_mask,velec);
522 velecsum = _mm_add_ps(velecsum,velec);
526 fscal = _mm_andnot_ps(dummy_mask,fscal);
528 /* Calculate temporary vectorial force */
529 tx = _mm_mul_ps(fscal,dx20);
530 ty = _mm_mul_ps(fscal,dy20);
531 tz = _mm_mul_ps(fscal,dz20);
533 /* Update vectorial force */
534 fix2 = _mm_add_ps(fix2,tx);
535 fiy2 = _mm_add_ps(fiy2,ty);
536 fiz2 = _mm_add_ps(fiz2,tz);
538 fjx0 = _mm_add_ps(fjx0,tx);
539 fjy0 = _mm_add_ps(fjy0,ty);
540 fjz0 = _mm_add_ps(fjz0,tz);
542 /**************************
543 * CALCULATE INTERACTIONS *
544 **************************/
546 /* Compute parameters for interactions between i and j atoms */
547 qq30 = _mm_mul_ps(iq3,jq0);
549 /* COULOMB ELECTROSTATICS */
550 velec = _mm_mul_ps(qq30,rinv30);
551 felec = _mm_mul_ps(velec,rinvsq30);
553 /* Update potential sum for this i atom from the interaction with this j atom. */
554 velec = _mm_andnot_ps(dummy_mask,velec);
555 velecsum = _mm_add_ps(velecsum,velec);
559 fscal = _mm_andnot_ps(dummy_mask,fscal);
561 /* Calculate temporary vectorial force */
562 tx = _mm_mul_ps(fscal,dx30);
563 ty = _mm_mul_ps(fscal,dy30);
564 tz = _mm_mul_ps(fscal,dz30);
566 /* Update vectorial force */
567 fix3 = _mm_add_ps(fix3,tx);
568 fiy3 = _mm_add_ps(fiy3,ty);
569 fiz3 = _mm_add_ps(fiz3,tz);
571 fjx0 = _mm_add_ps(fjx0,tx);
572 fjy0 = _mm_add_ps(fjy0,ty);
573 fjz0 = _mm_add_ps(fjz0,tz);
575 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
576 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
577 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
578 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
580 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
582 /* Inner loop uses 116 flops */
585 /* End of innermost loop */
587 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
588 f+i_coord_offset,fshift+i_shift_offset);
591 /* Update potential energies */
592 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
593 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
595 /* Increment number of inner iterations */
596 inneriter += j_index_end - j_index_start;
598 /* Outer loop uses 26 flops */
601 /* Increment number of outer iterations */
604 /* Update outer/inner flops */
606 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*116);
609 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sse4_1_single
610 * Electrostatics interaction: Coulomb
611 * VdW interaction: LennardJones
612 * Geometry: Water4-Particle
613 * Calculate force/pot: Force
616 nb_kernel_ElecCoul_VdwLJ_GeomW4P1_F_sse4_1_single
617 (t_nblist * gmx_restrict nlist,
618 rvec * gmx_restrict xx,
619 rvec * gmx_restrict ff,
620 t_forcerec * gmx_restrict fr,
621 t_mdatoms * gmx_restrict mdatoms,
622 nb_kernel_data_t * gmx_restrict kernel_data,
623 t_nrnb * gmx_restrict nrnb)
625 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
626 * just 0 for non-waters.
627 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
628 * jnr indices corresponding to data put in the four positions in the SIMD register.
630 int i_shift_offset,i_coord_offset,outeriter,inneriter;
631 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
632 int jnrA,jnrB,jnrC,jnrD;
633 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
634 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
635 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
637 real *shiftvec,*fshift,*x,*f;
638 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
640 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
642 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
644 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
646 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
648 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
649 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
650 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
651 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
652 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
653 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
654 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
655 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
658 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
661 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
662 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
663 __m128 dummy_mask,cutoff_mask;
664 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
665 __m128 one = _mm_set1_ps(1.0);
666 __m128 two = _mm_set1_ps(2.0);
672 jindex = nlist->jindex;
674 shiftidx = nlist->shift;
676 shiftvec = fr->shift_vec[0];
677 fshift = fr->fshift[0];
678 facel = _mm_set1_ps(fr->epsfac);
679 charge = mdatoms->chargeA;
680 nvdwtype = fr->ntype;
682 vdwtype = mdatoms->typeA;
684 /* Setup water-specific parameters */
685 inr = nlist->iinr[0];
686 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
687 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
688 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
689 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
691 /* Avoid stupid compiler warnings */
692 jnrA = jnrB = jnrC = jnrD = 0;
701 for(iidx=0;iidx<4*DIM;iidx++)
706 /* Start outer loop over neighborlists */
707 for(iidx=0; iidx<nri; iidx++)
709 /* Load shift vector for this list */
710 i_shift_offset = DIM*shiftidx[iidx];
712 /* Load limits for loop over neighbors */
713 j_index_start = jindex[iidx];
714 j_index_end = jindex[iidx+1];
716 /* Get outer coordinate index */
718 i_coord_offset = DIM*inr;
720 /* Load i particle coords and add shift vector */
721 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
722 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
724 fix0 = _mm_setzero_ps();
725 fiy0 = _mm_setzero_ps();
726 fiz0 = _mm_setzero_ps();
727 fix1 = _mm_setzero_ps();
728 fiy1 = _mm_setzero_ps();
729 fiz1 = _mm_setzero_ps();
730 fix2 = _mm_setzero_ps();
731 fiy2 = _mm_setzero_ps();
732 fiz2 = _mm_setzero_ps();
733 fix3 = _mm_setzero_ps();
734 fiy3 = _mm_setzero_ps();
735 fiz3 = _mm_setzero_ps();
737 /* Start inner kernel loop */
738 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
741 /* Get j neighbor index, and coordinate index */
746 j_coord_offsetA = DIM*jnrA;
747 j_coord_offsetB = DIM*jnrB;
748 j_coord_offsetC = DIM*jnrC;
749 j_coord_offsetD = DIM*jnrD;
751 /* load j atom coordinates */
752 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
753 x+j_coord_offsetC,x+j_coord_offsetD,
756 /* Calculate displacement vector */
757 dx00 = _mm_sub_ps(ix0,jx0);
758 dy00 = _mm_sub_ps(iy0,jy0);
759 dz00 = _mm_sub_ps(iz0,jz0);
760 dx10 = _mm_sub_ps(ix1,jx0);
761 dy10 = _mm_sub_ps(iy1,jy0);
762 dz10 = _mm_sub_ps(iz1,jz0);
763 dx20 = _mm_sub_ps(ix2,jx0);
764 dy20 = _mm_sub_ps(iy2,jy0);
765 dz20 = _mm_sub_ps(iz2,jz0);
766 dx30 = _mm_sub_ps(ix3,jx0);
767 dy30 = _mm_sub_ps(iy3,jy0);
768 dz30 = _mm_sub_ps(iz3,jz0);
770 /* Calculate squared distance and things based on it */
771 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
772 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
773 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
774 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
776 rinv10 = gmx_mm_invsqrt_ps(rsq10);
777 rinv20 = gmx_mm_invsqrt_ps(rsq20);
778 rinv30 = gmx_mm_invsqrt_ps(rsq30);
780 rinvsq00 = gmx_mm_inv_ps(rsq00);
781 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
782 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
783 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
785 /* Load parameters for j particles */
786 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
787 charge+jnrC+0,charge+jnrD+0);
788 vdwjidx0A = 2*vdwtype[jnrA+0];
789 vdwjidx0B = 2*vdwtype[jnrB+0];
790 vdwjidx0C = 2*vdwtype[jnrC+0];
791 vdwjidx0D = 2*vdwtype[jnrD+0];
793 fjx0 = _mm_setzero_ps();
794 fjy0 = _mm_setzero_ps();
795 fjz0 = _mm_setzero_ps();
797 /**************************
798 * CALCULATE INTERACTIONS *
799 **************************/
801 /* Compute parameters for interactions between i and j atoms */
802 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
803 vdwparam+vdwioffset0+vdwjidx0B,
804 vdwparam+vdwioffset0+vdwjidx0C,
805 vdwparam+vdwioffset0+vdwjidx0D,
808 /* LENNARD-JONES DISPERSION/REPULSION */
810 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
811 fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00));
815 /* Calculate temporary vectorial force */
816 tx = _mm_mul_ps(fscal,dx00);
817 ty = _mm_mul_ps(fscal,dy00);
818 tz = _mm_mul_ps(fscal,dz00);
820 /* Update vectorial force */
821 fix0 = _mm_add_ps(fix0,tx);
822 fiy0 = _mm_add_ps(fiy0,ty);
823 fiz0 = _mm_add_ps(fiz0,tz);
825 fjx0 = _mm_add_ps(fjx0,tx);
826 fjy0 = _mm_add_ps(fjy0,ty);
827 fjz0 = _mm_add_ps(fjz0,tz);
829 /**************************
830 * CALCULATE INTERACTIONS *
831 **************************/
833 /* Compute parameters for interactions between i and j atoms */
834 qq10 = _mm_mul_ps(iq1,jq0);
836 /* COULOMB ELECTROSTATICS */
837 velec = _mm_mul_ps(qq10,rinv10);
838 felec = _mm_mul_ps(velec,rinvsq10);
842 /* Calculate temporary vectorial force */
843 tx = _mm_mul_ps(fscal,dx10);
844 ty = _mm_mul_ps(fscal,dy10);
845 tz = _mm_mul_ps(fscal,dz10);
847 /* Update vectorial force */
848 fix1 = _mm_add_ps(fix1,tx);
849 fiy1 = _mm_add_ps(fiy1,ty);
850 fiz1 = _mm_add_ps(fiz1,tz);
852 fjx0 = _mm_add_ps(fjx0,tx);
853 fjy0 = _mm_add_ps(fjy0,ty);
854 fjz0 = _mm_add_ps(fjz0,tz);
856 /**************************
857 * CALCULATE INTERACTIONS *
858 **************************/
860 /* Compute parameters for interactions between i and j atoms */
861 qq20 = _mm_mul_ps(iq2,jq0);
863 /* COULOMB ELECTROSTATICS */
864 velec = _mm_mul_ps(qq20,rinv20);
865 felec = _mm_mul_ps(velec,rinvsq20);
869 /* Calculate temporary vectorial force */
870 tx = _mm_mul_ps(fscal,dx20);
871 ty = _mm_mul_ps(fscal,dy20);
872 tz = _mm_mul_ps(fscal,dz20);
874 /* Update vectorial force */
875 fix2 = _mm_add_ps(fix2,tx);
876 fiy2 = _mm_add_ps(fiy2,ty);
877 fiz2 = _mm_add_ps(fiz2,tz);
879 fjx0 = _mm_add_ps(fjx0,tx);
880 fjy0 = _mm_add_ps(fjy0,ty);
881 fjz0 = _mm_add_ps(fjz0,tz);
883 /**************************
884 * CALCULATE INTERACTIONS *
885 **************************/
887 /* Compute parameters for interactions between i and j atoms */
888 qq30 = _mm_mul_ps(iq3,jq0);
890 /* COULOMB ELECTROSTATICS */
891 velec = _mm_mul_ps(qq30,rinv30);
892 felec = _mm_mul_ps(velec,rinvsq30);
896 /* Calculate temporary vectorial force */
897 tx = _mm_mul_ps(fscal,dx30);
898 ty = _mm_mul_ps(fscal,dy30);
899 tz = _mm_mul_ps(fscal,dz30);
901 /* Update vectorial force */
902 fix3 = _mm_add_ps(fix3,tx);
903 fiy3 = _mm_add_ps(fiy3,ty);
904 fiz3 = _mm_add_ps(fiz3,tz);
906 fjx0 = _mm_add_ps(fjx0,tx);
907 fjy0 = _mm_add_ps(fjy0,ty);
908 fjz0 = _mm_add_ps(fjz0,tz);
910 fjptrA = f+j_coord_offsetA;
911 fjptrB = f+j_coord_offsetB;
912 fjptrC = f+j_coord_offsetC;
913 fjptrD = f+j_coord_offsetD;
915 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
917 /* Inner loop uses 108 flops */
923 /* Get j neighbor index, and coordinate index */
924 jnrlistA = jjnr[jidx];
925 jnrlistB = jjnr[jidx+1];
926 jnrlistC = jjnr[jidx+2];
927 jnrlistD = jjnr[jidx+3];
928 /* Sign of each element will be negative for non-real atoms.
929 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
930 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
932 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
933 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
934 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
935 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
936 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
937 j_coord_offsetA = DIM*jnrA;
938 j_coord_offsetB = DIM*jnrB;
939 j_coord_offsetC = DIM*jnrC;
940 j_coord_offsetD = DIM*jnrD;
942 /* load j atom coordinates */
943 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
944 x+j_coord_offsetC,x+j_coord_offsetD,
947 /* Calculate displacement vector */
948 dx00 = _mm_sub_ps(ix0,jx0);
949 dy00 = _mm_sub_ps(iy0,jy0);
950 dz00 = _mm_sub_ps(iz0,jz0);
951 dx10 = _mm_sub_ps(ix1,jx0);
952 dy10 = _mm_sub_ps(iy1,jy0);
953 dz10 = _mm_sub_ps(iz1,jz0);
954 dx20 = _mm_sub_ps(ix2,jx0);
955 dy20 = _mm_sub_ps(iy2,jy0);
956 dz20 = _mm_sub_ps(iz2,jz0);
957 dx30 = _mm_sub_ps(ix3,jx0);
958 dy30 = _mm_sub_ps(iy3,jy0);
959 dz30 = _mm_sub_ps(iz3,jz0);
961 /* Calculate squared distance and things based on it */
962 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
963 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
964 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
965 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
967 rinv10 = gmx_mm_invsqrt_ps(rsq10);
968 rinv20 = gmx_mm_invsqrt_ps(rsq20);
969 rinv30 = gmx_mm_invsqrt_ps(rsq30);
971 rinvsq00 = gmx_mm_inv_ps(rsq00);
972 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
973 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
974 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
976 /* Load parameters for j particles */
977 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
978 charge+jnrC+0,charge+jnrD+0);
979 vdwjidx0A = 2*vdwtype[jnrA+0];
980 vdwjidx0B = 2*vdwtype[jnrB+0];
981 vdwjidx0C = 2*vdwtype[jnrC+0];
982 vdwjidx0D = 2*vdwtype[jnrD+0];
984 fjx0 = _mm_setzero_ps();
985 fjy0 = _mm_setzero_ps();
986 fjz0 = _mm_setzero_ps();
988 /**************************
989 * CALCULATE INTERACTIONS *
990 **************************/
992 /* Compute parameters for interactions between i and j atoms */
993 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
994 vdwparam+vdwioffset0+vdwjidx0B,
995 vdwparam+vdwioffset0+vdwjidx0C,
996 vdwparam+vdwioffset0+vdwjidx0D,
999 /* LENNARD-JONES DISPERSION/REPULSION */
1001 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
1002 fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00));
1006 fscal = _mm_andnot_ps(dummy_mask,fscal);
1008 /* Calculate temporary vectorial force */
1009 tx = _mm_mul_ps(fscal,dx00);
1010 ty = _mm_mul_ps(fscal,dy00);
1011 tz = _mm_mul_ps(fscal,dz00);
1013 /* Update vectorial force */
1014 fix0 = _mm_add_ps(fix0,tx);
1015 fiy0 = _mm_add_ps(fiy0,ty);
1016 fiz0 = _mm_add_ps(fiz0,tz);
1018 fjx0 = _mm_add_ps(fjx0,tx);
1019 fjy0 = _mm_add_ps(fjy0,ty);
1020 fjz0 = _mm_add_ps(fjz0,tz);
1022 /**************************
1023 * CALCULATE INTERACTIONS *
1024 **************************/
1026 /* Compute parameters for interactions between i and j atoms */
1027 qq10 = _mm_mul_ps(iq1,jq0);
1029 /* COULOMB ELECTROSTATICS */
1030 velec = _mm_mul_ps(qq10,rinv10);
1031 felec = _mm_mul_ps(velec,rinvsq10);
1035 fscal = _mm_andnot_ps(dummy_mask,fscal);
1037 /* Calculate temporary vectorial force */
1038 tx = _mm_mul_ps(fscal,dx10);
1039 ty = _mm_mul_ps(fscal,dy10);
1040 tz = _mm_mul_ps(fscal,dz10);
1042 /* Update vectorial force */
1043 fix1 = _mm_add_ps(fix1,tx);
1044 fiy1 = _mm_add_ps(fiy1,ty);
1045 fiz1 = _mm_add_ps(fiz1,tz);
1047 fjx0 = _mm_add_ps(fjx0,tx);
1048 fjy0 = _mm_add_ps(fjy0,ty);
1049 fjz0 = _mm_add_ps(fjz0,tz);
1051 /**************************
1052 * CALCULATE INTERACTIONS *
1053 **************************/
1055 /* Compute parameters for interactions between i and j atoms */
1056 qq20 = _mm_mul_ps(iq2,jq0);
1058 /* COULOMB ELECTROSTATICS */
1059 velec = _mm_mul_ps(qq20,rinv20);
1060 felec = _mm_mul_ps(velec,rinvsq20);
1064 fscal = _mm_andnot_ps(dummy_mask,fscal);
1066 /* Calculate temporary vectorial force */
1067 tx = _mm_mul_ps(fscal,dx20);
1068 ty = _mm_mul_ps(fscal,dy20);
1069 tz = _mm_mul_ps(fscal,dz20);
1071 /* Update vectorial force */
1072 fix2 = _mm_add_ps(fix2,tx);
1073 fiy2 = _mm_add_ps(fiy2,ty);
1074 fiz2 = _mm_add_ps(fiz2,tz);
1076 fjx0 = _mm_add_ps(fjx0,tx);
1077 fjy0 = _mm_add_ps(fjy0,ty);
1078 fjz0 = _mm_add_ps(fjz0,tz);
1080 /**************************
1081 * CALCULATE INTERACTIONS *
1082 **************************/
1084 /* Compute parameters for interactions between i and j atoms */
1085 qq30 = _mm_mul_ps(iq3,jq0);
1087 /* COULOMB ELECTROSTATICS */
1088 velec = _mm_mul_ps(qq30,rinv30);
1089 felec = _mm_mul_ps(velec,rinvsq30);
1093 fscal = _mm_andnot_ps(dummy_mask,fscal);
1095 /* Calculate temporary vectorial force */
1096 tx = _mm_mul_ps(fscal,dx30);
1097 ty = _mm_mul_ps(fscal,dy30);
1098 tz = _mm_mul_ps(fscal,dz30);
1100 /* Update vectorial force */
1101 fix3 = _mm_add_ps(fix3,tx);
1102 fiy3 = _mm_add_ps(fiy3,ty);
1103 fiz3 = _mm_add_ps(fiz3,tz);
1105 fjx0 = _mm_add_ps(fjx0,tx);
1106 fjy0 = _mm_add_ps(fjy0,ty);
1107 fjz0 = _mm_add_ps(fjz0,tz);
1109 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1110 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1111 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1112 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1114 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1116 /* Inner loop uses 108 flops */
1119 /* End of innermost loop */
1121 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1122 f+i_coord_offset,fshift+i_shift_offset);
1124 /* Increment number of inner iterations */
1125 inneriter += j_index_end - j_index_start;
1127 /* Outer loop uses 24 flops */
1130 /* Increment number of outer iterations */
1133 /* Update outer/inner flops */
1135 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*108);