Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KinematicAbinitio.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file FoldConstraints.cc
11 /// @brief ab-initio fragment assembly protocol for proteins under the influence of contraints (e.g., NOE)
12 /// @detailed
13 /// @author Oliver Lange
14 ///
15 
16 
17 // Unit Headers
19 
20 // Package Headers
22 #include <protocols/jumping/JumpSample.hh> //for diagnosis output
25 
26 // Project Headers
27 #include <core/pose/Pose.hh>
30 
33 
34 #include <core/types.hh>
35 
37 // AUTO-REMOVED #include <core/fragment/FragSetCollection.hh>
39 
41 
45 // AUTO-REMOVED #include <protocols/moves/RepeatMover.hh>
46 
49 
52 
55 
58 
59 #include <core/fragment/FragSet.hh>
60 
61 
62 // ObjexxFCL Headers
63 #include <ObjexxFCL/format.hh>
64 #include <ObjexxFCL/string.functions.hh>
65 #include <ObjexxFCL/FArray1D.hh>
66 #include <ObjexxFCL/FArray2D.hh>
67 
68 // Utility headers
69 #include <numeric/random/random.hh>
70 // AUTO-REMOVED #include <utility/io/izstream.hh> //for cheats
71 #include <utility/io/ozstream.hh> //for dump_frags
72 
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>
81 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
82 
85 
86 //// C++ headers
87 //#include <cstdlib>
88 //#include <string>
89 #include <fstream>
90 
91 //Auto Headers
92 #include <core/fragment/Frame.hh>
98 #include <utility/vector0.hh>
99 #include <utility/vector1.hh>
100 
101 
102 static numeric::random::RandomGenerator RG(198243); // <- Magic number, do not change it!
103 static basic::Tracer tr("protocols.abinitio",basic::t_info);
104 
105 using namespace core;
109 
110 //@detail call this static routine before core::init to register the options
112  using namespace basic::options;
113  using namespace basic::options::OptionKeys;
115 
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 );
131  option.add_relevant( jumps::overlap_chainbreak );
132  // constraints/chainbreaks are phased in regarding their seq-sep. it grows from 15 (stage2 ) to MAX at end of stage4
133  // seqsep_accelerate > 0 will increase MAX such that constraints/chainbreak are enforced earlier. seqsep_accelerate = 0 means
134  // that MAX is exactly the longest seq-sep found in a given fold-tree.
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 );
139 
140 }
141 
142 namespace protocols {
143 namespace abinitio {
144 
145 using namespace basic::options;
146 using namespace basic::options::OptionKeys;
147 
148 KinematicAbinitio::~KinematicAbinitio() {}
149 
150 //@detail c'stor
151 KinematicAbinitio::KinematicAbinitio(
152  simple_moves::FragmentMoverOP brute_move_small,
153  simple_moves::FragmentMoverOP brute_move_large,
154  simple_moves::FragmentMoverOP smooth_move_small,
155  int dummy /* otherwise the two constructors are ambigous */
156 ) :
157  FoldConstraints ( brute_move_small, brute_move_large, smooth_move_small, dummy ),
158  bRampChainbreaks_( true )
159 {
160  BaseClass::type( "KinematicAbinitio" );
162 }
163 
164 
166  core::fragment::FragSetCOP fragset3mer,
167  core::fragment::FragSetCOP fragset9mer,
169 ) : FoldConstraints ( fragset3mer, fragset9mer, movemap ),
170  bRampChainbreaks_( true )
171 {
172  BaseClass::type( "KinematicAbinitio" );
174 }
175 
176 void
179  // set low chainbreak energy for stage 1 + 2
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 ]();
184  if ( !bRampChainbreaks_ ) {
185  set_score_weight( scoring::linear_chainbreak, chainbreak_score_1, STAGE_1 );
186  set_score_weight( scoring::linear_chainbreak, chainbreak_score_2, STAGE_2 );
187  set_score_weight( scoring::linear_chainbreak, chainbreak_score_3, STAGE_3a );
188  set_score_weight( scoring::linear_chainbreak, chainbreak_score_3, STAGE_3b );
189  set_score_weight( scoring::linear_chainbreak, chainbreak_score_4, STAGE_4 );
190  }
191 }
192 
193 //@brief read out cmd-line options
196  bRampChainbreaks_ = option[ jumps::ramp_chainbreaks ]; //default is true
198 }
199 
200 void KinematicAbinitio::replace_scorefxn( core::pose::Pose& pose, StageID stage, core::Real intra_stage_progress ) {
201  Parent::replace_scorefxn( pose, stage, intra_stage_progress );
203  kinematics().add_score_weights( scorefxn, 1.0 * stage / 2.0 + intra_stage_progress * 0.2 );
204  current_scorefxn( scorefxn );
205 }
206 
207 bool
209  //we set score term in here: we minimize in this one... need to set all score terms before that
210  bool success = Parent::prepare_stage1( pose );
211  if ( bRampChainbreaks_ ) {
212  Real const setting( 0.25 / 3 * option[ jumps::increase_chainbreak ] );
215  }
216  return success;
217 }
218 
219 bool
221  return Parent::prepare_stage2( pose );
222 }
223 
224 bool
226  return Parent::prepare_stage3( pose );
227 }
228 
229 bool
231  core::pose::Pose& pose,
232  Size iteration, /* loop_iteration*/
233  Size total /* total_iterations */
234 ) {
235  Real progress( 1.0* iteration/total );
236  if ( bRampChainbreaks_ ) {
237  Real const fact( progress * 1.0/3 * option[ jumps::increase_chainbreak ]);
238  //score_stage3a ( score2 )
240  //score_stage3b ( score5 )
242  }
243  return Parent::prepare_loop_in_stage3( pose, iteration, total ); //minimization happens here!
244 }
245 
246 
247 bool
249  core::pose::Pose& pose,
250  Size iteration, /* loop_iteration*/
251  Size total /* total_iterations */
252 ) {
253  Real progress( 1.0* iteration/total );
254  if ( bRampChainbreaks_ ) {
255  Real const setting( ( 1.5*progress+2.5 ) * ( 1.0/3) * option[ jumps::increase_chainbreak ]);
258  if ( bOverlapChainbreaks_ ) {
261  }
262  }
263  return Parent::prepare_loop_in_stage4( pose, iteration, total );
264 }
265 
266 
267 void
269  //if not already set, --> fix the chainbreaks dependent on distance
270  kinematics().add_chainbreak_variants( pose, max_dist, constraints().shortest_path() );
271  mc().reset( pose ); //necessary to avoid that new chainbreaks are immediatly removed by copying back the old pose
272  Parent::set_max_seq_sep( pose, max_dist );
273 }
274 
275 ///@details the native_pose_ is used to determine orientation and pleating of jumps
276 // void
277 // KinematicAbinitio::set_native_pose( core::pose::Pose const& native_pose ) {
278 // native_pose_ = new core::pose::Pose( native_pose );
279 // }
280 
281 void
283  // diagnostics for jumps
284  if ( get_native_pose() ) {
285  pose::Pose native_pose( *get_native_pose() );
286  native_pose.fold_tree( kinematics().sampling_fold_tree() );
288  pss.fill_struct( pose, "jump_log" );
289  evaluate_pose( pose, "jump_log", pss );
290 
291  utility::io::ozstream out( filename , std::ios_base::out | std::ios_base::app );
292  using namespace ObjexxFCL::fmt;
293  out << get_current_tag() << " "
294  << RJ(10, pss.get_energy ( "rms" ) ) << " "
295  // << RJ(10, pss.get_energy ( "rms_native" ) ) << " "
296  << RJ(10, pss.get_energy ( "score" ) ) << " ";
297  out << RJ(5, kinematics().sampling_fold_tree().num_jump() ) << " ";
298  for ( Size i = 1; i<=kinematics().sampling_fold_tree().num_jump(); i++ ) {
299  out << RJ(10, simple_filters::JumpEvaluator( native_pose, i ).apply( pose ) ) << " ";
300  }
301  out << jumping::JumpSample( pose.fold_tree() ) << " " << std::endl;
302  }
303 }
304 
305 void
307  if ( option[ resample::silent ].user() ) {
308  std::string const filename( option[ resample::silent ]() );
309  std::string tag("");
310  if ( option[ resample::tag ].user() ) {
311  tag = option[ resample::tag ]();
312  } else {
314  if ( job ) {
315  tag = job->input_tag();
316  }
317  }
318 
319  if ( tag == "" ) {
320  utility_exit_with_message("no resample tag found -- supply either via -resample:tag or via JobDistributor input_tag");
321  }
322 
323  //retrieve pose
325  if ( !sfd.read_file( filename ) ) {
326  utility_exit_with_message( "resampling for " + tag + " failed, problem reading silent file " + filename );
327  }
328 
329  if ( !sfd.has_tag( tag ) ) {
330  utility_exit_with_message( "resampling for " + tag + " failed, not found in silent file " + filename );
331  }
332  ConstraintSetOP cst_set = new ConstraintSet( *pose.constraint_set() ); //keep constraints from pose, (make new to remove constant)
333  sfd.get_structure( tag ).fill_pose( pose ); //fill pose and fold-tree from file
334  pose.constraint_set( cst_set ); // put constraint set back into place
335 
336  //retrieve fold_tree from pose
337  KinematicControlOP recovered_control = new KinematicControl( kinematics() );
338  if ( option[ resample::jumps ] ) {
339  using namespace jumping;
340  using namespace fragment;
341  JumpSample target_jumps( pose.fold_tree() );
342  target_jumps.steal_orientation_and_pleating( pose );
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;
346  //generate fragments from all homologes
347  core::fragment::FrameList jump_frames;
348  target_jumps.generate_jump_frames( jump_frames, kinematics().movemap() );
349  core::scoring::dssp::PairingsList library_pairings;
350  for ( FrameList::iterator jump_frame = jump_frames.begin();
351  jump_frame != jump_frames.end(); ++jump_frame ) {
352  core::scoring::dssp::Pairing target_pairing( target_jumps.get_pairing( (*jump_frame)->start(), (*jump_frame)->stop() ) );
353  library_pairings.push_back( target_pairing );
354  }
355  //fill remaining frames from ss-library
357  generate_jump_frags(
358  library_pairings,
359  kinematics().movemap(),
360  true /*with Torsion*/,
361  *jump_frags
362  );
363  using namespace protocols::simple_moves;
364  simple_moves::ClassicFragmentMoverOP jump_mover = new ClassicFragmentMover( jump_frags, kinematics().movemap_ptr() );
365  jump_mover->type( "JumpMoves" );
366  jump_mover->set_check_ss( false ); // this doesn't make sense with jump fragments
367  jump_mover->enable_end_bias_check( false ); //no sense for discontinuous fragments
368  recovered_control->set_jump_mover( jump_mover );
369  } else {
370  tr.Warning << "disable JUMP MOVES in resampling... probably not much of difference" << std::endl;
371  recovered_control->set_jump_mover( NULL ); // this mover will not have the correct jumps ... but jump-moves seem ineffective in stage3 an
372  }
373  recovered_control->set_sampling_fold_tree( pose.fold_tree() );
374  set_kinematics( recovered_control );
375  if ( !option[ resample::stage1 ] ) { //default true
376  set_skip_stage1( true );
377  }
378  if ( !option[ resample::stage2 ] ) {
379  set_skip_stage2( true );
380  }
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 ] );
384  Real r = RG.uniform();
385  Real val = r/(max_sep-min_sep)+min_sep;
386  set_seq_sep_stage1( val );
387  if ( val > 0.5 ) set_seq_sep_stage3( val ); //hard-coded number replace later
388  }
389  }
390 
391  // evaluation::MetaPoseEvaluatorOP ori_evaluator = evaluator();
392  tr.Debug << "set movemap from KinematicControl " << std::endl;
393  set_movemap( kinematics().movemap_ptr() );
394  //set fold-tree, apply a fragment from each jump_mover frame once
396  tr.Debug << "KinematicControl is implemented: ready to rumble " << std::endl;
397 
398  // set max_seq_separation fudge -factor such that distance contraints are not enforced far too late
399  // let's have it depend on the number of jumps. -- this is totally arbitrary
400  // maybe should check if it is actually better to keep the ramping speed fixed ( independen of max_possible_seq_separation ).
401  max_seq_sep_fudge( 1.0 + kinematics().sampling_fold_tree().num_jump() * option[ jumps::sep_switch_accelerate ] );
402 
403  // diagnostics for jumps
404  current_scorefxn()( pose );
405  dump_jump_log( pose, "jumps_pre.log");
406  if ( option[ jumps::dump_frags ] ) {
407  fragment::FragmentIO().write_data( "fragset_jumps.dump", *(kinematics().jump_mover()->fragments()) );
408  }
409 
410  using namespace basic::options;
411  using namespace basic::options::OptionKeys;
412  using namespace scoring::constraints;
413  ConstraintSetOP orig_constraints( NULL );
414 
415  if ( option[ fold_cst::keep_skipped_csts ] ) {
416  // if this is active we let the pose leave this class with the modulated constraint set... thus we reset it each time again
417  if ( !full_constraint_set_ ) {
418  full_constraint_set_ = pose.constraint_set()->clone();
419  } else {
421  }
422  }
423 
424  ConstraintCOPs skipped_list;
425  if ( pose.constraint_set()->has_residue_pair_constraints() ) {
426  evaluator()->add_evaluation( new constraints_additional::ConstraintEvaluator( "total_cst", *pose.constraint_set() ) );
427  if ( option[ fold_cst::constraint_skip_rate ].user() ) {
428  orig_constraints = pose.constraint_set()->clone();
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();
432  ConstraintSetOP filtered_cst = new ConstraintSet; //empty
433  for ( ConstraintCOPs::const_iterator it = cst_list.begin(), eit = cst_list.end();
434  it != eit; ++it ) {
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 ] );
439  try {
440  SkipViolFunc const& cfunc = dynamic_cast< SkipViolFunc const& >( (*it)->get_func() );
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 ){};
447  }
448  Real r = RG.uniform();
449  if ( r > skip_rate*local_skip ) { //keep constraint
450  tr.Trace << "keep constraint";
451  (*it)->show_def( tr.Trace, pose );
452  tr.Trace << std::endl;
453  filtered_cst->add_constraint( (*it)->clone() ); //clone things so show_violation doesn't change the SkipViolFunc numbers
454  } else skipped_list.push_back( *it );
455  }
456  pose.constraint_set( filtered_cst );
457  if ( tr.Debug.visible() ) {
458  filtered_cst->show_definition( std::cout, pose );
459  }
460  }
461  }
462 
463  // run protocol
464  Parent::apply( pose );
465  bool success = ( get_last_move_status() == moves::MS_SUCCESS );
466 
467  // diagnostics for jumps
468  dump_jump_log( pose, "jumps.log");
469 
470  if ( success && closure_protocol_ ) {
472  closure_protocol_->movemap( movemap() );
473  closure_protocol_->fragments( brute_move_small()->fragments() );
474  closure_protocol_->set_current_tag( get_current_tag() );
475  try {
477  } catch ( loops::EXCN_Loop_not_closed& excn ) {
478  set_current_tag( "C_"+get_current_tag().substr(std::min(2,(int)get_current_tag().size())) );
480  }
481  if( option[ OptionKeys::abinitio::debug ].user() ){
482  output_debug_structure( pose, "loop_closed" );
483  }
484  //////////////////////////////////////////////////////////////////////////////////////
485  //// Maybe idealize the structure before relax ?
486  if ( option[ OptionKeys::loops::idealize_after_loop_close ]()){
488  idealizer.fast( false );
489  idealizer.apply( pose );
490  }
491  }
492 
493  { //dump violated constraints into special file
494  if ( orig_constraints && option[ basic::options::OptionKeys::out::file::silent ].user() ) {
495  ConstraintSetCOP filtered_cst = pose.constraint_set();
496  ConstraintCOPs cst_list = filtered_cst->get_all_constraints();
497  std::string viol_file="_viols";
498  if ( get_current_job() && get_current_job()->output_file_name() != "" ) {
499  viol_file = get_current_job()->output_file_name()+viol_file;
500  }
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();
504  it != eit; ++it ) {
505  viol_stream << get_current_tag() << " ";
506  if ( (*it)->show_violations( tr.Debug, pose, 1, 1.1 /*threshold*/ ) ) {
507  viol_stream << "AKTIV VIOL ";
508  } else {
509  viol_stream << "AKTIV PASS ";
510  }
511  (*it)->show_def( viol_stream, pose );
512  } //for
513 
514  //no the constraint that were not active
515  for ( ConstraintCOPs::const_iterator it = skipped_list.begin(), eit = skipped_list.end();
516  it != eit; ++it ) {
517  viol_stream << get_current_tag() << " ";
518  if ( (*it)->show_violations( tr.Debug, pose, 1, 1.1 /*threshold*/ ) ) {
519  viol_stream << "PASSIV VIOL ";
520  } else {
521  viol_stream << "PASSIV PASS ";
522  }
523  (*it)->show_def( viol_stream, pose );
524  } //for
525 
526  }
527  }//scope
528 
529  if ( orig_constraints && !option[ fold_cst::keep_skipped_csts ] ) {
530  pose.constraint_set( orig_constraints );
531  }
532 
533  if ( pose.constraint_set()->has_residue_pair_constraints() ) {
534  evaluator()->pop_back(); //remove the added evaluation called total_cst
535  }
536 
537 }
538 
541  return "KinematicAbinitio";
542 }
543 
546  if ( !jump_mover ) return std_mover;
547 
548  moves::RandomMoverOP combi_move ( new moves::RandomMover );
549  Size nfrag_moves( option[ jumps::invrate_jump_move ] );
550  for ( Size i = 1; i<=nfrag_moves; i++ ) { // a simple way of changing the relative frequencies
551  combi_move->add_mover( std_mover );
552  }
553  combi_move->add_mover( jump_mover );
554 
555  return combi_move;
556 }
557 
558 
560  pose::Pose &,
561  moves::MoverOP std_mover,
562  bool bLargeWobble,
563  Real crank_up_angle )
564 {
565  using namespace basic::options;
566  using namespace basic::options::OptionKeys;
567 
568  int const nmoves ( 5 ); //this is standard in relax
569  Real temp = mc().temperature();
570 
571  // setup the move objects
573  simple_moves::SmallMoverOP small_mover( new simple_moves::SmallMover( mm_temp, temp, nmoves ) );
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 );
577 
578  // setup the move objects
579  simple_moves::ShearMoverOP shear_mover( new simple_moves::ShearMover( mm_temp, temp, nmoves ) );
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 );
583 
584  //setup cycle
586  cycle->add_mover( std_mover ); //the current frag_trial
587  cycle->add_mover( small_mover );
588  if ( !option[ jumps::no_shear ]() ) cycle->add_mover( shear_mover );
589 
590  if ( !option[ jumps::no_wobble ]() ) {
591  // and why not throwing in a wobble ?!
592  if ( bLargeWobble ) {
593  cycle->add_mover( new simple_moves::WobbleMover( brute_move_large()->fragments(), movemap() ) );
594  } else {
595  cycle->add_mover( new simple_moves::WobbleMover( brute_move_small()->fragments(), movemap() ) );
596  }
597  }
598  return cycle;
599 }
600 
602  if ( kinematics().jump_mover() ) {
603  return new moves::TrialMover( create_jump_moves( trials->mover() ), mc_ptr() );
604  } else return trials;
605 }
606 
607 
609  if ( kinematics().jump_mover() ) {
610  return new moves::TrialMover( create_jump_moves( trials->mover() ), mc_ptr() );
611  } else return trials;
612 }
613 
614 
616  using namespace basic::options;
617  using namespace basic::options::OptionKeys;
618  moves::MoverOP moves = trials->mover();
619  if ( kinematics().jump_mover() ) {
620  //adds jump_moves to the already existant moves
621  moves = create_jump_moves( moves );
622  }
623 
624  // add also bb_moves to the existent moves
625  if ( option[ jumps::bb_moves ] ) {
626  // okay the bb_moves are asked for. We are ON AIR !
627  bool bLargeWobble( true );
628  Real crank_up_angle = 6.0; //factor to make the small_moves larger: after-all we are in centroid mode
629  moves = create_bb_moves( pose, moves, bLargeWobble, crank_up_angle );
630  }
631  moves::TrialMoverOP retval = new moves::TrialMover( moves, mc_ptr() );
632  retval->keep_stats_type( moves::accept_reject );
633  return retval;
634  //return new moves::TrialMover( moves, mc_ptr() );
635 }
636 
638  using namespace basic::options;
639  using namespace basic::options::OptionKeys;
640 
641  moves::MoverOP moves = trials->mover();
642  if ( kinematics().jump_mover() && kk <= 1 ) {
643  moves = create_jump_moves( moves );
644  }
645  if ( option[ jumps::bb_moves ] ) {
646  // okay the bb_moves are asked for. We are ON AIR !
647  bool bLargeWobble( kk<=1 );
648  Real crank_up_angle = 5.0; //factor to make the small_moves larger: after-all we are in centroid mode
649  moves = create_bb_moves( pose, moves, bLargeWobble, crank_up_angle );
650  }
651  return new moves::TrialMover( moves, mc_ptr() );
652 }
653 
654 
655 
656 void
658  ResolutionSwitcher res_switch(
659  pose,
660  !start_from_centroid(), //input pose /*is ignored now witch calls pose.is_fullatom() instead */
661  true, // starts as centroid
662  true //yeah we will apply it to a centroid structure
663  );
664 
665  // initialize jumping
666  jumping::JumpSample current_jumps;
667 
668  Size attempts( 10 );
669  do {
670  current_jumps = jump_def_->create_jump_sample();
671  } while ( !current_jumps.is_valid() && attempts-- );
672 
673  if ( !current_jumps.is_valid() ) {
674  utility_exit_with_message( "not able to build valid fold-tree in JumpingFoldConstraints::setup_foldtree" );
675  }
676 
677  //allow jumps to move
678  kinematics::MoveMapOP new_movemap = new kinematics::MoveMap( *movemap() );
679  new_movemap->set_jump( true );
680 
681  core::fragment::FragSetOP jump_frags;
682  jump_frags = jump_def_->generate_jump_frags( current_jumps, *new_movemap );
683  using namespace protocols::simple_moves;
684  simple_moves::ClassicFragmentMoverOP jump_mover = new ClassicFragmentMover( jump_frags, new_movemap );
685  jump_mover->type( "JumpMoves" );
686  jump_mover->set_check_ss( false ); // this doesn't make sense with jump fragments
687  jump_mover->enable_end_bias_check( false ); //no sense for discontinuous fragments
688 
690  kc->set_sampling_fold_tree( current_jumps.fold_tree() );
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 );
696  // run protocol
697  if ( jump_mover() && option[ jumps::no_sample_ss_jumps ] ) {
698  jump_mover()->apply_at_all_positions( pose ); //make sure each jump is initialized
699  kc->set_jump_mover( NULL ); //but no sampling
700  }
701 
702  set_kinematics( kc );
703 
704  Parent::apply( pose );
706  res_switch.apply( pose );
708  }
709 }
710 
713  return "JumpingFoldConstraintsWrapper";
714 }
715 
716 //@detail c'stor
721  jumping::BaseJumpSetupOP jump_def,
722  int dummy /* otherwise the two constructors are ambigous */
723 ) : KinematicAbinitio ( brute_move_small, brute_move_large, smooth_move_small, dummy ),
724  jump_def_ ( jump_def )
725 {
726  BaseClass::type( "JumpingFoldConstraintsWrapper" );
727 }
728 
729 
731  core::fragment::FragSetCOP fragset3mer,
732  core::fragment::FragSetCOP fragset9mer,
734  jumping::BaseJumpSetupOP jump_def
735 ) : KinematicAbinitio ( fragset3mer, fragset9mer, movemap ),
736  jump_def_( jump_def )
737 {
738  BaseClass::type( "JumpingFoldConstraintsWrapper" );
739 }
740 
741 
742 } //abinitio
743 } //protocols