42 #include <basic/options/option.hh>
43 #include <utility/exit.hh>
45 #include <utility/vector1.hh>
46 #include <numeric/interpolation/spline/SplineGenerator.hh>
47 #include <numeric/interpolation/spline/SimpleInterpolator.hh>
50 #include <ObjexxFCL/FArray1D.hh>
51 #include <ObjexxFCL/FArray2D.hh>
52 #include <ObjexxFCL/FArray3D.hh>
60 #include <basic/Tracer.hh>
64 #include <basic/options/keys/score.OptionKeys.gen.hh>
65 #include <basic/options/keys/corrections.OptionKeys.gen.hh>
74 using namespace ObjexxFCL;
76 static basic::Tracer
TR(
"core.scoring.etable");
85 using namespace basic::options;
86 using namespace basic::options::OptionKeys;
95 atom_set_ ( atom_set_in ),
96 n_atomtypes_ ( atom_set_in->n_atomtypes() ),
99 max_dis_ ( options.max_dis ),
100 bins_per_A2 ( options.bins_per_A2 ),
101 Wradius ( options.Wradius ),
102 lj_switch_dis2sigma ( options.lj_switch_dis2sigma ),
103 max_dis2 ( max_dis_*max_dis_ ),
104 etable_disbins ( static_cast<
int >( max_dis2 * bins_per_A2)+1),
107 lj_use_lj_deriv_slope ( true ),
108 lj_slope_intercept ( 0.0 ),
109 lj_use_hbond_radii ( true ),
110 lj_hbond_OH_donor_dis ( options.lj_hbond_OH_donor_dis ),
111 lj_hbond_dis ( 3.0 ),
112 lj_hbond_hdis ( options.lj_hbond_hdis ),
113 lj_hbond_accOch_dis ( 2.80 ),
114 lj_hbond_accOch_hdis ( 1.75 ),
115 lj_use_water_radii ( true ),
116 lj_water_dis ( 3.0 ),
117 lj_water_hdis ( 1.95 ),
118 lk_min_dis2sigma ( 0.89 ),
120 min_dis2 ( min_dis * min_dis ),
121 add_long_range_damping ( true ),
122 long_range_damping_length ( 0.5 ),
124 safe_max_dis2 ( max_dis2 - epsilon ),
125 hydrogen_interaction_cutoff2_( option[ score::fa_Hatr ] ?
128 max_non_hydrogen_lj_radius_( 0.0 ),
129 max_hydrogen_lj_radius_( 0.0 )
146 if ( ! basic::options::option[ basic::options::OptionKeys::score::analytic_etable_evaluation ] )
206 lj_radius_[i] = (*atom_set_in)[i].lj_radius();
207 lj_wdepth_[i] = (*atom_set_in)[i].lj_wdepth();
208 lk_dgfree_[i] = (*atom_set_in)[i].lk_dgfree();
209 lk_lambda_[i] = (*atom_set_in)[i].lk_lambda();
210 lk_volume_[i] = (*atom_set_in)[i].lk_volume();
211 if ( (*atom_set_in)[i].is_hydrogen() ) {
219 if ( option[ score::no_lk_polar_desolvation ] ) {
252 if ( alternate_parameter_set.size() ) {
256 param_name =
"LJ_RADIUS_"+alternate_parameter_set;
257 if ( atom_set_in->has_extra_parameter( param_name ) ) {
258 TR <<
"Using alternate parameters: " << param_name <<
" in Etable construction." << std::endl;
259 Size const index( atom_set_in->extra_parameter_index( param_name ) );
263 param_name =
"LJ_WDEPTH_"+alternate_parameter_set;
264 if ( atom_set_in->has_extra_parameter( param_name ) ) {
265 TR <<
"Using alternate parameters: " << param_name <<
" in Etable construction."<<std::endl;
266 Size const index( atom_set_in->extra_parameter_index( param_name ) );
270 param_name =
"LK_DGFREE_"+alternate_parameter_set;
271 if ( atom_set_in->has_extra_parameter( param_name ) ) {
272 TR <<
"Using alternate parameters: " << param_name <<
" in Etable construction."<<std::endl;
273 Size const index( atom_set_in->extra_parameter_index( param_name ) );
277 param_name =
"LK_LAMBDA_"+alternate_parameter_set;
278 if ( atom_set_in->has_extra_parameter( param_name ) ) {
279 TR <<
"Using alternate parameters: " << param_name <<
" in Etable construction." << std::endl;
280 Size const index( atom_set_in->extra_parameter_index( param_name ) );
284 param_name =
"LK_VOLUME_"+alternate_parameter_set;
285 if ( atom_set_in->has_extra_parameter( param_name ) ) {
286 TR <<
"Using alternate parameters: " << param_name <<
" in Etable construction." << std::endl;
287 Size const index( atom_set_in->extra_parameter_index( param_name ) );
297 Real const MAX_H_HEAVY_DISTANCE = 1.35;
299 Real max_lj_rep_for_h = std::max(
305 std::pow( 2 * MAX_H_HEAVY_DISTANCE +
max_dis_, 2 ) : max_lj_rep_for_h * max_lj_rep_for_h;
354 using namespace basic::options;
355 using namespace basic::options::OptionKeys;
373 TR <<
"Starting energy table calculation" << std::endl;
409 int const slim( basic::options::option[ basic::options::OptionKeys::score::analytic_etable_evaluation ] );
412 for (
int atype1 = 1, atype_end =
n_atomtypes_; atype1 <= atype_end; ++atype1 ) {
414 bool atype1_virtual(
atom_type(atype1).is_virtual());
415 for (
int atype2 = slim ? atype1 : 1 ; atype2 <= atype_end; ++atype2 ) {
416 bool atype2_virtual(
atom_type(atype2).is_virtual());
420 for (
int disbin = 1; disbin <= normal_disbins; ++disbin ) {
421 Real const dis2 = ( disbin - 1 ) * dis2_step;
422 if( atype1_virtual || atype2_virtual ) {
432 Real atrE,d_atrE,repE,d_repE,solvE1,solvE2,dsolvE1,dsolvE2;
438 ljatr( disbin) = atrE;
440 ljrep( disbin) = repE;
442 fasol1( disbin) = solvE1;
443 fasol2( disbin) = solvE2;
444 dfasol( disbin) = dsolvE1 + dsolvE2;
445 dfasol1(disbin) = dsolvE1;
449 if ( atype1 <= atype2 ) {
464 ljatr, dljatr, ljrep, dljrep,
465 fasol1, fasol2, dfasol, dfasol1 );
477 ljatr, dljatr, ljrep, dljrep,
478 fasol1, fasol2, dfasol, dfasol1 );
480 if( !option[ score::no_smooth_etables ] ) {
483 ljatr, dljatr, ljrep, dljrep,
484 fasol1, fasol2, dfasol, dfasol1 );
487 if ( !option[ score::fa_Hatr ]) {
490 ljrep, ljatr, dljatr,
491 fasol1, fasol2, dfasol, dfasol1 );
497 ljatr, dljatr, ljrep, dljrep,
498 fasol1, fasol2, dfasol, dfasol1 );
508 using namespace ObjexxFCL;
511 map< string, FArray3D<Real>* > etables;
512 etables[
"ljatr"] = &
ljatr_; etables[
"ljrep"] = &
ljrep_;
514 etables[
"solv1"] = &
solv1_; etables[
"solv2"] = &
solv2_;
518 if ( option[ score::input_etables ].user() ) {
519 string tag = option[ score::input_etables ];
520 TR <<
"INPUT ETABLES " << tag << std::endl;
521 for (map<
string,FArray3D<Real>*>::iterator i = etables.begin(); i != etables.end(); i++) {
522 string ename = i->first;
523 string fname = tag+
"."+ename+
".etable";
524 std::ifstream input( fname.c_str() );
530 if ( option[ score::output_etables ].user() ) {
531 string header = option[ score::output_etables ];
532 TR <<
"OUTPUT ETABLES " << header << std::endl;
533 for (map<
string,FArray3D<Real>*>::iterator i = etables.begin(); i != etables.end(); i++) {
534 string ename = i->first;
535 string fname = header+
"."+ename+
".etable";
536 TR <<
"output_etable: writing etable: " << ename <<
" to " << fname << std::endl;
537 ofstream out(fname.c_str());
543 TR <<
"Finished calculating energy tables." << std::endl;
550 Real damping_thresh_dis2;
551 int damping_disbins, normal_disbins;
556 damping_thresh_dis2 =
max_dis2 - ( dif * dif );
557 damping_disbins =
static_cast< int >( damping_thresh_dis2*
bins_per_A2 );
562 return normal_disbins;
567 int const normal_disbins,
568 ObjexxFCL::FArray1A< Real >
ljatr,
569 ObjexxFCL::FArray1A< Real >
dljatr,
570 ObjexxFCL::FArray1A< Real >
ljrep,
571 ObjexxFCL::FArray1A< Real >
dljrep,
572 ObjexxFCL::FArray1A< Real > fasol1,
573 ObjexxFCL::FArray1A< Real > fasol2,
574 ObjexxFCL::FArray1A< Real > dfasol,
575 ObjexxFCL::FArray1A< Real > dfasol1
593 Real const intercept_ljatr_damp = -dljatr_damp*
max_dis_;
594 Real const intercept_ljrep_damp = -dljrep_damp*
max_dis_;
595 Real const intercept_solv1_damp = -dsolv1_damp*
max_dis_;
596 Real const intercept_solv2_damp = -dsolv2_damp*
max_dis_;
600 for (
int disbin = normal_disbins+1; disbin <=
etable_disbins; ++disbin ) {
601 Real const dis2 = ( disbin - 1 ) * dis2_step;
602 Real const dis = std::sqrt(dis2);
604 ljatr( disbin) = intercept_ljatr_damp + dis *dljatr_damp;
605 ljrep( disbin) = intercept_ljrep_damp + dis *dljrep_damp;
606 fasol1(disbin) = intercept_solv1_damp + dis *dsolv1_damp;
607 fasol2(disbin) = intercept_solv2_damp + dis *dsolv2_damp;
609 dljatr( disbin) = dljatr_damp;
610 dljrep( disbin) = dljrep_damp;
611 dfasol( disbin) = dsolv1_damp + dsolv2_damp;
612 dfasol1(disbin) = dsolv1_damp;
621 ObjexxFCL::FArray1A< Real >
ljatr,
622 ObjexxFCL::FArray1A< Real >
dljatr,
623 ObjexxFCL::FArray1A< Real >
ljrep,
624 ObjexxFCL::FArray1A< Real >
dljrep,
625 ObjexxFCL::FArray1A< Real > fasol1,
626 ObjexxFCL::FArray1A< Real > fasol2,
627 ObjexxFCL::FArray1A< Real > dfasol,
628 ObjexxFCL::FArray1A< Real > dfasol1
631 assert(
ljatr_.size() != 0 );
643 ObjexxFCL::FArray1A< Real > ljatr_full(
ljatr_( 1, atype2, atype1 ) );
644 ObjexxFCL::FArray1A< Real > dljatr_full(
dljatr_( 1, atype2, atype1 ) );
645 ObjexxFCL::FArray1A< Real > ljrep_full(
ljrep_( 1, atype2, atype1 ) );
646 ObjexxFCL::FArray1A< Real > dljrep_full(
dljrep_( 1, atype2, atype1 ) );
647 ObjexxFCL::FArray1A< Real > fasol1_full(
solv1_( 1, atype2, atype1 ) );
648 ObjexxFCL::FArray1A< Real > fasol2_full(
solv2_( 1, atype2, atype1 ) );
649 ObjexxFCL::FArray1A< Real > dfasol_full(
dsolv_( 1, atype2, atype1 ) );
650 ObjexxFCL::FArray1A< Real > dfasol1_full(
dsolv1_( 1, atype2, atype1 ) );
666 fasol1_full = fasol1;
667 fasol2_full = fasol2;
668 dfasol_full = dfasol;
669 dfasol1_full = dfasol1;
731 ObjexxFCL::FArray1A< Real >
ljatr,
732 ObjexxFCL::FArray1A< Real >
dljatr,
733 ObjexxFCL::FArray1A< Real >
ljrep,
734 ObjexxFCL::FArray1A< Real >
dljrep,
735 ObjexxFCL::FArray1A< Real > fasol1,
736 ObjexxFCL::FArray1A< Real > fasol2,
737 ObjexxFCL::FArray1A< Real > dfasol,
738 ObjexxFCL::FArray1A< Real > dfasol1
753 bool mod_hhrep =
false;
761 TR <<
"fullatom_setup: modifying h-h repulsion "
762 <<
" hhrep center " <<
c
763 <<
" hhrep height " << h
764 <<
" hhrep width " << w
765 <<
" hhrep exponent " << e
772 if ( atype1 == OCbb_idx && atype2 == OCbb_idx ) {
774 OCbb_OCbb_exrep.
xlo = 2.1; OCbb_OCbb_exrep.
xhi = 3.6; OCbb_OCbb_exrep.
slope = 2;
783 Real const bin = ( 4.2 * 4.2 / .05 ) + 1.0;
784 int const ibin( static_cast< int >( bin ) );
786 Real const dis = std::sqrt( ( k - 1 ) * .05f );
790 bool at1iscarbon(
false), at2iscarbon(
false);
793 if ( at1iscarbon && at2iscarbon ) {
794 fasol1( k ) = fasol1( ibin );
795 fasol2( k ) = fasol2( ibin );
804 if ( atype1 == OCbb_idx && atype2 == OCbb_idx ) {
805 Real const fac = std::max( dis - 3.6, -1.5 );
808 ljrep( k ) += 2 * ( fac * fac );
842 if ( atype1 == repls_idx || atype2 == repls_idx || atype1 == hreps_idx || atype2 == hreps_idx ) {
843 Size last_rep_bin( 0 );
851 if ( last_rep_bin == 0 &&
ljrep( i ) == 0.0 ) {
874 ObjexxFCL::FArray1A< Real >
ljatr,
875 ObjexxFCL::FArray1A< Real >
dljatr,
876 ObjexxFCL::FArray1A< Real >
ljrep,
877 ObjexxFCL::FArray1A< Real >
dljrep,
878 ObjexxFCL::FArray1A< Real > fasol1,
879 ObjexxFCL::FArray1A< Real > fasol2,
880 ObjexxFCL::FArray1A< Real > dfasol,
881 ObjexxFCL::FArray1A< Real > dfasol1
884 using namespace numeric::interpolation;
885 using namespace basic::options;
886 using namespace basic::options::OptionKeys;
901 FArray1D<int> bin_of_dis(100);
902 for(
int i = 1; i <= 100; ++i) {
903 float d = ((float)i)/10.0;
907 int minima_bin_index = 0;
912 if ( atype1 == 1 && atype2 == 1 ) {
913 TR <<
"smooth_etable: changing atr/rep split to bottom of energy well" << std::endl;
920 if (
ljatr(i) < min_atr ) {
925 if ( which_min != -1 ) {
926 minima_bin_index = which_min;
940 if( min_atr < 0.0 ) {
941 for(
int i = 1; i <= which_min; ++i ) {
949 using namespace numeric::interpolation::spline;
953 if ( atype1 == 1 && atype2 == 1 ) {
954 TR <<
"smooth_etable: spline smoothing lj etables (maxdis = " <<
max_dis_ <<
")" << std::endl;
959 int start = std::max( bin_of_dis( (
int)( (
max_dis_-1.5) * 10.0) ), minima_bin_index );
975 SplineGenerator gen( lbx, lby, lbdy, ubx, uby, ubdy );
985 InterpolatorOP interp( gen.get_interpolator() );
987 interp->interpolate( dis(i),
ljatr(i),
dljatr(i) );
991 SimpleInterpolatorOP sinterp =
dynamic_cast< SimpleInterpolator *
> (interp() );
993 utility_exit_with_message(
"Etable created non-simple-interpolator in smooth_etables()" );
997 sparams.
ylo = sinterp->y()[ 1 ];
998 sparams.
yhi = sinterp->y()[ 2 ];
999 sparams.
y2lo = sinterp->ddy()[ 1 ];
1000 sparams.
y2hi = sinterp->ddy()[ 2 ];
1009 if ( atype1 == 1 && atype2 == 1 ) {
1010 TR <<
"smooth_etable: spline smoothing solvation etables (max_dis = " <<
max_dis_ <<
")" << std::endl;
1014 int const S2 = bin_of_dis( (
int)((
max_dis_-1.5)*10.0) );
1026 if( (fasol1(SWTCH) != fasol1(1)) ||
1027 (fasol2(SWTCH) != fasol2(1)) ) {
1045 int const S1 = std::max(1,SWTCH - 30);
1046 int const E1 = std::min(SWTCH + 20,406);
1049 Real dsolv1e1 = (fasol1(E1+1)-fasol1(E1 ))/(dis(E1+1)-dis(E1 ));
1050 Real dsolv1s2 = (fasol1(S2 )-fasol1(S2-1))/(dis(S2 )-dis(S2-1));
1051 Real dsolv2e1 = (fasol2(E1+1)-fasol2(E1 ))/(dis(E1+1)-dis(E1 ));
1052 Real dsolv2s2 = (fasol2(S2 )-fasol2(S2-1))/(dis(S2 )-dis(S2-1));
1054 SplineGenerator gen11( dis(S1), fasol1(S1), 0.0 , dis(E1), fasol1(E1), dsolv1e1 );
1055 SplineGenerator gen21( dis(S1), fasol2(S1), 0.0 , dis(E1), fasol2(E1), dsolv2e1 );
1056 SplineGenerator gen12( dis(S2), fasol1(S2), dsolv1s2, dis(E2), fasol1(E2), 0.0 );
1057 SplineGenerator gen22( dis(S2), fasol2(S2), dsolv2s2, dis(E2), fasol2(E2), 0.0 );
1059 InterpolatorOP interp11( gen11.get_interpolator() );
1060 InterpolatorOP interp21( gen21.get_interpolator() );
1061 for(
int i = S1; i <= E1; ++i ) {
1063 interp11->interpolate( dis(i), fasol1(i), d1 );
1064 interp21->interpolate( dis(i), fasol2(i), d2 );
1069 InterpolatorOP interp12( gen12.get_interpolator() );
1070 InterpolatorOP interp22( gen22.get_interpolator() );
1071 for(
int i = S2; i <= E2; ++i ) {
1073 interp12->interpolate( dis(i), fasol1(i), d1 );
1074 interp22->interpolate( dis(i), fasol2(i), d2 );
1082 SplineGenerator genclose( dis(S1), fasol1(S1) + fasol2(S1), 0, dis(E2), fasol1(E1)+fasol2(E1), dfasol(E1) );
1083 InterpolatorOP interp_close( genclose.get_interpolator() );
1085 SimpleInterpolatorOP sinterp_close =
dynamic_cast< SimpleInterpolator *
> (interp_close() );
1087 if ( ! sinterp_close ) {
1088 utility_exit_with_message(
"Etable created non-simple-interpolator in smooth_etables()" );
1091 sparams.
ylo = sinterp_close->y()[ 1 ];
1092 sparams.
yhi = sinterp_close->y()[ 2 ];
1093 sparams.
y2lo = sinterp_close->ddy()[ 1 ];
1094 sparams.
y2hi = sinterp_close->ddy()[ 2 ];
1105 SplineGenerator genfar( dis(S2), fasol1(S2) + fasol2(S2), dfasol(S2), dis(E2), 0.0, 0.0 );
1106 InterpolatorOP interp_far( genfar.get_interpolator() );
1108 SimpleInterpolatorOP sinterp_far =
dynamic_cast< SimpleInterpolator *
> (interp_far() );
1109 if ( ! sinterp_far ) {
1110 utility_exit_with_message(
"Etable created non-simple-interpolator in smooth_etables()" );
1113 sparams.
ylo = sinterp_far->y()[ 1 ];
1114 sparams.
yhi = sinterp_far->y()[ 2 ];
1115 sparams.
y2lo = sinterp_far->ddy()[ 1 ];
1116 sparams.
y2hi = sinterp_far->ddy()[ 2 ];
1147 ObjexxFCL::FArray3D<Real> & etable,
1151 using namespace std;
1152 using namespace ObjexxFCL;
1160 float evalue = etable(bin,at1,at2);
1161 out << evalue <<
' ';
1195 ObjexxFCL::FArray3D<Real> & etable,
1199 using namespace std;
1201 TR <<
"input_etable: reading etable... " << label << endl;
1202 istringstream intmp;
1208 in.getline(buf,100000);
1210 if( !(intmp >> lblin >> numdisbin) ) {
1211 TR <<
"input_etable: WARNING bad etable header " << buf << endl;
1215 TR <<
"input_etable: WARNING etable types don't match! "<< endl;
1217 <<
" got " << lblin <<
',' << numdisbin<< endl;
1218 utility_exit_with_message(
"input_etable: WARNING etable types don't match! " );
1220 TR <<
"input_etable expected etable " << label <<
" of size " <<
etable_disbins
1221 <<
", got " << lblin <<
',' << numdisbin<< endl;
1226 int at1,at2,count=0,scount=0;
1228 while( in.getline(buf,100000) ) {
1233 if( ! (intmp >> at1 >> at2 ) ) {
1234 TR <<
"input_etable: error reading etable line: " << buf << endl;
1236 for(
int bin = 1; bin <=numdisbin; bin++) {
1237 if( !(intmp >> evalue) ) {
1238 TR <<
"input_etable: not enough bins on etable line: " << buf << endl;
1239 utility_exit_with_message(
"input_etable: not enough bins on etable line: " );
1243 etable(bin,at1,at2) = evalue;
1244 etable(bin,at2,at1) = evalue;
1249 TR <<
" read " << scount <<
" of " << count <<
" lines" << endl;
1290 FArray2< Real > & lj_sigma,
1291 FArray2< Real > & lj_r6_coeff,
1292 FArray2< Real > & lj_r12_coeff,
1293 FArray2< Real > & lj_switch_intercept,
1294 FArray2< Real > & lj_switch_slope,
1295 FArray1< Real > & lk_inv_lambda2,
1296 FArray2< Real > & lk_coeff,
1297 FArray2< Real > & lk_min_dis2sigma_value
1307 Real sigma,sigma6,sigma12,wdepth;
1310 Real thresh_dis,inv_thresh_dis2,x_thresh;
1313 Real const inv_neg2_tms_pi_sqrt_pi = { -0.089793561062583294 };
1320 lk_inv_lambda2(i) = inv_lambda * inv_lambda;
1321 lk_coeff_tmp(i) = inv_neg2_tms_pi_sqrt_pi *
1327 for (
int j = i; j <= e; ++j ) {
1332 sigma = ( sigma < 1.0e-9 ? 1.0e-9 : sigma );
1379 sigma6 = std::pow( sigma, 6 );
1380 sigma12 = sigma6 * sigma6;
1384 lj_sigma(i,j) = sigma;
1385 lj_sigma(j,i) = lj_sigma(i,j);
1387 lj_r6_coeff(i,j) = -2. * wdepth * sigma6;
1388 lj_r6_coeff(j,i) = lj_r6_coeff(i,j);
1390 lj_r12_coeff(i,j) = wdepth * sigma12;
1391 lj_r12_coeff(j,i) = lj_r12_coeff(i,j);
1403 lj_switch_slope(i,j) = (wdepth/sigma)*
1405 lj_switch_slope(j,i) = lj_switch_slope(i,j);
1411 lj_switch_intercept(j,i) = lj_switch_intercept(i,j);
1419 lj_switch_slope(j,i) = lj_switch_slope(i,j);
1422 lj_switch_intercept(j,i) = lj_switch_intercept(i,j);
1426 lk_coeff(i,j) = lk_coeff_tmp(i) *
lk_volume(j);
1428 lk_coeff(j,i) = lk_coeff_tmp(j) *
lk_volume(i);
1436 inv_thresh_dis2 = 1./( thresh_dis * thresh_dis );
1439 x_thresh = ( dis_rad * dis_rad ) * lk_inv_lambda2(i);
1440 lk_min_dis2sigma_value(i,j) = std::exp(-x_thresh) * lk_coeff(i,j) *
1445 x_thresh = ( dis_rad * dis_rad ) * lk_inv_lambda2(j);
1446 lk_min_dis2sigma_value(j,i) = std::exp(-x_thresh) * lk_coeff(j,i) *
1523 FArray2< Real > & lj_sigma,
1524 FArray2< Real > & lj_r6_coeff,
1525 FArray2< Real > & lj_r12_coeff,
1526 FArray2< Real > & lj_switch_intercept,
1527 FArray2< Real > & lj_switch_slope,
1528 FArray1< Real > & lk_inv_lambda2,
1529 FArray2< Real > & lk_coeff,
1530 FArray2< Real > & lk_min_dis2sigma_value
1538 Real ljE,d_ljE,x1,x2;
1540 Real inv_dis,inv_dis2,inv_dis6,inv_dis7,inv_dis12,inv_dis13;
1542 int xtra_atype1,xtra_atype2;
1560 dis = std::sqrt(dis2);
1562 inv_dis2 = inv_dis * inv_dis;
1573 xtra_atype1 = atype1;
1574 xtra_atype2 = atype2;
1578 dis2sigma = dis / lj_sigma(xtra_atype1,xtra_atype2);
1584 d_ljE = lj_switch_slope(xtra_atype1,xtra_atype2);
1585 ljE = dis*d_ljE + lj_switch_intercept(xtra_atype1,xtra_atype2);
1588 inv_dis6 = inv_dis2 * inv_dis2 * inv_dis2;
1589 inv_dis7 = inv_dis6 * inv_dis;
1590 inv_dis12 = inv_dis6 * inv_dis6;
1591 inv_dis13 = inv_dis12 * inv_dis;
1593 ljE = lj_r12_coeff(xtra_atype1,xtra_atype2) * inv_dis12 +
1594 lj_r6_coeff(xtra_atype1,xtra_atype2) * inv_dis6;
1596 d_ljE = -12.*lj_r12_coeff(xtra_atype1,xtra_atype2) * inv_dis13-6. *
1597 lj_r6_coeff(xtra_atype1,xtra_atype2) * inv_dis7;
1613 solvE1 = lk_min_dis2sigma_value(xtra_atype1,xtra_atype2);
1614 solvE2 = lk_min_dis2sigma_value(xtra_atype2,xtra_atype1);
1615 dsolvE1 = dsolvE2 = 0.0;
1621 x1 = ( dis_rad * dis_rad ) * lk_inv_lambda2(atype1);
1624 x2 = ( dis_rad * dis_rad ) * lk_inv_lambda2(atype2);
1626 solvE1 = std::exp(-x1) * lk_coeff(atype1,atype2) * inv_dis2;
1627 solvE2 = std::exp(-x2) * lk_coeff(atype2,atype1) * inv_dis2;
1630 dsolvE1 = -2.0 * solvE1 *
1631 (((dis-
lj_radius(atype1))*lk_inv_lambda2(atype1))+inv_dis);
1633 dsolvE2 = -2.0 * solvE2 *
1634 (((dis-
lj_radius(atype2))*lk_inv_lambda2(atype2))+inv_dis);
1646 ObjexxFCL::FArray1A< Real >
ljrep,
1647 ObjexxFCL::FArray1A< Real >
ljatr,
1648 ObjexxFCL::FArray1A< Real >
dljatr,
1649 ObjexxFCL::FArray1A< Real > fasol1,
1650 ObjexxFCL::FArray1A< Real > fasol2,
1651 ObjexxFCL::FArray1A< Real > dfasol,
1652 ObjexxFCL::FArray1A< Real > dfasol1
1664 if ( atype1 == HOH || atype2 == HOH ||
atom_type(atype1).is_hydrogen() ||
atom_type(atype2).is_hydrogen() ) {
1669 Size first_zero_ljrep = 0;
1673 fasol1(i) = fasol2(i) = dfasol(i) = dfasol1(i) = 0.0;
1674 if ( first_zero_ljrep == 0 &&
ljrep(i) == 0.0 ) {
1675 first_zero_ljrep = i;
1715 Real ljatrE_lo, ljrepE_lo, fasolE_lo;
1716 Real ljatrE_hi, ljrepE_hi, fasolE_hi;
1718 dis2 = at1.
xyz().distance_squared( at2.
xyz() );
1724 at2_lo.xyz(
Vector( std::sqrt( dis2lo ), 0, 0 ));
1725 at2_hi.
xyz(
Vector( std::sqrt( dis2hi ), 0, 0 ));
1730 Real alpha = (dis2*bins_per_A2 - dis2bin);
1733 lj_atrE = alpha * ljatrE_hi + (1-alpha) * ljatrE_lo;
1734 lj_repE = alpha * ljrepE_hi + (1-alpha) * ljrepE_lo;
1735 fa_solE = alpha * fasolE_hi + (1-alpha) * fasolE_lo;