2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, by the GROMACS development team, led by
5 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 * others, as listed in the AUTHORS file in the top-level source
7 * 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_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
49 #include "gmx_math_x86_avx_128_fma_double.h"
50 #include "kernelutil_x86_avx_128_fma_double.h"
53 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW4P1_VF_avx_128_fma_double
54 * Electrostatics interaction: Coulomb
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water4-Particle
57 * Calculate force/pot: PotentialAndForce
60 nb_kernel_ElecCoul_VdwCSTab_GeomW4P1_VF_avx_128_fma_double
61 (t_nblist * gmx_restrict nlist,
62 rvec * gmx_restrict xx,
63 rvec * gmx_restrict ff,
64 t_forcerec * gmx_restrict fr,
65 t_mdatoms * gmx_restrict mdatoms,
66 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
67 t_nrnb * gmx_restrict nrnb)
69 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
70 * just 0 for non-waters.
71 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
72 * jnr indices corresponding to data put in the four positions in the SIMD register.
74 int i_shift_offset,i_coord_offset,outeriter,inneriter;
75 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
77 int j_coord_offsetA,j_coord_offsetB;
78 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
80 real *shiftvec,*fshift,*x,*f;
81 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
83 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
85 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
87 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
89 __m128d ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
90 int vdwjidx0A,vdwjidx0B;
91 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
92 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
93 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
94 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
95 __m128d dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
96 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
99 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
102 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
103 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
105 __m128i ifour = _mm_set1_epi32(4);
106 __m128d rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
108 __m128d dummy_mask,cutoff_mask;
109 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
110 __m128d one = _mm_set1_pd(1.0);
111 __m128d two = _mm_set1_pd(2.0);
117 jindex = nlist->jindex;
119 shiftidx = nlist->shift;
121 shiftvec = fr->shift_vec[0];
122 fshift = fr->fshift[0];
123 facel = _mm_set1_pd(fr->epsfac);
124 charge = mdatoms->chargeA;
125 nvdwtype = fr->ntype;
127 vdwtype = mdatoms->typeA;
129 vftab = kernel_data->table_vdw->data;
130 vftabscale = _mm_set1_pd(kernel_data->table_vdw->scale);
132 /* Setup water-specific parameters */
133 inr = nlist->iinr[0];
134 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
135 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
136 iq3 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+3]));
137 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
139 /* Avoid stupid compiler warnings */
147 /* Start outer loop over neighborlists */
148 for(iidx=0; iidx<nri; iidx++)
150 /* Load shift vector for this list */
151 i_shift_offset = DIM*shiftidx[iidx];
153 /* Load limits for loop over neighbors */
154 j_index_start = jindex[iidx];
155 j_index_end = jindex[iidx+1];
157 /* Get outer coordinate index */
159 i_coord_offset = DIM*inr;
161 /* Load i particle coords and add shift vector */
162 gmx_mm_load_shift_and_4rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
163 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
165 fix0 = _mm_setzero_pd();
166 fiy0 = _mm_setzero_pd();
167 fiz0 = _mm_setzero_pd();
168 fix1 = _mm_setzero_pd();
169 fiy1 = _mm_setzero_pd();
170 fiz1 = _mm_setzero_pd();
171 fix2 = _mm_setzero_pd();
172 fiy2 = _mm_setzero_pd();
173 fiz2 = _mm_setzero_pd();
174 fix3 = _mm_setzero_pd();
175 fiy3 = _mm_setzero_pd();
176 fiz3 = _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_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
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 dx10 = _mm_sub_pd(ix1,jx0);
201 dy10 = _mm_sub_pd(iy1,jy0);
202 dz10 = _mm_sub_pd(iz1,jz0);
203 dx20 = _mm_sub_pd(ix2,jx0);
204 dy20 = _mm_sub_pd(iy2,jy0);
205 dz20 = _mm_sub_pd(iz2,jz0);
206 dx30 = _mm_sub_pd(ix3,jx0);
207 dy30 = _mm_sub_pd(iy3,jy0);
208 dz30 = _mm_sub_pd(iz3,jz0);
210 /* Calculate squared distance and things based on it */
211 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
212 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
213 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
214 rsq30 = gmx_mm_calc_rsq_pd(dx30,dy30,dz30);
216 rinv00 = gmx_mm_invsqrt_pd(rsq00);
217 rinv10 = gmx_mm_invsqrt_pd(rsq10);
218 rinv20 = gmx_mm_invsqrt_pd(rsq20);
219 rinv30 = gmx_mm_invsqrt_pd(rsq30);
221 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
222 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
223 rinvsq30 = _mm_mul_pd(rinv30,rinv30);
225 /* Load parameters for j particles */
226 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
227 vdwjidx0A = 2*vdwtype[jnrA+0];
228 vdwjidx0B = 2*vdwtype[jnrB+0];
230 fjx0 = _mm_setzero_pd();
231 fjy0 = _mm_setzero_pd();
232 fjz0 = _mm_setzero_pd();
234 /**************************
235 * CALCULATE INTERACTIONS *
236 **************************/
238 r00 = _mm_mul_pd(rsq00,rinv00);
240 /* Compute parameters for interactions between i and j atoms */
241 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
242 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
244 /* Calculate table index by multiplying r with table scale and truncate to integer */
245 rt = _mm_mul_pd(r00,vftabscale);
246 vfitab = _mm_cvttpd_epi32(rt);
248 vfeps = _mm_frcz_pd(rt);
250 vfeps = _mm_sub_pd(rt,_mm_round_pd(rt, _MM_FROUND_FLOOR));
252 twovfeps = _mm_add_pd(vfeps,vfeps);
253 vfitab = _mm_slli_epi32(vfitab,3);
255 /* CUBIC SPLINE TABLE DISPERSION */
256 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
257 F = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) );
258 GMX_MM_TRANSPOSE2_PD(Y,F);
259 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
260 H = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) +2);
261 GMX_MM_TRANSPOSE2_PD(G,H);
262 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
263 VV = _mm_macc_pd(vfeps,Fp,Y);
264 vvdw6 = _mm_mul_pd(c6_00,VV);
265 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
266 fvdw6 = _mm_mul_pd(c6_00,FF);
268 /* CUBIC SPLINE TABLE REPULSION */
269 vfitab = _mm_add_epi32(vfitab,ifour);
270 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
271 F = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) );
272 GMX_MM_TRANSPOSE2_PD(Y,F);
273 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
274 H = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) +2);
275 GMX_MM_TRANSPOSE2_PD(G,H);
276 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
277 VV = _mm_macc_pd(vfeps,Fp,Y);
278 vvdw12 = _mm_mul_pd(c12_00,VV);
279 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
280 fvdw12 = _mm_mul_pd(c12_00,FF);
281 vvdw = _mm_add_pd(vvdw12,vvdw6);
282 fvdw = _mm_xor_pd(signbit,_mm_mul_pd(_mm_add_pd(fvdw6,fvdw12),_mm_mul_pd(vftabscale,rinv00)));
284 /* Update potential sum for this i atom from the interaction with this j atom. */
285 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
289 /* Update vectorial force */
290 fix0 = _mm_macc_pd(dx00,fscal,fix0);
291 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
292 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
294 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
295 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
296 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
298 /**************************
299 * CALCULATE INTERACTIONS *
300 **************************/
302 /* Compute parameters for interactions between i and j atoms */
303 qq10 = _mm_mul_pd(iq1,jq0);
305 /* COULOMB ELECTROSTATICS */
306 velec = _mm_mul_pd(qq10,rinv10);
307 felec = _mm_mul_pd(velec,rinvsq10);
309 /* Update potential sum for this i atom from the interaction with this j atom. */
310 velecsum = _mm_add_pd(velecsum,velec);
314 /* Update vectorial force */
315 fix1 = _mm_macc_pd(dx10,fscal,fix1);
316 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
317 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
319 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
320 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
321 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
323 /**************************
324 * CALCULATE INTERACTIONS *
325 **************************/
327 /* Compute parameters for interactions between i and j atoms */
328 qq20 = _mm_mul_pd(iq2,jq0);
330 /* COULOMB ELECTROSTATICS */
331 velec = _mm_mul_pd(qq20,rinv20);
332 felec = _mm_mul_pd(velec,rinvsq20);
334 /* Update potential sum for this i atom from the interaction with this j atom. */
335 velecsum = _mm_add_pd(velecsum,velec);
339 /* Update vectorial force */
340 fix2 = _mm_macc_pd(dx20,fscal,fix2);
341 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
342 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
344 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
345 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
346 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
348 /**************************
349 * CALCULATE INTERACTIONS *
350 **************************/
352 /* Compute parameters for interactions between i and j atoms */
353 qq30 = _mm_mul_pd(iq3,jq0);
355 /* COULOMB ELECTROSTATICS */
356 velec = _mm_mul_pd(qq30,rinv30);
357 felec = _mm_mul_pd(velec,rinvsq30);
359 /* Update potential sum for this i atom from the interaction with this j atom. */
360 velecsum = _mm_add_pd(velecsum,velec);
364 /* Update vectorial force */
365 fix3 = _mm_macc_pd(dx30,fscal,fix3);
366 fiy3 = _mm_macc_pd(dy30,fscal,fiy3);
367 fiz3 = _mm_macc_pd(dz30,fscal,fiz3);
369 fjx0 = _mm_macc_pd(dx30,fscal,fjx0);
370 fjy0 = _mm_macc_pd(dy30,fscal,fjy0);
371 fjz0 = _mm_macc_pd(dz30,fscal,fjz0);
373 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
375 /* Inner loop uses 155 flops */
382 j_coord_offsetA = DIM*jnrA;
384 /* load j atom coordinates */
385 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
388 /* Calculate displacement vector */
389 dx00 = _mm_sub_pd(ix0,jx0);
390 dy00 = _mm_sub_pd(iy0,jy0);
391 dz00 = _mm_sub_pd(iz0,jz0);
392 dx10 = _mm_sub_pd(ix1,jx0);
393 dy10 = _mm_sub_pd(iy1,jy0);
394 dz10 = _mm_sub_pd(iz1,jz0);
395 dx20 = _mm_sub_pd(ix2,jx0);
396 dy20 = _mm_sub_pd(iy2,jy0);
397 dz20 = _mm_sub_pd(iz2,jz0);
398 dx30 = _mm_sub_pd(ix3,jx0);
399 dy30 = _mm_sub_pd(iy3,jy0);
400 dz30 = _mm_sub_pd(iz3,jz0);
402 /* Calculate squared distance and things based on it */
403 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
404 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
405 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
406 rsq30 = gmx_mm_calc_rsq_pd(dx30,dy30,dz30);
408 rinv00 = gmx_mm_invsqrt_pd(rsq00);
409 rinv10 = gmx_mm_invsqrt_pd(rsq10);
410 rinv20 = gmx_mm_invsqrt_pd(rsq20);
411 rinv30 = gmx_mm_invsqrt_pd(rsq30);
413 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
414 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
415 rinvsq30 = _mm_mul_pd(rinv30,rinv30);
417 /* Load parameters for j particles */
418 jq0 = _mm_load_sd(charge+jnrA+0);
419 vdwjidx0A = 2*vdwtype[jnrA+0];
421 fjx0 = _mm_setzero_pd();
422 fjy0 = _mm_setzero_pd();
423 fjz0 = _mm_setzero_pd();
425 /**************************
426 * CALCULATE INTERACTIONS *
427 **************************/
429 r00 = _mm_mul_pd(rsq00,rinv00);
431 /* Compute parameters for interactions between i and j atoms */
432 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
434 /* Calculate table index by multiplying r with table scale and truncate to integer */
435 rt = _mm_mul_pd(r00,vftabscale);
436 vfitab = _mm_cvttpd_epi32(rt);
438 vfeps = _mm_frcz_pd(rt);
440 vfeps = _mm_sub_pd(rt,_mm_round_pd(rt, _MM_FROUND_FLOOR));
442 twovfeps = _mm_add_pd(vfeps,vfeps);
443 vfitab = _mm_slli_epi32(vfitab,3);
445 /* CUBIC SPLINE TABLE DISPERSION */
446 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
447 F = _mm_setzero_pd();
448 GMX_MM_TRANSPOSE2_PD(Y,F);
449 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
450 H = _mm_setzero_pd();
451 GMX_MM_TRANSPOSE2_PD(G,H);
452 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
453 VV = _mm_macc_pd(vfeps,Fp,Y);
454 vvdw6 = _mm_mul_pd(c6_00,VV);
455 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
456 fvdw6 = _mm_mul_pd(c6_00,FF);
458 /* CUBIC SPLINE TABLE REPULSION */
459 vfitab = _mm_add_epi32(vfitab,ifour);
460 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
461 F = _mm_setzero_pd();
462 GMX_MM_TRANSPOSE2_PD(Y,F);
463 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
464 H = _mm_setzero_pd();
465 GMX_MM_TRANSPOSE2_PD(G,H);
466 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
467 VV = _mm_macc_pd(vfeps,Fp,Y);
468 vvdw12 = _mm_mul_pd(c12_00,VV);
469 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
470 fvdw12 = _mm_mul_pd(c12_00,FF);
471 vvdw = _mm_add_pd(vvdw12,vvdw6);
472 fvdw = _mm_xor_pd(signbit,_mm_mul_pd(_mm_add_pd(fvdw6,fvdw12),_mm_mul_pd(vftabscale,rinv00)));
474 /* Update potential sum for this i atom from the interaction with this j atom. */
475 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
476 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
480 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
482 /* Update vectorial force */
483 fix0 = _mm_macc_pd(dx00,fscal,fix0);
484 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
485 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
487 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
488 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
489 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
491 /**************************
492 * CALCULATE INTERACTIONS *
493 **************************/
495 /* Compute parameters for interactions between i and j atoms */
496 qq10 = _mm_mul_pd(iq1,jq0);
498 /* COULOMB ELECTROSTATICS */
499 velec = _mm_mul_pd(qq10,rinv10);
500 felec = _mm_mul_pd(velec,rinvsq10);
502 /* Update potential sum for this i atom from the interaction with this j atom. */
503 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
504 velecsum = _mm_add_pd(velecsum,velec);
508 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
510 /* Update vectorial force */
511 fix1 = _mm_macc_pd(dx10,fscal,fix1);
512 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
513 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
515 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
516 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
517 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
519 /**************************
520 * CALCULATE INTERACTIONS *
521 **************************/
523 /* Compute parameters for interactions between i and j atoms */
524 qq20 = _mm_mul_pd(iq2,jq0);
526 /* COULOMB ELECTROSTATICS */
527 velec = _mm_mul_pd(qq20,rinv20);
528 felec = _mm_mul_pd(velec,rinvsq20);
530 /* Update potential sum for this i atom from the interaction with this j atom. */
531 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
532 velecsum = _mm_add_pd(velecsum,velec);
536 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
538 /* Update vectorial force */
539 fix2 = _mm_macc_pd(dx20,fscal,fix2);
540 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
541 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
543 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
544 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
545 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
547 /**************************
548 * CALCULATE INTERACTIONS *
549 **************************/
551 /* Compute parameters for interactions between i and j atoms */
552 qq30 = _mm_mul_pd(iq3,jq0);
554 /* COULOMB ELECTROSTATICS */
555 velec = _mm_mul_pd(qq30,rinv30);
556 felec = _mm_mul_pd(velec,rinvsq30);
558 /* Update potential sum for this i atom from the interaction with this j atom. */
559 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
560 velecsum = _mm_add_pd(velecsum,velec);
564 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
566 /* Update vectorial force */
567 fix3 = _mm_macc_pd(dx30,fscal,fix3);
568 fiy3 = _mm_macc_pd(dy30,fscal,fiy3);
569 fiz3 = _mm_macc_pd(dz30,fscal,fiz3);
571 fjx0 = _mm_macc_pd(dx30,fscal,fjx0);
572 fjy0 = _mm_macc_pd(dy30,fscal,fjy0);
573 fjz0 = _mm_macc_pd(dz30,fscal,fjz0);
575 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0);
577 /* Inner loop uses 155 flops */
580 /* End of innermost loop */
582 gmx_mm_update_iforce_4atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
583 f+i_coord_offset,fshift+i_shift_offset);
586 /* Update potential energies */
587 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
588 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
590 /* Increment number of inner iterations */
591 inneriter += j_index_end - j_index_start;
593 /* Outer loop uses 26 flops */
596 /* Increment number of outer iterations */
599 /* Update outer/inner flops */
601 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*155);
604 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW4P1_F_avx_128_fma_double
605 * Electrostatics interaction: Coulomb
606 * VdW interaction: CubicSplineTable
607 * Geometry: Water4-Particle
608 * Calculate force/pot: Force
611 nb_kernel_ElecCoul_VdwCSTab_GeomW4P1_F_avx_128_fma_double
612 (t_nblist * gmx_restrict nlist,
613 rvec * gmx_restrict xx,
614 rvec * gmx_restrict ff,
615 t_forcerec * gmx_restrict fr,
616 t_mdatoms * gmx_restrict mdatoms,
617 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
618 t_nrnb * gmx_restrict nrnb)
620 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
621 * just 0 for non-waters.
622 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
623 * jnr indices corresponding to data put in the four positions in the SIMD register.
625 int i_shift_offset,i_coord_offset,outeriter,inneriter;
626 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
628 int j_coord_offsetA,j_coord_offsetB;
629 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
631 real *shiftvec,*fshift,*x,*f;
632 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
634 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
636 __m128d ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
638 __m128d ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
640 __m128d ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
641 int vdwjidx0A,vdwjidx0B;
642 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
643 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
644 __m128d dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
645 __m128d dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
646 __m128d dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
647 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
650 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
653 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
654 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
656 __m128i ifour = _mm_set1_epi32(4);
657 __m128d rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF,twovfeps;
659 __m128d dummy_mask,cutoff_mask;
660 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
661 __m128d one = _mm_set1_pd(1.0);
662 __m128d two = _mm_set1_pd(2.0);
668 jindex = nlist->jindex;
670 shiftidx = nlist->shift;
672 shiftvec = fr->shift_vec[0];
673 fshift = fr->fshift[0];
674 facel = _mm_set1_pd(fr->epsfac);
675 charge = mdatoms->chargeA;
676 nvdwtype = fr->ntype;
678 vdwtype = mdatoms->typeA;
680 vftab = kernel_data->table_vdw->data;
681 vftabscale = _mm_set1_pd(kernel_data->table_vdw->scale);
683 /* Setup water-specific parameters */
684 inr = nlist->iinr[0];
685 iq1 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+1]));
686 iq2 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+2]));
687 iq3 = _mm_mul_pd(facel,_mm_set1_pd(charge[inr+3]));
688 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
690 /* Avoid stupid compiler warnings */
698 /* Start outer loop over neighborlists */
699 for(iidx=0; iidx<nri; iidx++)
701 /* Load shift vector for this list */
702 i_shift_offset = DIM*shiftidx[iidx];
704 /* Load limits for loop over neighbors */
705 j_index_start = jindex[iidx];
706 j_index_end = jindex[iidx+1];
708 /* Get outer coordinate index */
710 i_coord_offset = DIM*inr;
712 /* Load i particle coords and add shift vector */
713 gmx_mm_load_shift_and_4rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,
714 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
716 fix0 = _mm_setzero_pd();
717 fiy0 = _mm_setzero_pd();
718 fiz0 = _mm_setzero_pd();
719 fix1 = _mm_setzero_pd();
720 fiy1 = _mm_setzero_pd();
721 fiz1 = _mm_setzero_pd();
722 fix2 = _mm_setzero_pd();
723 fiy2 = _mm_setzero_pd();
724 fiz2 = _mm_setzero_pd();
725 fix3 = _mm_setzero_pd();
726 fiy3 = _mm_setzero_pd();
727 fiz3 = _mm_setzero_pd();
729 /* Start inner kernel loop */
730 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
733 /* Get j neighbor index, and coordinate index */
736 j_coord_offsetA = DIM*jnrA;
737 j_coord_offsetB = DIM*jnrB;
739 /* load j atom coordinates */
740 gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
743 /* Calculate displacement vector */
744 dx00 = _mm_sub_pd(ix0,jx0);
745 dy00 = _mm_sub_pd(iy0,jy0);
746 dz00 = _mm_sub_pd(iz0,jz0);
747 dx10 = _mm_sub_pd(ix1,jx0);
748 dy10 = _mm_sub_pd(iy1,jy0);
749 dz10 = _mm_sub_pd(iz1,jz0);
750 dx20 = _mm_sub_pd(ix2,jx0);
751 dy20 = _mm_sub_pd(iy2,jy0);
752 dz20 = _mm_sub_pd(iz2,jz0);
753 dx30 = _mm_sub_pd(ix3,jx0);
754 dy30 = _mm_sub_pd(iy3,jy0);
755 dz30 = _mm_sub_pd(iz3,jz0);
757 /* Calculate squared distance and things based on it */
758 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
759 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
760 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
761 rsq30 = gmx_mm_calc_rsq_pd(dx30,dy30,dz30);
763 rinv00 = gmx_mm_invsqrt_pd(rsq00);
764 rinv10 = gmx_mm_invsqrt_pd(rsq10);
765 rinv20 = gmx_mm_invsqrt_pd(rsq20);
766 rinv30 = gmx_mm_invsqrt_pd(rsq30);
768 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
769 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
770 rinvsq30 = _mm_mul_pd(rinv30,rinv30);
772 /* Load parameters for j particles */
773 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
774 vdwjidx0A = 2*vdwtype[jnrA+0];
775 vdwjidx0B = 2*vdwtype[jnrB+0];
777 fjx0 = _mm_setzero_pd();
778 fjy0 = _mm_setzero_pd();
779 fjz0 = _mm_setzero_pd();
781 /**************************
782 * CALCULATE INTERACTIONS *
783 **************************/
785 r00 = _mm_mul_pd(rsq00,rinv00);
787 /* Compute parameters for interactions between i and j atoms */
788 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
789 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
791 /* Calculate table index by multiplying r with table scale and truncate to integer */
792 rt = _mm_mul_pd(r00,vftabscale);
793 vfitab = _mm_cvttpd_epi32(rt);
795 vfeps = _mm_frcz_pd(rt);
797 vfeps = _mm_sub_pd(rt,_mm_round_pd(rt, _MM_FROUND_FLOOR));
799 twovfeps = _mm_add_pd(vfeps,vfeps);
800 vfitab = _mm_slli_epi32(vfitab,3);
802 /* CUBIC SPLINE TABLE DISPERSION */
803 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
804 F = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) );
805 GMX_MM_TRANSPOSE2_PD(Y,F);
806 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
807 H = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) +2);
808 GMX_MM_TRANSPOSE2_PD(G,H);
809 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
810 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
811 fvdw6 = _mm_mul_pd(c6_00,FF);
813 /* CUBIC SPLINE TABLE REPULSION */
814 vfitab = _mm_add_epi32(vfitab,ifour);
815 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
816 F = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) );
817 GMX_MM_TRANSPOSE2_PD(Y,F);
818 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
819 H = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,1) +2);
820 GMX_MM_TRANSPOSE2_PD(G,H);
821 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
822 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
823 fvdw12 = _mm_mul_pd(c12_00,FF);
824 fvdw = _mm_xor_pd(signbit,_mm_mul_pd(_mm_add_pd(fvdw6,fvdw12),_mm_mul_pd(vftabscale,rinv00)));
828 /* Update vectorial force */
829 fix0 = _mm_macc_pd(dx00,fscal,fix0);
830 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
831 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
833 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
834 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
835 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
837 /**************************
838 * CALCULATE INTERACTIONS *
839 **************************/
841 /* Compute parameters for interactions between i and j atoms */
842 qq10 = _mm_mul_pd(iq1,jq0);
844 /* COULOMB ELECTROSTATICS */
845 velec = _mm_mul_pd(qq10,rinv10);
846 felec = _mm_mul_pd(velec,rinvsq10);
850 /* Update vectorial force */
851 fix1 = _mm_macc_pd(dx10,fscal,fix1);
852 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
853 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
855 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
856 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
857 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
859 /**************************
860 * CALCULATE INTERACTIONS *
861 **************************/
863 /* Compute parameters for interactions between i and j atoms */
864 qq20 = _mm_mul_pd(iq2,jq0);
866 /* COULOMB ELECTROSTATICS */
867 velec = _mm_mul_pd(qq20,rinv20);
868 felec = _mm_mul_pd(velec,rinvsq20);
872 /* Update vectorial force */
873 fix2 = _mm_macc_pd(dx20,fscal,fix2);
874 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
875 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
877 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
878 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
879 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
881 /**************************
882 * CALCULATE INTERACTIONS *
883 **************************/
885 /* Compute parameters for interactions between i and j atoms */
886 qq30 = _mm_mul_pd(iq3,jq0);
888 /* COULOMB ELECTROSTATICS */
889 velec = _mm_mul_pd(qq30,rinv30);
890 felec = _mm_mul_pd(velec,rinvsq30);
894 /* Update vectorial force */
895 fix3 = _mm_macc_pd(dx30,fscal,fix3);
896 fiy3 = _mm_macc_pd(dy30,fscal,fiy3);
897 fiz3 = _mm_macc_pd(dz30,fscal,fiz3);
899 fjx0 = _mm_macc_pd(dx30,fscal,fjx0);
900 fjy0 = _mm_macc_pd(dy30,fscal,fjy0);
901 fjz0 = _mm_macc_pd(dz30,fscal,fjz0);
903 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0);
905 /* Inner loop uses 144 flops */
912 j_coord_offsetA = DIM*jnrA;
914 /* load j atom coordinates */
915 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
918 /* Calculate displacement vector */
919 dx00 = _mm_sub_pd(ix0,jx0);
920 dy00 = _mm_sub_pd(iy0,jy0);
921 dz00 = _mm_sub_pd(iz0,jz0);
922 dx10 = _mm_sub_pd(ix1,jx0);
923 dy10 = _mm_sub_pd(iy1,jy0);
924 dz10 = _mm_sub_pd(iz1,jz0);
925 dx20 = _mm_sub_pd(ix2,jx0);
926 dy20 = _mm_sub_pd(iy2,jy0);
927 dz20 = _mm_sub_pd(iz2,jz0);
928 dx30 = _mm_sub_pd(ix3,jx0);
929 dy30 = _mm_sub_pd(iy3,jy0);
930 dz30 = _mm_sub_pd(iz3,jz0);
932 /* Calculate squared distance and things based on it */
933 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
934 rsq10 = gmx_mm_calc_rsq_pd(dx10,dy10,dz10);
935 rsq20 = gmx_mm_calc_rsq_pd(dx20,dy20,dz20);
936 rsq30 = gmx_mm_calc_rsq_pd(dx30,dy30,dz30);
938 rinv00 = gmx_mm_invsqrt_pd(rsq00);
939 rinv10 = gmx_mm_invsqrt_pd(rsq10);
940 rinv20 = gmx_mm_invsqrt_pd(rsq20);
941 rinv30 = gmx_mm_invsqrt_pd(rsq30);
943 rinvsq10 = _mm_mul_pd(rinv10,rinv10);
944 rinvsq20 = _mm_mul_pd(rinv20,rinv20);
945 rinvsq30 = _mm_mul_pd(rinv30,rinv30);
947 /* Load parameters for j particles */
948 jq0 = _mm_load_sd(charge+jnrA+0);
949 vdwjidx0A = 2*vdwtype[jnrA+0];
951 fjx0 = _mm_setzero_pd();
952 fjy0 = _mm_setzero_pd();
953 fjz0 = _mm_setzero_pd();
955 /**************************
956 * CALCULATE INTERACTIONS *
957 **************************/
959 r00 = _mm_mul_pd(rsq00,rinv00);
961 /* Compute parameters for interactions between i and j atoms */
962 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
964 /* Calculate table index by multiplying r with table scale and truncate to integer */
965 rt = _mm_mul_pd(r00,vftabscale);
966 vfitab = _mm_cvttpd_epi32(rt);
968 vfeps = _mm_frcz_pd(rt);
970 vfeps = _mm_sub_pd(rt,_mm_round_pd(rt, _MM_FROUND_FLOOR));
972 twovfeps = _mm_add_pd(vfeps,vfeps);
973 vfitab = _mm_slli_epi32(vfitab,3);
975 /* CUBIC SPLINE TABLE DISPERSION */
976 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
977 F = _mm_setzero_pd();
978 GMX_MM_TRANSPOSE2_PD(Y,F);
979 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
980 H = _mm_setzero_pd();
981 GMX_MM_TRANSPOSE2_PD(G,H);
982 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
983 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
984 fvdw6 = _mm_mul_pd(c6_00,FF);
986 /* CUBIC SPLINE TABLE REPULSION */
987 vfitab = _mm_add_epi32(vfitab,ifour);
988 Y = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) );
989 F = _mm_setzero_pd();
990 GMX_MM_TRANSPOSE2_PD(Y,F);
991 G = _mm_load_pd( vftab + _mm_extract_epi32(vfitab,0) +2);
992 H = _mm_setzero_pd();
993 GMX_MM_TRANSPOSE2_PD(G,H);
994 Fp = _mm_macc_pd(vfeps,_mm_macc_pd(H,vfeps,G),F);
995 FF = _mm_macc_pd(vfeps,_mm_macc_pd(twovfeps,H,G),Fp);
996 fvdw12 = _mm_mul_pd(c12_00,FF);
997 fvdw = _mm_xor_pd(signbit,_mm_mul_pd(_mm_add_pd(fvdw6,fvdw12),_mm_mul_pd(vftabscale,rinv00)));
1001 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1003 /* Update vectorial force */
1004 fix0 = _mm_macc_pd(dx00,fscal,fix0);
1005 fiy0 = _mm_macc_pd(dy00,fscal,fiy0);
1006 fiz0 = _mm_macc_pd(dz00,fscal,fiz0);
1008 fjx0 = _mm_macc_pd(dx00,fscal,fjx0);
1009 fjy0 = _mm_macc_pd(dy00,fscal,fjy0);
1010 fjz0 = _mm_macc_pd(dz00,fscal,fjz0);
1012 /**************************
1013 * CALCULATE INTERACTIONS *
1014 **************************/
1016 /* Compute parameters for interactions between i and j atoms */
1017 qq10 = _mm_mul_pd(iq1,jq0);
1019 /* COULOMB ELECTROSTATICS */
1020 velec = _mm_mul_pd(qq10,rinv10);
1021 felec = _mm_mul_pd(velec,rinvsq10);
1025 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1027 /* Update vectorial force */
1028 fix1 = _mm_macc_pd(dx10,fscal,fix1);
1029 fiy1 = _mm_macc_pd(dy10,fscal,fiy1);
1030 fiz1 = _mm_macc_pd(dz10,fscal,fiz1);
1032 fjx0 = _mm_macc_pd(dx10,fscal,fjx0);
1033 fjy0 = _mm_macc_pd(dy10,fscal,fjy0);
1034 fjz0 = _mm_macc_pd(dz10,fscal,fjz0);
1036 /**************************
1037 * CALCULATE INTERACTIONS *
1038 **************************/
1040 /* Compute parameters for interactions between i and j atoms */
1041 qq20 = _mm_mul_pd(iq2,jq0);
1043 /* COULOMB ELECTROSTATICS */
1044 velec = _mm_mul_pd(qq20,rinv20);
1045 felec = _mm_mul_pd(velec,rinvsq20);
1049 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1051 /* Update vectorial force */
1052 fix2 = _mm_macc_pd(dx20,fscal,fix2);
1053 fiy2 = _mm_macc_pd(dy20,fscal,fiy2);
1054 fiz2 = _mm_macc_pd(dz20,fscal,fiz2);
1056 fjx0 = _mm_macc_pd(dx20,fscal,fjx0);
1057 fjy0 = _mm_macc_pd(dy20,fscal,fjy0);
1058 fjz0 = _mm_macc_pd(dz20,fscal,fjz0);
1060 /**************************
1061 * CALCULATE INTERACTIONS *
1062 **************************/
1064 /* Compute parameters for interactions between i and j atoms */
1065 qq30 = _mm_mul_pd(iq3,jq0);
1067 /* COULOMB ELECTROSTATICS */
1068 velec = _mm_mul_pd(qq30,rinv30);
1069 felec = _mm_mul_pd(velec,rinvsq30);
1073 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
1075 /* Update vectorial force */
1076 fix3 = _mm_macc_pd(dx30,fscal,fix3);
1077 fiy3 = _mm_macc_pd(dy30,fscal,fiy3);
1078 fiz3 = _mm_macc_pd(dz30,fscal,fiz3);
1080 fjx0 = _mm_macc_pd(dx30,fscal,fjx0);
1081 fjy0 = _mm_macc_pd(dy30,fscal,fjy0);
1082 fjz0 = _mm_macc_pd(dz30,fscal,fjz0);
1084 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,fjx0,fjy0,fjz0);
1086 /* Inner loop uses 144 flops */
1089 /* End of innermost loop */
1091 gmx_mm_update_iforce_4atom_swizzle_pd(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1092 f+i_coord_offset,fshift+i_shift_offset);
1094 /* Increment number of inner iterations */
1095 inneriter += j_index_end - j_index_start;
1097 /* Outer loop uses 24 flops */
1100 /* Increment number of outer iterations */
1103 /* Update outer/inner flops */
1105 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*144);