2 * Note: this file was generated by the Gromacs sse2_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_sse2_double.h"
34 #include "kernelutil_x86_sse2_double.h"
37 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_double
38 * Electrostatics interaction: ReactionField
39 * VdW interaction: LennardJones
40 * Geometry: Particle-Particle
41 * Calculate force/pot: PotentialAndForce
44 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_VF_sse2_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
;
68 int vdwjidx0A
,vdwjidx0B
;
69 __m128d jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
70 __m128d dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
;
71 __m128d velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
74 __m128d rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,sh_vdw_invrcut6
;
77 __m128d one_sixth
= _mm_set1_pd(1.0/6.0);
78 __m128d one_twelfth
= _mm_set1_pd(1.0/12.0);
79 __m128d dummy_mask
,cutoff_mask
;
80 __m128d signbit
= gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
81 __m128d one
= _mm_set1_pd(1.0);
82 __m128d two
= _mm_set1_pd(2.0);
88 jindex
= nlist
->jindex
;
90 shiftidx
= nlist
->shift
;
92 shiftvec
= fr
->shift_vec
[0];
93 fshift
= fr
->fshift
[0];
94 facel
= _mm_set1_pd(fr
->epsfac
);
95 charge
= mdatoms
->chargeA
;
96 krf
= _mm_set1_pd(fr
->ic
->k_rf
);
97 krf2
= _mm_set1_pd(fr
->ic
->k_rf
*2.0);
98 crf
= _mm_set1_pd(fr
->ic
->c_rf
);
101 vdwtype
= mdatoms
->typeA
;
103 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
104 rcutoff_scalar
= fr
->rcoulomb
;
105 rcutoff
= _mm_set1_pd(rcutoff_scalar
);
106 rcutoff2
= _mm_mul_pd(rcutoff
,rcutoff
);
108 sh_vdw_invrcut6
= _mm_set1_pd(fr
->ic
->sh_invrc6
);
109 rvdw
= _mm_set1_pd(fr
->rvdw
);
111 /* Avoid stupid compiler warnings */
119 /* Start outer loop over neighborlists */
120 for(iidx
=0; iidx
<nri
; iidx
++)
122 /* Load shift vector for this list */
123 i_shift_offset
= DIM
*shiftidx
[iidx
];
125 /* Load limits for loop over neighbors */
126 j_index_start
= jindex
[iidx
];
127 j_index_end
= jindex
[iidx
+1];
129 /* Get outer coordinate index */
131 i_coord_offset
= DIM
*inr
;
133 /* Load i particle coords and add shift vector */
134 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec
+i_shift_offset
,x
+i_coord_offset
,&ix0
,&iy0
,&iz0
);
136 fix0
= _mm_setzero_pd();
137 fiy0
= _mm_setzero_pd();
138 fiz0
= _mm_setzero_pd();
140 /* Load parameters for i particles */
141 iq0
= _mm_mul_pd(facel
,_mm_load1_pd(charge
+inr
+0));
142 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
144 /* Reset potential sums */
145 velecsum
= _mm_setzero_pd();
146 vvdwsum
= _mm_setzero_pd();
148 /* Start inner kernel loop */
149 for(jidx
=j_index_start
; jidx
<j_index_end
-1; jidx
+=2)
152 /* Get j neighbor index, and coordinate index */
155 j_coord_offsetA
= DIM
*jnrA
;
156 j_coord_offsetB
= DIM
*jnrB
;
158 /* load j atom coordinates */
159 gmx_mm_load_1rvec_2ptr_swizzle_pd(x
+j_coord_offsetA
,x
+j_coord_offsetB
,
162 /* Calculate displacement vector */
163 dx00
= _mm_sub_pd(ix0
,jx0
);
164 dy00
= _mm_sub_pd(iy0
,jy0
);
165 dz00
= _mm_sub_pd(iz0
,jz0
);
167 /* Calculate squared distance and things based on it */
168 rsq00
= gmx_mm_calc_rsq_pd(dx00
,dy00
,dz00
);
170 rinv00
= gmx_mm_invsqrt_pd(rsq00
);
172 rinvsq00
= _mm_mul_pd(rinv00
,rinv00
);
174 /* Load parameters for j particles */
175 jq0
= gmx_mm_load_2real_swizzle_pd(charge
+jnrA
+0,charge
+jnrB
+0);
176 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
177 vdwjidx0B
= 2*vdwtype
[jnrB
+0];
179 /**************************
180 * CALCULATE INTERACTIONS *
181 **************************/
183 if (gmx_mm_any_lt(rsq00
,rcutoff2
))
186 /* Compute parameters for interactions between i and j atoms */
187 qq00
= _mm_mul_pd(iq0
,jq0
);
188 gmx_mm_load_2pair_swizzle_pd(vdwparam
+vdwioffset0
+vdwjidx0A
,
189 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
191 /* REACTION-FIELD ELECTROSTATICS */
192 velec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_add_pd(rinv00
,_mm_mul_pd(krf
,rsq00
)),crf
));
193 felec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_mul_pd(rinv00
,rinvsq00
),krf2
));
195 /* LENNARD-JONES DISPERSION/REPULSION */
197 rinvsix
= _mm_mul_pd(_mm_mul_pd(rinvsq00
,rinvsq00
),rinvsq00
);
198 vvdw6
= _mm_mul_pd(c6_00
,rinvsix
);
199 vvdw12
= _mm_mul_pd(c12_00
,_mm_mul_pd(rinvsix
,rinvsix
));
200 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
) ,
201 _mm_mul_pd( _mm_sub_pd(vvdw6
,_mm_mul_pd(c6_00
,sh_vdw_invrcut6
)),one_sixth
));
202 fvdw
= _mm_mul_pd(_mm_sub_pd(vvdw12
,vvdw6
),rinvsq00
);
204 cutoff_mask
= _mm_cmplt_pd(rsq00
,rcutoff2
);
206 /* Update potential sum for this i atom from the interaction with this j atom. */
207 velec
= _mm_and_pd(velec
,cutoff_mask
);
208 velecsum
= _mm_add_pd(velecsum
,velec
);
209 vvdw
= _mm_and_pd(vvdw
,cutoff_mask
);
210 vvdwsum
= _mm_add_pd(vvdwsum
,vvdw
);
212 fscal
= _mm_add_pd(felec
,fvdw
);
214 fscal
= _mm_and_pd(fscal
,cutoff_mask
);
216 /* Calculate temporary vectorial force */
217 tx
= _mm_mul_pd(fscal
,dx00
);
218 ty
= _mm_mul_pd(fscal
,dy00
);
219 tz
= _mm_mul_pd(fscal
,dz00
);
221 /* Update vectorial force */
222 fix0
= _mm_add_pd(fix0
,tx
);
223 fiy0
= _mm_add_pd(fiy0
,ty
);
224 fiz0
= _mm_add_pd(fiz0
,tz
);
226 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f
+j_coord_offsetA
,f
+j_coord_offsetB
,tx
,ty
,tz
);
230 /* Inner loop uses 54 flops */
237 j_coord_offsetA
= DIM
*jnrA
;
239 /* load j atom coordinates */
240 gmx_mm_load_1rvec_1ptr_swizzle_pd(x
+j_coord_offsetA
,
243 /* Calculate displacement vector */
244 dx00
= _mm_sub_pd(ix0
,jx0
);
245 dy00
= _mm_sub_pd(iy0
,jy0
);
246 dz00
= _mm_sub_pd(iz0
,jz0
);
248 /* Calculate squared distance and things based on it */
249 rsq00
= gmx_mm_calc_rsq_pd(dx00
,dy00
,dz00
);
251 rinv00
= gmx_mm_invsqrt_pd(rsq00
);
253 rinvsq00
= _mm_mul_pd(rinv00
,rinv00
);
255 /* Load parameters for j particles */
256 jq0
= _mm_load_sd(charge
+jnrA
+0);
257 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
259 /**************************
260 * CALCULATE INTERACTIONS *
261 **************************/
263 if (gmx_mm_any_lt(rsq00
,rcutoff2
))
266 /* Compute parameters for interactions between i and j atoms */
267 qq00
= _mm_mul_pd(iq0
,jq0
);
268 gmx_mm_load_1pair_swizzle_pd(vdwparam
+vdwioffset0
+vdwjidx0A
,&c6_00
,&c12_00
);
270 /* REACTION-FIELD ELECTROSTATICS */
271 velec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_add_pd(rinv00
,_mm_mul_pd(krf
,rsq00
)),crf
));
272 felec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_mul_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_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
) ,
280 _mm_mul_pd( _mm_sub_pd(vvdw6
,_mm_mul_pd(c6_00
,sh_vdw_invrcut6
)),one_sixth
));
281 fvdw
= _mm_mul_pd(_mm_sub_pd(vvdw12
,vvdw6
),rinvsq00
);
283 cutoff_mask
= _mm_cmplt_pd(rsq00
,rcutoff2
);
285 /* Update potential sum for this i atom from the interaction with this j atom. */
286 velec
= _mm_and_pd(velec
,cutoff_mask
);
287 velec
= _mm_unpacklo_pd(velec
,_mm_setzero_pd());
288 velecsum
= _mm_add_pd(velecsum
,velec
);
289 vvdw
= _mm_and_pd(vvdw
,cutoff_mask
);
290 vvdw
= _mm_unpacklo_pd(vvdw
,_mm_setzero_pd());
291 vvdwsum
= _mm_add_pd(vvdwsum
,vvdw
);
293 fscal
= _mm_add_pd(felec
,fvdw
);
295 fscal
= _mm_and_pd(fscal
,cutoff_mask
);
297 fscal
= _mm_unpacklo_pd(fscal
,_mm_setzero_pd());
299 /* Calculate temporary vectorial force */
300 tx
= _mm_mul_pd(fscal
,dx00
);
301 ty
= _mm_mul_pd(fscal
,dy00
);
302 tz
= _mm_mul_pd(fscal
,dz00
);
304 /* Update vectorial force */
305 fix0
= _mm_add_pd(fix0
,tx
);
306 fiy0
= _mm_add_pd(fiy0
,ty
);
307 fiz0
= _mm_add_pd(fiz0
,tz
);
309 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f
+j_coord_offsetA
,tx
,ty
,tz
);
313 /* Inner loop uses 54 flops */
316 /* End of innermost loop */
318 gmx_mm_update_iforce_1atom_swizzle_pd(fix0
,fiy0
,fiz0
,
319 f
+i_coord_offset
,fshift
+i_shift_offset
);
322 /* Update potential energies */
323 gmx_mm_update_1pot_pd(velecsum
,kernel_data
->energygrp_elec
+ggid
);
324 gmx_mm_update_1pot_pd(vvdwsum
,kernel_data
->energygrp_vdw
+ggid
);
326 /* Increment number of inner iterations */
327 inneriter
+= j_index_end
- j_index_start
;
329 /* Outer loop uses 9 flops */
332 /* Increment number of outer iterations */
335 /* Update outer/inner flops */
337 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_VF
,outeriter
*9 + inneriter
*54);
340 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
341 * Electrostatics interaction: ReactionField
342 * VdW interaction: LennardJones
343 * Geometry: Particle-Particle
344 * Calculate force/pot: Force
347 nb_kernel_ElecRFCut_VdwLJSh_GeomP1P1_F_sse2_double
348 (t_nblist
* gmx_restrict nlist
,
349 rvec
* gmx_restrict xx
,
350 rvec
* gmx_restrict ff
,
351 t_forcerec
* gmx_restrict fr
,
352 t_mdatoms
* gmx_restrict mdatoms
,
353 nb_kernel_data_t
* gmx_restrict kernel_data
,
354 t_nrnb
* gmx_restrict nrnb
)
356 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
357 * just 0 for non-waters.
358 * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
359 * jnr indices corresponding to data put in the four positions in the SIMD register.
361 int i_shift_offset
,i_coord_offset
,outeriter
,inneriter
;
362 int j_index_start
,j_index_end
,jidx
,nri
,inr
,ggid
,iidx
;
364 int j_coord_offsetA
,j_coord_offsetB
;
365 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
367 real
*shiftvec
,*fshift
,*x
,*f
;
368 __m128d tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
,jidxall
;
370 __m128d ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
371 int vdwjidx0A
,vdwjidx0B
;
372 __m128d jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
373 __m128d dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
;
374 __m128d velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
377 __m128d rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,sh_vdw_invrcut6
;
380 __m128d one_sixth
= _mm_set1_pd(1.0/6.0);
381 __m128d one_twelfth
= _mm_set1_pd(1.0/12.0);
382 __m128d dummy_mask
,cutoff_mask
;
383 __m128d signbit
= gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
384 __m128d one
= _mm_set1_pd(1.0);
385 __m128d two
= _mm_set1_pd(2.0);
391 jindex
= nlist
->jindex
;
393 shiftidx
= nlist
->shift
;
395 shiftvec
= fr
->shift_vec
[0];
396 fshift
= fr
->fshift
[0];
397 facel
= _mm_set1_pd(fr
->epsfac
);
398 charge
= mdatoms
->chargeA
;
399 krf
= _mm_set1_pd(fr
->ic
->k_rf
);
400 krf2
= _mm_set1_pd(fr
->ic
->k_rf
*2.0);
401 crf
= _mm_set1_pd(fr
->ic
->c_rf
);
402 nvdwtype
= fr
->ntype
;
404 vdwtype
= mdatoms
->typeA
;
406 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
407 rcutoff_scalar
= fr
->rcoulomb
;
408 rcutoff
= _mm_set1_pd(rcutoff_scalar
);
409 rcutoff2
= _mm_mul_pd(rcutoff
,rcutoff
);
411 sh_vdw_invrcut6
= _mm_set1_pd(fr
->ic
->sh_invrc6
);
412 rvdw
= _mm_set1_pd(fr
->rvdw
);
414 /* Avoid stupid compiler warnings */
422 /* Start outer loop over neighborlists */
423 for(iidx
=0; iidx
<nri
; iidx
++)
425 /* Load shift vector for this list */
426 i_shift_offset
= DIM
*shiftidx
[iidx
];
428 /* Load limits for loop over neighbors */
429 j_index_start
= jindex
[iidx
];
430 j_index_end
= jindex
[iidx
+1];
432 /* Get outer coordinate index */
434 i_coord_offset
= DIM
*inr
;
436 /* Load i particle coords and add shift vector */
437 gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec
+i_shift_offset
,x
+i_coord_offset
,&ix0
,&iy0
,&iz0
);
439 fix0
= _mm_setzero_pd();
440 fiy0
= _mm_setzero_pd();
441 fiz0
= _mm_setzero_pd();
443 /* Load parameters for i particles */
444 iq0
= _mm_mul_pd(facel
,_mm_load1_pd(charge
+inr
+0));
445 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
447 /* Start inner kernel loop */
448 for(jidx
=j_index_start
; jidx
<j_index_end
-1; jidx
+=2)
451 /* Get j neighbor index, and coordinate index */
454 j_coord_offsetA
= DIM
*jnrA
;
455 j_coord_offsetB
= DIM
*jnrB
;
457 /* load j atom coordinates */
458 gmx_mm_load_1rvec_2ptr_swizzle_pd(x
+j_coord_offsetA
,x
+j_coord_offsetB
,
461 /* Calculate displacement vector */
462 dx00
= _mm_sub_pd(ix0
,jx0
);
463 dy00
= _mm_sub_pd(iy0
,jy0
);
464 dz00
= _mm_sub_pd(iz0
,jz0
);
466 /* Calculate squared distance and things based on it */
467 rsq00
= gmx_mm_calc_rsq_pd(dx00
,dy00
,dz00
);
469 rinv00
= gmx_mm_invsqrt_pd(rsq00
);
471 rinvsq00
= _mm_mul_pd(rinv00
,rinv00
);
473 /* Load parameters for j particles */
474 jq0
= gmx_mm_load_2real_swizzle_pd(charge
+jnrA
+0,charge
+jnrB
+0);
475 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
476 vdwjidx0B
= 2*vdwtype
[jnrB
+0];
478 /**************************
479 * CALCULATE INTERACTIONS *
480 **************************/
482 if (gmx_mm_any_lt(rsq00
,rcutoff2
))
485 /* Compute parameters for interactions between i and j atoms */
486 qq00
= _mm_mul_pd(iq0
,jq0
);
487 gmx_mm_load_2pair_swizzle_pd(vdwparam
+vdwioffset0
+vdwjidx0A
,
488 vdwparam
+vdwioffset0
+vdwjidx0B
,&c6_00
,&c12_00
);
490 /* REACTION-FIELD ELECTROSTATICS */
491 felec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_mul_pd(rinv00
,rinvsq00
),krf2
));
493 /* LENNARD-JONES DISPERSION/REPULSION */
495 rinvsix
= _mm_mul_pd(_mm_mul_pd(rinvsq00
,rinvsq00
),rinvsq00
);
496 fvdw
= _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00
,rinvsix
),c6_00
),_mm_mul_pd(rinvsix
,rinvsq00
));
498 cutoff_mask
= _mm_cmplt_pd(rsq00
,rcutoff2
);
500 fscal
= _mm_add_pd(felec
,fvdw
);
502 fscal
= _mm_and_pd(fscal
,cutoff_mask
);
504 /* Calculate temporary vectorial force */
505 tx
= _mm_mul_pd(fscal
,dx00
);
506 ty
= _mm_mul_pd(fscal
,dy00
);
507 tz
= _mm_mul_pd(fscal
,dz00
);
509 /* Update vectorial force */
510 fix0
= _mm_add_pd(fix0
,tx
);
511 fiy0
= _mm_add_pd(fiy0
,ty
);
512 fiz0
= _mm_add_pd(fiz0
,tz
);
514 gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f
+j_coord_offsetA
,f
+j_coord_offsetB
,tx
,ty
,tz
);
518 /* Inner loop uses 37 flops */
525 j_coord_offsetA
= DIM
*jnrA
;
527 /* load j atom coordinates */
528 gmx_mm_load_1rvec_1ptr_swizzle_pd(x
+j_coord_offsetA
,
531 /* Calculate displacement vector */
532 dx00
= _mm_sub_pd(ix0
,jx0
);
533 dy00
= _mm_sub_pd(iy0
,jy0
);
534 dz00
= _mm_sub_pd(iz0
,jz0
);
536 /* Calculate squared distance and things based on it */
537 rsq00
= gmx_mm_calc_rsq_pd(dx00
,dy00
,dz00
);
539 rinv00
= gmx_mm_invsqrt_pd(rsq00
);
541 rinvsq00
= _mm_mul_pd(rinv00
,rinv00
);
543 /* Load parameters for j particles */
544 jq0
= _mm_load_sd(charge
+jnrA
+0);
545 vdwjidx0A
= 2*vdwtype
[jnrA
+0];
547 /**************************
548 * CALCULATE INTERACTIONS *
549 **************************/
551 if (gmx_mm_any_lt(rsq00
,rcutoff2
))
554 /* Compute parameters for interactions between i and j atoms */
555 qq00
= _mm_mul_pd(iq0
,jq0
);
556 gmx_mm_load_1pair_swizzle_pd(vdwparam
+vdwioffset0
+vdwjidx0A
,&c6_00
,&c12_00
);
558 /* REACTION-FIELD ELECTROSTATICS */
559 felec
= _mm_mul_pd(qq00
,_mm_sub_pd(_mm_mul_pd(rinv00
,rinvsq00
),krf2
));
561 /* LENNARD-JONES DISPERSION/REPULSION */
563 rinvsix
= _mm_mul_pd(_mm_mul_pd(rinvsq00
,rinvsq00
),rinvsq00
);
564 fvdw
= _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00
,rinvsix
),c6_00
),_mm_mul_pd(rinvsix
,rinvsq00
));
566 cutoff_mask
= _mm_cmplt_pd(rsq00
,rcutoff2
);
568 fscal
= _mm_add_pd(felec
,fvdw
);
570 fscal
= _mm_and_pd(fscal
,cutoff_mask
);
572 fscal
= _mm_unpacklo_pd(fscal
,_mm_setzero_pd());
574 /* Calculate temporary vectorial force */
575 tx
= _mm_mul_pd(fscal
,dx00
);
576 ty
= _mm_mul_pd(fscal
,dy00
);
577 tz
= _mm_mul_pd(fscal
,dz00
);
579 /* Update vectorial force */
580 fix0
= _mm_add_pd(fix0
,tx
);
581 fiy0
= _mm_add_pd(fiy0
,ty
);
582 fiz0
= _mm_add_pd(fiz0
,tz
);
584 gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f
+j_coord_offsetA
,tx
,ty
,tz
);
588 /* Inner loop uses 37 flops */
591 /* End of innermost loop */
593 gmx_mm_update_iforce_1atom_swizzle_pd(fix0
,fiy0
,fiz0
,
594 f
+i_coord_offset
,fshift
+i_shift_offset
);
596 /* Increment number of inner iterations */
597 inneriter
+= j_index_end
- j_index_start
;
599 /* Outer loop uses 7 flops */
602 /* Increment number of outer iterations */
605 /* Update outer/inner flops */
607 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_F
,outeriter
*7 + inneriter
*37);