24 #include <utility/tag/Tag.hh>
25 #include <basic/Tracer.hh>
43 #include <utility/string_util.hh>
46 #include <numeric/random/random.hh>
47 #include <numeric/random/random_permutation.hh>
49 #include <utility/sort_predicates.hh>
53 #include <utility/vector0.hh>
54 #include <utility/vector1.hh>
63 using namespace utility;
64 using namespace protocols::moves;
71 static basic::Tracer
TR(
"protocols.loophash.LoopHashDiversifier" );
88 return "LoopHashDiversifier";
97 min_inter_ss_bbrms_( 0.0 ),
98 max_inter_ss_bbrms_( 100000.0 ),
99 min_intra_ss_bbrms_( 0.0 ),
100 max_intra_ss_bbrms_( 100000.0 ),
108 num_iterations_(100),
111 filter_by_phipsi_( false ),
113 ranking_cenfilter_( NULL ),
114 scorefxn_cen_cst_(NULL),
115 scorefxn_rama_cst_(NULL)
141 bool filter_by_phipsi,
149 min_inter_ss_bbrms_( min_inter_ss_bbrms ),
150 max_inter_ss_bbrms_( max_inter_ss_bbrms ),
151 min_intra_ss_bbrms_( min_intra_ss_bbrms ),
152 max_intra_ss_bbrms_( max_intra_ss_bbrms ),
155 start_res_( start_res ),
156 stop_res_( stop_res ),
157 window_size_(window_size),
158 max_radius_(max_radius),
159 max_struct_(max_struct),
160 num_iterations_(num_iterations),
162 filter_by_phipsi_( filter_by_phipsi ),
163 cenfilter_( cenfilter ),
164 ranking_cenfilter_( ranking_cenfilter ),
165 scorefxn_cen_cst_(scorefxn_cen_cst),
166 scorefxn_rama_cst_(scorefxn_rama_cst)
180 using namespace core::io::silent;
182 Pose const saved_pose( pose );
209 bool div_success =
false;
222 for(
core::Size res=lh_start+1; res<=lh_stop; ++res)
242 std::vector< SilentStructOP > lib_structs;
243 Size starttime = time( NULL );
245 Size endtime = time( NULL );
246 Size nstructs = lib_structs.size();
247 TR <<
"Found " << nstructs <<
" alternative states in time: " << endtime - starttime << std::endl;
252 std::vector< std::pair< Real, SilentStructOP > > cen_scored_structs;
253 for(std::vector< SilentStructOP >::const_iterator struct_it = lib_structs.begin();
254 struct_it != lib_structs.end(); ++struct_it)
257 (*struct_it)->fill_pose( rpose );
267 new_struct->fill_struct( rpose );
268 cen_scored_structs.push_back( std::pair<Real, SilentStructOP >(-score_i,new_struct) );
273 std::sort( cen_scored_structs.begin(), cen_scored_structs.end(), utility::SortFirst<Real, SilentStructOP>() );
275 TR <<
"After centroid filter: " <<
all_structs_.size() <<
" of " << cen_scored_structs.size() <<
" structures" << std::endl;
279 TR<<
"No structures survived centroid filter. Consider relaxing filters"<<std::endl;
292 TR<<
"diversification failed after " <<
num_try_div_ <<
" trials"<<std::endl;
301 std::pair< Real, SilentStructOP > currbest =
all_structs_.back();
303 TR <<
"Best score after round " << cur_iter <<
": " << -currbest.first << std::endl;
305 currbest.second->fill_pose( pose );
356 ideal_ = tag->getOption<
bool >(
"ideal", false );
361 if ( tag->hasOption(
"start_res_num" ) || tag->hasOption(
"start_pdb_num"))
363 if ( tag->hasOption(
"stop_res_num" ) || tag->hasOption(
"stop_pdb_num"))
368 if( tag->hasOption(
"scorefxn_cen_cst") )
370 std::string scorefxn_name = tag->getOption<
string>(
"scorefxn_cen_cst" );
373 if( tag->hasOption(
"scorefxn_rama_cst") )
375 std::string scorefxn_name = tag->getOption<
string>(
"scorefxn_rama_cst" );
384 if ( tag->hasOption(
"db_path" )) {
385 std::string db_path = tag->getOption<
string >(
"db_path" );
392 string const centroid_filter_name( tag->getOption<
string >(
"centroid_filter",
"true_filter" ) );
393 Filters_map::const_iterator find_cenfilter( filters.find( centroid_filter_name ) );
394 if( find_cenfilter == filters.end() )
395 utility_exit_with_message(
"Filter " + centroid_filter_name +
" not found in LoopHashDiversifier" );