Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopRelaxMover.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 /// @brief demo program for implementing loop relax + FA relax
11 /// @author Mike Tyka
12 /// @author Srivatsan Raman
13 /// @author James Thompson
14 /// @author Daniel J. Mandell
15 
16 // include these first for building on Visual Studio
17 
20 
21 // Package headers
22 #include <protocols/loops/Loops.hh>
24 
26 #ifdef BOINC_GRAPHICS
27 #include <protocols/boinc/boinc.hh>
28 #endif // BOINC_GRAPHICS
29 #include <boost/foreach.hpp>
30 #define foreach BOOST_FOREACH
31 
32 // Project Headers
37 #include <core/pose/selection.hh>
38 #include <utility/tag/Tag.hh>
39 
41 #include <core/fragment/FragSet.hh>
42 #include <core/id/AtomID.hh>
43 #include <core/io/pdb/pose_io.hh>
46 #include <core/kinematics/Jump.hh>
52 #include <core/pose/Pose.hh>
53 #include <core/pose/util.hh>
60 #include <core/scoring/Energies.hh>
61 #include <core/scoring/rms_util.hh>
62 // AUTO-REMOVED #include <core/scoring/ScoreFunctionFactory.hh>
63 #include <core/types.hh>
64 #include <basic/Tracer.hh>
75 //#include <protocols/loops/LoopMover.fwd.hh>
76 //#include <protocols/loops/LoopMover.hh>
80 #include <protocols/loops/Loop.hh>
81 #include <protocols/loops/Loops.hh>
83 #include <protocols/loops/util.hh>
86 #ifdef GL_GRAPHICS
87 #include <protocols/viewer/viewers.hh> // this was auto-removed but is needed for graphics builds!
88 #endif
89 #include <utility/exit.hh>
90 
91 // symmetry
93 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
94 
99 
100 
101 // C++ headers
102 // AUTO-REMOVED #include <fstream>
103 #include <iostream>
104 #include <string>
105 
106 // option key includes
107 
108 #include <basic/options/keys/in.OptionKeys.gen.hh>
109 #include <basic/options/keys/out.OptionKeys.gen.hh>
110 #include <basic/options/keys/loops.OptionKeys.gen.hh>
111 #include <basic/options/keys/relax.OptionKeys.gen.hh>
112 #include <basic/options/keys/cm.OptionKeys.gen.hh>
113 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
114 
115 //Auto Headers
118 #include <core/pose/util.tmpl.hh>
122 #include <protocols/relax/util.hh>
123 #include <utility/Bound.hh>
124 #include <utility/vector0.hh>
125 #include <utility/vector1.hh>
126 #include <utility/keys/SmallKeyVector.hh>
127 #include <utility/options/BooleanOption.hh>
128 #include <basic/options/option.hh>
129 
130 #if defined(WIN32) || defined(__CYGWIN__)
131  #include <ctime>
132 #endif
133 
134 
135 namespace protocols {
136 namespace comparative_modeling {
137 
138 //constructors
140  guarded_loops_( new loops::GuardedLoopsFromFile )
141 {
142  set_defaults_();
143 }
144 
145 // BE WARNED: THIS CONSTRUCTOR DOES NOT CALL SET_DEFAULTS().
146 // AS A RESULT, THE SCORE FUNCTIONS (AMONG OTHER THINGS) WILL
147 // NOT BE INITIALIZED
149  std::string const & remodel,
150  std::string const & intermedrelax,
151  std::string const & refine,
152  std::string const & relax,
153  loops::Loops const & loops
154 ) : moves::Mover(),
155  cmd_line_csts_( true ),
156  copy_sidechains_( true ),
157  n_rebuild_tries_( 3 ),
158  rebuild_filter_( 999 ),
159  remodel_( remodel ),
160  intermedrelax_( intermedrelax ),
161  refine_( refine ),
162  relax_( relax ),
163  guarded_loops_( new loops::GuardedLoopsFromFile( loops ))
164 {}
165 
166 // BE WARNED: THIS CONSTRUCTOR DOES NOT CALL SET_DEFAULTS().
167 // AS A RESULT, THE SCORE FUNCTIONS (AMONG OTHER THINGS) WILL
168 // NOT BE INITIALIZED
170  std::string const & remodel,
171  std::string const & intermedrelax,
172  std::string const & refine,
173  std::string const & relax,
174  loops::LoopsFileData const & loops_from_file
175 ) : moves::Mover(),
176  cmd_line_csts_( true ),
177  copy_sidechains_( true ),
178  n_rebuild_tries_( 3 ),
179  rebuild_filter_( 999 ),
180  remodel_( remodel ),
181  intermedrelax_( intermedrelax ),
182  refine_( refine ),
183  relax_( relax ),
184  guarded_loops_( new loops::GuardedLoopsFromFile( loops_from_file ))
185 {}
186 
188  std::string const & remodel,
189  std::string const & intermedrelax,
190  std::string const & refine,
191  std::string const & relax,
192  loops::GuardedLoopsFromFileOP guarded_loops
193 ) : moves::Mover(),
194  cmd_line_csts_( true ),
195  copy_sidechains_( true ),
196  n_rebuild_tries_( 3 ),
197  rebuild_filter_( 999 ),
198  remodel_( remodel ),
199  intermedrelax_( intermedrelax ),
200  refine_( refine ),
201  relax_( relax ),
202  guarded_loops_( guarded_loops ) // shallow copy
203 {}
204 
205 /// @brief Copy-ctor; shallow copy of all data object.
207  cmd_line_csts_( src.cmd_line_csts_ ),
208  copy_sidechains_( src.copy_sidechains_ ),
209  n_rebuild_tries_( src.n_rebuild_tries_ ),
210  rebuild_filter_( src.rebuild_filter_ ),
211  remodel_( src.remodel_ ),
212  intermedrelax_( src.intermedrelax_ ),
213  refine_( src.refine_ ),
214  relax_( src.relax_ ),
215  guarded_loops_( src.guarded_loops_ ),
216  cen_scorefxn_( src.cen_scorefxn_ ),
217  fa_scorefxn_( src.fa_scorefxn_ ),
218  frag_libs_( src.frag_libs_ ),
219  compute_rmsd_( src.compute_rmsd_ )
220 {}
221 
222 /// @brief assignment operator; Shallow copy of all data.
223 LoopRelaxMover const &
225 {
226  if ( this != &rhs ) {
231  remodel_ = rhs.remodel_;
233  refine_ = rhs.refine_;
234  relax_ = rhs.relax_;
238  frag_libs_ = rhs.frag_libs_;
240  }
241  return *this;
242 }
243 
244 
245 //destructor
247 
250 ) {
251  frag_libs_ = new_libs;
252 }
253 
256  return frag_libs_;
257 }
258 
260  core::scoring::ScoreFunctionOP centroid_scorefxn,
261  core::scoring::ScoreFunctionOP fullatom_scorefxn
262 ) {
263  //cen_scorefxn_ = cen_scorefxn;
264  //fa_scorefxn_ = fa_scorefxn;
265  cen_scorefxn( centroid_scorefxn );
266  fa_scorefxn ( fullatom_scorefxn );
267 }
268 
271 ) {
273 }
274 
276  core::scoring::ScoreFunctionOP cen_scorefxn
277 ) {
279 }
280 
282  int corelength = 0;
283  std::string const curr_job_tag( get_current_tag() );
284 
285  // store the initial (possibly fullatom) pose
286  // used for computing RMS later
287  // we may steal sidechains from this pose as well
288  core::pose::Pose start_pose = pose;
289 
290  using namespace core;
291  using namespace basic::options;
292  using namespace basic::options::OptionKeys;
293  // this typedef belongs in its own .fwd.hh file.
294  //typedef utility::pointer::owning_ptr< loops::IndependentLoopMover > loops::IndependentLoopMoverOP;
295 
296  basic::Tracer TR("protocols.looprelax");
297 
298  TR << "==== Loop protocol: ================================================="
299  << std::endl;
300  TR << " remodel " << remodel() << std::endl;
301  TR << " intermedrelax " << intermedrelax() << std::endl;
302  TR << " refine " << refine() << std::endl;
303  TR << " relax " << relax() << std::endl;
304 
305  // load native pose (if provided)
306  core::pose::Pose native_pose;
307  if ( option[ in::file::native ].user() ) {
308  core::import_pose::pose_from_pdb( native_pose, option[ in::file::native ]() );
309  core::pose::set_ss_from_phipsi( native_pose );
310  } else {
311  native_pose = start_pose;
312  }
313 
314  if ( start_pose.total_residue() != native_pose.total_residue() ) {
315  // strip VRTs from the end, then compare lengths
316  int nnonvrt_start = start_pose.total_residue();
317  while ( nnonvrt_start>0 && start_pose.residue( nnonvrt_start ).aa() == core::chemical::aa_vrt ) nnonvrt_start--;
318 
319  int nnonvrt_native = native_pose.total_residue();
320  while ( nnonvrt_native>0 && native_pose.residue( nnonvrt_native ).aa() == core::chemical::aa_vrt ) nnonvrt_native--;
321  if ( nnonvrt_native != nnonvrt_start )
322  utility_exit_with_message(
323  "Start pose and native pose don't match in length"
324  );
325  }
326 
329  evaluator->add_evaluation(
330  new simple_filters::SelectRmsdEvaluator( native_pose, "_native" )
331  );
332 
333 #ifdef BOINC_GRAPHICS
334  // set native for graphics
335  boinc::Boinc::set_graphics_native_pose( native_pose );
336 #endif
337 
338  // pick loops if necessary
339  guarded_loops_->resolve_loop_indices( pose );
341  // try to load loops from command line
342  if ( loops->size() == 0 ) {
343  TR.Debug << "picking loops by chainbreak score." << std::endl;
345  start_pose, option[ cm::min_loop_size ]() );
346  *loops = *loops_picked; // copy the loops we just read in into the guarded_loops_ object
347 
348  if ( loops->size() == 0 ) {
349  TR.Debug << "no loops found." << std::endl;
350  remodel( "no" );
351  }
352  } // loops.size() == 0
353 
354  loops->verify_against( start_pose );
355  TR.Debug << loops << std::endl;
356 
357  if ( option[ OptionKeys::loops::extended ]() ) loops->set_extended( true );
358  bool const debug( option[ OptionKeys::loops::debug ]() );
359 
360  // superimpose native over core ?
361  core::pose::Pose native_pose_super = native_pose;
363  if( option[ OptionKeys::loops::superimpose_native ]() ){
364  core::pose::initialize_atomid_map( atom_map, native_pose_super, core::id::BOGUS_ATOM_ID );
365  for ( core::Size ir=1; ir <= native_pose.total_residue(); ++ir ) {
366  if( !loops->is_loop_residue( ir ) ){
367  id::AtomID const id1( native_pose_super.residue(ir).atom_index("CA"), ir );
368  id::AtomID const id2( pose.residue(ir).atom_index("CA"), ir );
369  atom_map.set(id1, id2);
370  }
371  }
372  /*core::Real rms =*/ core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
373  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_super_pose.pdb");
374  if ( debug ) native_pose_super.dump_pdb(curr_job_tag + "_after_super_native.pdb");
375  }
376 
377  bool const fullatom_input( pose.is_fullatom() );
378  bool const fullatom_output(
379  option[ out::file::fullatom ]() || refine() != "no" || relax() != "no"
380  );
381 
382  if (fullatom_input) {
384  }
385 
386 
387  checkpoint::CheckPointer checkpoints_("Loopbuild");
388  // need to make sure that the bailout structure is set!
389  checkpoints_.checkpoint( pose, curr_job_tag, "initial", true );
390 
391 #ifdef BOINC_GRAPHICS
392  // attach boinc graphics pose observer
393  boinc::Boinc::attach_graphics_current_pose_observer( pose );
394 #endif
395 
396 #ifdef GL_GRAPHICS
398  pose.conformation(), "loops_pose"
399  );
400 #endif
401  ////////////////////////////
402 
403  // loop rebuilding
404  loops->auto_choose_cutpoints( pose );
405 
406  // if remove_extended_loops is specified, treat extended loops as missing density, by randomly placing the atoms
407  // this is not great behavior, BUT the code is already tolerant of missing density treated in this fashion
408  bool remove_extended_loops = option[ OptionKeys::loops::remove_extended_loops ]();
409  if (remove_extended_loops) {
410  for ( loops::Loops::const_iterator it = loops->begin(), it_end = loops->end();
411  it != it_end; ++it
412  ) {
413  if ( it->is_extended() && it->skip_rate() == 0.0 ) {
414  TR << "Removing loop: " << *it << std::endl;
415  int lstart = it->start(); if (lstart != 1) lstart++;
416 
417  for (core::Size r = lstart; r<= it->stop(); ++r) {
418  for (core::Size k = 1; k<= pose.residue(r).natoms(); ++k) {
420  900.000 + numeric::random::uniform()*100.000,
421  900.000 + numeric::random::uniform()*100.000,
422  900.000 + numeric::random::uniform()*100.000
423  );
424  pose.set_xyz( core::id::AtomID( k,r ) , rnd_atm );
425  }
426  }
427  }
428  }
429  } // remove_extended_loops
430 
431  ///////////////////////////////////////////////////////////////////////////////////////
432  ////
433  //// Remove Missing density
434  ////
435  //// if this is an initial loop building exercise, build conservatively first, i.e. dont extend loop
436  //// regions etc. Then repeat with a more aggressive approach to make sure the loops are closed etc.
437  //// This makes sure all the missing density is gone before doing proper loop building.
438  ////
439  if ( option[ OptionKeys::loops::build_initial ].user() ) {
440  TR << "====================================================================================" << std::endl;
441  TR << "===" << std::endl;
442  TR << "=== Initial Building " << std::endl;
443  TR << "===" << std::endl;
444 
445  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "initial_build", false, true) ) {
446  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_initial_build.pdb");
447 
448  runtime_assert( frag_libs().size() > 0 );
450  for ( Size i = 1; i <= frag_libs().size(); ++i ) {
451  quick_ccd.add_fragments( frag_libs()[i] );
452  }
453 
454  quick_ccd.get_checkpoints()->set_type("InitialBuild");
455  quick_ccd.set_current_tag( curr_job_tag );
456  quick_ccd.set_native_pose( new core::pose::Pose ( native_pose ) );
457  quick_ccd.set_scorefxn( cen_scorefxn_ );
458  quick_ccd.set_build_attempts_( 1 );
459  quick_ccd.set_grow_attempts_( 0 );
460  quick_ccd.set_accept_aborted_loops_( true );
461  quick_ccd.set_strict_loops( true );
462  quick_ccd.set_random_order_( false );
463  quick_ccd.set_build_all_loops_( true );
464  quick_ccd.set_loop_combine_rate_( 0.0 );
465 
466  /// RUN quick_ccd
467  quick_ccd.apply( pose );
468 
470 
471  //fpd if we care at all about the global coordinate frame
472  //fpd (and thus have a root VRT) then don't recenter the pose
473  if ( pose.residue_type( pose.fold_tree().root() ).aa() != core::chemical::aa_vrt )
474  pose.center();
475  (*cen_scorefxn_)(pose);
476  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_initial_build.pdb");
477 
478  checkpoints_.checkpoint( pose, curr_job_tag, "initial_build", true);
479  }
480  checkpoints_.debug( curr_job_tag, "initial_build", (*cen_scorefxn_)( pose ) );
481  } // build_initial
482 
483  // Make sure loops can be grown in any protocol, not just QuickCCD
484  if ( basic::options::option[ basic::options::OptionKeys::loops::random_grow_loops_by ].user() ) {
485  loops->grow_all_loops( pose , basic::options::option[ basic::options::OptionKeys::loops::random_grow_loops_by ]() );
486  }
487 
488  ///////////////////////////////////////////////////////////////////////////////////////
489  ////
490  //// add constraints if specified by user.
491  ////
492  ////
493  if ( cmd_line_csts() ) {
495  pose, *cen_scorefxn_
496  );
497  } else {
500  );
501  }
502 
503  // mjo TODO: check if pose.conformation().detect_disulfides needs to be called. If it does consider replacing this with core/pose/initialize_disulfide_bonds().
504 
505  // read in disulfides if specified by user
506  if ( option[ in::fix_disulf ].user() ) {
507  using std::pair;
508  using utility::vector1;
509  vector1< pair<Size, Size> > disulfides;
510 
511  core::io::raw_data::DisulfideFile ds_file( option[ in::fix_disulf ]() );
512  ds_file.disulfides( disulfides, pose );
513  pose.conformation().fix_disulfides( disulfides );
514  }
515 
516 
517 
518  ///////////////////////////////////////////////////////////////////////////////////////
519  ////
520  //// Loop remodelling (centroid loop modelling)
521  ////
522  ////
523 
524 
525  long starttime = time(NULL);
526  bool all_loops_closed = true;
527  bool tmp_all_loops_closed = false;
528  if ( remodel() != "no" ) {
529  TR << "====================================================================================" << std::endl;
530  TR << "===" << std::endl;
531  TR << "=== Remodel " << std::endl;
532  TR << "===" << std::endl;
533  all_loops_closed = false;
534  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "remodel", false, true) ) {
535 
536  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_rebuild.pdb");
537 
538  using core::Size;
539  using core::Real;
540  using core::pose::Pose;
541  for ( Size ii = 1; ii <= n_rebuild_tries(); ++ii ) {
542  core::Real current_sc( rebuild_filter() + 1 );
543  TR.Debug << "Remodeling attempt " << ii << "." << std::endl;
544  if ( remodel() == "old_loop_relax") {
545  LoopRebuild loop_rebuild( cen_scorefxn_, *loops );
546  loop_rebuild.apply( pose );
547  } else {
548 
549 /* // DJM: does this cause a crash if the only loop is terminal
550  if ( remodel() == "perturb_kic" ) {
551  // remove the terminal loops - perturb_kic doesnt seem to support these, sadly.
552  protocols::loops::Loops newloops;
553  for( core::Size i=1; i <= loops.size() ; i ++ ){
554  if( loops[i].start() <= 1 ) continue;
555  if( loops[i].stop() >= pose.total_residue() ) continue;
556  newloops.add_loop( loops[i] );
557  }
558  loops = newloops;
559  }
560  */
561  // DJM: need to cast this as IndependentLoopMover to set strict loops to true.
562  loops::loop_mover::IndependentLoopMoverOP remodel_mover( static_cast< loops::loop_mover::IndependentLoopMover * >
563  ( loops::LoopMoverFactory::get_instance()->create_loop_mover( remodel(), loops ).get() ) );
565  if ( !remodel_mover ) {
566  utility_exit_with_message( "Error: no remodel mover defined!" );
567  }
568  if ( ! ( remodel() == "perturb_kic" ) ) {
569  runtime_assert( frag_libs().size() > 0 );
570  }
571 
572  for ( Size i = 1; i <= frag_libs().size(); ++i ) {
573  remodel_mover->add_fragments( frag_libs()[i] );
574  }
575 
576  remodel_mover->set_scorefxn( cen_scorefxn_ ); // set cst score
577 
578  if ( remodel() == "perturb_kic" ) {
580  protocols::loops::fold_tree_from_loops( pose, *loops, f_new, true );
581  pose.fold_tree( f_new );
582  }
583  remodel_mover->get_checkpoints()->set_type("Remodel");
584  remodel_mover->set_current_tag( curr_job_tag );
585  remodel_mover->set_native_pose( new Pose( native_pose ) );
586  remodel_mover->apply( pose );
587 
588  if ( remodel() == "perturb_kic" ) { //DJM: skip this struct if initial closure fails
589  if ( remodel_mover->get_last_move_status() != protocols::moves::MS_SUCCESS) {
591  TR << "Structure " << " failed initial kinematic closure. Skipping..." << std::endl;
592  //bool fail = true; // make this
593  pose.fold_tree( f_orig );
594  return;
595  }
596  pose.fold_tree( f_orig );
597  }//if ( remodel() == "perturb_kic" )
598  tmp_all_loops_closed = remodel_mover->get_all_loops_closed();
599  }
600  current_sc = (*cen_scorefxn_)( pose );
601 
602  if(option[ OptionKeys::cm::loop_rebuild_filter ].user() || (remodel() == "old_loop_relax")){
603  TR << "classic check for loop closure" << std::endl;
604  current_sc = (*cen_scorefxn_)( pose );
605  if ( current_sc <= rebuild_filter() ){
606  all_loops_closed = true;
607  break; //fpd changed >= to <=
608  // ... don't we want to stop when our score is _less_ than the cutoff
609  }
610  }
611  else{
612  if(tmp_all_loops_closed){
613  all_loops_closed = true;
614  break;
615  }
616  }
617  } // for ( in n_rebuild_tries )
618 
619  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_rebuild.pdb");
620  checkpoints_.checkpoint( pose, curr_job_tag, "remodel", true);
621  } // recover checkpoint
622  checkpoints_.debug( curr_job_tag, "remodel", (*cen_scorefxn_)( pose ) );
623  } // if ( remodel != no )
624  else { all_loops_closed = true; } // AS 03/16/2012: hack to allow refinement without a preceding perturb stage
625 
626  long endtime = time(NULL);
627 
628  TR << "Buildtime: " << endtime - starttime << std::endl;
629 
630 
631  TR << pose.fold_tree() << std::endl;
632 
633  ///////////////////////////////////////////////////////////////////////////////////////
634  ////
635  //// Halfway stats
636  ////
637  ////
638  if( compute_rmsd() ){
639  setPoseExtraScores( pose, "cen_irms", core::scoring::CA_rmsd( start_pose, pose ) );
640  if ( option[ in::file::native ].user() ) {
641  setPoseExtraScores( pose, "cen_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
642  setPoseExtraScores( pose, "cen_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
643  setPoseExtraScores( pose, "cen_loopcarms", loops::loop_rmsd(native_pose_super, pose, *loops, true ) );
644  }
645  }
646 
647 
648  ///////////////////////////////////////////////////////////////////////////////////////
649  ////
650  //// Full atom part
651  ////
652  ////
653  if ( fullatom_output ) {
654  // make sure there aren't any cut point variants flying about
655 
656  loops::remove_cutpoint_variants( pose, true );
657 
658  // if no centroid modelling was done at all, then grab the original
659  // fullatom pose.
660  if ( remodel() == "no" &&
661  !option[ OptionKeys::loops::build_initial ].user() &&
662  fullatom_input
663  ) {
664  pose = start_pose;
665  }
666 
667  TR << "===================================================================================="
668  << std::endl;
669  TR << "===" << std::endl;
670  TR << "=== Fullatom " << std::endl;
671  TR << "===" << std::endl;
672 
673  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_fullatom.pdb");
674  TR << "Annotated sequence before fa switch: " << pose.annotated_sequence(true) << std::endl;
675 
676  //puts full-atom sidechains on loop regions
678  pose.conformation().detect_bonds(); //apl fix this !
679 
680  utility::vector1< bool > needToRepack( pose.total_residue() , !fullatom_input );
681  bool needToRepackAtAll = !fullatom_input;
682 
683  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_fullatom.pdb");
684  // copy sidechain torsions from input pose
685  if ( fullatom_input && copy_sidechains() ) {
686 
687  for ( core::Size i = 1; i <= pose.total_residue(); ++i ) {
688  // if remodelling was done, repack the loops - otherwise leave it.
689  if ( remodel() != "no" ) {
690  for( loops::Loops::const_iterator it=loops()->begin(), it_end=loops()->end(); it != it_end; ++it ) {
691  if ( i >= core::Size( it->start() ) - 3
692  && i <= core::Size( it->stop() ) + 3 ) {
693  // allow 3-residue leeway on either side for 'random_loops'
694  // this kind of sucks.
695  TR.Debug << "Repacking because in loop: " << i << std::endl;
696  needToRepack[i] = true;
697  break;
698  }
699  }
700  }
701 
702  // if there is missing density in the sidechain, then we need to
703  // repack check this my making sure that no SC atom is more than
704  // 20A (?) away from CA
705  if ( start_pose.residue_type(i).is_protein() && start_pose.residue_type(i).has("CA") ) {
706  numeric::xyzVector< core::Real> ca_pos = start_pose.residue(i).atom("CA").xyz();
707  for (int j=1; j<=(int)start_pose.residue(i).natoms(); ++j) {
708  if ( (ca_pos - start_pose.residue(i).atom(j).xyz()).length() > 20 ) {
709  TR.Debug << "Missing dens: " << i << std::endl;
710  needToRepack[i] = true;
711  break;
712  }
713  }
714  } // missing density?
715 
716  //copy sidechains only for non-loop regions
717  if ( !needToRepack[i] ) {
718  if ( pose.residue_type(i).is_protein() )
719  pose.replace_residue( i, start_pose.residue(i), true );
720  TR.Debug << "Copying sidechain from template: " << i << std::endl;
721  } else {
722  needToRepackAtAll = true;
723  }
724  } // for ( i in pose.total_residue() )
725  } // fa_input
726 
727  // create score function and add constraints for fullatom part
728  if ( cmd_line_csts() ) {
730  pose, *fa_scorefxn_
731  );
732  } else {
734  *fa_scorefxn_
735  );
736  }
737 
738 
739 
740  // Add coordinate constraints to non-loop regions if desired
741  core::Real constrain_rigid_segments_weight = option[ OptionKeys::loops::constrain_rigid_segments ]();
742  if( constrain_rigid_segments_weight > 0.0 ){
743  protocols::loops::Loops coordconstraint_segments;
744  //core::pose::Pose coordconstrainted_pose = pose;
745  core::pose::Pose constraint_target_pose = pose;
746 
747 
748  coordconstraint_segments = loops->invert( pose.total_residue() ); // Invert the loops selection - i.e. the rigid areas are now defined
749  std::cout << "Restraining the following segments: " << std::endl << coordconstraint_segments << std::endl;
750 
751  // ResidueTypeSet
752  using namespace core;
753  using namespace conformation;
754  using namespace core::scoring;
755  using namespace core::scoring::constraints;
756  using namespace id;
757 
758  if ( pose.residue( pose.total_residue() ).aa() != core::chemical::aa_vrt ) {
761  }
762 
763  //fpd nmonomerres is #residues in a single subunit (excluding virtuals)
764  core::Size rootres = pose.fold_tree().root();
765  core::Size nmonomerres = pose.total_residue()-1;
769  dynamic_cast<core::conformation::symmetry::SymmetricConformation &> ( pose.conformation()) );
770  symm_info = SymmConf.Symmetry_Info();
771  nmonomerres = symm_info->num_independent_residues();
772  }
773 
774  if (!option[ OptionKeys::relax::coord_cst_width ].user() ) {
775  Real const coord_sdev( option[ OptionKeys::relax::coord_cst_stdev ] );
776  // default is 0.5 (from idealize) -- maybe too small
777  for ( Size i = 1; i<=nmonomerres; ++i ) {
778  if ( !pose.residue(i).is_polymer() ) continue;
779  if ( coordconstraint_segments.is_loop_residue( i ) ) {
780  Residue const & nat_i_rsd( constraint_target_pose.residue(i) );
781  for ( Size ii = 1; ii<=nat_i_rsd.last_backbone_atom(); ++ii ) {
782  pose.add_constraint( new CoordinateConstraint( AtomID(ii,i), AtomID(1,rootres), nat_i_rsd.xyz( ii ),
783  new HarmonicFunc( 0.0, coord_sdev ) ) );
784  }
785 
786  // now cst symmetry mates
787  // if (symm_info) {
788  // for ( core::conformation::symmetry::SymmetryInfo::Clones::const_iterator pos=symm_info->bb_clones( i ).begin(),
789  // epos=symm_info->bb_clones( i ).end(); pos != epos; ++pos ) {
790  // for ( Size ii = 1; ii<= nat_i_rsd.last_backbone_atom(); ++ii ) {
791  // pose.add_constraint( new CoordinateConstraint( AtomID(ii,*pos), AtomID(1,nres), nat_i_rsd.xyz( ii ),
792  // new HarmonicFunc( 0.0, coord_sdev ) ) );
793  // }
794  // }
795  // }
796  }
797  }
798  } else {
799  Real const cst_width( option[ OptionKeys::relax::coord_cst_width ]() );
800  Real const coord_sdev( option[ OptionKeys::relax::coord_cst_stdev ]() );
801  for ( Size i = 1; i<=nmonomerres; ++i ) {
802  if ( !pose.residue(i).is_polymer() ) continue;
803  if( coordconstraint_segments.is_loop_residue( i ) ) {
804  Residue const & nat_i_rsd( constraint_target_pose.residue(i) );
805  for ( Size ii = 1; ii<= nat_i_rsd.last_backbone_atom(); ++ii ) {
806  pose.add_constraint( new CoordinateConstraint( AtomID(ii,i), AtomID(1,rootres), nat_i_rsd.xyz( ii ),
807  new BoundFunc( 0, cst_width, coord_sdev, "xyz" )) );
808  }
809  // now cst symmetry mates
810  // if (symm_info) {
811  // for ( core::conformation::symmetry::SymmetryInfo::Clones::const_iterator pos=symm_info->bb_clones( i ).begin(),
812  // epos=symm_info->bb_clones( i ).end(); pos != epos; ++pos ) {
813  // for ( Size ii = 1; ii<= nat_i_rsd.last_backbone_atom(); ++ii ) {
814  // pose.add_constraint( new CoordinateConstraint( AtomID(ii,*pos), AtomID(1,nres), nat_i_rsd.xyz( ii ),
815  // new BoundFunc( 0, cst_width, coord_sdev, "xyz" )) );
816  // }
817  // }
818  // }
819  }
820  }
821  }
822 
823 
824 
825  fa_scorefxn_->set_weight( coordinate_constraint, constrain_rigid_segments_weight );
826  }
827 
828 
829 
830 
831  // ----------------------------------------------------------
832 
833 
834 
835 
836 
837  // do the same (again) for fit-to-density
838  if ( option[ edensity::mapfile ].user() ) {
840  }
841 
842  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_repack.pdb");
843  if ( needToRepackAtAll ) { // kic refine does its own initial repacking
844  TR << "Repacking required" << std::endl;
845  TR << "Detecting disulfides" << std::endl;
846  TR << "Annotated sequence before repack: " << pose.annotated_sequence(true) << std::endl;
847  // repack loop + missing-density residues
849  using namespace core::pack::task;
850  using namespace core::pack::task::operation;
851  TaskFactoryOP tf = new TaskFactory;
852  tf->push_back( new NoRepackDisulfides );
853  tf->push_back( new InitializeFromCommandline );
854  tf->push_back( new IncludeCurrent );
855  tf->push_back( new RestrictToRepacking );
856  PackerTaskOP taskstd = tf->create_task_and_apply_taskoperations( pose );
858  // does nothing if pose is not symm
859  taskstd->restrict_to_residues(needToRepack);
860 
861  fa_scorefxn_->show_line( TR, pose );
862  core::kinematics::MoveMapOP mm( new core::kinematics::MoveMap ); //fpd symmetrize this
863  mm->set_bb( false );
864  mm->set_chi( true );
865  for( core::Size i = 1; i <= pose.total_residue(); ++i ){
867  TR<<"disabling minimization on disulfide residue "<<i<<std::endl;
868  mm->set_chi( i, false );
869  }
870  }
871 
872  //fpd symmetrize this
873  if ( core::pose::symmetry::is_symmetric( pose ) ) {
875  pack1.apply( pose );
876 
878  core::optimization::MinimizerOptions options("dfpmin_armijo_nonmonotone", 1e-5, true, false);
880 
881  mzr.run( pose, *mm, *fa_scorefxn_, options );
882  } else {
884  pack1.apply( pose );
885 
886  // quick SC minimization
888  core::optimization::MinimizerOptions options("dfpmin_armijo_nonmonotone", 1e-5, true, false);
889  mzr.run( pose, *mm, *fa_scorefxn_, options );
890  }
891 
892  fa_scorefxn_->show_line( TR, pose );
893  } else {
894  //fpd
895  (*fa_scorefxn_)(pose);
896  TR << "No repacking required" << std::endl;
897  (*fa_scorefxn_)(pose);
898  }
899 
900  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_repack.pdb");
901  } // fullatom_output
902 
903  //////////////////////////////////////////////////////////////////////////////////////
904  ////
905  //// intermediate relax the structure
906  ////
907  ////
908  if ( intermedrelax() != "no" && (all_loops_closed)) {
909  TR << "====================================================================================" << std::endl;
910  TR << "===" << std::endl;
911  TR << "=== Intermediate Relax " << std::endl;
912  TR << "===" << std::endl;
913 
914  core::kinematics::FoldTree f_new, f_orig=pose.fold_tree();
915  if ( option[ OptionKeys::loops::relax_with_foldtree ].user() ){
916  loops::fold_tree_from_loops( pose, *loops, f_new );
917  pose.fold_tree( f_new );
919  fa_scorefxn_->set_weight( core::scoring::chainbreak, option[ OptionKeys::relax::chainbreak_weight ]() );
920  fa_scorefxn_->set_weight( core::scoring::linear_chainbreak, option[ OptionKeys::relax::linear_chainbreak_weight ]() );
921  fa_scorefxn_->set_weight( core::scoring::overlap_chainbreak, option[ OptionKeys::relax::overlap_chainbreak_weight ]() );
922  }
923 
924 
925  TR << pose.fold_tree() << std::endl;
926  if( compute_rmsd() ){
927  setPoseExtraScores( pose, "brlx_irms", core::scoring::CA_rmsd( start_pose, pose ) );
928  if ( option[ in::file::native ].user() ) {
929  if( option[ OptionKeys::loops::superimpose_native ]() ){
930  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
931  }
932  setPoseExtraScores( pose, "brlx_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
933  setPoseExtraScores( pose, "brlx_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
934  setPoseExtraScores( pose, "brlx_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
935  setPoseExtraScores( pose, "brlx_loopcarms", loops::loop_rmsd(native_pose_super, pose, *loops,true ) );
936  }
937  }
938 
939  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "relax", true , true) ) {
940  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_relax.pdb");
941  if ( intermedrelax() == "relax" ) {
943  relax_prot->set_current_tag( curr_job_tag );
944  relax_prot->apply( pose );
945  } else if (( intermedrelax() == "fastrelax" ) ||
946  ( intermedrelax() == "seqrelax" )){
947  relax::FastRelax seqrelax( fa_scorefxn_, option[ OptionKeys::relax::sequence_file ]() );
948  seqrelax.set_current_tag( curr_job_tag );
949  seqrelax.apply( pose );
950  }
951  checkpoints_.checkpoint( pose, curr_job_tag, "relax", true);
952  }
953  checkpoints_.debug( curr_job_tag, "relax", (*fa_scorefxn_)( pose ) );
954  } // intermediate relax the structure
955 
956  if ( intermedrelax() != "no" && (!all_loops_closed)) {
957  //The following keeps the score lines equivalent in the silent file.
958  if( compute_rmsd() ){
959  setPoseExtraScores( pose, "brlx_irms", core::scoring::CA_rmsd( start_pose, pose ) );
960  if ( option[ in::file::native ].user() ) {
961  if( option[ OptionKeys::loops::superimpose_native ]() ){
962  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
963  }
964  setPoseExtraScores( pose, "brlx_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
965  setPoseExtraScores( pose, "brlx_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
966  setPoseExtraScores( pose, "brlx_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
967  setPoseExtraScores( pose, "brlx_loopcarms", loops::loop_rmsd(native_pose_super, pose, *loops,true ) );
968  }
969  }
970  }
971 
972  ///////////////////////////////////////////////////////////////////////////////////////
973  ////
974  //// Loop refine (fullatom type loop modelling )
975  ////
976  ////
977 
978  if ( refine() != "no" && (all_loops_closed)) {
979  TR << "====================================================================================" << std::endl;
980  TR << "===" << std::endl;
981  TR << "=== Refine " << std::endl;
982  TR << "===" << std::endl;
983 
984  long starttime = time(NULL);
985 
986  if( compute_rmsd() ){
987  setPoseExtraScores( pose, "bref_irms", core::scoring::CA_rmsd( start_pose, pose ) );
988  if ( option[ in::file::native ].user() ) {
989  if( option[ OptionKeys::loops::superimpose_native ]() ){
990  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
991  }
992  setPoseExtraScores( pose, "bref_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
993  setPoseExtraScores( pose, "bref_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
994  setPoseExtraScores( pose, "bref_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
995  }
996  }
997 
998  core::kinematics::FoldTree f_new, f_orig=pose.fold_tree();
999  if ( refine() == "refine_kic" ) {
1000  loops::fold_tree_from_loops( pose, *loops, f_new, true /* include terminal cutpoints */);
1001  }
1002  else {
1003  loops::fold_tree_from_loops( pose, *loops, f_new);
1004  }
1005  pose.fold_tree( f_new );
1006  TR << "fold_tree_before_refine " << pose.fold_tree() << std::endl;
1007 
1008  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "refine", true , true) ) {
1009 
1010  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_refine.pdb");
1011  if ( refine() == "refine_ccd" ) {
1013  refine_ccd.set_native_pose( new core::pose::Pose ( native_pose ) );
1014  refine_ccd.apply( pose );
1015  } else
1016  if ( refine() == "refine_kic" ) {
1017  //loops.remove_terminal_loops( pose );
1019  refine_kic.set_native_pose( new core::pose::Pose ( native_pose ) );
1020  refine_kic.apply( pose );
1021  }
1022  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_refine.pdb");
1023  checkpoints_.checkpoint( pose, curr_job_tag, "refine", true);
1024 
1025  // need to get the chainbreak score before the cutpoint variants are removed
1026 
1027  if ( option[ OptionKeys::loops::kic_use_linear_chainbreak ]() ){
1029  pose, "final_chainbreak",
1031  );
1032  } else {
1034  pose, "final_chainbreak",
1036  );
1037  }
1038  }
1039 
1040  checkpoints_.debug( curr_job_tag, "refine", (*fa_scorefxn_)( pose ) );
1041 
1043  // restore simple fold tree
1044  pose.fold_tree( f_orig );
1045 
1046  endtime = time(NULL);
1047 
1048  TR << "Refinetime: " << endtime - starttime << std::endl;
1049 
1050  }
1051  if ( refine() != "no" && (!all_loops_closed)) {
1052  //The following keeps the score lines equivalent in the silent file.
1053  if( compute_rmsd() ){
1054  setPoseExtraScores( pose, "brlx_irms", core::scoring::CA_rmsd( start_pose, pose ) );
1055  if ( option[ in::file::native ].user() ) {
1056  if( option[ OptionKeys::loops::superimpose_native ]() ){
1057  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
1058  }
1059  setPoseExtraScores( pose, "brlx_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
1060  setPoseExtraScores( pose, "brlx_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
1061  setPoseExtraScores( pose, "brlx_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
1062  }
1063  }
1064  }
1065 
1066  // if ( refine != "no" )
1067 
1068  //////////////////////////////////////////////////////////////////////////////////////
1069  ////
1070  //// Maybe idealize the structure before relax ?
1071  ////
1072  ////
1073  if ( option[ OptionKeys::loops::idealize_after_loop_close ].user() && (all_loops_closed)) {
1074 
1075  if ( debug ){
1076  pose.dump_pdb(curr_job_tag + "_before_idealize.pdb");
1077  }
1079  idealizer.fast( false );
1080  idealizer.apply( pose );
1081  if ( debug ){
1082  pose.dump_pdb(curr_job_tag + "_after_idealize.pdb");
1083  }
1084  }
1085 
1086 
1087  //////////////////////////////////////////////////////////////////////////////////////
1088  ////
1089  //// Relax the structure
1090  ////
1091  ////
1092 
1093  if ( relax() != "no" && (all_loops_closed)) {
1094  TR << "====================================================================================" << std::endl;
1095  TR << "===" << std::endl;
1096  TR << "=== Relax " << std::endl;
1097  TR << "===" << std::endl;
1098 
1099  core::kinematics::FoldTree f_new, f_orig=pose.fold_tree();
1100  if ( option[ OptionKeys::loops::relax_with_foldtree ].user() ){
1101  loops::fold_tree_from_loops( pose, *loops, f_new );
1102  pose.fold_tree( f_new );
1104  fa_scorefxn_->set_weight( core::scoring::chainbreak, option[ OptionKeys::relax::chainbreak_weight ]() );
1105  fa_scorefxn_->set_weight( core::scoring::linear_chainbreak, option[ OptionKeys::relax::linear_chainbreak_weight ]() );
1106  fa_scorefxn_->set_weight( core::scoring::overlap_chainbreak, option[ OptionKeys::relax::overlap_chainbreak_weight ]() );
1107  }
1108 
1109 
1110  TR << pose.fold_tree() << std::endl;
1111  if( compute_rmsd() ){
1112  setPoseExtraScores( pose, "brlx_irms", core::scoring::CA_rmsd( start_pose, pose ) );
1113  if ( option[ in::file::native ].user() ) {
1114  if( option[ OptionKeys::loops::superimpose_native ]() ){
1115  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
1116  }
1117  setPoseExtraScores( pose, "brlx_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
1118  setPoseExtraScores( pose, "brlx_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
1119  setPoseExtraScores( pose, "brlx_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
1120  }
1121  }
1122 
1123  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "relax", true , true) ) {
1124  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_relax.pdb");
1125  if ( relax() == "relax" ) {
1127  relax_prot->set_current_tag( curr_job_tag );
1128  relax_prot->apply( pose );
1129  } else if (( relax() == "fastrelax" ) ||
1130  ( relax() == "seqrelax" )) {
1131  relax::FastRelax seqrelax( fa_scorefxn_, option[ OptionKeys::relax::sequence_file ]() );
1132  seqrelax.set_current_tag( curr_job_tag );
1133  seqrelax.apply( pose );
1134  } else if ( relax() == "minirelax" ) {
1136  mini_relax.set_current_tag( curr_job_tag );
1137  mini_relax.apply( pose );
1138  }
1139  checkpoints_.checkpoint( pose, curr_job_tag, "relax", true);
1140  }
1141  checkpoints_.debug( curr_job_tag, "relax", (*fa_scorefxn_)( pose ) );
1142 
1143  // restore simple fold tree
1145  pose.fold_tree( f_orig );
1146 
1147  fa_scorefxn_->set_weight( core::scoring::chainbreak, 0.0 );
1148  fa_scorefxn_->set_weight( core::scoring::linear_chainbreak, 0.0 );
1149  fa_scorefxn_->set_weight( core::scoring::overlap_chainbreak, 0.0 );
1150 
1151  if ( debug ) pose.dump_pdb(curr_job_tag + "_after_relax.pdb");
1152 
1153  if ( option[ OptionKeys::loops::final_clean_fastrelax ]() ) {
1157  fa_scorefxn_->set_weight( core::scoring::angle_constraint, 0.0 );
1159  fa_scorefxn_->set_weight( core::scoring::big_bin_constraint, 0.0 );
1160  if ( !checkpoints_.recover_checkpoint( pose, curr_job_tag, "ffrelax", true , true ) ) {
1161  relax::FastRelax fast_relax( fa_scorefxn_ );
1162  fast_relax.set_current_tag( curr_job_tag );
1163  fast_relax.apply( pose );
1164  checkpoints_.checkpoint( pose, curr_job_tag, "ffrelax", true);
1165  }
1166  checkpoints_.debug( curr_job_tag, "ffrelax", (*fa_scorefxn_)( pose ) );
1167  }
1168  } // relax the structure
1169  if ( relax() != "no" && (!all_loops_closed)) {
1170  //The following keeps the score lines equivalent in the silent file.
1171  if( compute_rmsd() ){
1172  setPoseExtraScores( pose, "brlx_irms", core::scoring::CA_rmsd( start_pose, pose ) );
1173  if ( option[ in::file::native ].user() ) {
1174  if( option[ OptionKeys::loops::superimpose_native ]() ){
1175  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
1176  }
1177  setPoseExtraScores( pose, "brlx_rms", core::scoring::native_CA_rmsd(native_pose, pose ) );
1178  setPoseExtraScores( pose, "brlx_corerms", native_loop_core_CA_rmsd(native_pose, pose, *loops, corelength ) );
1179  setPoseExtraScores( pose, "brlx_looprms", loops::loop_rmsd(native_pose_super, pose, *loops ) );
1180  }
1181  }
1182  }
1183 
1184  //////////////////////////////////////////////////////////////////////////////////////
1185  ////
1186  //// Statistics
1187  ////
1188 
1189  TR << "====================================================================================" << std::endl;
1190  TR << "===" << std::endl;
1191  TR << "=== Getting Statistics " << std::endl;
1192  TR << "===" << std::endl;
1193  TR << "===" << std::endl;
1194 
1195  if( compute_rmsd() ){
1197  pose, "irms", core::scoring::CA_rmsd( start_pose, pose )
1198  );
1199  if ( option[ in::file::native ].user() ) {
1200  if( option[ OptionKeys::loops::superimpose_native ]() ){
1201  core::scoring::superimpose_pose( native_pose_super, pose, atom_map );
1202  }
1203  setPoseExtraScores( pose, "rms", core::scoring::native_CA_rmsd( native_pose, pose ));
1204  setPoseExtraScores( pose, "looprms", loops::loop_rmsd( native_pose_super, pose, *loops, false /*CA_only*/, true /*bb_only*/ ));
1205  setPoseExtraScores( pose, "loop_heavy_rms", loops::loop_rmsd( native_pose_super, pose, *loops, false /*CA_only*/, false /*bb_only*/ ));
1206  setPoseExtraScores( pose, "loopcarms", loops::loop_rmsd( native_pose_super, pose, *loops, true ));
1207  setPoseExtraScores( pose, "corerms", native_loop_core_CA_rmsd( native_pose, pose, *loops, corelength ) );
1208  setPoseExtraScores( pose, "corelen", corelength );
1209  //if( pose.is_fullatom() ) addScoresForLoopParts( pose, loops, (*fa_scorefxn_), native_pose, 10 );
1210  //else addScoresForLoopParts( pose, loops, (*cen_scorefxn_), native_pose, 10 );
1211  }
1212  }
1213 
1214  core::Real final_score;
1215 
1216  if ( debug ) pose.dump_pdb(curr_job_tag + "_before_final_rescore.pdb");
1217 
1218  if (fullatom_output) final_score = (*fa_scorefxn_)(pose); // may include constraint score
1219  else final_score = (*cen_scorefxn_)(pose); // may include constraint score
1220 
1221 
1223  pose, std::string("final_looprelax_score"), final_score
1224  );
1225 
1226 } // LoopRelaxMover
1227 
1228 /// @brief Must be called before the Loops data can be read from.
1230 {
1231  guarded_loops_->resolve_loop_indices( pose );
1232 }
1233 
1234 /// @details By setting the loops object directly, the requirement is relaxed that a Pose be first
1235 /// given to the LoopRelax object (through a call to apply() or resolve_loopfile_indices)
1236 /// before the get_loops() function may be called.
1238  guarded_loops_->set_loops_pointer( val );
1239 }
1240 
1241 /// @brief Set the loop file data. This will require that
1243  guarded_loops_->loops( loopfiledata );
1244 }
1245 
1248  return guarded_loops_->loops();
1249 }
1250 
1253  return guarded_loops_->loops();
1254 }
1255 
1256 
1259  return "LoopRelaxMover";
1260 }
1261 
1263  using namespace basic::options;
1264  using namespace basic::options::OptionKeys;
1265 
1266  cmd_line_csts_ = true;
1267  copy_sidechains_ = true;
1268  remodel_ = option[ OptionKeys::loops::remodel ]();
1269  intermedrelax_ = option[ OptionKeys::loops::intermedrelax ]();
1270  refine_ = option[ OptionKeys::loops::refine ]() ;
1271  relax_ = option[ OptionKeys::loops::relax ]();
1272  n_rebuild_tries_ = 3;
1273  rebuild_filter_ = 999.0;
1274  compute_rmsd( true );
1275 
1276  // use score4L by default (will be symm if needed)
1279 
1280  // get cmd line scorefxn by default (will be symm if needed)
1282 }
1283 
1284 using namespace utility::tag;
1285 using namespace protocols::moves;
1286 void
1288 {
1289  cmd_line_csts( tag->getOption< bool >( "cmd_line_csts", true ) );
1290  copy_sidechains( tag->getOption< bool >( "copy_sidechains", true ) );
1291  rebuild_filter( tag->getOption< core::Real >( "rebuild_filter", 999 ) );
1292  compute_rmsd( tag->getOption< bool >( "compute_rmsd", true ) );
1293  n_rebuild_tries( tag->getOption< core::Size >( "n_rebuild_tries", 10 ) );
1294  remodel( tag->getOption< std::string >( "remodel", "quick_ccd" ) );
1295  intermedrelax( tag->getOption< std::string >( "intermedrelax", "no" ) );
1296  refine( tag->getOption< std::string >( "refine", "refine_ccd" ) );
1297  relax( tag->getOption< std::string >( "relax", "no" ) );
1298  if( tag->getOption< bool >( "read_fragments", false ) )
1300 
1301  //read tag "scorefxn"
1304  //cen_scorefxn_->set_weight( core::scoring::chainbreak, 10.0 / 3.0 );
1306 
1308 }
1309 
1312 {
1314 }
1315 
1318  return new LoopRelaxMover;
1319 }
1320 
1323 {
1324  return "LoopRelaxMover";
1325 }
1326 
1329 
1332 
1333 
1334 /*
1335 /// currrently taskfactory is not supported
1336 core::pack::task::TaskFactoryOP
1337 LoopRelaxMover::task_factory() const{ return task_factory_; }
1338 
1339 void
1340 LoopRelaxMover::task_factory( core::pack::task::TaskFactoryOP tf ){ task_factory_ = tf; }
1341 */
1342 
1343 } // namespace loops
1344 } // namespace protocols