2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS sse2_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
47 #include "gromacs/simd/math_x86_sse2_double.h"
48 #include "kernelutil_x86_sse2_double.h"
51 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_double
52 * Electrostatics interaction: ReactionField
53 * VdW interaction: LennardJones
54 * Geometry: Particle-Particle
55 * Calculate force/pot: PotentialAndForce
58 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_double
59 (t_nblist * gmx_restrict nlist,
60 rvec * gmx_restrict xx,
61 rvec * gmx_restrict ff,
62 t_forcerec * gmx_restrict fr,
63 t_mdatoms * gmx_restrict mdatoms,
64 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
65 t_nrnb * gmx_restrict nrnb)
67 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
68 * just 0 for non-waters.
69 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
70 * jnr indices corresponding to data put in the four positions in the SIMD register.
72 int i_shift_offset,i_coord_offset,outeriter,inneriter;
73 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75 int j_coord_offsetA,j_coord_offsetB;
76 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
78 real *shiftvec,*fshift,*x,*f;
79 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
81 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 int vdwjidx0A,vdwjidx0B;
83 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
84 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
85 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
88 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
91 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
92 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
93 __m128d dummy_mask,cutoff_mask;
94 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
95 __m128d one = _mm_set1_pd(1.0);
96 __m128d two = _mm_set1_pd(2.0);
102 jindex = nlist->jindex;
104 shiftidx = nlist->shift;
106 shiftvec = fr->shift_vec[0];
107 fshift = fr->fshift[0];
108 facel = _mm_set1_pd(fr->epsfac);
109 charge = mdatoms->chargeA;
110 krf = _mm_set1_pd(fr->ic->k_rf);
111 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
112 crf = _mm_set1_pd(fr->ic->c_rf);
113 nvdwtype = fr->ntype;
115 vdwtype = mdatoms->typeA;
117 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
118 rcutoff_scalar = fr->rcoulomb;
119 rcutoff = _mm_set1_pd(rcutoff_scalar);
120 rcutoff2 = _mm_mul_pd(rcutoff,rcutoff);
122 sh_vdw_invrcut6 = _mm_set1_pd(fr->ic->sh_invrc6);
123 rvdw = _mm_set1_pd(fr->rvdw);
125 /* Avoid stupid compiler warnings */
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
136 /* Load shift vector for this list */
137 i_shift_offset = DIM*shiftidx[iidx];
139 /* Load limits for loop over neighbors */
140 j_index_start = jindex[iidx];
141 j_index_end = jindex[iidx+1];
143 /* Get outer coordinate index */
145 i_coord_offset = DIM*inr;
147 /* Load i particle coords and add shift vector */
148 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
150 fix0 = _mm_setzero_pd();
151 fiy0 = _mm_setzero_pd();
152 fiz0 = _mm_setzero_pd();
154 /* Load parameters for i particles */
155 iq0 = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
156 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
158 /* Reset potential sums */
159 velecsum = _mm_setzero_pd();
160 vvdwsum = _mm_setzero_pd();
162 /* Start inner kernel loop */
163 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
166 /* Get j neighbor index, and coordinate index */
169 j_coord_offsetA = DIM*jnrA;
170 j_coord_offsetB = DIM*jnrB;
172 /* load j atom coordinates */
173 gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
176 /* Calculate displacement vector */
177 dx00 = _mm_sub_pd(ix0,jx0);
178 dy00 = _mm_sub_pd(iy0,jy0);
179 dz00 = _mm_sub_pd(iz0,jz0);
181 /* Calculate squared distance and things based on it */
182 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
184 rinv00 = gmx_mm_invsqrt_pd(rsq00);
186 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
188 /* Load parameters for j particles */
189 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
190 vdwjidx0A = 2*vdwtype[jnrA+0];
191 vdwjidx0B = 2*vdwtype[jnrB+0];
193 /**************************
194 * CALCULATE INTERACTIONS *
195 **************************/
197 if (gmx_mm_any_lt(rsq00,rcutoff2))
200 /* Compute parameters for interactions between i and j atoms */
201 qq00 = _mm_mul_pd(iq0,jq0);
202 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
203 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
205 /* REACTION-FIELD ELECTROSTATICS */
206 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_add_pd(rinv00,_mm_mul_pd(krf,rsq00)),crf));
207 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
209 /* LENNARD-JONES DISPERSION/REPULSION */
211 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
212 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
213 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
214 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) ,
215 _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
216 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
218 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
220 /* Update potential sum for this i atom from the interaction with this j atom. */
221 velec = _mm_and_pd(velec,cutoff_mask);
222 velecsum = _mm_add_pd(velecsum,velec);
223 vvdw = _mm_and_pd(vvdw,cutoff_mask);
224 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
226 fscal = _mm_add_pd(felec,fvdw);
228 fscal = _mm_and_pd(fscal,cutoff_mask);
230 /* Calculate temporary vectorial force */
231 tx = _mm_mul_pd(fscal,dx00);
232 ty = _mm_mul_pd(fscal,dy00);
233 tz = _mm_mul_pd(fscal,dz00);
235 /* Update vectorial force */
236 fix0 = _mm_add_pd(fix0,tx);
237 fiy0 = _mm_add_pd(fiy0,ty);
238 fiz0 = _mm_add_pd(fiz0,tz);
240 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
244 /* Inner loop uses 54 flops */
251 j_coord_offsetA = DIM*jnrA;
253 /* load j atom coordinates */
254 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
257 /* Calculate displacement vector */
258 dx00 = _mm_sub_pd(ix0,jx0);
259 dy00 = _mm_sub_pd(iy0,jy0);
260 dz00 = _mm_sub_pd(iz0,jz0);
262 /* Calculate squared distance and things based on it */
263 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
265 rinv00 = gmx_mm_invsqrt_pd(rsq00);
267 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
269 /* Load parameters for j particles */
270 jq0 = _mm_load_sd(charge+jnrA+0);
271 vdwjidx0A = 2*vdwtype[jnrA+0];
273 /**************************
274 * CALCULATE INTERACTIONS *
275 **************************/
277 if (gmx_mm_any_lt(rsq00,rcutoff2))
280 /* Compute parameters for interactions between i and j atoms */
281 qq00 = _mm_mul_pd(iq0,jq0);
282 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
284 /* REACTION-FIELD ELECTROSTATICS */
285 velec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_add_pd(rinv00,_mm_mul_pd(krf,rsq00)),crf));
286 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
288 /* LENNARD-JONES DISPERSION/REPULSION */
290 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
291 vvdw6 = _mm_mul_pd(c6_00,rinvsix);
292 vvdw12 = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
293 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) ,
294 _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
295 fvdw = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
297 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
299 /* Update potential sum for this i atom from the interaction with this j atom. */
300 velec = _mm_and_pd(velec,cutoff_mask);
301 velec = _mm_unpacklo_pd(velec,_mm_setzero_pd());
302 velecsum = _mm_add_pd(velecsum,velec);
303 vvdw = _mm_and_pd(vvdw,cutoff_mask);
304 vvdw = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
305 vvdwsum = _mm_add_pd(vvdwsum,vvdw);
307 fscal = _mm_add_pd(felec,fvdw);
309 fscal = _mm_and_pd(fscal,cutoff_mask);
311 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
313 /* Calculate temporary vectorial force */
314 tx = _mm_mul_pd(fscal,dx00);
315 ty = _mm_mul_pd(fscal,dy00);
316 tz = _mm_mul_pd(fscal,dz00);
318 /* Update vectorial force */
319 fix0 = _mm_add_pd(fix0,tx);
320 fiy0 = _mm_add_pd(fiy0,ty);
321 fiz0 = _mm_add_pd(fiz0,tz);
323 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
327 /* Inner loop uses 54 flops */
330 /* End of innermost loop */
332 gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
333 f+i_coord_offset,fshift+i_shift_offset);
336 /* Update potential energies */
337 gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
338 gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
340 /* Increment number of inner iterations */
341 inneriter += j_index_end - j_index_start;
343 /* Outer loop uses 9 flops */
346 /* Increment number of outer iterations */
349 /* Update outer/inner flops */
351 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*54);
354 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
355 * Electrostatics interaction: ReactionField
356 * VdW interaction: LennardJones
357 * Geometry: Particle-Particle
358 * Calculate force/pot: Force
361 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
362 (t_nblist * gmx_restrict nlist,
363 rvec * gmx_restrict xx,
364 rvec * gmx_restrict ff,
365 t_forcerec * gmx_restrict fr,
366 t_mdatoms * gmx_restrict mdatoms,
367 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
368 t_nrnb * gmx_restrict nrnb)
370 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
371 * just 0 for non-waters.
372 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
373 * jnr indices corresponding to data put in the four positions in the SIMD register.
375 int i_shift_offset,i_coord_offset,outeriter,inneriter;
376 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
378 int j_coord_offsetA,j_coord_offsetB;
379 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
381 real *shiftvec,*fshift,*x,*f;
382 __m128d tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
384 __m128d ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
385 int vdwjidx0A,vdwjidx0B;
386 __m128d jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
387 __m128d dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
388 __m128d velec,felec,velecsum,facel,crf,krf,krf2;
391 __m128d rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
394 __m128d one_sixth = _mm_set1_pd(1.0/6.0);
395 __m128d one_twelfth = _mm_set1_pd(1.0/12.0);
396 __m128d dummy_mask,cutoff_mask;
397 __m128d signbit = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
398 __m128d one = _mm_set1_pd(1.0);
399 __m128d two = _mm_set1_pd(2.0);
405 jindex = nlist->jindex;
407 shiftidx = nlist->shift;
409 shiftvec = fr->shift_vec[0];
410 fshift = fr->fshift[0];
411 facel = _mm_set1_pd(fr->epsfac);
412 charge = mdatoms->chargeA;
413 krf = _mm_set1_pd(fr->ic->k_rf);
414 krf2 = _mm_set1_pd(fr->ic->k_rf*2.0);
415 crf = _mm_set1_pd(fr->ic->c_rf);
416 nvdwtype = fr->ntype;
418 vdwtype = mdatoms->typeA;
420 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
421 rcutoff_scalar = fr->rcoulomb;
422 rcutoff = _mm_set1_pd(rcutoff_scalar);
423 rcutoff2 = _mm_mul_pd(rcutoff,rcutoff);
425 sh_vdw_invrcut6 = _mm_set1_pd(fr->ic->sh_invrc6);
426 rvdw = _mm_set1_pd(fr->rvdw);
428 /* Avoid stupid compiler warnings */
436 /* Start outer loop over neighborlists */
437 for(iidx=0; iidx<nri; iidx++)
439 /* Load shift vector for this list */
440 i_shift_offset = DIM*shiftidx[iidx];
442 /* Load limits for loop over neighbors */
443 j_index_start = jindex[iidx];
444 j_index_end = jindex[iidx+1];
446 /* Get outer coordinate index */
448 i_coord_offset = DIM*inr;
450 /* Load i particle coords and add shift vector */
451 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
453 fix0 = _mm_setzero_pd();
454 fiy0 = _mm_setzero_pd();
455 fiz0 = _mm_setzero_pd();
457 /* Load parameters for i particles */
458 iq0 = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
459 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
461 /* Start inner kernel loop */
462 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
465 /* Get j neighbor index, and coordinate index */
468 j_coord_offsetA = DIM*jnrA;
469 j_coord_offsetB = DIM*jnrB;
471 /* load j atom coordinates */
472 gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
475 /* Calculate displacement vector */
476 dx00 = _mm_sub_pd(ix0,jx0);
477 dy00 = _mm_sub_pd(iy0,jy0);
478 dz00 = _mm_sub_pd(iz0,jz0);
480 /* Calculate squared distance and things based on it */
481 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
483 rinv00 = gmx_mm_invsqrt_pd(rsq00);
485 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
487 /* Load parameters for j particles */
488 jq0 = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
489 vdwjidx0A = 2*vdwtype[jnrA+0];
490 vdwjidx0B = 2*vdwtype[jnrB+0];
492 /**************************
493 * CALCULATE INTERACTIONS *
494 **************************/
496 if (gmx_mm_any_lt(rsq00,rcutoff2))
499 /* Compute parameters for interactions between i and j atoms */
500 qq00 = _mm_mul_pd(iq0,jq0);
501 gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
502 vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
504 /* REACTION-FIELD ELECTROSTATICS */
505 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
507 /* LENNARD-JONES DISPERSION/REPULSION */
509 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
510 fvdw = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
512 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
514 fscal = _mm_add_pd(felec,fvdw);
516 fscal = _mm_and_pd(fscal,cutoff_mask);
518 /* Calculate temporary vectorial force */
519 tx = _mm_mul_pd(fscal,dx00);
520 ty = _mm_mul_pd(fscal,dy00);
521 tz = _mm_mul_pd(fscal,dz00);
523 /* Update vectorial force */
524 fix0 = _mm_add_pd(fix0,tx);
525 fiy0 = _mm_add_pd(fiy0,ty);
526 fiz0 = _mm_add_pd(fiz0,tz);
528 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
532 /* Inner loop uses 37 flops */
539 j_coord_offsetA = DIM*jnrA;
541 /* load j atom coordinates */
542 gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
545 /* Calculate displacement vector */
546 dx00 = _mm_sub_pd(ix0,jx0);
547 dy00 = _mm_sub_pd(iy0,jy0);
548 dz00 = _mm_sub_pd(iz0,jz0);
550 /* Calculate squared distance and things based on it */
551 rsq00 = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
553 rinv00 = gmx_mm_invsqrt_pd(rsq00);
555 rinvsq00 = _mm_mul_pd(rinv00,rinv00);
557 /* Load parameters for j particles */
558 jq0 = _mm_load_sd(charge+jnrA+0);
559 vdwjidx0A = 2*vdwtype[jnrA+0];
561 /**************************
562 * CALCULATE INTERACTIONS *
563 **************************/
565 if (gmx_mm_any_lt(rsq00,rcutoff2))
568 /* Compute parameters for interactions between i and j atoms */
569 qq00 = _mm_mul_pd(iq0,jq0);
570 gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
572 /* REACTION-FIELD ELECTROSTATICS */
573 felec = _mm_mul_pd(qq00,_mm_sub_pd(_mm_mul_pd(rinv00,rinvsq00),krf2));
575 /* LENNARD-JONES DISPERSION/REPULSION */
577 rinvsix = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
578 fvdw = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
580 cutoff_mask = _mm_cmplt_pd(rsq00,rcutoff2);
582 fscal = _mm_add_pd(felec,fvdw);
584 fscal = _mm_and_pd(fscal,cutoff_mask);
586 fscal = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
588 /* Calculate temporary vectorial force */
589 tx = _mm_mul_pd(fscal,dx00);
590 ty = _mm_mul_pd(fscal,dy00);
591 tz = _mm_mul_pd(fscal,dz00);
593 /* Update vectorial force */
594 fix0 = _mm_add_pd(fix0,tx);
595 fiy0 = _mm_add_pd(fiy0,ty);
596 fiz0 = _mm_add_pd(fiz0,tz);
598 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
602 /* Inner loop uses 37 flops */
605 /* End of innermost loop */
607 gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
608 f+i_coord_offset,fshift+i_shift_offset);
610 /* Increment number of inner iterations */
611 inneriter += j_index_end - j_index_start;
613 /* Outer loop uses 7 flops */
616 /* Increment number of outer iterations */
619 /* Update outer/inner flops */
621 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*37);