63 #include <ObjexxFCL/format.hh>
64 #include <ObjexxFCL/string.functions.hh>
65 #include <ObjexxFCL/FArray1D.hh>
66 #include <ObjexxFCL/FArray2D.hh>
69 #include <numeric/random/random.hh>
71 #include <utility/io/ozstream.hh>
73 #include <basic/Tracer.hh>
74 #include <basic/options/option.hh>
75 #include <basic/options/keys/loops.OptionKeys.gen.hh>
76 #include <basic/options/keys/jumps.OptionKeys.gen.hh>
77 #include <basic/options/keys/resample.OptionKeys.gen.hh>
78 #include <basic/options/keys/fold_cst.OptionKeys.gen.hh>
79 #include <basic/options/keys/out.OptionKeys.gen.hh>
80 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
98 #include <utility/vector0.hh>
99 #include <utility/vector1.hh>
102 static numeric::random::RandomGenerator
RG(198243);
103 static basic::Tracer
tr(
"protocols.abinitio",basic::t_info);
105 using namespace core;
112 using namespace basic::options;
113 using namespace basic::options::OptionKeys;
116 option.add_relevant( resample::silent );
117 option.add_relevant( resample::tag );
118 option.add_relevant( resample::stage2 );
119 option.add_relevant( resample::min_max_start_seq_sep );
120 option.add_relevant( jumps::bb_moves );
121 option.add_relevant( jumps::no_wobble );
122 option.add_relevant( jumps::no_shear );
123 option.add_relevant( jumps::no_sample_ss_jumps );
124 option.add_relevant( jumps::invrate_jump_move );
125 option.add_relevant( jumps::chainbreak_weight_stage1 );
126 option.add_relevant( jumps::chainbreak_weight_stage2 );
127 option.add_relevant( jumps::chainbreak_weight_stage3 );
128 option.add_relevant( jumps::chainbreak_weight_stage4 );
129 option.add_relevant( jumps::increase_chainbreak );
130 option.add_relevant( jumps::ramp_chainbreaks );
135 option.add_relevant( jumps::sep_switch_accelerate );
136 option.add_relevant( jumps::dump_frags );
137 option.add_relevant( OptionKeys::loops::idealize_after_loop_close );
138 option.add_relevant( fold_cst::constraint_skip_rate );
142 namespace protocols {
145 using namespace basic::options;
146 using namespace basic::options::OptionKeys;
148 KinematicAbinitio::~KinematicAbinitio() {}
151 KinematicAbinitio::KinematicAbinitio(
157 FoldConstraints ( brute_move_small, brute_move_large, smooth_move_small, dummy ),
158 bRampChainbreaks_( true )
170 bRampChainbreaks_( true )
180 Real chainbreak_score_1 = option[ jumps::chainbreak_weight_stage1 ]();
181 Real chainbreak_score_2 = option[ jumps::chainbreak_weight_stage2 ]();
182 Real chainbreak_score_3 = option[ jumps::chainbreak_weight_stage3 ]();
183 Real chainbreak_score_4 = option[ jumps::chainbreak_weight_stage4 ]();
212 Real const setting( 0.25 / 3 * option[ jumps::increase_chainbreak ] );
235 Real progress( 1.0* iteration/total );
237 Real const fact( progress * 1.0/3 * option[ jumps::increase_chainbreak ]);
253 Real progress( 1.0* iteration/total );
255 Real const setting( ( 1.5*progress+2.5 ) * ( 1.0/3) * option[ jumps::increase_chainbreak ]);
291 utility::io::ozstream out( filename , std::ios_base::out | std::ios_base::app );
292 using namespace ObjexxFCL::fmt;
296 << RJ(10, pss.
get_energy (
"score" ) ) <<
" ";
297 out << RJ(5,
kinematics().sampling_fold_tree().num_jump() ) <<
" ";
307 if ( option[ resample::silent ].user() ) {
310 if ( option[ resample::tag ].user() ) {
311 tag = option[ resample::tag ]();
315 tag = job->input_tag();
320 utility_exit_with_message(
"no resample tag found -- supply either via -resample:tag or via JobDistributor input_tag");
326 utility_exit_with_message(
"resampling for " + tag +
" failed, problem reading silent file " + filename );
330 utility_exit_with_message(
"resampling for " + tag +
" failed, not found in silent file " + filename );
338 if ( option[ resample::jumps ] ) {
339 using namespace jumping;
340 using namespace fragment;
343 tr.Warning <<
"enable JUMP MOVES in resamplin --- these are taken from SS-library"
344 <<
" no matter where original structures came from" << std::endl;
345 FragSetOP jump_frags =
new OrderedFragSet;
350 for ( FrameList::iterator jump_frame = jump_frames.begin();
351 jump_frame != jump_frames.end(); ++jump_frame ) {
353 library_pairings.push_back( target_pairing );
363 using namespace protocols::simple_moves;
365 jump_mover->type(
"JumpMoves" );
366 jump_mover->set_check_ss(
false );
367 jump_mover->enable_end_bias_check(
false );
368 recovered_control->set_jump_mover( jump_mover );
370 tr.Warning <<
"disable JUMP MOVES in resampling... probably not much of difference" << std::endl;
371 recovered_control->set_jump_mover( NULL );
373 recovered_control->set_sampling_fold_tree( pose.
fold_tree() );
375 if ( !option[ resample::stage1 ] ) {
378 if ( !option[ resample::stage2 ] ) {
381 if ( option[ resample::min_max_start_seq_sep ].user() ) {
382 Real const min_sep( option[ resample::min_max_start_seq_sep ]()[ 1 ] );
383 Real const max_sep( option[ resample::min_max_start_seq_sep ]()[ 2 ] );
385 Real val = r/(max_sep-min_sep)+min_sep;
392 tr.Debug <<
"set movemap from KinematicControl " << std::endl;
396 tr.Debug <<
"KinematicControl is implemented: ready to rumble " << std::endl;
406 if ( option[ jumps::dump_frags ] ) {
410 using namespace basic::options;
411 using namespace basic::options::OptionKeys;
412 using namespace scoring::constraints;
415 if ( option[ fold_cst::keep_skipped_csts ] ) {
427 if ( option[ fold_cst::constraint_skip_rate ].user() ) {
429 Real const skip_rate( option[ fold_cst::constraint_skip_rate ]() );
430 tr.Info <<
"Skip some constraints: " << skip_rate << std::endl;
431 ConstraintCOPs cst_list = orig_constraints->get_all_constraints();
433 for ( ConstraintCOPs::const_iterator it = cst_list.begin(), eit = cst_list.end();
435 Real local_skip( 1.0 );
436 if ( option[ fold_cst::violation_skip_basis ].user() ) {
437 Real const basis( option[ fold_cst::violation_skip_basis ] );
438 Real const base_line( option[ fold_cst::violation_skip_ignore ] );
441 local_skip*=1.0*(cfunc.
viols()-base_line)/basis;
442 tr.Trace <<
"ponder constraint "; (*it)->show_def(
tr.Trace, pose );
443 tr.Trace <<
"skip prob: " << skip_rate*local_skip <<
" computed from, viols :" << cfunc.
viols() <<
" - " << base_line <<
" base: "
444 << basis <<
" times overall skip_rate " << skip_rate << std::endl;
445 if ( local_skip > 1.0 ) local_skip = 1.0;
446 }
catch ( std::bad_cast ){};
449 if ( r > skip_rate*local_skip ) {
450 tr.Trace <<
"keep constraint";
451 (*it)->show_def(
tr.Trace, pose );
452 tr.Trace << std::endl;
453 filtered_cst->add_constraint( (*it)->clone() );
454 }
else skipped_list.push_back( *it );
457 if (
tr.Debug.visible() ) {
458 filtered_cst->show_definition( std::cout, pose );
486 if ( option[ OptionKeys::loops::idealize_after_loop_close ]()){
488 idealizer.
fast(
false );
489 idealizer.
apply( pose );
494 if ( orig_constraints && option[ basic::options::OptionKeys::out::file::silent ].user() ) {
501 utility::io::ozstream viol_stream;
502 viol_stream.open_append( viol_file );
503 for ( ConstraintCOPs::const_iterator it = cst_list.begin(), eit = cst_list.end();
506 if ( (*it)->show_violations(
tr.Debug, pose, 1, 1.1 ) ) {
507 viol_stream <<
"AKTIV VIOL ";
509 viol_stream <<
"AKTIV PASS ";
511 (*it)->show_def( viol_stream, pose );
515 for ( ConstraintCOPs::const_iterator it = skipped_list.begin(), eit = skipped_list.end();
518 if ( (*it)->show_violations(
tr.Debug, pose, 1, 1.1 ) ) {
519 viol_stream <<
"PASSIV VIOL ";
521 viol_stream <<
"PASSIV PASS ";
523 (*it)->show_def( viol_stream, pose );
529 if ( orig_constraints && !option[ fold_cst::keep_skipped_csts ] ) {
541 return "KinematicAbinitio";
546 if ( !jump_mover )
return std_mover;
549 Size nfrag_moves( option[ jumps::invrate_jump_move ] );
550 for (
Size i = 1; i<=nfrag_moves; i++ ) {
551 combi_move->add_mover( std_mover );
553 combi_move->add_mover( jump_mover );
563 Real crank_up_angle )
565 using namespace basic::options;
566 using namespace basic::options::OptionKeys;
568 int const nmoves ( 5 );
574 small_mover->angle_max(
'H', 2.0*crank_up_angle );
575 small_mover->angle_max(
'E', 2.0*crank_up_angle );
576 small_mover->angle_max(
'L', 3.0*crank_up_angle );
580 shear_mover->angle_max(
'H', 2.0*crank_up_angle*2.0 );
581 shear_mover->angle_max(
'E', 2.0*crank_up_angle*2.0 );
582 shear_mover->angle_max(
'L', 3.0*crank_up_angle*2.0 );
586 cycle->add_mover( std_mover );
587 cycle->add_mover( small_mover );
588 if ( !option[ jumps::no_shear ]() ) cycle->add_mover( shear_mover );
590 if ( !option[ jumps::no_wobble ]() ) {
592 if ( bLargeWobble ) {
604 }
else return trials;
611 }
else return trials;
616 using namespace basic::options;
617 using namespace basic::options::OptionKeys;
625 if ( option[ jumps::bb_moves ] ) {
627 bool bLargeWobble(
true );
628 Real crank_up_angle = 6.0;
638 using namespace basic::options;
639 using namespace basic::options::OptionKeys;
645 if ( option[ jumps::bb_moves ] ) {
647 bool bLargeWobble( kk<=1 );
648 Real crank_up_angle = 5.0;
670 current_jumps = jump_def_->create_jump_sample();
671 }
while ( !current_jumps.
is_valid() && attempts-- );
674 utility_exit_with_message(
"not able to build valid fold-tree in JumpingFoldConstraints::setup_foldtree" );
679 new_movemap->set_jump(
true );
682 jump_frags = jump_def_->generate_jump_frags( current_jumps, *new_movemap );
683 using namespace protocols::simple_moves;
685 jump_mover->type(
"JumpMoves" );
686 jump_mover->set_check_ss(
false );
687 jump_mover->enable_end_bias_check(
false );
691 tr.Debug <<
"JumpingFoldConstraintsWrapper: sampling fold_tree " << current_jumps.
fold_tree() << std::endl;
692 kc->set_final_fold_tree( pose.
fold_tree() );
693 tr.Debug <<
"JumpingFoldConstraintsWrapper: final fold_tree " << pose.
fold_tree() << std::endl;
694 kc->set_jump_mover( jump_mover );
695 kc->set_movemap( new_movemap );
697 if ( jump_mover() && option[ jumps::no_sample_ss_jumps ] ) {
698 jump_mover()->apply_at_all_positions( pose );
699 kc->set_jump_mover( NULL );
706 res_switch.
apply( pose );
713 return "JumpingFoldConstraintsWrapper";
723 ) :
KinematicAbinitio ( brute_move_small, brute_move_large, smooth_move_small, dummy ),
724 jump_def_ ( jump_def )
736 jump_def_( jump_def )