7 #ifndef KNL_MAKE_DEPENDS_INCLUDE
10 #if (VDW_SWITCH_MODE == VDW_SWITCH_MODE_FORCE) || (VDW_SWITCH_MODE == VDW_SWITCH_MODE_MARTINI)
13 for (k=0; k<npairi; ++k) {
14 r2list[k] = r2list_f[k] + r2_delta;
33 #if ( FULL( EXCLUDED( SHORT( 1+ ) ) ) 0 )
39 #if __INTEL_COMPILER_BUILD_DATE == 20160721
40 #warning disabled simd pragma on innner loop due to compiler segfault
42 #pragma omp simd SHORT(FAST(reduction(+:f_i_x,f_i_y,f_i_z)) ENERGY(FAST(reduction(+:vdwEnergy) SHORT(reduction(+:electEnergy))))) \
43 FULL(reduction(+:fullf_i_x,fullf_i_y,fullf_i_z) ENERGY(reduction(+:fullElectEnergy)))
46 #pragma loop_count avg=100
48 #pragma loop_count avg=4
51 for (k=0; k<npairi; ++k) {
53 const float r2 = r2list_f[k];
54 const float r_1 = 1.f / sqrtf(r2);
55 const float r_2 = r_1 * r_1;
56 const float knl_table_r_1 =
57 r_1 > KNL_TABLE_MAX_R_1 ? KNL_TABLE_MAX_R_1 : r_1;
58 const float knl_table_f = (KNL_TABLE_FACTOR-2) * knl_table_r_1;
59 const int knl_table_i = knl_table_f;
60 const float knl_diff = knl_table_f - knl_table_i;
62 const int j = pairlisti[k];
65 #define pFlt_j (pFlt_1+j)
67 #if (VDW_SWITCH_MODE == VDW_SWITCH_MODE_FORCE) || (VDW_SWITCH_MODE == VDW_SWITCH_MODE_MARTINI)
69 int table_i = (r2iilist[2*k] >> 14) + r2_delta_expc;
71 float diffa = r2list[k] - r2_table[table_i];
73 #define table_four_i (table_four + 16*table_i)
80 #define lj_pars (lj_row+lj_index)
89 #define fullf_j (fullf_1+j)
92 float kqq = kq_i_f *
p_j->charge;
94 LES(
float lambda_pair = lambda_table_i[
p_j->partition]; )
96 register const float p_ij_x = xlist[k];
97 register const float p_ij_y = ylist[k];
98 register const float p_ij_z = zlist[k];
100 const float A = scaling_f *
lj_pars->A;
101 const float B = scaling_f *
lj_pars->B;
103 #if VDW_SWITCH_MODE == VDW_SWITCH_MODE_FORCE
104 {
int vdw_switch_mode_force; }
107 const float r_6 = r_2 * r_2 * r_2;
108 float vdwa_energy, vdwb_energy, vdwa_gradient, vdwb_gradient;
110 if ( r2 > switchOn2_f ) {
111 const float tmpa = r_6 - cutoff_6_f;
112 vdwa_energy = k_vdwa_f * tmpa * tmpa;
113 const float tmpb = r_1 * r_2 - cutoff_3_f;
114 vdwb_energy = k_vdwb_f * tmpb * tmpb;
115 vdwa_gradient = -6.f * k_vdwa_f * tmpa * r_2 * r_6;
116 vdwb_gradient = -3.f * k_vdwb_f * tmpb * r_2 * r_2 * r_1;
118 const float r_12 = r_6 * r_6;
119 vdwa_energy = r_12 + v_vdwa_f;
120 vdwb_energy = r_6 + v_vdwb_f;
121 vdwa_gradient = -6.f * r_2 * r_12;
122 vdwb_gradient = -3.f * r_2 * r_6;
124 vdw_b = -2.f * ( A * vdwa_gradient - B * vdwb_gradient );
126 vdwEnergy += A * vdwa_energy - B * vdwb_energy;
130 {
int vdw_switch_mode_martini; }
133 const float r = r2 * r_1;
134 const float r12 = (r-switchOn_f)*(r-switchOn_f);
135 const float r13 = (r-switchOn_f)*(r-switchOn_f)*(r-switchOn_f);
138 const float LJshifttempA = -(1.f/3.f)*A12_f*r13 - (1.f/4.f)*B12_f*r12*r12 - C12_f;
139 const float LJshifttempB = -(1.f/3.f)*A6_f*r13 - (1.f/4.f)*B6_f*r12*r12 - C6_f;
140 const float shiftValA = ( r > switchOn_f ? LJshifttempA : -C12_f);
141 const float shiftValB = ( r > switchOn_f ? LJshifttempB : -C6_f);
144 const float LJdshifttempA = -A12_f*r12 - B12_f*r13;
145 const float LJdshifttempB = -A6_f*r12 - B6_f*r13;
146 const float dshiftValA = ( r > switchOn_f ? LJdshifttempA*0.5f*r_1 : 0 );
147 const float dshiftValB = ( r > switchOn_f ? LJdshifttempB*0.5f*r_1 : 0 );
149 const float r_6 = r_2 * r_2 * r_2;
150 const float r_12 = r_6 * r_6;
153 const float vdwa_energy = r_12 + shiftValA;
154 const float vdwb_energy = r_6 + shiftValB;
157 const float vdwa_gradient = -6.f * r_2 * r_12 + dshiftValA ;
158 const float vdwb_gradient = -3.f * r_2 * r_6 + dshiftValB;
160 vdw_b = -2.f * ( A * vdwa_gradient - B * vdwb_gradient );
162 vdwEnergy += A * vdwa_energy - B * vdwb_energy;
166 {
int vdw_switch_mode_energy; }
169 const float r_6 = r_2 * r_2 * r_2;
170 const float r_12 = r_6 * r_6;
171 const float c2 = cutoff2_f-r2;
172 const float c4 = c2*(c3_f-2.f*c2);
173 const float switchVal =
174 ( r2 > switchOn2_f ? c2*c4*c1_f : 1.f );
175 const float dSwitchVal =
176 ( r2 > switchOn2_f ? 2.f*c1_f*(c2*c2-c4) : 0.f );
177 const float vdwa_gradient = ( dSwitchVal - 6.f * switchVal * r_2 ) * r_12;
178 const float vdwb_gradient = ( dSwitchVal - 3.f * switchVal * r_2 ) * r_6;
179 vdw_b = -2.f * ( A * vdwa_gradient - B * vdwb_gradient );
181 vdwEnergy += switchVal * ( A * r_12 - B * r_6 );
185 #error VDW_SWITCH_MODE not recognized
191 float fast_b = kqq * ( knl_fast_grad_table[knl_table_i] * (1.f-knl_diff) +
192 knl_fast_grad_table[knl_table_i+1] * knl_diff );
197 float fast_val = kqq * ( knl_fast_ener_table[knl_table_i] * (1.f-knl_diff) +
198 knl_fast_ener_table[knl_table_i+1] * knl_diff );
225 #if ( SHORT( 1+ ) 0 )
226 float slow_b = kqq * ( knl_scor_grad_table[knl_table_i] * (1.f-knl_diff) +
227 knl_scor_grad_table[knl_table_i+1] * knl_diff );
229 float slow_val = kqq * ( knl_scor_ener_table[knl_table_i] * (1.f-knl_diff) +
230 knl_scor_ener_table[knl_table_i+1] * knl_diff );
233 float slow_b = kqq * ( knl_corr_grad_table[knl_table_i] * (1.f-knl_diff) +
234 knl_corr_grad_table[knl_table_i+1] * knl_diff );
236 float slow_val = kqq * ( knl_corr_ener_table[knl_table_i] * (1.f-knl_diff) +
237 knl_corr_ener_table[knl_table_i+1] * knl_diff );
242 fullElectEnergy -=
LAM(lambda_pair *) slow_val;
249 register float slow_dir = slow_b;
250 float fullforce_r = slow_dir
LAM(* lambda_pair);
255 fullf_j->x -= ftmp_x;
258 fullf_j->y -= ftmp_y;
261 fullf_j->z -= ftmp_z;
274 #endif // KNL_MAKE_DEPENDS_INCLUDE
register BigReal fast_dir
register BigReal electEnergy
#define VDW_SWITCH_MODE_MARTINI
register const BigReal p_ij_z
register const BigReal p_ij_x
#define VDW_SWITCH_MODE_ENERGY
register const BigReal p_ij_y