2 * Note: this file was generated by the Gromacs avx_128_fma_double 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_avx_128_fma_double.h"
34 #include "kernelutil_x86_avx_128_fma_double.h"
37 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
38 * Electrostatics interaction: ReactionField
39 * VdW interaction: LennardJones
40 * Geometry: Water3-Water3
41 * Calculate force/pot: PotentialAndForce
44 nb_kernel_ElecRF_VdwLJ_GeomW3W3_VF_avx_128_fma_double
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 refer to j loop unrolling done with SSE double precision, e.g. for the two 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;
61 int j_coord_offsetA,j_coord_offsetB;
62 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
64 real *shiftvec,*fshift,*x,*f;
65 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
67 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
69 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
71 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
72 int vdwjidx0A,vdwjidx0B;
73 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
74 int vdwjidx1A,vdwjidx1B;
75 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
76 int vdwjidx2A,vdwjidx2B;
77 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
78 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
79 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
80 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
81 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
82 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
83 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
84 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
85 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
86 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
87 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
90 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
93 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
94 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
95 __m128d dummy_mask,cutoff_mask;
96 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
97 __m128d one = _mm_set1_pd(1.0);
98 __m128d two = _mm_set1_pd(2.0);
104 jindex = nlist->jindex;
106 shiftidx = nlist->shift;
108 shiftvec = fr->shift_vec[0];
109 fshift = fr->fshift[0];
110 facel = _mm_set1_pd(fr->epsfac);
111 charge = mdatoms->chargeA;
112 krf = _mm_set1_pd(fr->ic->k_rf);
113 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
114 crf = _mm_set1_pd(fr->ic->c_rf);
115 nvdwtype = fr->ntype;
117 vdwtype = mdatoms->typeA;
119 /* Setup water-specific parameters */
120 inr = nlist->iinr[0];
121 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
122 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
123 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
124 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
126 jq0 = _mm_set1_pd(charge[inr+0]);
127 jq1 = _mm_set1_pd(charge[inr+1]);
128 jq2 = _mm_set1_pd(charge[inr+2]);
129 vdwjidx0A = 2*vdwtype[inr+0];
130 qq00 = _mm_mul_pd(iq0,jq0);
131 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
132 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
133 qq01 = _mm_mul_pd(iq0,jq1);
134 qq02 = _mm_mul_pd(iq0,jq2);
135 qq10 = _mm_mul_pd(iq1,jq0);
136 qq11 = _mm_mul_pd(iq1,jq1);
137 qq12 = _mm_mul_pd(iq1,jq2);
138 qq20 = _mm_mul_pd(iq2,jq0);
139 qq21 = _mm_mul_pd(iq2,jq1);
140 qq22 = _mm_mul_pd(iq2,jq2);
142 /* Avoid stupid compiler warnings */
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
166 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
168 fix0 = _mm_setzero_pd();
169 fiy0 = _mm_setzero_pd();
170 fiz0 = _mm_setzero_pd();
171 fix1 = _mm_setzero_pd();
172 fiy1 = _mm_setzero_pd();
173 fiz1 = _mm_setzero_pd();
174 fix2 = _mm_setzero_pd();
175 fiy2 = _mm_setzero_pd();
176 fiz2 = _mm_setzero_pd();
178 /* Reset potential sums */
179 velecsum = _mm_setzero_pd();
180 vvdwsum = _mm_setzero_pd();
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
186 /* Get j neighbor index, and coordinate index */
189 j_coord_offsetA = DIM*jnrA;
190 j_coord_offsetB = DIM*jnrB;
192 /* load j atom coordinates */
193 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
194 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
196 /* Calculate displacement vector */
197 dx00 = _mm_sub_pd(ix0,jx0);
198 dy00 = _mm_sub_pd(iy0,jy0);
199 dz00 = _mm_sub_pd(iz0,jz0);
200 dx01 = _mm_sub_pd(ix0,jx1);
201 dy01 = _mm_sub_pd(iy0,jy1);
202 dz01 = _mm_sub_pd(iz0,jz1);
203 dx02 = _mm_sub_pd(ix0,jx2);
204 dy02 = _mm_sub_pd(iy0,jy2);
205 dz02 = _mm_sub_pd(iz0,jz2);
206 dx10 = _mm_sub_pd(ix1,jx0);
207 dy10 = _mm_sub_pd(iy1,jy0);
208 dz10 = _mm_sub_pd(iz1,jz0);
209 dx11 = _mm_sub_pd(ix1,jx1);
210 dy11 = _mm_sub_pd(iy1,jy1);
211 dz11 = _mm_sub_pd(iz1,jz1);
212 dx12 = _mm_sub_pd(ix1,jx2);
213 dy12 = _mm_sub_pd(iy1,jy2);
214 dz12 = _mm_sub_pd(iz1,jz2);
215 dx20 = _mm_sub_pd(ix2,jx0);
216 dy20 = _mm_sub_pd(iy2,jy0);
217 dz20 = _mm_sub_pd(iz2,jz0);
218 dx21 = _mm_sub_pd(ix2,jx1);
219 dy21 = _mm_sub_pd(iy2,jy1);
220 dz21 = _mm_sub_pd(iz2,jz1);
221 dx22 = _mm_sub_pd(ix2,jx2);
222 dy22 = _mm_sub_pd(iy2,jy2);
223 dz22 = _mm_sub_pd(iz2,jz2);
225 /* Calculate squared distance and things based on it */
226 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
227 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
228 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
229 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
230 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
231 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
232 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
233 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
234 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
236 rinv00 = gmx_mm_invsqrt_pd(rsq00);
237 rinv01 = gmx_mm_invsqrt_pd(rsq01);
238 rinv02 = gmx_mm_invsqrt_pd(rsq02);
239 rinv10 = gmx_mm_invsqrt_pd(rsq10);
240 rinv11 = gmx_mm_invsqrt_pd(rsq11);
241 rinv12 = gmx_mm_invsqrt_pd(rsq12);
242 rinv20 = gmx_mm_invsqrt_pd(rsq20);
243 rinv21 = gmx_mm_invsqrt_pd(rsq21);
244 rinv22 = gmx_mm_invsqrt_pd(rsq22);
246 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
247 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
248 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
249 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
250 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
251 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
252 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
253 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
254 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
256 fjx0 = _mm_setzero_pd();
257 fjy0 = _mm_setzero_pd();
258 fjz0 = _mm_setzero_pd();
259 fjx1 = _mm_setzero_pd();
260 fjy1 = _mm_setzero_pd();
261 fjz1 = _mm_setzero_pd();
262 fjx2 = _mm_setzero_pd();
263 fjy2 = _mm_setzero_pd();
264 fjz2 = _mm_setzero_pd();
266 /**************************
267 * CALCULATE INTERACTIONS *
268 **************************/
270 /* REACTION-FIELD ELECTROSTATICS */
271 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
272 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
274 /* LENNARD-JONES DISPERSION/REPULSION */
276 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
277 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
278 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
279 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
280 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
282 /* Update potential sum for this i atom from the interaction with this j atom. */
283 velecsum = _mm_add_pd(velecsum,velec);
284 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
286 fscal = _mm_add_pd(felec,fvdw);
288 /* Update vectorial force */
289 fix0 = _mm_macc_pd(dx00,fscal,fix0);
290 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
291 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
293 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
294 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
295 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
297 /**************************
298 * CALCULATE INTERACTIONS *
299 **************************/
301 /* REACTION-FIELD ELECTROSTATICS */
302 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
303 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
305 /* Update potential sum for this i atom from the interaction with this j atom. */
306 velecsum = _mm_add_pd(velecsum,velec);
310 /* Update vectorial force */
311 fix0 = _mm_macc_pd(dx01,fscal,fix0);
312 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
313 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
315 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
316 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
317 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
319 /**************************
320 * CALCULATE INTERACTIONS *
321 **************************/
323 /* REACTION-FIELD ELECTROSTATICS */
324 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
325 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
327 /* Update potential sum for this i atom from the interaction with this j atom. */
328 velecsum = _mm_add_pd(velecsum,velec);
332 /* Update vectorial force */
333 fix0 = _mm_macc_pd(dx02,fscal,fix0);
334 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
335 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
337 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
338 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
339 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
341 /**************************
342 * CALCULATE INTERACTIONS *
343 **************************/
345 /* REACTION-FIELD ELECTROSTATICS */
346 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
347 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
349 /* Update potential sum for this i atom from the interaction with this j atom. */
350 velecsum = _mm_add_pd(velecsum,velec);
354 /* Update vectorial force */
355 fix1 = _mm_macc_pd(dx10,fscal,fix1);
356 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
357 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
359 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
360 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
361 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
363 /**************************
364 * CALCULATE INTERACTIONS *
365 **************************/
367 /* REACTION-FIELD ELECTROSTATICS */
368 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
369 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
371 /* Update potential sum for this i atom from the interaction with this j atom. */
372 velecsum = _mm_add_pd(velecsum,velec);
376 /* Update vectorial force */
377 fix1 = _mm_macc_pd(dx11,fscal,fix1);
378 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
379 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
381 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
382 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
383 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
385 /**************************
386 * CALCULATE INTERACTIONS *
387 **************************/
389 /* REACTION-FIELD ELECTROSTATICS */
390 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
391 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
393 /* Update potential sum for this i atom from the interaction with this j atom. */
394 velecsum = _mm_add_pd(velecsum,velec);
398 /* Update vectorial force */
399 fix1 = _mm_macc_pd(dx12,fscal,fix1);
400 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
401 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
403 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
404 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
405 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
407 /**************************
408 * CALCULATE INTERACTIONS *
409 **************************/
411 /* REACTION-FIELD ELECTROSTATICS */
412 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
413 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
415 /* Update potential sum for this i atom from the interaction with this j atom. */
416 velecsum = _mm_add_pd(velecsum,velec);
420 /* Update vectorial force */
421 fix2 = _mm_macc_pd(dx20,fscal,fix2);
422 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
423 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
425 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
426 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
427 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
429 /**************************
430 * CALCULATE INTERACTIONS *
431 **************************/
433 /* REACTION-FIELD ELECTROSTATICS */
434 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
435 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
437 /* Update potential sum for this i atom from the interaction with this j atom. */
438 velecsum = _mm_add_pd(velecsum,velec);
442 /* Update vectorial force */
443 fix2 = _mm_macc_pd(dx21,fscal,fix2);
444 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
445 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
447 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
448 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
449 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
451 /**************************
452 * CALCULATE INTERACTIONS *
453 **************************/
455 /* REACTION-FIELD ELECTROSTATICS */
456 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
457 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
459 /* Update potential sum for this i atom from the interaction with this j atom. */
460 velecsum = _mm_add_pd(velecsum,velec);
464 /* Update vectorial force */
465 fix2 = _mm_macc_pd(dx22,fscal,fix2);
466 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
467 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
469 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
470 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
471 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
473 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
475 /* Inner loop uses 327 flops */
482 j_coord_offsetA = DIM*jnrA;
484 /* load j atom coordinates */
485 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
486 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
488 /* Calculate displacement vector */
489 dx00 = _mm_sub_pd(ix0,jx0);
490 dy00 = _mm_sub_pd(iy0,jy0);
491 dz00 = _mm_sub_pd(iz0,jz0);
492 dx01 = _mm_sub_pd(ix0,jx1);
493 dy01 = _mm_sub_pd(iy0,jy1);
494 dz01 = _mm_sub_pd(iz0,jz1);
495 dx02 = _mm_sub_pd(ix0,jx2);
496 dy02 = _mm_sub_pd(iy0,jy2);
497 dz02 = _mm_sub_pd(iz0,jz2);
498 dx10 = _mm_sub_pd(ix1,jx0);
499 dy10 = _mm_sub_pd(iy1,jy0);
500 dz10 = _mm_sub_pd(iz1,jz0);
501 dx11 = _mm_sub_pd(ix1,jx1);
502 dy11 = _mm_sub_pd(iy1,jy1);
503 dz11 = _mm_sub_pd(iz1,jz1);
504 dx12 = _mm_sub_pd(ix1,jx2);
505 dy12 = _mm_sub_pd(iy1,jy2);
506 dz12 = _mm_sub_pd(iz1,jz2);
507 dx20 = _mm_sub_pd(ix2,jx0);
508 dy20 = _mm_sub_pd(iy2,jy0);
509 dz20 = _mm_sub_pd(iz2,jz0);
510 dx21 = _mm_sub_pd(ix2,jx1);
511 dy21 = _mm_sub_pd(iy2,jy1);
512 dz21 = _mm_sub_pd(iz2,jz1);
513 dx22 = _mm_sub_pd(ix2,jx2);
514 dy22 = _mm_sub_pd(iy2,jy2);
515 dz22 = _mm_sub_pd(iz2,jz2);
517 /* Calculate squared distance and things based on it */
518 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
519 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
520 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
521 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
522 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
523 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
524 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
525 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
526 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
528 rinv00 = gmx_mm_invsqrt_pd(rsq00);
529 rinv01 = gmx_mm_invsqrt_pd(rsq01);
530 rinv02 = gmx_mm_invsqrt_pd(rsq02);
531 rinv10 = gmx_mm_invsqrt_pd(rsq10);
532 rinv11 = gmx_mm_invsqrt_pd(rsq11);
533 rinv12 = gmx_mm_invsqrt_pd(rsq12);
534 rinv20 = gmx_mm_invsqrt_pd(rsq20);
535 rinv21 = gmx_mm_invsqrt_pd(rsq21);
536 rinv22 = gmx_mm_invsqrt_pd(rsq22);
538 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
539 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
540 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
541 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
542 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
543 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
544 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
545 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
546 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
548 fjx0 = _mm_setzero_pd();
549 fjy0 = _mm_setzero_pd();
550 fjz0 = _mm_setzero_pd();
551 fjx1 = _mm_setzero_pd();
552 fjy1 = _mm_setzero_pd();
553 fjz1 = _mm_setzero_pd();
554 fjx2 = _mm_setzero_pd();
555 fjy2 = _mm_setzero_pd();
556 fjz2 = _mm_setzero_pd();
558 /**************************
559 * CALCULATE INTERACTIONS *
560 **************************/
562 /* REACTION-FIELD ELECTROSTATICS */
563 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_macc_pd(krf,rsq00,rinv00),crf));
564 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
566 /* LENNARD-JONES DISPERSION/REPULSION */
568 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
569 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
570 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
571 vvdw = _mm_msub_pd( vvdw12,one_twelfth, _mm_mul_pd(vvdw6,one_sixth) );
572 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
574 /* Update potential sum for this i atom from the interaction with this j atom. */
575 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
576 velecsum = _mm_add_pd(velecsum,velec);
577 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
578 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
580 fscal = _mm_add_pd(felec,fvdw);
582 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
584 /* Update vectorial force */
585 fix0 = _mm_macc_pd(dx00,fscal,fix0);
586 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
587 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
589 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
590 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
591 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
593 /**************************
594 * CALCULATE INTERACTIONS *
595 **************************/
597 /* REACTION-FIELD ELECTROSTATICS */
598 velec = _mm_mul_pd(qq01,_mm_sub_pd(_mm_macc_pd(krf,rsq01,rinv01),crf));
599 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
601 /* Update potential sum for this i atom from the interaction with this j atom. */
602 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
603 velecsum = _mm_add_pd(velecsum,velec);
607 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
609 /* Update vectorial force */
610 fix0 = _mm_macc_pd(dx01,fscal,fix0);
611 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
612 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
614 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
615 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
616 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
618 /**************************
619 * CALCULATE INTERACTIONS *
620 **************************/
622 /* REACTION-FIELD ELECTROSTATICS */
623 velec = _mm_mul_pd(qq02,_mm_sub_pd(_mm_macc_pd(krf,rsq02,rinv02),crf));
624 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
626 /* Update potential sum for this i atom from the interaction with this j atom. */
627 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
628 velecsum = _mm_add_pd(velecsum,velec);
632 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
634 /* Update vectorial force */
635 fix0 = _mm_macc_pd(dx02,fscal,fix0);
636 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
637 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
639 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
640 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
641 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
643 /**************************
644 * CALCULATE INTERACTIONS *
645 **************************/
647 /* REACTION-FIELD ELECTROSTATICS */
648 velec = _mm_mul_pd(qq10,_mm_sub_pd(_mm_macc_pd(krf,rsq10,rinv10),crf));
649 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
651 /* Update potential sum for this i atom from the interaction with this j atom. */
652 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
653 velecsum = _mm_add_pd(velecsum,velec);
657 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
659 /* Update vectorial force */
660 fix1 = _mm_macc_pd(dx10,fscal,fix1);
661 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
662 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
664 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
665 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
666 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
668 /**************************
669 * CALCULATE INTERACTIONS *
670 **************************/
672 /* REACTION-FIELD ELECTROSTATICS */
673 velec = _mm_mul_pd(qq11,_mm_sub_pd(_mm_macc_pd(krf,rsq11,rinv11),crf));
674 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
676 /* Update potential sum for this i atom from the interaction with this j atom. */
677 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
678 velecsum = _mm_add_pd(velecsum,velec);
682 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
684 /* Update vectorial force */
685 fix1 = _mm_macc_pd(dx11,fscal,fix1);
686 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
687 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
689 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
690 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
691 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
693 /**************************
694 * CALCULATE INTERACTIONS *
695 **************************/
697 /* REACTION-FIELD ELECTROSTATICS */
698 velec = _mm_mul_pd(qq12,_mm_sub_pd(_mm_macc_pd(krf,rsq12,rinv12),crf));
699 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
701 /* Update potential sum for this i atom from the interaction with this j atom. */
702 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
703 velecsum = _mm_add_pd(velecsum,velec);
707 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
709 /* Update vectorial force */
710 fix1 = _mm_macc_pd(dx12,fscal,fix1);
711 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
712 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
714 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
715 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
716 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
718 /**************************
719 * CALCULATE INTERACTIONS *
720 **************************/
722 /* REACTION-FIELD ELECTROSTATICS */
723 velec = _mm_mul_pd(qq20,_mm_sub_pd(_mm_macc_pd(krf,rsq20,rinv20),crf));
724 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
726 /* Update potential sum for this i atom from the interaction with this j atom. */
727 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
728 velecsum = _mm_add_pd(velecsum,velec);
732 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
734 /* Update vectorial force */
735 fix2 = _mm_macc_pd(dx20,fscal,fix2);
736 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
737 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
739 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
740 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
741 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
743 /**************************
744 * CALCULATE INTERACTIONS *
745 **************************/
747 /* REACTION-FIELD ELECTROSTATICS */
748 velec = _mm_mul_pd(qq21,_mm_sub_pd(_mm_macc_pd(krf,rsq21,rinv21),crf));
749 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
751 /* Update potential sum for this i atom from the interaction with this j atom. */
752 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
753 velecsum = _mm_add_pd(velecsum,velec);
757 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
759 /* Update vectorial force */
760 fix2 = _mm_macc_pd(dx21,fscal,fix2);
761 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
762 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
764 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
765 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
766 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
768 /**************************
769 * CALCULATE INTERACTIONS *
770 **************************/
772 /* REACTION-FIELD ELECTROSTATICS */
773 velec = _mm_mul_pd(qq22,_mm_sub_pd(_mm_macc_pd(krf,rsq22,rinv22),crf));
774 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
776 /* Update potential sum for this i atom from the interaction with this j atom. */
777 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
778 velecsum = _mm_add_pd(velecsum,velec);
782 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
784 /* Update vectorial force */
785 fix2 = _mm_macc_pd(dx22,fscal,fix2);
786 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
787 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
789 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
790 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
791 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
793 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
795 /* Inner loop uses 327 flops */
798 /* End of innermost loop */
800 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
801 f+i_coord_offset,fshift+i_shift_offset);
804 /* Update potential energies */
805 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
806 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
808 /* Increment number of inner iterations */
809 inneriter += j_index_end - j_index_start;
811 /* Outer loop uses 20 flops */
814 /* Increment number of outer iterations */
817 /* Update outer/inner flops */
819 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*20 + inneriter*327);
822 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
823 * Electrostatics interaction: ReactionField
824 * VdW interaction: LennardJones
825 * Geometry: Water3-Water3
826 * Calculate force/pot: Force
829 nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_avx_128_fma_double
830 (t_nblist * gmx_restrict nlist,
831 rvec * gmx_restrict xx,
832 rvec * gmx_restrict ff,
833 t_forcerec * gmx_restrict fr,
834 t_mdatoms * gmx_restrict mdatoms,
835 nb_kernel_data_t * gmx_restrict kernel_data,
836 t_nrnb * gmx_restrict nrnb)
838 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
839 * just 0 for non-waters.
840 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
841 * jnr indices corresponding to data put in the four positions in the SIMD register.
843 int i_shift_offset,i_coord_offset,outeriter,inneriter;
844 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
846 int j_coord_offsetA,j_coord_offsetB;
847 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
849 real *shiftvec,*fshift,*x,*f;
850 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
852 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
854 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
856 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
857 int vdwjidx0A,vdwjidx0B;
858 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
859 int vdwjidx1A,vdwjidx1B;
860 __m128d jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
861 int vdwjidx2A,vdwjidx2B;
862 __m128d jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
863 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
864 __m128d dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01;
865 __m128d dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02;
866 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
867 __m128d dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
868 __m128d dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
869 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
870 __m128d dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
871 __m128d dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
872 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
875 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
878 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
879 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
880 __m128d dummy_mask,cutoff_mask;
881 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
882 __m128d one = _mm_set1_pd(1.0);
883 __m128d two = _mm_set1_pd(2.0);
889 jindex = nlist->jindex;
891 shiftidx = nlist->shift;
893 shiftvec = fr->shift_vec[0];
894 fshift = fr->fshift[0];
895 facel = _mm_set1_pd(fr->epsfac);
896 charge = mdatoms->chargeA;
897 krf = _mm_set1_pd(fr->ic->k_rf);
898 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
899 crf = _mm_set1_pd(fr->ic->c_rf);
900 nvdwtype = fr->ntype;
902 vdwtype = mdatoms->typeA;
904 /* Setup water-specific parameters */
905 inr = nlist->iinr[0];
906 iq0 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+0]));
907 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
908 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
909 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
911 jq0 = _mm_set1_pd(charge[inr+0]);
912 jq1 = _mm_set1_pd(charge[inr+1]);
913 jq2 = _mm_set1_pd(charge[inr+2]);
914 vdwjidx0A = 2*vdwtype[inr+0];
915 qq00 = _mm_mul_pd(iq0,jq0);
916 c6_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A]);
917 c12_00 = _mm_set1_pd(vdwparam[vdwioffset0+vdwjidx0A+1]);
918 qq01 = _mm_mul_pd(iq0,jq1);
919 qq02 = _mm_mul_pd(iq0,jq2);
920 qq10 = _mm_mul_pd(iq1,jq0);
921 qq11 = _mm_mul_pd(iq1,jq1);
922 qq12 = _mm_mul_pd(iq1,jq2);
923 qq20 = _mm_mul_pd(iq2,jq0);
924 qq21 = _mm_mul_pd(iq2,jq1);
925 qq22 = _mm_mul_pd(iq2,jq2);
927 /* Avoid stupid compiler warnings */
935 /* Start outer loop over neighborlists */
936 for(iidx=0; iidx<nri; iidx++)
938 /* Load shift vector for this list */
939 i_shift_offset = DIM*shiftidx[iidx];
941 /* Load limits for loop over neighbors */
942 j_index_start = jindex[iidx];
943 j_index_end = jindex[iidx+1];
945 /* Get outer coordinate index */
947 i_coord_offset = DIM*inr;
949 /* Load i particle coords and add shift vector */
950 gmx_mm_load_shift_and_3rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
951 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
953 fix0 = _mm_setzero_pd();
954 fiy0 = _mm_setzero_pd();
955 fiz0 = _mm_setzero_pd();
956 fix1 = _mm_setzero_pd();
957 fiy1 = _mm_setzero_pd();
958 fiz1 = _mm_setzero_pd();
959 fix2 = _mm_setzero_pd();
960 fiy2 = _mm_setzero_pd();
961 fiz2 = _mm_setzero_pd();
963 /* Start inner kernel loop */
964 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
967 /* Get j neighbor index, and coordinate index */
970 j_coord_offsetA = DIM*jnrA;
971 j_coord_offsetB = DIM*jnrB;
973 /* load j atom coordinates */
974 gmx_mm_load_3rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
975 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
977 /* Calculate displacement vector */
978 dx00 = _mm_sub_pd(ix0,jx0);
979 dy00 = _mm_sub_pd(iy0,jy0);
980 dz00 = _mm_sub_pd(iz0,jz0);
981 dx01 = _mm_sub_pd(ix0,jx1);
982 dy01 = _mm_sub_pd(iy0,jy1);
983 dz01 = _mm_sub_pd(iz0,jz1);
984 dx02 = _mm_sub_pd(ix0,jx2);
985 dy02 = _mm_sub_pd(iy0,jy2);
986 dz02 = _mm_sub_pd(iz0,jz2);
987 dx10 = _mm_sub_pd(ix1,jx0);
988 dy10 = _mm_sub_pd(iy1,jy0);
989 dz10 = _mm_sub_pd(iz1,jz0);
990 dx11 = _mm_sub_pd(ix1,jx1);
991 dy11 = _mm_sub_pd(iy1,jy1);
992 dz11 = _mm_sub_pd(iz1,jz1);
993 dx12 = _mm_sub_pd(ix1,jx2);
994 dy12 = _mm_sub_pd(iy1,jy2);
995 dz12 = _mm_sub_pd(iz1,jz2);
996 dx20 = _mm_sub_pd(ix2,jx0);
997 dy20 = _mm_sub_pd(iy2,jy0);
998 dz20 = _mm_sub_pd(iz2,jz0);
999 dx21 = _mm_sub_pd(ix2,jx1);
1000 dy21 = _mm_sub_pd(iy2,jy1);
1001 dz21 = _mm_sub_pd(iz2,jz1);
1002 dx22 = _mm_sub_pd(ix2,jx2);
1003 dy22 = _mm_sub_pd(iy2,jy2);
1004 dz22 = _mm_sub_pd(iz2,jz2);
1006 /* Calculate squared distance and things based on it */
1007 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1008 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1009 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1010 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1011 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1012 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1013 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1014 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1015 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1017 rinv00 = gmx_mm_invsqrt_pd(rsq00);
1018 rinv01 = gmx_mm_invsqrt_pd(rsq01);
1019 rinv02 = gmx_mm_invsqrt_pd(rsq02);
1020 rinv10 = gmx_mm_invsqrt_pd(rsq10);
1021 rinv11 = gmx_mm_invsqrt_pd(rsq11);
1022 rinv12 = gmx_mm_invsqrt_pd(rsq12);
1023 rinv20 = gmx_mm_invsqrt_pd(rsq20);
1024 rinv21 = gmx_mm_invsqrt_pd(rsq21);
1025 rinv22 = gmx_mm_invsqrt_pd(rsq22);
1027 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1028 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1029 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1030 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1031 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1032 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1033 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1034 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1035 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1037 fjx0 = _mm_setzero_pd();
1038 fjy0 = _mm_setzero_pd();
1039 fjz0 = _mm_setzero_pd();
1040 fjx1 = _mm_setzero_pd();
1041 fjy1 = _mm_setzero_pd();
1042 fjz1 = _mm_setzero_pd();
1043 fjx2 = _mm_setzero_pd();
1044 fjy2 = _mm_setzero_pd();
1045 fjz2 = _mm_setzero_pd();
1047 /**************************
1048 * CALCULATE INTERACTIONS *
1049 **************************/
1051 /* REACTION-FIELD ELECTROSTATICS */
1052 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1054 /* LENNARD-JONES DISPERSION/REPULSION */
1056 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1057 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1059 fscal = _mm_add_pd(felec,fvdw);
1061 /* Update vectorial force */
1062 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1063 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1064 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1066 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1067 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1068 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1070 /**************************
1071 * CALCULATE INTERACTIONS *
1072 **************************/
1074 /* REACTION-FIELD ELECTROSTATICS */
1075 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1079 /* Update vectorial force */
1080 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1081 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1082 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1084 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1085 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1086 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1088 /**************************
1089 * CALCULATE INTERACTIONS *
1090 **************************/
1092 /* REACTION-FIELD ELECTROSTATICS */
1093 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1097 /* Update vectorial force */
1098 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1099 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1100 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1102 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1103 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1104 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1106 /**************************
1107 * CALCULATE INTERACTIONS *
1108 **************************/
1110 /* REACTION-FIELD ELECTROSTATICS */
1111 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1115 /* Update vectorial force */
1116 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1117 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1118 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1120 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1121 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1122 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1124 /**************************
1125 * CALCULATE INTERACTIONS *
1126 **************************/
1128 /* REACTION-FIELD ELECTROSTATICS */
1129 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1133 /* Update vectorial force */
1134 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1135 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1136 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1138 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1139 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1140 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1142 /**************************
1143 * CALCULATE INTERACTIONS *
1144 **************************/
1146 /* REACTION-FIELD ELECTROSTATICS */
1147 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1151 /* Update vectorial force */
1152 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1153 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1154 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1156 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1157 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1158 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1160 /**************************
1161 * CALCULATE INTERACTIONS *
1162 **************************/
1164 /* REACTION-FIELD ELECTROSTATICS */
1165 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1169 /* Update vectorial force */
1170 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1171 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1172 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1174 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1175 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1176 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1178 /**************************
1179 * CALCULATE INTERACTIONS *
1180 **************************/
1182 /* REACTION-FIELD ELECTROSTATICS */
1183 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1187 /* Update vectorial force */
1188 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1189 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1190 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1192 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1193 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1194 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1196 /**************************
1197 * CALCULATE INTERACTIONS *
1198 **************************/
1200 /* REACTION-FIELD ELECTROSTATICS */
1201 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1205 /* Update vectorial force */
1206 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1207 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1208 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1210 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1211 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1212 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1214 gmx_mm_decrement_3rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1216 /* Inner loop uses 277 flops */
1219 if(jidx<j_index_end)
1223 j_coord_offsetA = DIM*jnrA;
1225 /* load j atom coordinates */
1226 gmx_mm_load_3rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
1227 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,&jy2,&jz2);
1229 /* Calculate displacement vector */
1230 dx00 = _mm_sub_pd(ix0,jx0);
1231 dy00 = _mm_sub_pd(iy0,jy0);
1232 dz00 = _mm_sub_pd(iz0,jz0);
1233 dx01 = _mm_sub_pd(ix0,jx1);
1234 dy01 = _mm_sub_pd(iy0,jy1);
1235 dz01 = _mm_sub_pd(iz0,jz1);
1236 dx02 = _mm_sub_pd(ix0,jx2);
1237 dy02 = _mm_sub_pd(iy0,jy2);
1238 dz02 = _mm_sub_pd(iz0,jz2);
1239 dx10 = _mm_sub_pd(ix1,jx0);
1240 dy10 = _mm_sub_pd(iy1,jy0);
1241 dz10 = _mm_sub_pd(iz1,jz0);
1242 dx11 = _mm_sub_pd(ix1,jx1);
1243 dy11 = _mm_sub_pd(iy1,jy1);
1244 dz11 = _mm_sub_pd(iz1,jz1);
1245 dx12 = _mm_sub_pd(ix1,jx2);
1246 dy12 = _mm_sub_pd(iy1,jy2);
1247 dz12 = _mm_sub_pd(iz1,jz2);
1248 dx20 = _mm_sub_pd(ix2,jx0);
1249 dy20 = _mm_sub_pd(iy2,jy0);
1250 dz20 = _mm_sub_pd(iz2,jz0);
1251 dx21 = _mm_sub_pd(ix2,jx1);
1252 dy21 = _mm_sub_pd(iy2,jy1);
1253 dz21 = _mm_sub_pd(iz2,jz1);
1254 dx22 = _mm_sub_pd(ix2,jx2);
1255 dy22 = _mm_sub_pd(iy2,jy2);
1256 dz22 = _mm_sub_pd(iz2,jz2);
1258 /* Calculate squared distance and things based on it */
1259 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
1260 rsq01 = gmx_mm_calc_rsq_pd(dx01,dy01,dz01);
1261 rsq02 = gmx_mm_calc_rsq_pd(dx02,dy02,dz02);
1262 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
1263 rsq11 = gmx_mm_calc_rsq_pd(dx11,dy11,dz11);
1264 rsq12 = gmx_mm_calc_rsq_pd(dx12,dy12,dz12);
1265 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
1266 rsq21 = gmx_mm_calc_rsq_pd(dx21,dy21,dz21);
1267 rsq22 = gmx_mm_calc_rsq_pd(dx22,dy22,dz22);
1269 rinv00 = gmx_mm_invsqrt_pd(rsq00);
1270 rinv01 = gmx_mm_invsqrt_pd(rsq01);
1271 rinv02 = gmx_mm_invsqrt_pd(rsq02);
1272 rinv10 = gmx_mm_invsqrt_pd(rsq10);
1273 rinv11 = gmx_mm_invsqrt_pd(rsq11);
1274 rinv12 = gmx_mm_invsqrt_pd(rsq12);
1275 rinv20 = gmx_mm_invsqrt_pd(rsq20);
1276 rinv21 = gmx_mm_invsqrt_pd(rsq21);
1277 rinv22 = gmx_mm_invsqrt_pd(rsq22);
1279 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
1280 rinvsq01 = _mm_mul_pd(rinv01,rinv01);
1281 rinvsq02 = _mm_mul_pd(rinv02,rinv02);
1282 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
1283 rinvsq11 = _mm_mul_pd(rinv11,rinv11);
1284 rinvsq12 = _mm_mul_pd(rinv12,rinv12);
1285 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
1286 rinvsq21 = _mm_mul_pd(rinv21,rinv21);
1287 rinvsq22 = _mm_mul_pd(rinv22,rinv22);
1289 fjx0 = _mm_setzero_pd();
1290 fjy0 = _mm_setzero_pd();
1291 fjz0 = _mm_setzero_pd();
1292 fjx1 = _mm_setzero_pd();
1293 fjy1 = _mm_setzero_pd();
1294 fjz1 = _mm_setzero_pd();
1295 fjx2 = _mm_setzero_pd();
1296 fjy2 = _mm_setzero_pd();
1297 fjz2 = _mm_setzero_pd();
1299 /**************************
1300 * CALCULATE INTERACTIONS *
1301 **************************/
1303 /* REACTION-FIELD ELECTROSTATICS */
1304 felec = _mm_mul_pd(qq00,_mm_msub_pd(rinv00,rinvsq00,krf2));
1306 /* LENNARD-JONES DISPERSION/REPULSION */
1308 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
1309 fvdw = _mm_mul_pd(_mm_msub_pd(c12_00,rinvsix,c6_00),_mm_mul_pd(rinvsix,rinvsq00));
1311 fscal = _mm_add_pd(felec,fvdw);
1313 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1315 /* Update vectorial force */
1316 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1317 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1318 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1320 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1321 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1322 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1324 /**************************
1325 * CALCULATE INTERACTIONS *
1326 **************************/
1328 /* REACTION-FIELD ELECTROSTATICS */
1329 felec = _mm_mul_pd(qq01,_mm_msub_pd(rinv01,rinvsq01,krf2));
1333 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1335 /* Update vectorial force */
1336 fix0 = _mm_macc_pd(dx01,fscal,fix0);
1337 fiy0 = _mm_macc_pd(dy01,fscal,fiy0);
1338 fiz0 = _mm_macc_pd(dz01,fscal,fiz0);
1340 fjx1 = _mm_macc_pd(dx01,fscal,fjx1);
1341 fjy1 = _mm_macc_pd(dy01,fscal,fjy1);
1342 fjz1 = _mm_macc_pd(dz01,fscal,fjz1);
1344 /**************************
1345 * CALCULATE INTERACTIONS *
1346 **************************/
1348 /* REACTION-FIELD ELECTROSTATICS */
1349 felec = _mm_mul_pd(qq02,_mm_msub_pd(rinv02,rinvsq02,krf2));
1353 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1355 /* Update vectorial force */
1356 fix0 = _mm_macc_pd(dx02,fscal,fix0);
1357 fiy0 = _mm_macc_pd(dy02,fscal,fiy0);
1358 fiz0 = _mm_macc_pd(dz02,fscal,fiz0);
1360 fjx2 = _mm_macc_pd(dx02,fscal,fjx2);
1361 fjy2 = _mm_macc_pd(dy02,fscal,fjy2);
1362 fjz2 = _mm_macc_pd(dz02,fscal,fjz2);
1364 /**************************
1365 * CALCULATE INTERACTIONS *
1366 **************************/
1368 /* REACTION-FIELD ELECTROSTATICS */
1369 felec = _mm_mul_pd(qq10,_mm_msub_pd(rinv10,rinvsq10,krf2));
1373 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1375 /* Update vectorial force */
1376 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1377 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1378 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1380 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1381 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1382 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1384 /**************************
1385 * CALCULATE INTERACTIONS *
1386 **************************/
1388 /* REACTION-FIELD ELECTROSTATICS */
1389 felec = _mm_mul_pd(qq11,_mm_msub_pd(rinv11,rinvsq11,krf2));
1393 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1395 /* Update vectorial force */
1396 fix1 = _mm_macc_pd(dx11,fscal,fix1);
1397 fiy1 = _mm_macc_pd(dy11,fscal,fiy1);
1398 fiz1 = _mm_macc_pd(dz11,fscal,fiz1);
1400 fjx1 = _mm_macc_pd(dx11,fscal,fjx1);
1401 fjy1 = _mm_macc_pd(dy11,fscal,fjy1);
1402 fjz1 = _mm_macc_pd(dz11,fscal,fjz1);
1404 /**************************
1405 * CALCULATE INTERACTIONS *
1406 **************************/
1408 /* REACTION-FIELD ELECTROSTATICS */
1409 felec = _mm_mul_pd(qq12,_mm_msub_pd(rinv12,rinvsq12,krf2));
1413 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1415 /* Update vectorial force */
1416 fix1 = _mm_macc_pd(dx12,fscal,fix1);
1417 fiy1 = _mm_macc_pd(dy12,fscal,fiy1);
1418 fiz1 = _mm_macc_pd(dz12,fscal,fiz1);
1420 fjx2 = _mm_macc_pd(dx12,fscal,fjx2);
1421 fjy2 = _mm_macc_pd(dy12,fscal,fjy2);
1422 fjz2 = _mm_macc_pd(dz12,fscal,fjz2);
1424 /**************************
1425 * CALCULATE INTERACTIONS *
1426 **************************/
1428 /* REACTION-FIELD ELECTROSTATICS */
1429 felec = _mm_mul_pd(qq20,_mm_msub_pd(rinv20,rinvsq20,krf2));
1433 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1435 /* Update vectorial force */
1436 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1437 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1438 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1440 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1441 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1442 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1444 /**************************
1445 * CALCULATE INTERACTIONS *
1446 **************************/
1448 /* REACTION-FIELD ELECTROSTATICS */
1449 felec = _mm_mul_pd(qq21,_mm_msub_pd(rinv21,rinvsq21,krf2));
1453 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1455 /* Update vectorial force */
1456 fix2 = _mm_macc_pd(dx21,fscal,fix2);
1457 fiy2 = _mm_macc_pd(dy21,fscal,fiy2);
1458 fiz2 = _mm_macc_pd(dz21,fscal,fiz2);
1460 fjx1 = _mm_macc_pd(dx21,fscal,fjx1);
1461 fjy1 = _mm_macc_pd(dy21,fscal,fjy1);
1462 fjz1 = _mm_macc_pd(dz21,fscal,fjz1);
1464 /**************************
1465 * CALCULATE INTERACTIONS *
1466 **************************/
1468 /* REACTION-FIELD ELECTROSTATICS */
1469 felec = _mm_mul_pd(qq22,_mm_msub_pd(rinv22,rinvsq22,krf2));
1473 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1475 /* Update vectorial force */
1476 fix2 = _mm_macc_pd(dx22,fscal,fix2);
1477 fiy2 = _mm_macc_pd(dy22,fscal,fiy2);
1478 fiz2 = _mm_macc_pd(dz22,fscal,fiz2);
1480 fjx2 = _mm_macc_pd(dx22,fscal,fjx2);
1481 fjy2 = _mm_macc_pd(dy22,fscal,fjy2);
1482 fjz2 = _mm_macc_pd(dz22,fscal,fjz2);
1484 gmx_mm_decrement_3rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2);
1486 /* Inner loop uses 277 flops */
1489 /* End of innermost loop */
1491 gmx_mm_update_iforce_3atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1492 f+i_coord_offset,fshift+i_shift_offset);
1494 /* Increment number of inner iterations */
1495 inneriter += j_index_end - j_index_start;
1497 /* Outer loop uses 18 flops */
1500 /* Increment number of outer iterations */
1503 /* Update outer/inner flops */
1505 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*18 + inneriter*277);