28 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
33 extern void send_build_mic_force_table();
64 BigReal* ComputeNonbondedUtil::mic_table_base_ptr;
65 int ComputeNonbondedUtil::mic_table_n;
66 int ComputeNonbondedUtil::mic_table_n_16;
69 int ComputeNonbondedUtil::avxTilesMode;
70 float* ComputeNonbondedUtil::avx_tiles_eps4_sigma = 0;
71 float* ComputeNonbondedUtil::avx_tiles_eps4_sigma_14 = 0;
73 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
74 float* ComputeNonbondedUtil::knl_table_alloc;
75 float* ComputeNonbondedUtil::knl_fast_ener_table;
76 float* ComputeNonbondedUtil::knl_fast_grad_table;
77 float* ComputeNonbondedUtil::knl_scor_ener_table;
78 float* ComputeNonbondedUtil::knl_scor_grad_table;
79 float* ComputeNonbondedUtil::knl_slow_ener_table;
80 float* ComputeNonbondedUtil::knl_slow_grad_table;
81 float* ComputeNonbondedUtil::knl_excl_ener_table;
82 float* ComputeNonbondedUtil::knl_excl_grad_table;
84 float* ComputeNonbondedUtil::knl_corr_ener_table;
85 float* ComputeNonbondedUtil::knl_corr_grad_table;
180 #define SPLIT_SHIFT 2
182 #define SPLIT_XPLOR 4
184 #define SPLIT_MARTINI 6
211 ADD_TENSOR(reduction,REDUCTION_VIRIAL_NBOND,data,virialIndex);
212 ADD_TENSOR(reduction,REDUCTION_VIRIAL_SLOW,data,fullElectVirialIndex);
213 ADD_VECTOR(reduction,REDUCTION_PAIR_VDW_FORCE,data,pairVDWForceIndex);
214 ADD_VECTOR(reduction,REDUCTION_PAIR_ELECT_FORCE,data,pairElectForceIndex);
221 if (!reduction)
return;
227 size_t nelems = arraysize*(numAtomTypes*(numAtomTypes+1))/2;
229 memset(arr, 0, nelems*
sizeof(
BigReal));
232 for (i=0; i<numAtomTypes; i++) {
233 for (j=0; j<numAtomTypes; j++) {
236 if (ii > jj) {
int tmp=ii; ii=jj; jj=tmp; }
237 const int reductionOffset = (ii*numAtomTypes - (ii*(ii+1))/2 + jj)*arraysize;
238 for (
int k=0; k<arraysize; k++) {
239 arr[reductionOffset+k] += data[k];
245 reduction->
add(nelems, arr);
250 NAMD_bug(
"Tried to call missing nonbonded compute routine.");
255 if ( CkMyRank() )
return;
322 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
323 NAMD_die(
"drudeNbthole is not supported in CUDA version");
326 NAMD_die(
"drudeNbthole is not supported with locally enhanced sampling");
328 NAMD_die(
"drudeNbthole is not supported with pair interaction calculation");
330 NAMD_die(
"drudeNbthole is not supported with pressure profile calculation");
334 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
335 NAMD_die(
"Alchemical free-energy perturbation is not supported in CUDA version");
354 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
355 NAMD_die(
"Alchemical thermodynamic integration is not supported in CUDA version");
373 }
else if (
lesOn ) {
374 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
375 NAMD_die(
"Locally enhanced sampling is not supported in CUDA version");
384 if (ip && jp && ip != jp) {
410 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
411 NAMD_die(
"Pressure profile calculation is not supported in CUDA version");
433 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
434 NAMD_die(
"Pair interaction calculation is not supported in CUDA version");
442 }
else if ( tabulatedEnergies ) {
443 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
444 NAMD_die(
"Tabulated energies is not supported in CUDA version");
464 NAMD_die(
"Go forces is not supported in CUDA version");
529 double cutoff3 = cutoff *
cutoff2;
530 double switchOn6 = switchOn3 * switchOn3;
531 double cutoff6 = cutoff3 * cutoff3;
542 BigReal A6 = p6 * ((p6+1)*switchOn-(p6+4)*
cutoff)/(pow(cutoff,p6+2)*pow(cutoff-switchOn,2));
543 BigReal B6 = -p6 * ((p6+1)*switchOn-(p6+3)*
cutoff)/(pow(cutoff,p6+2)*pow(cutoff-switchOn,3));
544 BigReal C6 = 1.0/pow(cutoff,p6)-A6/3.0*pow(cutoff-switchOn,3)-B6/4.0*pow(cutoff-switchOn,4);
547 BigReal A12 = p12 * ((p12+1)*switchOn-(p12+4)*
cutoff)/(pow(cutoff,p12+2)*pow(cutoff-switchOn,2));
548 BigReal B12 = -p12 * ((p12+1)*switchOn-(p12+3)*
cutoff)/(pow(cutoff,p12+2)*pow(cutoff-switchOn,3));
549 BigReal C12 = 1.0/pow(cutoff,p12)-A12/3.0*pow(cutoff-switchOn,3)-B12/4.0*pow(cutoff-switchOn,4);
573 const int PMEOn = simParams->
PMEOn;
574 const int MSMOn = simParams->
MSMOn;
575 const int MSMSplit = simParams->
MSMSplit;
579 BigReal TwoBySqrtPi = 1.12837916709551;
598 NAMD_die(
"Sorry, XPLOR splitting not supported.");
602 NAMD_die(
"Sorry, SHARP splitting not supported.");
606 NAMD_die(
"Unknown splitting type found!");
619 iout <<
iINFO <<
"NONBONDED TABLE R-SQUARED SPACING: " <<
625 while ( (
cutoff2 +
r2_delta) > r2_tmp ) { r2_tmp *= 2.0; cutoff2_exp += 1; }
630 #if defined(NAMD_MIC)
631 int n_16 = (n + 15) & (~15);
635 iout <<
iINFO <<
"NONBONDED TABLE SIZE: " <<
636 n <<
" POINTS\n" <<
endi;
640 #if defined(NAMD_MIC)
643 while ( ((
long)table_align) % 128 ) ++table_align;
644 mic_table_base_ptr = table_align;
646 mic_table_n_16 = n_16;
660 while ( ((
long)table_align) % 128 ) ++table_align;
695 if (avxTilesMode == 1) {
698 for (
int i = 0; i < table_dim; i++)
699 for (
int j = i+1; j < table_dim; j++)
703 if (avxTilesMode > 1)
704 iout <<
iINFO <<
"AVX-512 TILES WILL USE SHORT-RANGE INTERPOLATION ("
705 << avxTilesMode <<
")\n";
709 if ( avx_tiles_eps4_sigma )
delete [] avx_tiles_eps4_sigma;
710 if ( avx_tiles_eps4_sigma_14 )
delete [] avx_tiles_eps4_sigma_14;
711 avx_tiles_eps4_sigma =
new float[num_params*2];
712 avx_tiles_eps4_sigma_14 =
new float[num_params*2];
713 for (
int i = 0; i < num_params; i++) {
714 Real sigma, sigma_14, epsilon, epsilon_14;
717 avx_tiles_eps4_sigma[i*2] = 4.0 *
scaling * epsilon;
718 avx_tiles_eps4_sigma[i*2 + 1] = sigma;
719 avx_tiles_eps4_sigma_14[i*2] = 4.0 *
scaling * epsilon_14;
720 avx_tiles_eps4_sigma_14[i*2 + 1] = sigma_14;
726 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
727 if ( knl_table_alloc )
delete [] knl_table_alloc;
728 if ( KNL_TABLE_MAX_R_1 < 1.f || KNL_TABLE_FACTOR < 1 ||
730 static_cast<int>(1.0 / KNL_TABLE_MAX_R_1 * KNL_TABLE_SIZE))
731 NAMD_bug(
"Inconsistent KNL preprocessor settings.");
733 knl_table_alloc =
new float[10*KNL_TABLE_SIZE];
735 knl_table_alloc =
new float[8*KNL_TABLE_SIZE];
737 knl_fast_ener_table = knl_table_alloc;
738 knl_fast_grad_table = knl_table_alloc + KNL_TABLE_SIZE;
739 knl_scor_ener_table = knl_table_alloc + 2*KNL_TABLE_SIZE;
740 knl_scor_grad_table = knl_table_alloc + 3*KNL_TABLE_SIZE;
741 knl_slow_ener_table = knl_table_alloc + 4*KNL_TABLE_SIZE;
742 knl_slow_grad_table = knl_table_alloc + 5*KNL_TABLE_SIZE;
743 knl_excl_ener_table = knl_table_alloc + 6*KNL_TABLE_SIZE;
744 knl_excl_grad_table = knl_table_alloc + 7*KNL_TABLE_SIZE;
745 knl_fast_ener_table[0] = 0.;
746 knl_fast_grad_table[0] = 0.;
747 knl_scor_ener_table[0] = 0.;
748 knl_scor_grad_table[0] = 0.;
749 knl_slow_ener_table[0] = 0.;
750 knl_slow_grad_table[0] = 0.;
751 knl_excl_ener_table[0] = 0.;
752 knl_excl_grad_table[0] = 0.;
754 knl_corr_ener_table = knl_table_alloc + 8*KNL_TABLE_SIZE;
755 knl_corr_grad_table = knl_table_alloc + 9*KNL_TABLE_SIZE;
756 knl_corr_ener_table[0] = 0.;
757 knl_corr_grad_table[0] = 0.;
759 for (
int knl_table = 0; knl_table < 2; ++knl_table ) {
762 nn = KNL_TABLE_SIZE-1;
764 for ( i=1; i<nn; ++i ) {
767 for ( i=1; i<n; ++i ) {
771 const BigReal r2_del = r2_base / 64.0;
776 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
778 r = (double)(KNL_TABLE_FACTOR-2)/(double)(i);
782 if ( r2 <= r2_limit ) r2_delta_i = i;
795 BigReal fast_energy, fast_gradient;
796 BigReal scor_energy, scor_gradient;
797 BigReal slow_energy, slow_gradient;
802 BigReal corr_energy, corr_gradient;
809 corr_gradient =
pi_ewaldcof*exp(-(tmp_a*tmp_a))*r + tmp_b;
810 }
else if ( MSMOn ) {
814 SPOLY(&g, &dg, r_a, MSMSplit);
815 corr_energy = 1 - r_a * g;
816 corr_gradient = 1 + r_a*r_a * dg;
818 corr_energy = corr_gradient = 0;
824 fast_gradient = -1.0/r2;
825 scor_energy = scor_gradient = 0;
826 slow_energy = slow_gradient = 0;
830 shiftVal *= shiftVal;
832 fast_energy = shiftVal/r;
833 fast_gradient = dShiftVal/r - shiftVal/r2;
834 scor_energy = scor_gradient = 0;
835 slow_energy = slow_gradient = 0;
840 const BigReal COUL_SWITCH = 0.;
843 BigReal A1 = p1 * ((p1+1)*COUL_SWITCH-(p1+4)*
cutoff)/(pow(cutoff,p1+2)*pow(cutoff-COUL_SWITCH,2));
844 BigReal B1 = -p1 * ((p1+1)*COUL_SWITCH-(p1+3)*
cutoff)/(pow(cutoff,p1+2)*pow(cutoff-COUL_SWITCH,3));
845 BigReal X1 = 1.0/pow(cutoff,p1)-A1/3.0*pow(cutoff-COUL_SWITCH,3)-B1/4.0*pow(cutoff-COUL_SWITCH,4);
846 BigReal r12 = (r-COUL_SWITCH)*(r-COUL_SWITCH);
847 BigReal r13 = (r-COUL_SWITCH)*(r-COUL_SWITCH)*(r-COUL_SWITCH);
848 BigReal shiftVal = -(A1/3.0)*r13 - (B1/4.0)*r12*r12 - X1;
849 BigReal dShiftVal = -A1*r12 - B1*r13;
850 fast_energy = (1/r) + shiftVal;
851 fast_gradient = -1/(r2) + dShiftVal;
852 scor_energy = scor_gradient = 0;
853 slow_energy = slow_gradient = 0;
858 slow_energy = 0.5/cutoff * (3.0 - (r2/
cutoff2));
861 scor_energy = slow_energy + (corr_energy - 1.0)/r;
862 scor_gradient = slow_gradient - (corr_gradient - 1.0)/r2;
864 fast_energy = 1.0/r - slow_energy;
865 fast_gradient = -1.0/r2 - slow_gradient;
874 - 15.0*(r/
cutoff) + 10.0);
876 - 45.0 *(r/
cutoff) + 20.0);
878 scor_energy = slow_energy + (corr_energy - 1.0)/r;
879 scor_gradient = slow_gradient - (corr_gradient - 1.0)/r2;
881 fast_energy = 1.0/r - slow_energy;
882 fast_gradient = -1.0/r2 - slow_gradient;
889 fast_gradient *= 0.5 * r_1;
890 scor_gradient *= 0.5 * r_1;
891 slow_gradient *= 0.5 * r_1;
897 BigReal vdwa_energy, vdwa_gradient;
898 BigReal vdwb_energy, vdwb_gradient;
900 const BigReal r_6 = r_2*r_2*r_2;
910 vdwa_energy =
k_vdwa * tmpa * tmpa;
912 vdwb_energy =
k_vdwb * tmpb * tmpb;
913 vdwa_gradient = -6.0 *
k_vdwa * tmpa * r_2 * r_6;
914 vdwb_gradient = -3.0 *
k_vdwb * tmpb * r_2 * r_2 * r_1;
916 vdwa_energy = r_12 +
v_vdwa;
917 vdwb_energy = r_6 +
v_vdwb;
918 vdwa_gradient = -6.0 * r_2 * r_12;
919 vdwb_gradient = -3.0 * r_2 * r_6;
936 BigReal LJshifttempA = -(A12/3)*r13 - (B12/4)*r12*r12 - C12;
937 BigReal LJshifttempB = -(A6/3)*r13 - (B6/4)*r12*r12 - C6;
943 BigReal LJdshifttempA = -A12*r12 - B12*r13;
944 BigReal LJdshifttempB = -A6*r12 - B6*r13;
946 ( r2 >
switchOn2 ? LJdshifttempA*0.5*r_1 : 0 );
948 ( r2 >
switchOn2 ? LJdshifttempB*0.5*r_1 : 0 );
958 vdwa_energy = r_12 + shiftValA;
959 vdwb_energy = r_6 + shiftValB;
961 vdwa_gradient = -6/pow(r,14) + dshiftValA ;
962 vdwb_gradient = -3/pow(r,8) + dshiftValB;
974 vdwa_energy = switchVal * r_12;
975 vdwb_energy = switchVal * r_6;
977 vdwa_gradient = ( dSwitchVal - 6.0 * switchVal * r_2 ) * r_12;
978 vdwb_gradient = ( dSwitchVal - 3.0 * switchVal * r_2 ) * r_6;
982 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
984 knl_fast_ener_table[i] = -1.*fast_energy;
985 knl_fast_grad_table[i] = -2.*fast_gradient;
986 knl_scor_ener_table[i] = -1.*scor_energy;
987 knl_scor_grad_table[i] = -2.*scor_gradient;
988 knl_slow_ener_table[i] = (-1.*scor_energy - (
scale14-1)*slow_energy) /
990 knl_slow_grad_table[i] = (-2.*scor_gradient -
992 knl_excl_ener_table[i] = slow_energy - scor_energy;
993 knl_excl_grad_table[i] = 2.*(slow_gradient - scor_gradient);
995 knl_corr_ener_table[i] = -1.*(fast_energy + scor_energy);
996 knl_corr_grad_table[i] = -2.*(fast_gradient + scor_gradient);
999 knl_fast_ener_table[nn] = knl_fast_ener_table[i];
1000 knl_fast_grad_table[nn] = knl_fast_grad_table[i];
1001 knl_scor_ener_table[nn] = knl_scor_ener_table[i];
1002 knl_scor_grad_table[nn] = knl_scor_grad_table[i];
1003 knl_slow_ener_table[nn] = knl_slow_ener_table[i];
1004 knl_slow_grad_table[nn] = knl_slow_grad_table[i];
1005 knl_excl_ener_table[nn] = knl_excl_ener_table[i];
1006 knl_excl_grad_table[nn] = knl_excl_grad_table[i];
1008 knl_corr_ener_table[nn] = knl_corr_ener_table[i];
1009 knl_corr_grad_table[nn] = knl_corr_grad_table[i];
1014 *(fast_i++) = fast_energy;
1015 *(fast_i++) = fast_gradient;
1018 *(scor_i++) = scor_energy;
1019 *(scor_i++) = scor_gradient;
1022 *(slow_i++) = slow_energy;
1023 *(slow_i++) = slow_gradient;
1026 *(vdwa_i++) = vdwa_energy;
1027 *(vdwa_i++) = vdwa_gradient;
1030 *(vdwb_i++) = vdwb_energy;
1031 *(vdwb_i++) = vdwb_gradient;
1035 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
1040 #if defined(NAMD_KNL) || defined(NAMD_AVXTILES)
1044 if ( ! r2_delta_i ) {
1045 NAMD_bug(
"Failed to find table entry for r2 == r2_limit\n");
1048 NAMD_bug(
"Found bad table entry for r2 == r2_limit\n");
1052 const char *table_name =
"XXXX";
1053 int smooth_short = 0;
1054 for ( j=0; j<5; ++j ) {
1059 table_name =
"FAST";
1064 table_name =
"SCOR";
1069 table_name =
"SLOW";
1074 table_name =
"VDWA";
1079 table_name =
"VDWB";
1084 t0[0] = t0[4] - t0[5] * (
r2_delta / 64.0 );
1088 if ( smooth_short ) {
1089 BigReal energy0 = t0[4*r2_delta_i];
1090 BigReal gradient0 = t0[4*r2_delta_i+1];
1092 t0[0] = energy0 - gradient0 * (r20 -
r2_table[0]);
1096 for ( i=0,t=t0; i<(n-1); ++i,t+=4 ) {
1099 NAMD_bug(
"Bad table delta calculation.\n");
1101 if ( smooth_short && i+1 < r2_delta_i ) {
1102 BigReal energy0 = t0[4*r2_delta_i];
1103 BigReal gradient0 = t0[4*r2_delta_i+1];
1105 t[4] = energy0 - gradient0 * (r20 -
r2_table[i+1]);
1113 BigReal c = ( 3.0 * (v2 - v1) - x * (2.0 * g1 + g2) ) / ( x * x );
1114 BigReal d = ( -2.0 * (v2 - v1) + x * (g1 + g2) ) / ( x * x * x );
1117 for (
int k=0; k < 2; ++k ) {
1118 BigReal dv = (v1 - v2) + ( ( d * x + c ) * x + g1 ) * x;
1119 BigReal dg = (g1 - g2) + ( 3.0 * d * x + 2.0 * c ) *
x;
1120 c -= ( 3.0 * dv - x * dg ) / ( x * x );
1121 d -= ( -2.0 * dv + x * dg ) / ( x * x * x );
1149 for ( i=0,t=t0; i<(n-1); ++i,t+=4 ) {
1151 const BigReal r2_del = r2_base / 64.0;
1154 if ( r > cutoff )
break;
1156 BigReal dv = ( ( t[3] * x + t[2] ) * x + t[1] ) * x + t[0] - t[4];
1157 BigReal dg = ( 3.0 * t[3] * x + 2.0 * t[2] ) * x + t[1] - t[5];
1158 if ( t[4] != 0. && fabs(dv/t[4]) > fdvmax ) {
1159 fdvmax = fabs(dv/t[4]); fdvmax_r = r;
1161 if ( fabs(dv) > dvmax ) {
1162 dvmax = fabs(dv); dvmax_r = r;
1164 if ( t[5] != 0. && fabs(dg/t[5]) > fdgmax ) {
1165 fdgmax = fabs(dg/t[5]); fdgmax_r = r;
1167 if ( fabs(dg) > dgmax ) {
1168 dgmax = fabs(dg); dgmax_r = r;
1170 BigReal gcd = (t[4] - t[0]) / x;
1171 BigReal gcd_prec = (fabs(t[0]) + fabs(t[4])) * 1.e-15 / x;
1172 gcm = 0.9 * gcm + 0.1 * fabs(t[5]);
1173 BigReal gca = 0.5 * (t[1] + t[5]);
1174 BigReal gci = ( 0.75 * t[3] * x + t[2] ) * x + t[1];
1175 BigReal rc = sqrt(r2 + 0.5 * x);
1177 if ( dgcda != 0. && fabs(dgcda) < gcd_prec ) {
1182 if ( dgcdi != 0. && fabs(dgcdi) < gcd_prec ) {
1187 if ( t[1]*t[5] > 0. && gcm != 0. && fabs(dgcda/gcm) > fdgcdamax ) {
1188 fdgcdamax = fabs(dgcda/gcm); fdgcdamax_r = rc;
1190 if ( fabs(dgcda) > fdgcdamax ) {
1191 dgcdamax = fabs(dgcda); dgcdamax_r = rc;
1193 if ( t[1]*t[5] > 0. && gcm != 0. && fabs(dgcdi/gcm) > fdgcdimax ) {
1194 fdgcdimax = fabs(dgcdi/gcm); fdgcdimax_r = rc;
1196 if ( fabs(dgcdi) > fdgcdimax ) {
1197 dgcdimax = fabs(dgcdi); dgcdimax_r = rc;
1199 if ( t[1]*t[5] > 0. && gcm != 0. && fabs(dgcai/gcm) > fdgcaimax ) {
1200 fdgcaimax = fabs(dgcai/gcm); fdgcaimax_r = rc;
1202 if ( fabs(dgcai) > fdgcaimax ) {
1203 dgcaimax = fabs(dgcai); dgcaimax_r = rc;
1206 CkPrintf(
"TABLE %s %g %g %g %g\n",table_name,rc,dgcda/gcm,dgcda,gci);
1207 if (dv != 0.) CkPrintf(
"TABLE %d ENERGY ERROR %g AT %g (%d)\n",j,dv,r,i);
1208 if (dg != 0.) CkPrintf(
"TABLE %d FORCE ERROR %g AT %g (%d)\n",j,dg,r,i);
1211 if ( dvmax != 0.0 ) {
1212 iout <<
iINFO <<
"ABSOLUTE IMPRECISION IN " << table_name <<
1213 " TABLE ENERGY: " << dvmax <<
" AT " << dvmax_r <<
"\n" <<
endi;
1215 if ( fdvmax != 0.0 ) {
1216 iout <<
iINFO <<
"RELATIVE IMPRECISION IN " << table_name <<
1217 " TABLE ENERGY: " << fdvmax <<
" AT " << fdvmax_r <<
"\n" <<
endi;
1219 if ( dgmax != 0.0 ) {
1220 iout <<
iINFO <<
"ABSOLUTE IMPRECISION IN " << table_name <<
1221 " TABLE FORCE: " << dgmax <<
" AT " << dgmax_r <<
"\n" <<
endi;
1223 if ( fdgmax != 0.0 ) {
1224 iout <<
iINFO <<
"RELATIVE IMPRECISION IN " << table_name <<
1225 " TABLE FORCE: " << fdgmax <<
" AT " << fdgmax_r <<
"\n" <<
endi;
1227 if (fdgcdamax != 0.0 ) {
1228 iout <<
iINFO <<
"INCONSISTENCY IN " << table_name <<
1229 " TABLE ENERGY VS FORCE: " << fdgcdamax <<
" AT " << fdgcdamax_r <<
"\n" <<
endi;
1230 if ( fdgcdamax > 0.1 ) {
1232 iout << iERROR <<
"CALCULATED " << table_name <<
1233 " FORCE MAY NOT MATCH ENERGY! POSSIBLE BUG!\n";
1234 iout << iERROR <<
"\n";
1237 if (0 && fdgcdimax != 0.0 ) {
1238 iout <<
iINFO <<
"INCONSISTENCY IN " << table_name <<
1239 " TABLE ENERGY VS FORCE: " << fdgcdimax <<
" AT " << fdgcdimax_r <<
"\n" <<
endi;
1241 if ( 0 && fdgcaimax != 0.0 ) {
1242 iout <<
iINFO <<
"INCONSISTENCY IN " << table_name <<
1243 " TABLE AVG VS INT FORCE: " << fdgcaimax <<
" AT " << fdgcaimax_r <<
"\n" <<
endi;
1249 for ( i=0; i<4*n; ++i ) {
1255 for ( i=0; i<n; ++i ) {
1256 for (
int j=0; j<4; ++j ) {
1267 for ( i=0; i<n; ++i ) {
1301 sprintf(fname,
"/tmp/namd.table.pe%d.dat",CkMyPe());
1302 FILE *f = fopen(fname,
"w");
1303 for ( i=0; i<(n-1); ++i ) {
1305 const BigReal r2_del = r2_base / 64.0;
1311 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1313 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1315 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1317 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1319 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1321 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1323 fprintf(f,
" %g %g %g %g", t[0], t[1], t[2], t[3]);
1330 for ( i=0; i<n; ++i ) {
1331 BigReal tmp0, tmp1, tmp2, tmp3;
1343 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
1350 send_build_mic_force_table();
static void calc_pair_fullelect_pprof(nonbonded *)
static BigReal * fast_table
static int pressureProfileSlabs
static void calc_pair_energy_merge_fullelect_tabener(nonbonded *)
static void calc_self_energy_go(nonbonded *)
std::ostream & iINFO(std::ostream &s)
static void calc_self_energy_merge_fullelect_ti(nonbonded *)
static BigReal * scor_table
static void calc_pair_les(nonbonded *)
static void calc_self_energy_slow_fullelect_fep(nonbonded *)
static void calc_pair_merge_fullelect(nonbonded *)
static void calc_self_energy_merge_fullelect_int(nonbonded *)
static void calc_self_energy_slow_fullelect(nonbonded *)
static void calc_self_energy_merge_fullelect_tabener(nonbonded *)
static void calc_self_energy_slow_fullelect_ti(nonbonded *)
static void calc_self_energy_fullelect_int(nonbonded *)
static void submitReductionData(BigReal *, SubmitReduction *)
static void calc_self_ti(nonbonded *)
static void calc_self_fullelect_pprof(nonbonded *)
static void calc_self_tabener(nonbonded *)
static void calc_self_energy_fullelect(nonbonded *)
static void calc_pair_slow_fullelect_ti(nonbonded *)
static void(* calcSelf)(nonbonded *)
static BigReal dielectric_1
#define ADD_TENSOR(R, RL, D, DL)
static __global__ void(const patch_pair *patch_pairs, const atom *atoms, const atom_param *atom_params, const int *vdw_types, unsigned int *plist, float4 *tmpforces, float4 *slow_tmpforces, float4 *forces, float4 *slow_forces, float *tmpvirials, float *slow_tmpvirials, float *virials, float *slow_virials, unsigned int *global_counters, int *force_ready_queue, const unsigned int *overflow_exclusions, const int npatches, const int block_begin, const int total_block_count, int *block_order, exclmask *exclmasks, const int lj_table_size, const float3 lata, const float3 latb, const float3 latc, const float cutoff2, const float plcutoff2, const int doSlow)
static void calc_pair_merge_fullelect_tabener(nonbonded *)
static void calc_self_les(nonbonded *)
SimParameters * simParameters
static void calc_pair_merge_fullelect_go(nonbonded *)
static void calc_pair_energy_merge_fullelect(nonbonded *)
static void calc_pair_slow_fullelect_pprof(nonbonded *)
static const Molecule * mol
static void calc_pair_energy_fullelect_fep(nonbonded *)
static void calc_self_energy_fullelect_pprof(nonbonded *)
static void calc_self_energy_fullelect_les(nonbonded *)
static void calc_self_energy_fullelect_ti(nonbonded *)
std::ostream & endi(std::ostream &s)
static void calc_self_fullelect(nonbonded *)
#define VDW_SWITCH_MODE_MARTINI
static void calc_self_energy_ti(nonbonded *)
static BigReal * vdwa_table
static void calc_self_energy_int(nonbonded *)
static void submitPressureProfileData(BigReal *, SubmitReduction *)
static BigReal pressureProfileThickness
int get_table_dim() const
static void calc_pair_slow_fullelect(nonbonded *)
static void calc_pair(nonbonded *)
static BigReal r2_delta_1
static void calc_self_go(nonbonded *)
static void(* calcMergePair)(nonbonded *)
static void calc_pair_energy_tabener(nonbonded *)
static void calc_self_slow_fullelect_pprof(nonbonded *)
static void calc_pair_energy_slow_fullelect_go(nonbonded *)
static void calc_self_energy_merge_fullelect_fep(nonbonded *)
static int pressureProfileAtomTypes
static Bool alchThermIntOn
static void(* calcMergePairEnergy)(nonbonded *)
static BigReal lesScaling
static void calc_pair_energy_go(nonbonded *)
static void calc_pair_merge_fullelect_ti(nonbonded *)
static BigReal * full_table
static void calc_pair_merge_fullelect_les(nonbonded *)
static void calc_pair_slow_fullelect_go(nonbonded *)
static int vdw_switch_mode
static void calc_pair_energy_merge_fullelect_fep(nonbonded *)
static BigReal * r2_table
static void(* calcSlowPairEnergy)(nonbonded *)
void send_build_cuda_force_table()
static void(* calcPair)(nonbonded *)
void add(int nitems, const BigReal *arr)
static void(* calcSlowPair)(nonbonded *)
static void calc_pair_energy_fullelect_go(nonbonded *)
static void calc_pair_energy_slow_fullelect_tabener(nonbonded *)
static void calc_self_slow_fullelect(nonbonded *)
static void calc_self_energy_les(nonbonded *)
static void calc_pair_energy_fep(nonbonded *)
static void(* calcMergeSelfEnergy)(nonbonded *)
static void calc_pair_tabener(nonbonded *)
static Bool pairInteractionSelf
static void calc_pair_energy_pprof(nonbonded *)
static BigReal * table_noshort
static void calc_self_energy_slow_fullelect_tabener(nonbonded *)
void NAMD_bug(const char *err_msg)
static void calc_self_energy_fullelect_tabener(nonbonded *)
static void calc_pair_energy_int(nonbonded *)
static BigReal pressureProfileMin
static void calc_self_slow_fullelect_tabener(nonbonded *)
static void calc_pair_energy_slow_fullelect_les(nonbonded *)
static void calc_pair_energy_ti(nonbonded *)
static void calc_pair_energy_slow_fullelect_fep(nonbonded *)
static void calc_self_slow_fullelect_ti(nonbonded *)
static void calc_pair_slow_fullelect_les(nonbonded *)
static void calc_pair_fullelect_ti(nonbonded *)
static void calc_pair_energy(nonbonded *)
static BigReal * table_ener
static void calc_pair_pprof(nonbonded *)
#define ADD_VECTOR(R, RL, D, DL)
static void calc_pair_energy_fullelect_ti(nonbonded *)
static void calc_self_energy_merge_fullelect_les(nonbonded *)
static void calc_self_slow_fullelect_go(nonbonded *)
static void calc_pair_energy_merge_fullelect_go(nonbonded *)
static Bool pressureProfileOn
static void calc_error(nonbonded *)
static void calc_self_energy_fullelect_go(nonbonded *)
BigReal PMEEwaldCoefficient
int get_vdw_pair_params(Index ind1, Index ind2, Real *, Real *, Real *, Real *)
static void calc_self_fullelect_tabener(nonbonded *)
static void(* calcFullSelf)(nonbonded *)
void NAMD_die(const char *err_msg)
static void calc_self_merge_fullelect_ti(nonbonded *)
static void(* calcSlowSelf)(nonbonded *)
static void calc_self_fullelect_les(nonbonded *)
static void calc_self_merge_fullelect_go(nonbonded *)
int get_num_vdw_params(void)
static BigReal switchOn_1
static Bool vdwForceSwitching
static void calc_self_energy_merge_fullelect_go(nonbonded *)
static void calc_self_energy_merge_fullelect(nonbonded *)
static void calc_pair_energy_fullelect_int(nonbonded *)
static void calc_pair_energy_merge_fullelect_pprof(nonbonded *)
static BigReal * lambda_table
static void calc_self_energy_fep(nonbonded *)
static BigReal pi_ewaldcof
static void(* calcSlowSelfEnergy)(nonbonded *)
static void calc_pair_energy_slow_fullelect_pprof(nonbonded *)
static BigReal * slow_table
static void(* calcSelfEnergy)(nonbonded *)
static void(* calcPairEnergy)(nonbonded *)
static void calc_pair_fullelect_les(nonbonded *)
static void calc_pair_energy_les(nonbonded *)
int pressureProfileAtomTypes
static void calc_self_merge_fullelect(nonbonded *)
static void calc_self_energy_tabener(nonbonded *)
static void calc_pair_energy_merge_fullelect_int(nonbonded *)
static void calc_self_energy_slow_fullelect_pprof(nonbonded *)
static void calc_self_energy_pprof(nonbonded *)
static Bool pairInteractionOn
static void calc_pair_energy_fullelect_pprof(nonbonded *)
static void calc_pair_fullelect_go(nonbonded *)
static void calc_pair_energy_slow_fullelect(nonbonded *)
static void calc_pair_energy_fullelect_les(nonbonded *)
static BigReal * vdwb_table
static void calc_pair_energy_fullelect_tabener(nonbonded *)
static void(* calcFullPair)(nonbonded *)
#define VDW_SWITCH_MODE_FORCE
static void calc_pair_merge_fullelect_pprof(nonbonded *)
static const LJTable * ljTable
static void calc_self_energy_merge_fullelect_pprof(nonbonded *)
#define VDW_SWITCH_MODE_ENERGY
static void(* calcFullPairEnergy)(nonbonded *)
static BigReal * corr_table
static BigReal * table_short
static void calc_self(nonbonded *)
#define SPOLY(pg, pdg, ra, split)
static void calc_self_fullelect_ti(nonbonded *)
static void calc_pair_fullelect_tabener(nonbonded *)
static void calc_pair_energy_merge_fullelect_ti(nonbonded *)
std::ostream & iERROR(std::ostream &s)
static BigReal * table_alloc
static void calc_self_energy_fullelect_fep(nonbonded *)
static void calc_self_merge_fullelect_tabener(nonbonded *)
static BigReal alchVdwShiftCoeff
static void calc_pair_go(nonbonded *)
static void calc_pair_ti(nonbonded *)
ExclusionSettings exclude
static void calc_self_energy(nonbonded *)
void get_vdw_params(Real *sigma, Real *epsilon, Real *sigma14, Real *epsilon14, Index index)
static void calc_self_fullelect_go(nonbonded *)
static void calc_pair_energy_merge_fullelect_les(nonbonded *)
static void calc_self_pprof(nonbonded *)
static void calc_self_merge_fullelect_les(nonbonded *)
static void calc_pair_slow_fullelect_tabener(nonbonded *)
static void calc_pair_energy_fullelect(nonbonded *)
static void calc_self_merge_fullelect_pprof(nonbonded *)
static void calc_self_energy_slow_fullelect_go(nonbonded *)
static void calc_pair_energy_slow_fullelect_ti(nonbonded *)
static void(* calcMergeSelf)(nonbonded *)
static void calc_self_energy_slow_fullelect_les(nonbonded *)
static void(* calcFullSelfEnergy)(nonbonded *)
BigReal alchVdwShiftCoeff
static void calc_pair_fullelect(nonbonded *)
static void calc_self_slow_fullelect_les(nonbonded *)