28 #include <basic/options/option.hh>
39 #include <basic/Tracer.hh>
55 #include <numeric/geometry/hashing/SixDHasher.hh>
61 #include <utility/exit.hh>
62 #include <utility/fixedsizearray1.hh>
63 #include <utility/pointer/owning_ptr.hh>
76 #include <numeric/random/random.hh>
87 #include <basic/options/keys/in.OptionKeys.gen.hh>
88 #include <basic/options/keys/out.OptionKeys.gen.hh>
89 #include <basic/options/keys/lh.OptionKeys.gen.hh>
90 #include <basic/options/keys/relax.OptionKeys.gen.hh>
96 #include <utility/vector1.hh>
97 #include <utility/excn/EXCN_Base.hh>
100 #include <numeric/random/random.hh>
101 #include <numeric/random/random_permutation.hh>
109 static basic::Tracer
TR(
"main");
111 using namespace protocols::moves;
112 using namespace core::scoring;
113 using namespace core;
114 using namespace core::pose;
115 using namespace conformation;
116 using namespace kinematics;
117 using namespace numeric::geometry::hashing;
118 using namespace protocols::frag_picker;
119 using namespace protocols::loophash;
122 namespace protocols {
125 static numeric::random::RandomGenerator
RG(9479);
130 if( !library_ )
return;
132 using namespace basic::options;
133 using namespace basic::options::OptionKeys;
136 core::Size skim_size = option[ lh::skim_size ]();
145 if( option[ in::file::native ].user() ){
146 native_pose =
new Pose;
151 for(
int round = 0;
round < option[ OptionKeys::lh::rounds ];
round ++ ){
153 if (!checkpoints_.recover_checkpoint( pose, get_current_tag(), checkpoint_id,
true,
true )){
155 std::vector< core::io::silent::SilentStructOP > lib_structs;
163 while( lib_structs.size() < skim_size ){
170 TR.Info <<
"Lcount: " << lcount << std::endl;
173 TR.Info <<
"FOUND " << lib_structs.size() <<
" alternative states in time: " << endtime2 - starttime2 << std::endl;
176 if(( option[ OptionKeys::lh::write_centroid_structs ]() ) ||
177 ( option[ OptionKeys::lh::centroid_only ]() )){
179 std::string silent_file_ = option[ OptionKeys::out::file::silent ]();
180 silent_file_ +=
".centroid.out" ;
181 for(
core::Size h = 0; h < lib_structs.size(); h++){
183 lib_structs[h]->fill_pose( rpose );
184 lib_structs[h]->add_energy(
"round",
round, 1.0 );
188 lib_structs[h]->add_energy(
"rms", rms, 1.0 );
189 lib_structs[h]->add_energy(
"gdtmm", gdtmm, 1.0 );
191 lib_structs[h]->set_decoy_tag(
"S_" + string_of(
round ) +
"_" + string_of( h ) );
192 lib_structs[h]->sort_silent_scores();
198 if( option[ OptionKeys::lh::centroid_only ]() )
break;
202 numeric::random::random_permutation(lib_structs.begin(), lib_structs.end(),
numeric::random::RG);
204 std::vector< core::io::silent::SilentStructOP > select_lib_structs;
205 for(
core::Size k=0;k< std::min(skim_size, lib_structs.size() ) ;k++){
206 select_lib_structs.push_back( lib_structs[k] );
216 TR.Info <<
"Batchrelax time: " << endtime - starttime <<
" for " << select_lib_structs.size() <<
" structures " << std::endl;
219 for(
core::Size h = 0; h < select_lib_structs.size(); h++){
220 TR.Info <<
"DOING: " << h <<
" / " << select_lib_structs.size() << std::endl;
222 select_lib_structs[h]->fill_pose( rpose );
224 TR.Info <<
"score: " << h <<
" " << score << std::endl;
225 if( score < bestscore ){
233 std::string silent_file_ = option[ OptionKeys::out::file::silent ]();
234 for(
core::Size h = 0; h < select_lib_structs.size(); h++){
235 if( h == bestindex ) {
237 select_lib_structs[h]->fill_pose( rpose );
238 #ifdef BOINC_GRAPHICS
240 core::Real score = select_lib_structs[h]->get_energy(
"score");
241 boinc::Boinc::update_graphics_low_energy( pose, score );
242 boinc::Boinc::update_graphics_last_accepted( pose, score );
244 select_lib_structs[h]->add_energy(
"round",
round, 1.0 );
245 select_lib_structs[h]->set_decoy_tag(
"S_" + string_of(
round ) +
"_" + string_of( h ) );
246 select_lib_structs[h]->sort_silent_scores();
251 checkpoints_.checkpoint( pose, get_current_tag(), checkpoint_id,
true );
257 std::cerr <<
"BOINC Finishing normally." << std::endl;
263 TR <<
"Finished serial loophash." << std::endl;
270 using namespace basic::options;
271 using namespace basic::options::OptionKeys;
272 using namespace protocols::loophash;
278 if ( option[lh::create_db]() ){;
279 loop_hash_library->create_db();
280 loop_hash_library->save_db();
287 loop_hash_library->load_db();
290 }
catch ( utility::excn::EXCN_Base& excn ) {
291 std::cerr <<
"Exception: " << std::endl;
292 excn.show( std::cerr );
293 std::cout <<
"Exception: " << std::endl;
294 excn.show( std::cout );