51 #include <ObjexxFCL/string.functions.hh>
54 #include <utility/exit.hh>
55 #include <utility/vector1.fwd.hh>
56 #include <utility/pointer/ReferenceCount.hh>
59 #include <utility/io/ozstream.hh>
60 #include <numeric/numeric.functions.hh>
61 #include <basic/prof.hh>
62 #include <basic/Tracer.hh>
63 #include <basic/options/option.hh>
64 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
65 #include <basic/options/keys/run.OptionKeys.gen.hh>
66 #include <basic/options/keys/templates.OptionKeys.gen.hh>
79 #include <utility/vector0.hh>
80 #include <utility/vector1.hh>
83 static basic::Tracer
tr(
"protocols.abinitio");
87 using namespace basic;
88 using namespace basic::options;
89 using namespace basic::options::OptionKeys;
109 using namespace basic::options;
110 using namespace basic::options::OptionKeys;
111 option.add_relevant( OptionKeys::abinitio::increase_cycles );
112 option.add_relevant( OptionKeys::abinitio::smooth_cycles_only );
114 option.add_relevant( OptionKeys::abinitio::skip_convergence_check );
115 option.add_relevant( OptionKeys::abinitio::log_frags );
116 option.add_relevant( OptionKeys::abinitio::only_stage1 );
117 option.add_relevant( OptionKeys::abinitio::end_bias );
118 option.add_relevant( OptionKeys::abinitio::symmetry_residue );
119 option.add_relevant( OptionKeys::abinitio::vdw_weight_stage1 );
120 option.add_relevant( OptionKeys::abinitio::override_vdw_all_stages );
121 option.add_relevant( OptionKeys::abinitio::recover_low_in_stages );
122 option.add_relevant( OptionKeys::abinitio::close_chbrk );
126 namespace protocols {
131 return find( vec.begin(), vec.end(), query) != vec.end();
137 ClassicAbinitio::ClassicAbinitio(
143 brute_move_small_( brute_move_small ),
144 brute_move_large_( brute_move_large ),
145 smooth_move_small_( smooth_move_small )
151 movemap_ = brute_move_large->movemap();
168 using namespace basic::options;
175 if ( option[ OptionKeys::abinitio::log_frags ].user() ) {
176 if ( !option[
OptionKeys::abinitio::debug ] ) utility_exit_with_message(
"apply option abinitio::log_frags always together with abinitio::debug!!!");
179 sms =
new SmoothFragmentMover( fragset_small, movemap,
new GunnCost );
180 }
else if ( option[ OptionKeys::abinitio::symmetry_residue ].user() ) {
181 Size const sr ( option[ OptionKeys::abinitio::symmetry_residue ] );
182 bms =
new SymmetricFragmentMover( fragset_small, movemap, sr );
183 bml =
new SymmetricFragmentMover( fragset_large, movemap, sr );
184 sms =
new SmoothSymmetricFragmentMover( fragset_small, movemap,
new GunnCost, sr );
186 bms =
new ClassicFragmentMover( fragset_small, movemap );
187 bml =
new ClassicFragmentMover( fragset_large, movemap );
188 sms =
new SmoothFragmentMover ( fragset_small, movemap,
new GunnCost );
191 bms->set_end_bias( option[ OptionKeys::abinitio::end_bias ] );
192 bml->set_end_bias( option[ OptionKeys::abinitio::end_bias ] );
193 sms->set_end_bias( option[ OptionKeys::abinitio::end_bias ] );
271 using namespace moves;
272 using namespace scoring;
273 using namespace scoring::constraints;
276 if ( option[ OptionKeys::run::dry_run ]() )
return;
281 bool success(
true );
285 PROF_START( basic::STAGE1 );
286 clock_t starttime = clock();
293 tr.Info <<
"\n===================================================================\n";
294 tr.Info <<
" Stage 1 \n";
295 tr.Info <<
" Folding with score0 for max of " <<
stage1_cycles() << std::endl;
297 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
317 clock_t endtime = clock();
318 PROF_STOP( basic::STAGE1 );
319 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
321 tr.Info <<
"Timeperstep: " << (double(endtime) - starttime )/(CLOCKS_PER_SEC ) << std::endl;
336 tr.Info <<
"\n===================================================================\n";
337 tr.Info <<
" Stage 2 \n";
338 tr.Info <<
" Folding with score1 for " <<
stage2_cycles() << std::endl;
340 PROF_START( basic::STAGE2 );
341 clock_t starttime = clock();
345 Real const setting( 0.25 );
347 tr.Info <<
" Chain_break score assigned " << std::endl;
373 clock_t endtime = clock();
374 PROF_STOP( basic::STAGE2 );
375 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
378 tr <<
"Timeperstep: " << (double(endtime) - starttime )/(CLOCKS_PER_SEC ) << std::endl;
391 tr.Info <<
"\n===================================================================\n";
392 tr.Info <<
" Stage 3 \n";
393 tr.Info <<
" Folding with score2 and score5 for " <<
stage3_cycles() <<std::endl;
395 PROF_START( basic::STAGE3 );
396 clock_t starttime = clock();
413 clock_t endtime = clock();
414 PROF_STOP( basic::STAGE3);
415 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
418 tr <<
"Timeperstep: " << (double(endtime) - starttime )/( CLOCKS_PER_SEC) << std::endl;
432 tr.Info <<
"\n===================================================================\n";
433 tr.Info <<
" Stage 4 \n";
436 PROF_START( basic::STAGE4 );
437 clock_t starttime = clock();
454 clock_t endtime = clock();
455 PROF_STOP( basic::STAGE4 );
456 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
459 tr <<
"Timeperstep: " << (double(endtime) - starttime )/( CLOCKS_PER_SEC ) << std::endl;
462 tr.Info <<
"\n===================================================================\n";
463 tr.Info <<
" Finished Abinitio \n";
464 tr.Info << std::endl;
471 tr.Info <<
"\n===================================================================\n";
472 tr.Info <<
" Stage 5 \n";
475 PROF_START( basic::STAGE5 );
476 clock_t starttime = clock();
492 clock_t endtime = clock();
493 PROF_STOP( basic::STAGE5 );
494 if ( option[ basic::options::OptionKeys::run::profile ] ) prof_show();
497 tr <<
"Timeperstep: " << (double(endtime) - starttime )/( CLOCKS_PER_SEC ) << std::endl;
500 tr.Info <<
"\n===================================================================\n";
501 tr.Info <<
" Now really finished Abinitio \n";
502 tr.Info << std::endl;
520 return "ClassicAbinitio";
639 using namespace basic::options;
640 if ( option[ OptionKeys::abinitio::only_stage1 ]() ) {
649 using namespace scoring;
650 using namespace basic::options;
651 using namespace basic::options::OptionKeys;
653 tr.Debug <<
"creating standard scoring functions" << std::endl;
655 if ( option[ OptionKeys::abinitio::stage1_patch ].user() ) {
661 if ( option[ OptionKeys::abinitio::stage2_patch ].user() ) {
667 if ( option[ OptionKeys::abinitio::stage3a_patch ].user() ) {
673 if ( option[ OptionKeys::abinitio::stage3b_patch ].user() ) {
679 if ( option[ OptionKeys::abinitio::stage4_patch ].user() ) {
685 if ( option[ OptionKeys::abinitio::stage5_patch ].user() ) {
692 if ( option[ OptionKeys::abinitio::override_vdw_all_stages ] ) {
700 tr.Debug <<
"set score weights for ";
702 else tr.Debug <<
"stage " << (stage <=
STAGE_3a ? stage : ( stage-1 ) ) << ( stage ==
STAGE_3b ?
"b " :
" " );
732 using namespace basic::options;
734 bQuickTest_ = basic::options::option[ basic::options::OptionKeys::run::test_cycles ]();
739 set_cycles( option[ OptionKeys::abinitio::increase_cycles ] );
745 if ( option[ OptionKeys::abinitio::only_stage1 ] ) {
749 if ( option[ OptionKeys::abinitio::include_stage5 ] ) {
758 if ( option[ OptionKeys::abinitio::recover_low_in_stages ].user() ) {
759 for ( IntegerVectorOption::const_iterator it = option[ OptionKeys::abinitio::recover_low_in_stages ]().begin(),
760 eit = option[ OptionKeys::abinitio::recover_low_in_stages ]().
end(); it!=eit; ++it ) {
763 else if ( *it == 3 ) {
779 close_chbrk_ = option[ OptionKeys::abinitio::close_chbrk ];
794 void reset() { ct_ = 0; bInit_ =
false; }
813 very_old_pose_ = pose;
816 runtime_assert( trials_ );
817 tr.Trace <<
"TrialCounter in hConvergenceCheck: " << trials_->num_accepts() << std::endl;
818 if ( numeric::mod(trials_->num_accepts(),100) != 0 )
return true;
819 if ( (
Size) trials_->num_accepts() <= last_move_ )
return true;
820 last_move_ = trials_->num_accepts();
827 very_old_pose_ = pose;
828 if ( converge_rms >= 3.0 ) {
832 tr.Info <<
" stop cycles in stage3 due to convergence " << std::endl;
846 trial->apply( pose );
848 tr.Info <<
"Replaced extended chain after " << j <<
" cycles." << std::endl;
853 tr.Warning <<
"Warning: extended chain may still remain after " <<
stage1_cycles() <<
" cycles!" << std::endl;
889 using namespace ObjexxFCL;
902 hConvergenceCheckOP convergence_checker ( NULL );
903 if ( !option[ basic::options::OptionKeys::abinitio::skip_convergence_check ] ) {
909 for (
int lct1 = 1; lct1 <= nloop1; lct1++) {
911 for (
int lct2 = 1; lct2 <= nloop2; lct2++, iteration++ ) {
912 tr.Debug <<
"Loop: " << lct1 <<
" " << lct2 << std::endl;
920 tr.Debug <<
" Score stage3 loop iteration " << lct1 <<
" " << lct2 << std::endl;
921 if ( convergence_checker ) {
923 convergence_checker->set_trials( stage3_trials );
929 if ( numeric::mod( (
int)iteration, 2 ) == 0 || iteration > 7 )
recover_low( pose,
STAGE_3a );
958 Size nloop_stage4 = 3;
960 for (
Size kk = 1; kk <= nloop_stage4; ++kk ) {
961 tr.Debug <<
"prepare ..." << std::endl ;
969 tr.Debug <<
"switch to smooth moves" << std::endl;
975 tr.Debug <<
"finished" << std::endl;
995 small_mover->angle_max(
'H', 2.0 );
996 small_mover->angle_max(
'E', 2.0 );
997 small_mover->angle_max(
'L', 5.0 );
1044 mc_->recover_low( pose );
1061 if ( stage ==
STAGE_5 ) temperature = 0.5;
1062 mc_->set_autotemp(
true, temperature );
1063 mc_->set_temperature( temperature );
1087 (*score_stage1_)( pose );
1095 (*score_stage2_)(pose);
1104 if ( option[ templates::change_movemap ].user() && option[ templates::change_movemap ] == 3 ) {
1106 new_mm->set_bb(
true );
1115 (*score_stage4_)( pose );
1118 if ( option[ templates::change_movemap ].user() && option[ templates::change_movemap ] == 4 ) {
1120 new_mm->set_bb(
true );
1121 tr.Debug <<
"option: templates::change_movemap ACTIVE: set_movemap" << std::endl;
1132 (*score_stage5_)( pose );
1140 Real chbrk_weight_stage_3a = 0;
1141 Real chbrk_weight_stage_3b = 0;
1143 if ( numeric::mod( (
int)iteration, 2 ) == 0 || iteration > 7 ) {
1144 Real progress( iteration );
1145 chbrk_weight_stage_3a = 0.25 * progress;
1146 tr.Debug <<
"select score_stage3a..." << std::endl;
1150 Real progress( iteration );
1151 chbrk_weight_stage_3b = 0.05 * progress;
1152 tr.Debug <<
"select score_stage3b..." << std::endl;
1170 Real chbrk_weight_stage_4 (iteration*0.5+2.5);
1187 using namespace core::io::silent;
1192 if ( option[ basic::options::OptionKeys::abinitio::explicit_pdb_debug ]() ) {
1196 if ( option[ basic::options::OptionKeys::abinitio::log_frags ].user() ) {
1198 utility::io::ozstream output( filename );
1200 log_frag.
show( output );