unsigned *exclusion_filter;
gmx_exclfilter filter_S0, filter_S2;
- gmx_simd_real_t zero_S = gmx_simd_set1_r(0);
+ gmx_simd_real_t zero_S = gmx_simd_set1_r(0.0);
gmx_simd_real_t one_S = gmx_simd_set1_r(1.0);
gmx_simd_real_t iq_S0 = gmx_simd_setzero_r();
gmx_simd_real_t iq_S2 = gmx_simd_setzero_r();
+
+#ifdef CALC_COUL_RF
gmx_simd_real_t mrc_3_S;
#ifdef CALC_ENERGIES
gmx_simd_real_t hrc_3_S, moh_rc_S;
#endif
+#endif
#ifdef CALC_COUL_TAB
/* Coulomb table variables */
#ifndef TAB_FDV0
const real *tab_coul_V;
#endif
- int ti0_array[2*GMX_SIMD_REAL_WIDTH], *ti0;
- int ti2_array[2*GMX_SIMD_REAL_WIDTH], *ti2;
+ /* Thread-local working buffers for force and potential lookups */
+ int ti0_array[2*GMX_SIMD_REAL_WIDTH], *ti0 = NULL;
+ int ti2_array[2*GMX_SIMD_REAL_WIDTH], *ti2 = NULL;
#ifdef CALC_ENERGIES
gmx_simd_real_t mhalfsp_S;
#endif
gmx_simd_real_t sh_ewald_S;
#endif
+#ifdef LJ_POT_SWITCH
+ gmx_simd_real_t rswitch_S;
+ gmx_simd_real_t swV3_S, swV4_S, swV5_S;
+ gmx_simd_real_t swF2_S, swF3_S, swF4_S;
+#else
+#ifdef LJ_FORCE_SWITCH
+ gmx_simd_real_t rswitch_S;
+ gmx_simd_real_t p6_fc2_S, p6_fc3_S;
+ gmx_simd_real_t p12_fc2_S, p12_fc3_S;
+#ifdef CALC_ENERGIES
+ gmx_simd_real_t p6_vc3_S, p6_vc4_S;
+ gmx_simd_real_t p12_vc3_S, p12_vc4_S;
+ gmx_simd_real_t p6_6cpot_S, p12_12cpot_S;
+#endif
+#else
+#ifdef CALC_ENERGIES
+ gmx_simd_real_t p6_cpot_S, p12_cpot_S;
+#endif
+#endif
+#endif
+
#ifdef LJ_COMB_LB
const real *ljc;
#endif
#ifdef CALC_ENERGIES
- gmx_simd_real_t sh_invrc6_S, sh_invrc12_S;
-
/* cppcheck-suppress unassignedVariable */
real tmpsum_array[2*GMX_SIMD_REAL_WIDTH], *tmpsum;
#endif
exclusion_filter = nbat->simd_exclusion_filter2;
}
- /* Here we cast the exclusion masks from unsigned * to int * or
- * real *. Since we only check bits, the actual value they
- * represent does not matter, as long as both mask and exclusion
- * info are treated the same way.
+ /* Here we cast the exclusion filters from unsigned * to int * or real *.
+ * Since we only check bits, the actual value they represent does not
+ * matter, as long as both filter and mask data are treated the same way.
*/
filter_S0 = gmx_load_exclusion_filter(exclusion_filter + 0*2*UNROLLJ*filter_stride);
filter_S2 = gmx_load_exclusion_filter(exclusion_filter + 1*2*UNROLLJ*filter_stride);
+#ifdef CALC_COUL_RF
+ /* Reaction-field constants */
+ mrc_3_S = gmx_simd_set1_r(-2*ic->k_rf);
+#ifdef CALC_ENERGIES
+ hrc_3_S = gmx_simd_set1_r(ic->k_rf);
+ moh_rc_S = gmx_simd_set1_r(-ic->c_rf);
+#endif
+#endif
+
#ifdef CALC_COUL_TAB
/* Generate aligned table index pointers */
ti0 = prepare_table_load_buffer(ti0_array);
sh_ewald_S = gmx_simd_set1_r(ic->sh_ewald);
#endif
- q = nbat->q;
- type = nbat->type;
- facel = ic->epsfac;
- shiftvec = shift_vec[0];
- x = nbat->x;
+ /* LJ function constants */
+#if defined CALC_ENERGIES || defined LJ_POT_SWITCH
+ sixth_S = gmx_simd_set1_r(1.0/6.0);
+ twelveth_S = gmx_simd_set1_r(1.0/12.0);
+#endif
- avoid_sing_S = gmx_simd_set1_r(NBNXN_AVOID_SING_R2_INC);
+#ifdef LJ_POT_SWITCH
+ rswitch_S = gmx_simd_set1_r(ic->rvdw_switch);
+ swV3_S = gmx_simd_set1_r(ic->vdw_switch.c3);
+ swV4_S = gmx_simd_set1_r(ic->vdw_switch.c4);
+ swV5_S = gmx_simd_set1_r(ic->vdw_switch.c5);
+ swF2_S = gmx_simd_set1_r(3*ic->vdw_switch.c3);
+ swF3_S = gmx_simd_set1_r(4*ic->vdw_switch.c4);
+ swF4_S = gmx_simd_set1_r(5*ic->vdw_switch.c5);
+#else
+ sixth_S = gmx_simd_set1_r(1.0/6.0);
+ twelveth_S = gmx_simd_set1_r(1.0/12.0);
+#ifdef LJ_FORCE_SWITCH
+ rswitch_S = gmx_simd_set1_r(ic->rvdw_switch);
+ p6_fc2_S = gmx_simd_set1_r(ic->dispersion_shift.c2);
+ p6_fc3_S = gmx_simd_set1_r(ic->dispersion_shift.c3);
+ p12_fc2_S = gmx_simd_set1_r(ic->repulsion_shift.c2);
+ p12_fc3_S = gmx_simd_set1_r(ic->repulsion_shift.c3);
+#ifdef CALC_ENERGIES
+ {
+ gmx_simd_real_t mthird_S = gmx_simd_set1_r(-1.0/3.0);
+ gmx_simd_real_t mfourth_S = gmx_simd_set1_r(-1.0/4.0);
+
+ p6_vc3_S = gmx_simd_mul_r(mthird_S, p6_fc2_S);
+ p6_vc4_S = gmx_simd_mul_r(mfourth_S, p6_fc3_S);
+ p6_6cpot_S = gmx_simd_set1_r(ic->dispersion_shift.cpot/6);
+ p12_vc3_S = gmx_simd_mul_r(mthird_S, p12_fc2_S);
+ p12_vc4_S = gmx_simd_mul_r(mfourth_S, p12_fc3_S);
+ p12_12cpot_S = gmx_simd_set1_r(ic->repulsion_shift.cpot/12);
+ }
+#endif
+#else
+ /* Plain LJ cut-off, with potential shift cpot, which can be 0 */
+#ifdef CALC_ENERGIES
+ p6_cpot_S = gmx_simd_set1_r(ic->dispersion_shift.cpot);
+ p12_cpot_S = gmx_simd_set1_r(ic->repulsion_shift.cpot);
+#endif
+#endif
+#endif /* LJ_POT_SWITCH */
/* The kernel either supports rcoulomb = rvdw or rcoulomb >= rvdw */
rc2_S = gmx_simd_set1_r(ic->rcoulomb*ic->rcoulomb);
rcvdw2_S = gmx_simd_set1_r(ic->rvdw*ic->rvdw);
#endif
-#ifdef CALC_ENERGIES
- sixth_S = gmx_simd_set1_r(1.0/6.0);
- twelveth_S = gmx_simd_set1_r(1.0/12.0);
-
- sh_invrc6_S = gmx_simd_set1_r(ic->sh_invrc6);
- sh_invrc12_S = gmx_simd_set1_r(ic->sh_invrc6*ic->sh_invrc6);
-#endif
-
- mrc_3_S = gmx_simd_set1_r(-2*ic->k_rf);
-
-#ifdef CALC_ENERGIES
- hrc_3_S = gmx_simd_set1_r(ic->k_rf);
+ avoid_sing_S = gmx_simd_set1_r(NBNXN_AVOID_SING_R2_INC);
- moh_rc_S = gmx_simd_set1_r(-ic->c_rf);
-#endif
+ q = nbat->q;
+ type = nbat->type;
+ facel = ic->epsfac;
+ shiftvec = shift_vec[0];
+ x = nbat->x;
#ifdef CALC_ENERGIES
tmpsum = gmx_simd_align_r(tmpsum_array);
#define CALC_LJ
if (half_LJ)
{
+ /* Coulomb: all i-atoms, LJ: first half i-atoms */
#define CALC_COULOMB
#define HALF_LJ
#define CHECK_EXCLS
}
else if (do_coul)
{
+ /* Coulomb: all i-atoms, LJ: all i-atoms */
#define CALC_COULOMB
#define CHECK_EXCLS
while (cjind < cjind1 && nbl->cj[cjind].excl != NBNXN_INTERACTION_MASK_ALL)
}
else
{
+ /* Coulomb: none, LJ: all i-atoms */
#define CHECK_EXCLS
while (cjind < cjind1 && nbl->cj[cjind].excl != NBNXN_INTERACTION_MASK_ALL)
{
/* Add accumulated i-forces to the force array */
fix_S = gmx_mm_transpose_sum4h_pr(fix_S0, fix_S2);
- gmx_store_pr4(f+scix, gmx_add_pr4(fix_S, gmx_load_pr4(f+scix)));
+ gmx_simd4_store_r(f+scix, gmx_add_pr4(fix_S, gmx_load_pr4(f+scix)));
fiy_S = gmx_mm_transpose_sum4h_pr(fiy_S0, fiy_S2);
- gmx_store_pr4(f+sciy, gmx_add_pr4(fiy_S, gmx_load_pr4(f+sciy)));
+ gmx_simd4_store_r(f+sciy, gmx_add_pr4(fiy_S, gmx_load_pr4(f+sciy)));
fiz_S = gmx_mm_transpose_sum4h_pr(fiz_S0, fiz_S2);
- gmx_store_pr4(f+sciz, gmx_add_pr4(fiz_S, gmx_load_pr4(f+sciz)));
+ gmx_simd4_store_r(f+sciz, gmx_add_pr4(fiz_S, gmx_load_pr4(f+sciz)));
#ifdef CALC_SHIFTFORCES
fshift[ish3+0] += gmx_sum_simd4(fix_S, shf);