32 #include <basic/Tracer.hh>
35 #include <ObjexxFCL/format.hh>
38 #include <utility/tag/Tag.hh>
40 #include <utility/vector0.hh>
41 #include <utility/vector1.hh>
49 static basic::Tracer
tr(
"protocols.filters.ScoreCutoffFilter");
52 namespace simple_filters {
56 parent(
"ScoreCutoffFilter"), cutoff_( 0.0 ), report_residue_pair_energies_( false ), total_score_( true ), unweighted_( false )
63 parent(
"ScoreCutoffFilter"),cutoff_(cutoff_in), report_residue_pair_energies_( false ), total_score_( true ), unweighted_( false )
80 using namespace core::scoring;
89 tr <<
"WARNING: setting score_type to total score even though other score types have previously been set. these will be erased." << std::endl;
111 if ( cur_score <=
cutoff() )
return true;
121 using namespace core::scoring;
155 if (tag->hasOption(
"report_residue_pair_energies")) {
158 if (tag->hasOption(
"cutoff")) {
168 using namespace core::scoring;
173 ostr <<
" Scoretype: " << *sco_it <<
" score: " << emap.
sum() <<
", cutoff: " <<
cutoff_ << std::endl;
181 using namespace core::scoring;
182 core::Size field_width( 10 ), last_active_sr_st(0);
193 if( !lrec )
continue;
194 if( !lrec->empty() ) active_lr_e.push_back( lrec );
202 for(
core::Size i =1; i <= active_st.size(); ++i) ostr << ObjexxFCL::fmt::F( field_width, 2, weights[ active_st[ i ] ] ) <<
" ";
209 std::map< core::Size, EnergyMap > upper_interactions;
213 egraph_it != egraph.get_energy_node( res1 )->const_upper_edge_list_end(); ++egraph_it){
214 core::Size other_ind( (*egraph_it)->get_other_ind( res1 ) );
215 upper_interactions.insert( std::pair< Size, EnergyMap >(other_ind,
EnergyMap() ) );
216 EnergyMap & this_emap( upper_interactions.find( other_ind )->second );
217 EnergyEdge const * eedge( static_cast< EnergyEdge const * >(*egraph_it));
219 for(
core::Size i =1; i <= last_active_sr_st; ++i) this_emap[ active_st[i] ] = ((*eedge)[ active_st[i] ]);
224 for(
Size lr = 1; lr <= active_lr_e.size(); lr++){
226 *rni != *( active_lr_e[lr]->const_upper_neighbor_iterator_end( res1 ) ); ++(*rni) ) {
228 core::Size other_ind( rni->upper_neighbor_id() );
229 rni->retrieve_energy( lr_emap );
230 std::map< core::Size, EnergyMap >::iterator map_it = upper_interactions.find( other_ind );
231 if( map_it == upper_interactions.end() ) upper_interactions.insert( std::pair<Size, EnergyMap >(other_ind, lr_emap ) );
232 else map_it->second += lr_emap;
237 for( std::map< core::Size, EnergyMap >::const_iterator map_it = upper_interactions.begin(); map_it != upper_interactions.end(); ++map_it){
239 EnergyMap const & this_emap( map_it->second );
243 for(
core::Size i =1; i <= active_st.size(); ++i){
244 core::Real score( weights[ active_st[i] ] * this_emap[ active_st[i] ] );
246 ostr << ObjexxFCL::fmt::F( field_width, 2, score) <<
" ";
248 ostr << ObjexxFCL::fmt::F( field_width, 2, totscore) <<
"\n";