2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sse2_double kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_x86_sse2_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_double
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81 int vdwjidx0A,vdwjidx0B;
82 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
84 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
87 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
90 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
91 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
92 __m128d dummy_mask,cutoff_mask;
93 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
94 __m128d one = _mm_set1_pd(1.0);
95 __m128d two = _mm_set1_pd(2.0);
101 jindex = nlist->jindex;
103 shiftidx = nlist->shift;
105 shiftvec = fr->shift_vec[0];
106 fshift = fr->fshift[0];
107 facel = _mm_set1_pd(fr->ic->epsfac);
108 charge = mdatoms->chargeA;
109 krf = _mm_set1_pd(fr->ic->k_rf);
110 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
111 crf = _mm_set1_pd(fr->ic->c_rf);
112 nvdwtype = fr->ntype;
114 vdwtype = mdatoms->typeA;
116 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
117 rcutoff_scalar = fr->ic->rcoulomb;
118 rcutoff = _mm_set1_pd(rcutoff_scalar);
119 rcutoff2 = _mm_mul_pd(rcutoff,rcutoff);
121 sh_vdw_invrcut6 = _mm_set1_pd(fr->ic->sh_invrc6);
122 rvdw = _mm_set1_pd(fr->ic->rvdw);
124 /* Avoid stupid compiler warnings */
132 /* Start outer loop over neighborlists */
133 for(iidx=0; iidx<nri; iidx++)
135 /* Load shift vector for this list */
136 i_shift_offset = DIM*shiftidx[iidx];
138 /* Load limits for loop over neighbors */
139 j_index_start = jindex[iidx];
140 j_index_end = jindex[iidx+1];
142 /* Get outer coordinate index */
144 i_coord_offset = DIM*inr;
146 /* Load i particle coords and add shift vector */
147 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
149 fix0 = _mm_setzero_pd();
150 fiy0 = _mm_setzero_pd();
151 fiz0 = _mm_setzero_pd();
153 /* Load parameters for i particles */
154 iq0 = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
155 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
157 /* Reset potential sums */
158 velecsum = _mm_setzero_pd();
159 vvdwsum = _mm_setzero_pd();
161 /* Start inner kernel loop */
162 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
165 /* Get j neighbor index, and coordinate index */
168 j_coord_offsetA = DIM*jnrA;
169 j_coord_offsetB = DIM*jnrB;
171 /* load j atom coordinates */
172 gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
175 /* Calculate displacement vector */
176 dx00 = _mm_sub_pd(ix0,jx0);
177 dy00 = _mm_sub_pd(iy0,jy0);
178 dz00 = _mm_sub_pd(iz0,jz0);
180 /* Calculate squared distance and things based on it */
181 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
183 rinv00 = sse2_invsqrt_d(rsq00);
185 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
187 /* Load parameters for j particles */
188 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
189 vdwjidx0A = 2*vdwtype[jnrA+0];
190 vdwjidx0B = 2*vdwtype[jnrB+0];
192 /**************************
193 * CALCULATE INTERACTIONS *
194 **************************/
196 if (gmx_mm_any_lt(rsq00,rcutoff2))
199 /* Compute parameters for interactions between i and j atoms */
200 qq00 = _mm_mul_pd(iq0,jq0);
201 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
202 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
204 /* REACTION-FIELD ELECTROSTATICS */
205 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_add_pd(rinv00,_mm_mul_pd(krf,rsq00)),crf));
206 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
208 /* LENNARD-JONES DISPERSION/REPULSION */
210 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
211 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
212 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
213 vvdw = _mm_sub_pd(_mm_mul_pd( _mm_sub_pd(vvdw12 , _mm_mul_pd(c12_00,_mm_mul_pd(sh_vdw_invrcut6,sh_vdw_invrcut6))), one_twelfth) ,
214 _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
215 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
217 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
219 /* Update potential sum for this i atom from the interaction with this j atom. */
220 velec = _mm_and_pd(velec,cutoff_mask);
221 velecsum = _mm_add_pd(velecsum,velec);
222 vvdw = _mm_and_pd(vvdw,cutoff_mask);
223 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
225 fscal = _mm_add_pd(felec,fvdw);
227 fscal = _mm_and_pd(fscal,cutoff_mask);
229 /* Calculate temporary vectorial force */
230 tx = _mm_mul_pd(fscal,dx00);
231 ty = _mm_mul_pd(fscal,dy00);
232 tz = _mm_mul_pd(fscal,dz00);
234 /* Update vectorial force */
235 fix0 = _mm_add_pd(fix0,tx);
236 fiy0 = _mm_add_pd(fiy0,ty);
237 fiz0 = _mm_add_pd(fiz0,tz);
239 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
243 /* Inner loop uses 54 flops */
250 j_coord_offsetA = DIM*jnrA;
252 /* load j atom coordinates */
253 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
256 /* Calculate displacement vector */
257 dx00 = _mm_sub_pd(ix0,jx0);
258 dy00 = _mm_sub_pd(iy0,jy0);
259 dz00 = _mm_sub_pd(iz0,jz0);
261 /* Calculate squared distance and things based on it */
262 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
264 rinv00 = sse2_invsqrt_d(rsq00);
266 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
268 /* Load parameters for j particles */
269 jq0 = _mm_load_sd(charge+jnrA+0);
270 vdwjidx0A = 2*vdwtype[jnrA+0];
272 /**************************
273 * CALCULATE INTERACTIONS *
274 **************************/
276 if (gmx_mm_any_lt(rsq00,rcutoff2))
279 /* Compute parameters for interactions between i and j atoms */
280 qq00 = _mm_mul_pd(iq0,jq0);
281 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
283 /* REACTION-FIELD ELECTROSTATICS */
284 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_add_pd(rinv00,_mm_mul_pd(krf,rsq00)),crf));
285 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
287 /* LENNARD-JONES DISPERSION/REPULSION */
289 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
290 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
291 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
292 vvdw = _mm_sub_pd(_mm_mul_pd( _mm_sub_pd(vvdw12 , _mm_mul_pd(c12_00,_mm_mul_pd(sh_vdw_invrcut6,sh_vdw_invrcut6))), one_twelfth) ,
293 _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
294 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
296 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
298 /* Update potential sum for this i atom from the interaction with this j atom. */
299 velec = _mm_and_pd(velec,cutoff_mask);
300 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
301 velecsum = _mm_add_pd(velecsum,velec);
302 vvdw = _mm_and_pd(vvdw,cutoff_mask);
303 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
304 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
306 fscal = _mm_add_pd(felec,fvdw);
308 fscal = _mm_and_pd(fscal,cutoff_mask);
310 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
312 /* Calculate temporary vectorial force */
313 tx = _mm_mul_pd(fscal,dx00);
314 ty = _mm_mul_pd(fscal,dy00);
315 tz = _mm_mul_pd(fscal,dz00);
317 /* Update vectorial force */
318 fix0 = _mm_add_pd(fix0,tx);
319 fiy0 = _mm_add_pd(fiy0,ty);
320 fiz0 = _mm_add_pd(fiz0,tz);
322 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
326 /* Inner loop uses 54 flops */
329 /* End of innermost loop */
331 gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
332 f+i_coord_offset,fshift+i_shift_offset);
335 /* Update potential energies */
336 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
337 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
339 /* Increment number of inner iterations */
340 inneriter += j_index_end - j_index_start;
342 /* Outer loop uses 9 flops */
345 /* Increment number of outer iterations */
348 /* Update outer/inner flops */
350 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*54);
353 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
354 * Electrostatics interaction: ReactionField
355 * VdW interaction: LennardJones
356 * Geometry: Particle-Particle
357 * Calculate force/pot: Force
360 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
361 (t_nblist * gmx_restrict nlist,
362 rvec * gmx_restrict xx,
363 rvec * gmx_restrict ff,
364 struct t_forcerec * gmx_restrict fr,
365 t_mdatoms * gmx_restrict mdatoms,
366 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
367 t_nrnb * gmx_restrict nrnb)
369 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
370 * just 0 for non-waters.
371 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
372 * jnr indices corresponding to data put in the four positions in the SIMD register.
374 int i_shift_offset,i_coord_offset,outeriter,inneriter;
375 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
377 int j_coord_offsetA,j_coord_offsetB;
378 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
380 real *shiftvec,*fshift,*x,*f;
381 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
383 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
384 int vdwjidx0A,vdwjidx0B;
385 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
386 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
387 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
390 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
393 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
394 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
395 __m128d dummy_mask,cutoff_mask;
396 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
397 __m128d one = _mm_set1_pd(1.0);
398 __m128d two = _mm_set1_pd(2.0);
404 jindex = nlist->jindex;
406 shiftidx = nlist->shift;
408 shiftvec = fr->shift_vec[0];
409 fshift = fr->fshift[0];
410 facel = _mm_set1_pd(fr->ic->epsfac);
411 charge = mdatoms->chargeA;
412 krf = _mm_set1_pd(fr->ic->k_rf);
413 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
414 crf = _mm_set1_pd(fr->ic->c_rf);
415 nvdwtype = fr->ntype;
417 vdwtype = mdatoms->typeA;
419 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
420 rcutoff_scalar = fr->ic->rcoulomb;
421 rcutoff = _mm_set1_pd(rcutoff_scalar);
422 rcutoff2 = _mm_mul_pd(rcutoff,rcutoff);
424 sh_vdw_invrcut6 = _mm_set1_pd(fr->ic->sh_invrc6);
425 rvdw = _mm_set1_pd(fr->ic->rvdw);
427 /* Avoid stupid compiler warnings */
435 /* Start outer loop over neighborlists */
436 for(iidx=0; iidx<nri; iidx++)
438 /* Load shift vector for this list */
439 i_shift_offset = DIM*shiftidx[iidx];
441 /* Load limits for loop over neighbors */
442 j_index_start = jindex[iidx];
443 j_index_end = jindex[iidx+1];
445 /* Get outer coordinate index */
447 i_coord_offset = DIM*inr;
449 /* Load i particle coords and add shift vector */
450 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
452 fix0 = _mm_setzero_pd();
453 fiy0 = _mm_setzero_pd();
454 fiz0 = _mm_setzero_pd();
456 /* Load parameters for i particles */
457 iq0 = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
458 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
460 /* Start inner kernel loop */
461 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
464 /* Get j neighbor index, and coordinate index */
467 j_coord_offsetA = DIM*jnrA;
468 j_coord_offsetB = DIM*jnrB;
470 /* load j atom coordinates */
471 gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
474 /* Calculate displacement vector */
475 dx00 = _mm_sub_pd(ix0,jx0);
476 dy00 = _mm_sub_pd(iy0,jy0);
477 dz00 = _mm_sub_pd(iz0,jz0);
479 /* Calculate squared distance and things based on it */
480 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
482 rinv00 = sse2_invsqrt_d(rsq00);
484 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
486 /* Load parameters for j particles */
487 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
488 vdwjidx0A = 2*vdwtype[jnrA+0];
489 vdwjidx0B = 2*vdwtype[jnrB+0];
491 /**************************
492 * CALCULATE INTERACTIONS *
493 **************************/
495 if (gmx_mm_any_lt(rsq00,rcutoff2))
498 /* Compute parameters for interactions between i and j atoms */
499 qq00 = _mm_mul_pd(iq0,jq0);
500 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
501 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
503 /* REACTION-FIELD ELECTROSTATICS */
504 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
506 /* LENNARD-JONES DISPERSION/REPULSION */
508 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
509 fvdw = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
511 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
513 fscal = _mm_add_pd(felec,fvdw);
515 fscal = _mm_and_pd(fscal,cutoff_mask);
517 /* Calculate temporary vectorial force */
518 tx = _mm_mul_pd(fscal,dx00);
519 ty = _mm_mul_pd(fscal,dy00);
520 tz = _mm_mul_pd(fscal,dz00);
522 /* Update vectorial force */
523 fix0 = _mm_add_pd(fix0,tx);
524 fiy0 = _mm_add_pd(fiy0,ty);
525 fiz0 = _mm_add_pd(fiz0,tz);
527 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
531 /* Inner loop uses 37 flops */
538 j_coord_offsetA = DIM*jnrA;
540 /* load j atom coordinates */
541 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
544 /* Calculate displacement vector */
545 dx00 = _mm_sub_pd(ix0,jx0);
546 dy00 = _mm_sub_pd(iy0,jy0);
547 dz00 = _mm_sub_pd(iz0,jz0);
549 /* Calculate squared distance and things based on it */
550 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
552 rinv00 = sse2_invsqrt_d(rsq00);
554 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
556 /* Load parameters for j particles */
557 jq0 = _mm_load_sd(charge+jnrA+0);
558 vdwjidx0A = 2*vdwtype[jnrA+0];
560 /**************************
561 * CALCULATE INTERACTIONS *
562 **************************/
564 if (gmx_mm_any_lt(rsq00,rcutoff2))
567 /* Compute parameters for interactions between i and j atoms */
568 qq00 = _mm_mul_pd(iq0,jq0);
569 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
571 /* REACTION-FIELD ELECTROSTATICS */
572 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
574 /* LENNARD-JONES DISPERSION/REPULSION */
576 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
577 fvdw = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
579 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
581 fscal = _mm_add_pd(felec,fvdw);
583 fscal = _mm_and_pd(fscal,cutoff_mask);
585 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
587 /* Calculate temporary vectorial force */
588 tx = _mm_mul_pd(fscal,dx00);
589 ty = _mm_mul_pd(fscal,dy00);
590 tz = _mm_mul_pd(fscal,dz00);
592 /* Update vectorial force */
593 fix0 = _mm_add_pd(fix0,tx);
594 fiy0 = _mm_add_pd(fiy0,ty);
595 fiz0 = _mm_add_pd(fiz0,tz);
597 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
601 /* Inner loop uses 37 flops */
604 /* End of innermost loop */
606 gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
607 f+i_coord_offset,fshift+i_shift_offset);
609 /* Increment number of inner iterations */
610 inneriter += j_index_end - j_index_start;
612 /* Outer loop uses 7 flops */
615 /* Increment number of outer iterations */
618 /* Update outer/inner flops */
620 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*37);