23 #include <basic/database/open.hh>
27 #include <utility/io/izstream.hh>
28 #include <utility/vector1.hh>
31 #include <numeric/constants.hh>
32 #include <numeric/interpolation/Histogram.hh>
35 #include <basic/Tracer.hh>
37 #include <numeric/xyz.functions.hh>
39 static basic::Tracer
TR(
"core.scoring.disulfides.CentroidDisulfidePotential");
44 using namespace numeric::interpolation;
51 namespace disulfides {
56 CentroidDisulfidePotential::CentroidDisulfidePotential() {}
61 CentroidDisulfidePotential::~CentroidDisulfidePotential() {}
68 CentroidDisulfidePotential::score_disulfide(
71 Energy & cbcb_distance_score,
72 Energy & centroid_distance_score,
73 Energy & cacbcb_angle_1_score,
74 Energy & cacbcb_angle_2_score,
75 Energy & cacbcbca_dihedral_score,
76 Energy & backbone_dihedral_score
79 Real cbcb_distance_sq, centroid_distance_sq, cacbcb_angle_1, cacbcb_angle_2,
80 cacbcbca_dihedral, backbone_dihedral, score_factor;
90 centroid_distance_score,
93 cacbcbca_dihedral_score,
94 backbone_dihedral_score,
110 CentroidDisulfidePotential::score_disulfide(
129 static const Real min_native_cb_dist_sq = 10;
130 static const Real max_native_cb_dist_sq = 22;
132 static const Real max_cb_dist_sq = 400;
135 disulfide_params(res1, res2,
137 centroid_distance_sq,
146 cbcb_distance_score = cb_distance_func_->func(cbcb_distance_sq);
148 if(centroid_distance_sq < 0) {
150 centroid_distance_score = 0.0;
152 centroid_distance_score = cen_distance_func_->func(centroid_distance_sq);
160 if( cbcb_distance_sq < min_native_cb_dist_sq || max_cb_dist_sq < cbcb_distance_sq ) {
162 cacbcb_angle_1_score = 0.;
163 cacbcb_angle_2_score = 0.;
164 cacbcbca_dihedral_score = 0.;
165 backbone_dihedral_score = 0.;
168 else if( cbcb_distance_sq < max_native_cb_dist_sq ) {
169 cb_score_factor = 1.;
173 cb_score_factor = (cbcb_distance_sq - max_cb_dist_sq) /
174 (max_native_cb_dist_sq - max_cb_dist_sq);
177 cacbcb_angle_1_score = cacbcb_angle_func_->func(cacbcb_angle_1);
178 cacbcb_angle_2_score = cacbcb_angle_func_->func(cacbcb_angle_2);
179 cacbcbca_dihedral_score = cacbcbca_dihedral_func_->func(cacbcbca_dihedral);
180 backbone_dihedral_score = ncacac_dihedral_func_->func(backbone_dihedral);
182 cacbcbca_dihedral_score *= cb_score_factor;
183 backbone_dihedral_score *= cb_score_factor;
184 cacbcb_angle_1_score *= cb_score_factor;
185 cacbcb_angle_2_score *= cb_score_factor;
206 CentroidDisulfidePotential::disulfide_params(
209 Real & cbcb_distance_sq,
210 Real & centroid_distance_sq,
211 Real & cacbcb_angle_1,
212 Real & cacbcb_angle_2,
213 Real & cacbcbca_dihedral,
214 Real & backbone_dihedral)
216 using numeric::constants::d::radians_to_degrees;
228 restype_set->name_map(
"ALA"), res1, conformation) );
236 restype_set->name_map(
"ALA"), res2, conformation) );
239 assert(res1_ptr->type().has_atom_name(
"CB"));
240 assert(res2_ptr->type().has_atom_name(
"CB"));
242 Vector const& calpha_1 ( res1_ptr->xyz(
"CA") );
243 Vector const& cbeta_1 ( res1_ptr->xyz(
"CB") );
244 Vector const& n_1 ( res1_ptr->xyz(
"N") );
245 Vector const& calpha_2 ( res2_ptr->xyz(
"CA") );
246 Vector const& cbeta_2 ( res2_ptr->xyz(
"CB") );
247 Vector const& c_2 ( res2_ptr->xyz(
"C") );
249 cbcb_distance_sq = cbeta_1.distance_squared(cbeta_2);
250 cacbcb_angle_1 = angle_of( calpha_1, cbeta_1, cbeta_2);
251 cacbcb_angle_2 = angle_of( calpha_2, cbeta_2, cbeta_1);
252 cacbcb_angle_1 *= radians_to_degrees;
253 cacbcb_angle_2 *= radians_to_degrees;
254 cacbcbca_dihedral = dihedral_degrees(calpha_1,cbeta_1,cbeta_2,calpha_2);
256 backbone_dihedral = dihedral_degrees(n_1, calpha_1, calpha_2, c_2);
258 centroid_distance_sq = -1;
259 if( res1_ptr->type().has_atom_name(
"CEN") &&
260 res2_ptr->type().has_atom_name(
"CEN") )
262 Vector const& cen_1( res1_ptr->xyz(
"CEN"));
263 Vector const& cen_2( res2_ptr->xyz(
"CEN"));
264 centroid_distance_sq = cen_1.distance_squared(cen_2);
267 assert(0. <= centroid_distance_sq );
269 assert(0. <= cbcb_distance_sq);
270 assert(0. <= cacbcb_angle_1); assert( cacbcb_angle_1 <= 180. );
271 assert(0. <= cacbcb_angle_2); assert( cacbcb_angle_2 <= 180. );
292 bool CentroidDisulfidePotential::is_disulfide(
297 Energy cbcb_distance_score,
298 centroid_distance_score,
299 cacbcb_angle_1_score,
300 cacbcb_angle_2_score,
301 cacbcbca_dihedral_score,
302 backbone_dihedral_score;
303 Real cbcb_distance_sq,
304 centroid_distance_sq,
310 score_disulfide(res1,
313 centroid_distance_sq,
319 centroid_distance_score,
320 cacbcb_angle_1_score,
321 cacbcb_angle_2_score,
322 cacbcbca_dihedral_score,
323 backbone_dihedral_score,
328 return cbcb_distance_score <= disulfide_cb_dist_cutoff &&
329 cacbcb_angle_1 >= 60. &&
330 cacbcb_angle_2 >= 60. ;
335 const Real CentroidDisulfidePotential::disulfide_cb_dist_cutoff(4.392);
345 static HistogramCOP<Real,Real>::Type
347 utility::io::izstream scores_stream;
348 basic::database::open( scores_stream, file);
349 HistogramCOP<Real,Real>::Type scores =
new Histogram<Real,Real>( scores_stream() );
350 scores_stream.close();
355 Cb_Distance_Func::Cb_Distance_Func() {}
356 Cb_Distance_Func::~Cb_Distance_Func() {}
357 Real Cb_Distance_Func::func(
Real const cb_dist_sq_)
const {
359 Energy score = base_score_;
360 for(
Size i = 0; i<3; ++i ) {
361 score -=
dgaussian(cb_dist_sq_, means_[i], sds_[i], weights_[i] );
369 const Real Cb_Distance_Func::means_[3] = { 12.445, 15.327, 14.0 };
370 const Real Cb_Distance_Func::sds_[3] = { 1.1737973, 2.1955666, 0.3535534 };
371 const Real Cb_Distance_Func::weights_[3] = {10.8864116, 33.5711622, 0.2658681 };
372 const Real Cb_Distance_Func::base_score_ = 0.0;
375 Cen_Distance_Func::Cen_Distance_Func() {}
376 Cen_Distance_Func::~Cen_Distance_Func() {}
377 Real Cen_Distance_Func::func(
Real const cen_dist_sq)
const {
378 if( centroid_dist_scores_ == 0)
379 centroid_dist_scores_ =
histogram_from_db(
"scoring/score_functions/disulfides/centroid_distance_score");
381 centroid_dist_scores_->interpolate(cen_dist_sq,e);
384 Real Cen_Distance_Func::dfunc(
Real const )
const {
387 HistogramCOP<Real,Real>::Type Cen_Distance_Func::centroid_dist_scores_ = 0;
390 CaCbCb_Angle_Func::CaCbCb_Angle_Func() {}
391 CaCbCb_Angle_Func::~CaCbCb_Angle_Func() {}
392 Real CaCbCb_Angle_Func::func(
Real const cacbcb_angle)
const {
393 if( CaCbCb_angle_scores_ == 0 )
394 CaCbCb_angle_scores_ =
histogram_from_db(
"scoring/score_functions/disulfides/centroid_CaCbCb_angle_score");
396 CaCbCb_angle_scores_->interpolate(cacbcb_angle,e);
399 Real CaCbCb_Angle_Func::dfunc(
Real const )
const {
402 HistogramCOP<core::Real,core::Real>::Type CaCbCb_Angle_Func::CaCbCb_angle_scores_ = 0;
406 NCaCaC_Dihedral_Func::NCaCaC_Dihedral_Func() {}
407 NCaCaC_Dihedral_Func::~NCaCaC_Dihedral_Func() {}
408 Real NCaCaC_Dihedral_Func::func(
Real const backbone_dihedral)
const {
409 if( backbone_dihedral_scores_ == 0 )
410 backbone_dihedral_scores_ =
histogram_from_db(
"scoring/score_functions/disulfides/centroid_backbone_dihedral_score");
412 backbone_dihedral_scores_->interpolate(backbone_dihedral, e);
415 Real NCaCaC_Dihedral_Func::dfunc(
Real const )
const {
418 HistogramCOP<core::Real,core::Real>::Type NCaCaC_Dihedral_Func::backbone_dihedral_scores_ = 0;
423 CaCbCbCa_Dihedral_Func::CaCbCbCa_Dihedral_Func() {}
424 CaCbCbCa_Dihedral_Func::~CaCbCbCa_Dihedral_Func() {}
425 Real CaCbCbCa_Dihedral_Func::func(
Real const cacbcbca_dihedral)
const {
426 if( CaCbCbCa_dihedral_scores_ == 0 )
427 CaCbCbCa_dihedral_scores_ =
histogram_from_db(
"scoring/score_functions/disulfides/centroid_CaCbCbCa_dihedral_score");
429 CaCbCbCa_dihedral_scores_->interpolate(cacbcbca_dihedral,e);
432 Real CaCbCbCa_Dihedral_Func::dfunc(
Real const )
const {
435 HistogramCOP<core::Real,core::Real>::Type CaCbCbCa_Dihedral_Func::CaCbCbCa_dihedral_scores_ = 0;