29 #include <basic/Tracer.hh>
30 #include <basic/prof.hh>
33 #include <utility/vector1.hh>
40 static basic::Tracer
tr(
"protocols.noesy_assign.DistanceScoreMover");
44 using namespace basic;
47 namespace noesy_assign {
52 nr_assignments_( cpl.count_assignments() ),
53 peak_violation_counts_( cross_peaks_.
size(), 0 ),
54 final_dist_power_( 6.0 ),
57 basic::ProfileThis doit( basic::NOESY_ASSIGN_DIST_INIT );
64 constraints_.push_back( (*ait)->create_constraint( pose ) );
66 tr.Error <<
"while setting up constraints in DistanceScoreMover: " << excn << std::endl;
73 tr.Error <<
"while setting up constraints in DistanceScoreMover: " << excn << std::endl;
81 basic::ProfileThis doit( basic::NOESY_ASSIGN_DIST_PREP_SCORE );
89 (*ait)->set_decoy_compatibility( 0.0 );
169 basic::ProfileThis doit( basic::NOESY_ASSIGN_DIST_APPLY );
173 SingleConstraints::const_iterator constraint_it(
constraints_.begin() );
178 tr.Debug <<
"DistanceScoreMover is not used in calibration mode " << std::endl;
188 Real dist_buf[ 2000 ];
189 runtime_assert( (*it)->n_assigned() < 2000 );
190 if ( (*it)->n_assigned() == 0 )
continue;
191 Size ct_assignments( 1 );
192 Real sum_dist( 0.0 );
193 Real sum_dist_filt( 0.0 );
194 for (
CrossPeak::iterator ait = (*it)->begin(); ait != (*it)->end(); ++ait, ++ct_assignments ) {
197 if ( !( *constraint_it )) {
205 dist = (*constraint_it)->dist( pose );
208 Real invd = 1.0/dist;
209 Real invd3 = invd*invd*invd;
214 tr.Trace <<
"sum_dist " << sum_dist <<
" dist " << dist << std::endl;
217 sum_dist_filt += ( (*ait)->normalized_peak_volume() > params.
min_volume_ )*invd6;
218 dist_buf[ ct_assignments ] = dist;
223 sum_dist=sum_dist_filt;
227 if ( sum_dist > 0 ) {
228 sum_dist=pow( sum_dist, -1.0/6.0 );
232 bool violated(
dcut_ > 0 && ( sum_dist - (*it)->distance_bound() ) >
dcut_ );
237 basic::ProfileThis doit( basic::NOESY_ASSIGN_DIST_SET_COMPABILITY_SCORE );
241 for (
CrossPeak::iterator ait = (*it)->begin(); ait != (*it)->end(); ++ait, ++ct_assignments ) {
245 if ( dist_buf[ ct_assignments ] ) {
248 (*ait)->set_decoy_compatibility( (*ait)->decoy_compatibility() + pow( dist_buf[ ct_assignments ]/sum_dist, -
final_dist_power_) );
250 if ( (*ait)->decoy_compatibility() == 0 ) {
263 (*ait)->set_decoy_compatibility( (*ait)->decoy_compatibility()/
count_decoys_ );