41 #include <basic/prof.hh>
42 #include <basic/datacache/BasicDataCache.hh>
43 #include <basic/options/option.hh>
44 #include <basic/options/keys/in.OptionKeys.gen.hh>
45 #include <basic/options/keys/score.OptionKeys.gen.hh>
46 #include <basic/Tracer.hh>
49 #include <utility/exit.hh>
54 static basic::Tracer
TR(
"core.scoring.FACTSPotential");
58 # define Math_PI 3.14159265358979323846
74 initialize_number_of_atoms( rsd );
95 for(
Size i_atm = 1; i_atm <= natoms(); ++i_atm ){
96 selfneigh_[i_atm].nneigh = 0;
97 selfneigh_[i_atm].resID.resize( MAXNEIGH );
98 selfneigh_[i_atm].atmID.resize( MAXNEIGH );
111 initialize_parameters( rsd );
112 initialize_charge( rsd );
124 using namespace basic::options;
125 using namespace basic::options::OptionKeys;
143 Size FACTS_ALPHA_INDEX;
144 if ( option[ score::facts_asp_patch ]() ){
151 COradius_.resize( natoms() );
152 volume_.resize( natoms() );
153 a0_.resize( natoms() );
154 a1_.resize( natoms() );
155 a2_.resize( natoms() );
156 a3_.resize( natoms() );
157 b1_.resize( natoms() );
158 b2_.resize( natoms() );
159 c0_.resize( natoms() );
160 c1_.resize( natoms() );
161 c2_.resize( natoms() );
162 c3_.resize( natoms() );
163 d1_.resize( natoms() );
164 d2_.resize( natoms() );
165 not_using_.resize( natoms() );
167 for(
Size i = 1; i <= natoms(); ++i){
169 if ( vdw_radius <= 1.0e-6 ){
170 not_using_[i] =
true;
172 not_using_[i] =
false;
175 volume_[i] = (4.0/3.0) *
Math_PI * vdw_radius * vdw_radius * vdw_radius;
201 for(
Size atm = 1;atm <= natoms(); atm++){
208 string resname = rsd.
name();
210 Real volume_per_Hapo = (4.0/3.0) *
Math_PI * 1.0 * 1.0 * 1.0;
212 if (atmname.compare(
"Hapo") == 0){
215 }
else if (atmname.compare(
"CH3") == 0){
216 volume_[i] += 3.0*volume_per_Hapo;
217 }
else if (atmname.compare(
"CH2") == 0){
218 volume_[i] += 2.0*volume_per_Hapo;
219 }
else if (atmname.compare(
"CH1") == 0){
220 volume_[i] += volume_per_Hapo;
221 }
else if (atmname.compare(
"aroC") == 0){
222 volume_[i] += volume_per_Hapo;
223 }
else if (resname.compare(
"GLY") == 0 && atmname.compare(
"CAbb") == 0){
224 volume_[i] += 2.0*volume_per_Hapo;
225 }
else if (resname.compare(
"GLY") != 0 && atmname.compare(
"CAbb") == 0){
226 volume_[i] += volume_per_Hapo;
227 }
else if (resname.compare(
"CYS") == 0 && atmname.compare(
"S") == 0){
228 volume_[i] += volume_per_Hapo;
247 for (
Size i=1; i<= src_size; ++i ) {
267 for (
Size i=1; i<= nres; ++i ) {
302 for (
Size i=1; i<= nrot; ++i ) {
315 MultiplicitiveFactor_(332.07156)
317 using namespace basic::options;
318 using namespace basic::options::OptionKeys;
320 Kappa_ = option[ score::facts_kappa ]();
322 Tau_ = (1.0/option[ score::hackelec_die ]() ) - (1.0/78.5);
323 do_apprx = option[ score::facts_apprx ]();
326 TR <<
"FACTS Approximation turned on." << endl;
329 if( option[ score::facts_asp_patch ] ){
330 TR <<
"FACTS ASP patch applied." << endl;
333 assert( option[score::hackelec_die]() == 1.0 );
334 assert( option[score::hackelec_r_option]() );
347 for (
Size i=1; i<= nres; ++i ) {
351 if ( existing_rsd.is_protein() ) {
354 if ( existing_rsd.is_lower_terminus() ) {
355 protein_placeholder_residue_type =
356 &(residue_set.get_residue_type_with_variant_added( *protein_placeholder_residue_type,
359 if ( existing_rsd.is_upper_terminus() ) {
360 protein_placeholder_residue_type =
361 &(residue_set.get_residue_type_with_variant_added( *protein_placeholder_residue_type,
370 Size const dummy_index( rsd->atom_index(
"DUMM") );
372 assert( std::fabs( rsd->xyz(
"CA").distance( rsd->xyz( dummy_index )) - 2.44 ) < 1e-2 );
388 PROF_START( basic::FACTS_GET_ALL_BORN_RADII );
392 if ( pose.
data().has( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO ) ) {
394 ( pose.
data().get_ptr( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )() );
399 facts_info->initialize( pose );
402 EnergyGraph const & energy_graph( energies.energy_graph() );
405 for ( res1 = 1; res1 <= nres; ++res1 ) {
410 if( facts1.natoms() == 0)
continue;
415 iru = energy_graph.get_node( res1 )->const_edge_list_begin(),
417 iru != irue; ++iru ) {
418 Size const res2( (*iru)->get_other_ind( res1 ) );
421 if (res2 < res1)
continue;
436 for ( res1 = 1; res1 <= nres; ++res1 ){
460 for ( res1 = 1; res1 <= nres; ++ res1 ){
468 iru = energy_graph.get_node( res1 )->const_edge_list_begin(),
470 iru != irue; ++iru ) {
472 Size const res2( (*iru)->get_other_ind( res1 ) );
474 if (res2 < res1)
continue;
487 pose.
data().set( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO, facts_info );
488 PROF_STOP( basic::FACTS_GET_ALL_BORN_RADII );
512 for (
Size atm1 = 1; atm1 <= natoms1; ++atm1 ) {
513 xyz1 = rsd1.
xyz(atm1);
517 for (
Size atm2 = 1; atm2 <= natoms2; ++atm2 ) {
518 if (same_res && (atm1 == atm2 ))
continue;
520 xyz2 = (rsd2.
xyz( atm2 ));
521 Vector const dxyz( xyz1 - xyz2 );
525 Real dis2 = xyz1.distance_squared( xyz2 );
526 Real dis = std::sqrt(dis2);
531 if( dis2 >= CutOff_sqr )
continue;
535 Real theta_sqrt = 1.0 - (dis2 / CutOff_sqr);
536 Real thetaij = theta_sqrt*theta_sqrt;
542 facts1.
Ai_[atm1] += Vi;
545 facts1.
nmtr_[atm1] += (Vi/dis2)*dxyz;
546 facts1.
dnmtr_[atm1] += Vi/dis;
563 Real thetaij, theta_sqrt;
568 for (
Size atm1 = 1; atm1 <= natoms1; ++atm1 ) {
578 for (
Size atm2 = 1; atm2 <= natoms2; ++atm2 ) {
579 if (same_res && (atm1 >= atm2))
continue;
583 Vector const dxyz( xyz1 - xyz2 );
584 Real const dis2 = dxyz[0]*dxyz[0] + dxyz[1]*dxyz[1] + dxyz[2]*dxyz[2];
586 if ( dis2 > MAX_SELFDCUT2 )
continue;
588 Real dis = std::sqrt(dis2);
593 if( dis2 <= CutOff_sqr1 && facts2.
volume(atm2) > 1e-3 ){
594 if (neigh1.nneigh >= facts1.
MAXNEIGH)
continue;
597 neigh1.resID[ neigh1.nneigh ] = rsd2.
seqpos();
598 neigh1.atmID[ neigh1.nneigh ] = atm2;
601 theta_sqrt = 1.0 - (dis2 / CutOff_sqr1);
602 thetaij = theta_sqrt*theta_sqrt;
607 facts1.
Ai_[atm1] += Vi;
610 facts1.
nmtr_[atm1] += (Vi/dis2)*dxyz;
611 facts1.
dnmtr_[atm1] += Vi/dis;
615 if( dis2 <= CutOff_sqr2 && facts1.
volume(atm1) > 1e-3 ){
627 theta_sqrt = 1.0 - (dis2 / CutOff_sqr2);
628 thetaij = theta_sqrt*theta_sqrt;
631 Real const Vi = V1*thetaij;
634 facts2.
Ai_[atm2] += Vi;
637 facts2.
nmtr_[atm2] -= (Vi/dis2)*dxyz;
638 facts2.
dnmtr_[atm2] += Vi/dis;
649 for(
Size atm1 = 1 ;atm1<=facts1.
natoms(); atm1++ ){
654 facts1.
Bi_[atm1] = (facts1.
nmtr(atm1)).norm() / facts1.
dnmtr(atm1);
657 facts1.
Ci_[atm1] = facts1.
Ai(atm1) + (facts1.
b1( atm1 ) * facts1.
Bi(atm1)) +
658 (facts1.
b2(atm1) * facts1.
Ai(atm1) * facts1.
Bi(atm1) );
660 Real expterm = exp( -facts1.
a2(atm1) * (facts1.
Ci(atm1) - facts1.
a3(atm1)) );
661 Real tmp = facts1.
a1(atm1)/(1.0 + expterm);
664 facts1.
esolvE_[atm1] = facts1.
a0(atm1) + tmp;
668 facts1.
dG_dCi_[atm1] = facts1.
a2(atm1)*expterm*tmp/( 1.0 + expterm );
672 facts1.
Di_[atm1] = facts1.
Ai(atm1) + (facts1.
d1( atm1 ) * facts1.
Bi(atm1)) +
673 (facts1.
d2(atm1) * facts1.
Ai(atm1) * facts1.
Bi(atm1) );
676 expterm = exp( -facts1.
c2(atm1) * (facts1.
Di(atm1) - facts1.
c3(atm1)) );
677 tmp = facts1.
c1(atm1)/(1.0 + expterm);
679 facts1.
sasa_[atm1] = facts1.
c0(atm1) + tmp;
682 facts1.
dSA_dDi_[atm1] = facts1.
c2(atm1)*expterm*tmp/( 1.0 + expterm );
700 bool const same_res = ( rsd1.
seqpos() == rsd2.
seqpos() );
704 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++atm1 ) {
706 Real const &q1 = facts1.
q(atm1);
708 if( facts1.
not_using(atm1) || std::fabs( q1 ) < 1.0e-6 )
continue;
712 for (
Size atm2 = 1; atm2 <= rsd2.
natoms(); ++atm2 ) {
713 Real const &q2 = facts2.
q( atm2 );
715 if( facts2.
not_using(atm2) || std::fabs( q2 ) < 1.0e-6 )
continue;
718 Real dis2 = xyz1.distance_squared( xyz2 );
720 if ( dis2 >= cut_off_square )
continue;
722 Real dis = std::sqrt(dis2);
723 Vector dxyz = xyz1 - xyz2;
725 Real const &BRi = facts1.
BR(atm1);
726 Real const &BRj = facts2.
BR(atm2);
730 Real tmp2 = exp(-tmp1/BRij);
731 Real tmp3 = sqrt(dis2 + BRij*tmp2);
734 if (tmp3 == 0)
continue;
739 Real sf1 = 1.0 - dis2/cut_off_square;
743 Real g1 = 0.5*fpair/(tmp3*tmp3);
745 Real dE_drij = g1*g2;
746 Real dsf2_drij = 4.0*sf1/cut_off_square;
747 Real dEsf_drij = dE_drij*sf2 + fpair*dsf2_drij;
751 GBpair -= 0.5*fpair*sf2;
753 facts1.
dE_drij2_[atm1] += dEsf_drij*dxyz;
754 facts1.
dE_dBR_[atm1] -= 0.5*sf2*g1*tmp2*(BRj + tmp1/BRi);
755 facts2.
dE_dBR_[atm2] -= 0.5*sf2*g1*tmp2*(BRi + tmp1/BRj);
760 facts1.
dE_drij2_[atm1] += dEsf_drij*dxyz;
761 facts2.
dE_drij2_[atm2] -= dEsf_drij*dxyz;
762 facts1.
dE_dBR_[atm1] -= sf2*g1*tmp2*(BRj + tmp1/BRi);
763 facts2.
dE_dBR_[atm2] -= sf2*g1*tmp2*(BRi + tmp1/BRj);
782 Real a12 = 0.865924478668;
783 Real b12 = 0.4399086973;
785 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++atm1 ) {
787 Real const &q1 = facts1.
q(atm1);
789 if( facts1.
not_using(atm1) || std::fabs( q1 ) < 1.0e-6 )
continue;
792 for (
Size atm2 = 1; atm2 <= rsd2.
natoms(); ++atm2 ) {
793 Real const &q2 = facts2.
q( atm2 );
795 if( facts2.
not_using(atm2) || std::fabs( q2 ) < 1.0e-6 )
continue;
798 Real dis2 = xyz1.distance_squared( xyz2 );
800 if ( dis2 >= cut_off_square )
continue;
802 Real const &BRi = facts1.
BR(atm1);
803 Real const &BRj = facts2.
BR(atm2);
806 Real m = sqrt(BRi*BRj);
807 Real dis = std::sqrt(dis2);
808 Vector dxyz = xyz1 - xyz2;
811 sqrt(dis2+BRij*exp(-dis2/(
Kappa()*BRij)))*(1.0-dis2/cut_off_square)*(1.0-dis2/cut_off_square);
814 Real arg = 1.0/((a12+b12)*m);
815 Real sfm = (1.0 - BRij/cut_off_square);
816 Real fm = arg*sfm*sfm;
817 Real gm = -arg*(sfm*sfm*a12*arg + sfm*4.0*m/cut_off_square);
819 Real c = (gm - 2.0*fm/m + 2.0/BRij)/BRij;
820 Real d = (-gm + 3.0*fm/m - 3.0/BRij)/m;
835 Real sf1 = 1.0 - dis2/cut_off_square;
836 Real dsf2_drij = 4.0*sf1/cut_off_square;
837 Real farg = a12*dis + b12*m;
839 Real farg2 = fpair*sf1*sf1/farg;
842 Real dEsf_drij = -farg2/dis - fpair*dsf2_drij;
845 GBpair += fpair*sf1*sf1;
847 facts1.
dE_drij2_[atm1] += dEsf_drij*dxyz;
848 facts2.
dE_drij2_[atm2] -= dEsf_drij*dxyz;
849 facts1.
dE_dBR_[atm1] += 0.5*farg2*b12*BRj / m;
850 facts2.
dE_dBR_[atm2] += 0.5*farg2*b12*BRi / m;
872 if ( pose.
data().has( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO ) ) {
874 ( pose.
data().get_ptr( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )() );
879 for (
Size res1 = 1; res1 <= facts_info->size(); ++res1){
882 for (
Size atm1 = 1; atm1 <= facts1.natoms(); ++atm1){
886 if ( (fabs(facts1.esolvE(atm1)) <= 1e-6) || (facts1.not_using(atm1)) )
continue;
889 facts1.polarF2d_[atm1] += facts1.dE_drij2_[atm1];
892 Real dB_dBdnmtr = -facts1.Bi(atm1)/facts1.dnmtr(atm1);
893 Real dB_dBnmtr = 1.0/(facts1.nmtr(atm1).norm() * facts1.dnmtr(atm1));
894 Real dBR_dG = facts1.BR(atm1)/facts1.esolvE(atm1);
896 Real CutOff_sqr = facts1.COradius(atm1)*facts1.COradius(atm1);
902 for (
Size i_j = 1; i_j <= n_neigh; ++i_j){
910 Vector const dxyz( crd1 - crd2 );
911 Real const dis2 ( dxyz.length_squared() );
912 Real const dis ( std::sqrt(dis2) );
913 Real const i_dis2 ( 1.0/dis2 );
915 Real theta_sqrt = 1.0 - (dis2 / CutOff_sqr);
916 Real dtheta_tmp1 = facts2.volume(atm2) * theta_sqrt*theta_sqrt;
917 Real dtheta_tmp2 = 4.0*facts2.volume(atm2) *theta_sqrt/CutOff_sqr;
918 Real tmp1 = dtheta_tmp1*i_dis2;
919 Real tmp2 = (tmp1 + dtheta_tmp2)/dis;
922 Real dAi_drij = -dtheta_tmp2;
925 Real arg12 = -2.0*dtheta_tmp1*i_dis2 - dtheta_tmp2;
926 Vector argv1 = i_dis2*arg12*dxyz;
927 Real dBn_drij = argv1[0]*facts1.nmtr(atm1)[0] + argv1[1]*facts1.nmtr(atm1)[1] + argv1[2]*facts1.nmtr(atm1)[2];
928 Vector dBn_drij2 = facts1.nmtr(atm1)*dtheta_tmp1*i_dis2;
929 Vector dBi_drij = (dB_dBnmtr*dBn_drij - dB_dBdnmtr*tmp2)*dxyz + dB_dBnmtr*dBn_drij2;
932 Vector dCi_drij_for_F2 = dAi_drij*dxyz + facts1.b1(atm1)*dBi_drij +
933 facts1.b2(atm1)*(facts1.Ai(atm1)*dBi_drij + facts1.Bi(atm1)*dAi_drij*dxyz);
935 Vector dE_drij_for_F2 = facts1.dE_dBR(atm1)*dBR_dG*facts1.dG_dCi(atm1)*dCi_drij_for_F2;
937 facts1.polarF2BR_[atm1] += dE_drij_for_F2;
938 facts2.polarF2BR_[atm2] -= dE_drij_for_F2;
941 Vector dDi_drij_for_F2 = dAi_drij*dxyz + facts1.d1(atm1)*dBi_drij +
942 facts1.d2(atm1)*(facts1.Ai(atm1)*dBi_drij + facts1.Bi(atm1)*dAi_drij*dxyz);
944 Vector dSA_drij_for_F2 = facts1.alpha(atm1)*facts1.dSA_dDi(atm1)*dDi_drij_for_F2;
946 facts1.nonpolarF2_[atm1] += dSA_drij_for_F2;
947 facts2.nonpolarF2_[atm2] -= dSA_drij_for_F2;
952 pose.
data().set( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO, facts_info );
953 PROF_STOP( basic::FACTS_GET_ALL_BORN_RADII );
980 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++ atm1 ){
981 E_SA += facts1.
alpha(atm1)*facts1.
sasa(atm1);
1002 bool const same_res = ( rsd1.
seqpos() == rsd2.
seqpos() );
1008 Real theta_sqrt, thetaij, thetaij_ref;
1017 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++atm1 ) {
1021 for (
Size atm2 = 1; atm2 <= rsd2.
natoms(); ++atm2 ) {
1022 if ( same_res && atm1 == atm2 )
continue;
1026 Vector dxyz = xyz1 - xyz2;
1028 Real dis2 = dxyz[0]*dxyz[0] + dxyz[1]*dxyz[1] + dxyz[2]*dxyz[2];
1029 Real dis = sqrt(dis2);
1032 Vector dxyz_ref1 = xyz1 - rsd2_ref.
xyz(atm2);
1033 Real dis2_ref1 = dxyz_ref1[0]*dxyz_ref1[0] + dxyz_ref1[1]*dxyz_ref1[1]
1034 + dxyz_ref1[2]*dxyz_ref1[2];
1036 if ( abs(facts1.
esolvE(atm1)) > 1e-6 && abs(dis2 - dis2_ref1) > 1e-3
1037 && ( dis2 < CutOff_sqr1 || dis2_ref1 < CutOff_sqr1 )) {
1038 Real dis_ref = sqrt(dis2_ref1);
1040 if ( dis2 < CutOff_sqr1 ){
1041 theta_sqrt = 1.0 - (dis2 / CutOff_sqr1);
1042 thetaij = theta_sqrt*theta_sqrt;
1047 if ( dis2_ref1 < CutOff_sqr1 ){
1048 theta_sqrt = 1.0 - (dis2_ref1 / CutOff_sqr1);
1049 thetaij_ref = theta_sqrt*theta_sqrt;
1054 Ai1[atm1] += fct*facts2.
volume(atm2)*(thetaij - thetaij_ref);
1056 nmtr1[atm1] += fct*facts2.
volume(atm2)*(thetaij*dxyz/dis2
1057 - thetaij_ref*dxyz_ref1/dis2_ref1);
1058 dnmtr1[atm1] += fct*facts2.
volume(atm2)*(thetaij/dis - thetaij_ref/dis_ref);
1063 Vector dxyz_ref2 = xyz2 - rsd1_ref.
xyz(atm1);
1064 Real dis2_ref2 = dxyz_ref2[0]*dxyz_ref2[0] + dxyz_ref2[1]*dxyz_ref2[1]
1065 + dxyz_ref2[2]*dxyz_ref2[2];
1067 if ( abs(facts2.
esolvE(atm2)) > 1e-6 && abs(dis2_ref2 - dis2) > 1e-3
1068 && (dis2 < CutOff_sqr2 || dis2_ref2 < CutOff_sqr2) ) {
1069 Real dis_ref = sqrt(dis2_ref2);
1071 if ( dis2 < CutOff_sqr2 ){
1072 theta_sqrt = 1.0 - (dis2 / CutOff_sqr2);
1073 thetaij = theta_sqrt*theta_sqrt;
1078 if ( dis2_ref2 < CutOff_sqr2 ){
1079 theta_sqrt = 1.0 - (dis2_ref2 / CutOff_sqr2);
1080 thetaij_ref = theta_sqrt*theta_sqrt;
1085 Ai2[atm2] += fct*facts1.
volume(atm1)*(thetaij - thetaij_ref);
1086 nmtr2[atm2] += fct*facts1.
volume(atm1)*(thetaij*(-dxyz)/dis2
1087 - thetaij_ref*dxyz_ref2/dis2_ref2);
1088 dnmtr2[atm2] += fct*facts1.
volume(atm1)*(thetaij/dis - thetaij_ref/dis_ref);
1095 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++atm1 ) {
1096 Real const &Ai = Ai1[atm1];
1097 Real const &Bi = nmtr1[atm1].norm()/dnmtr1[atm1];
1099 if ( abs(facts1.
esolvE(atm1)) > 1e-6 ){
1100 Real Ci = Ai + facts1.
b1(atm1)*Bi + facts1.
b2(atm1)*Ai*Bi;
1101 Real Gi = facts1.
a0(atm1) + facts1.
a1(atm1)/
1102 (1.0 + exp( -facts1.
a2(atm1) * (Ci - facts1.
a3(atm1)) ) );
1105 Real dDi = Ai + facts1.
d1(atm1)*Bi + facts1.
d2(atm1)*Ai*Bi - facts1.
Di(atm1);
1106 dSAi1[atm1] = facts1.
alpha(atm1)*facts1.
dSA_dDi(atm1)*dDi;
1110 for (
Size atm2 = 1; atm2 <= rsd2.
natoms(); ++atm2 ) {
1111 Real const &Ai = Ai2[atm2];
1112 Real const &Bi = nmtr2[atm2].norm()/dnmtr2[atm2];
1114 if ( abs(facts2.
esolvE(atm2)) > 1e-6 ){
1115 Real Ci = Ai + facts2.
b1(atm2)*Bi + facts2.
b2(atm2)*Ai*Bi;
1116 Real Gi = facts2.
a0(atm2) + facts2.
a1(atm2)/
1117 (1.0 + exp( -facts2.
a2(atm2) * (Ci - facts2.
a3(atm2)) ) );
1121 Real dDi = Ai + facts2.
d1(atm2)*Bi + facts2.
d2(atm2)*Ai*Bi - facts2.
Di(atm2);
1122 dSAi2[atm2] = facts2.
alpha(atm2)*facts2.
dSA_dDi(atm2)*dDi;
1139 bool const same_res = ( rsd1.
seqpos() == rsd2.
seqpos() );
1142 for (
Size atm1 = 1; atm1 <= rsd1.
natoms(); ++atm1 ) {
1144 Real q1 = facts1.
q(atm1);
1146 if( facts1.
not_using(atm1) || std::fabs( q1 ) < 1.0e-6 )
continue;
1148 for (
Size atm2 = 1; atm2 <= rsd2.
natoms(); ++atm2 ) {
1149 Real q2 = facts2.
q( atm2 );
1151 if( facts2.
not_using(atm2) || std::fabs( q2 ) < 1.0e-6 )
continue;
1154 Real dis2 = xyz1.distance_squared( xyz2 );
1156 if ( dis2 >= cut_off_square )
continue;
1158 Real dis = std::sqrt(dis2);
1164 BRi = facts1.
BR(atm1);
1165 BRj = facts2.
BR(atm2);
1168 Real BRij = BRi*BRj;
1171 Real tmp2 = exp(-tmp1/BRij);
1172 Real tmp3 = sqrt(dis2 + BRij*tmp2);
1177 Real sf1 = 1.0 - dis2/cut_off_square;
1181 score -= 0.5*sf2*fpair;
1195 bool const exclude_DNA_DNA,
1200 FACTSPoseInfo const & facts_info( static_cast< FACTSPoseInfo const & >
1201 ( pose.
data().get( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )));
1202 Size const atm1(
id.atomno() );
1203 Size const res1(
id.rsd() );
1211 Vector tmpv = weight * (facts1.polarF2d(atm1) + facts1.polarF2BR(atm1));
1215 Vector virtualcrd = -tmpv + crd1;
1216 F1 += crd1.cross( virtualcrd );
1225 bool const exclude_DNA_DNA,
1230 FACTSPoseInfo const & facts_info( static_cast< FACTSPoseInfo const & >
1231 ( pose.
data().get( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )));
1232 Size const atm1(
id.atomno() );
1233 Size const res1(
id.rsd() );
1241 Vector tmpv = weight * facts1.nonpolarF2(atm1);
1245 Vector virtualcrd = -tmpv + crd1;
1246 F1 += crd1.cross( virtualcrd );
1255 PROF_START( basic::FACTS_SETUP_FOR_PACKING );
1277 ( pose.
data().get_ptr( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )() );
1280 facts_info->set_repack_list( repacking_residues );
1286 pose.
data().set( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO, facts_info );
1287 PROF_STOP( basic::FACTS_SETUP_FOR_PACKING );
1292 assert( facts_info.
size() == nres );
1294 for (
Size i=1; i<= nres; ++i ) {
1299 assert( rsd1.natoms()<1 || std::fabs(facts1.Ai(1)) < 1e-3 );
1301 for (
Size j=1; j<= nres; ++j ) {
1317 ( pose.
data().get( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO ) ) );
1321 facts.initialize( rsd );
1328 FACTSPoseInfo const & facts_info_pose( static_cast< FACTSPoseInfo const & >
1329 (pose.
data().get( core::pose::datacache::CacheableDataType::FACTS_POSE_INFO )));
1337 pose, facts_info_pose,
1338 facts_info_rotamers->residue_info( n ) );
1341 rotamer_set.
data().set( core::conformation::RotamerSetCacheableDataType::FACTS_ROTAMER_SET_INFO, facts_info_rotamers );
1349 Size natoms1, natoms2;
1351 assert( rsd1.
natoms()<1 || std::fabs(facts1.
Ai(1)) < 1e-3 );
1371 Real score_correction = 0.0;
1373 for(
Size iatm = 1; iatm <= rsd.
natoms(); ++iatm ){
1374 Vector const &dxyz = rsd.
xyz(iatm) - ref_rsd.
xyz(iatm);
1377 Real dabs = dxyz[0]*dxyz[0] + dxyz[1]*dxyz[1] + dxyz[2]*dxyz[2];
1379 if( dabs > 1.0e-3 && dabs < 0.25 ){
1380 score_correction += drv[0]*dxyz[0] + drv[1]*dxyz[1] + drv[2]*dxyz[2];
1383 return score_correction;