Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrepackMover.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 protocols/protein_interface_design/movers/PrepackMover.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 
14 // Unit headers
18 
19 // Project headers
21 #include <utility/tag/Tag.hh>
29 
32 
33 #include <basic/options/keys/docking.OptionKeys.gen.hh>
34 #include <basic/options/keys/packing.OptionKeys.gen.hh>
38 #include <basic/options/option.hh>
41 
42 #include <core/pose/Pose.hh>
43 #include <utility/vector0.hh>
44 #include <utility/vector1.hh>
45 #include <basic/Tracer.hh>
46 
47 
48 namespace protocols {
49 namespace protein_interface_design {
50 namespace movers {
51 
52 using namespace core;
53 using namespace std;
54 using namespace core::scoring;
55 using namespace protocols::moves;
56 
57 static basic::Tracer TR( "protocols.protein_interface_design.movers.PrepackMover" );
58 
61 {
63 }
64 
67  return new PrepackMover;
68 }
69 
72 {
73  return "Prepack";
74 }
75 
77  protocols::simple_moves::PackRotamersMover( PrepackMoverCreator::mover_name() ),
78  scorefxn_( NULL ),
79  jump_num_( 0 ),
80  min_bb_( false ),
81  mm_( NULL )
82 {}
83 
86  core::Size jump_num
87 ) :
88  protocols::simple_moves::PackRotamersMover( PrepackMoverCreator::mover_name() ),
89  scorefxn_( scorefxn ),
90  jump_num_( jump_num )
91 {}
92 
93 
96  return( protocols::moves::MoverOP( new PrepackMover( *this ) ) );
97 }
98 
102 }
103 
105 
106 /// @details separate bound partners (if any), minimize, do rotamer trials, and re-minimize.
108 {
109  // make a local packertask, reading resfiles and including current rotamers, excluding disulfides
110  TR << "Performing repack..." << std::endl;
111  using namespace core::pack::task;
112  TaskFactoryOP tf;
113  if( task_factory() ) tf = new TaskFactory( *task_factory() );
114  else tf = new TaskFactory;
116  tf->push_back( new operation::IncludeCurrent );
117  tf->push_back( new operation::RestrictToRepacking );
118  tf->push_back( new operation::NoRepackDisulfides );
119 
120  // incorporating Ian's UnboundRotamer operation.
121  // note that nothing happens if unboundrot option is inactive!
123  unboundrot->initialize_from_command_line();
125  tf->push_back( unboundrot_operation );
126  core::pack::dunbrack::load_unboundrot(pose); // adds scoring bonuses for the "unbound" rotamers, if any
127 
128  using namespace protocols::toolbox::task_operations;
129  if (basic::options::option[ basic::options::OptionKeys::docking::norepack1 ]()) tf->push_back( new DockingNoRepack1( jump_num_) );
130  if (basic::options::option[ basic::options::OptionKeys::docking::norepack2 ]()) tf->push_back( new DockingNoRepack2( jump_num_) );
131 
132  //in case there is a resfile, information in this resfile overrides the computed task
133  if( basic::options::option[basic::options::OptionKeys::packing::resfile].user() ) {
134  tf->push_back( new operation::ReadResfile );
135  }
136  PackerTaskOP task = tf->create_task_and_apply_taskoperations( pose );
137 
138  TR << "Pre-minimizing structure..." << std::endl;
139  core::kinematics::MoveMapOP mm_general;
140  if( min_bb() && mm() ){
141  mm_general = mm()->clone();
142  for ( core::Size i = 1; i <= pose.total_residue(); ++i) {
143  if ( !pose.residue(i).is_protein() ) {
144  mm_general->set_chi( i, false );
145  continue;
146  }
147  // Check for disulfide bonded cysteines
148  if( pose.residue(i).type().name() == "CYD" ) mm_general->set_chi( i, false );
149  }
150  }
151  else{
152  mm_general = new core::kinematics::MoveMap;
153  mm_general->clear();
154  }
155  if( min_bb() ){ //premin bb+sc
156  if( !mm() ) mm_general->set_bb( true );
157  protocols::simple_moves::MinMover min_bb_mover( mm_general, scorefxn_, "dfpmin_armijo_nonmonotone", 1e-5, true/*nblist*/, false/*deriv_check*/ );
158  min_bb_mover.apply( pose );
159  }
160 
161  // separate any bound partners
163  if( (jump_num_ > 0) && (pose.conformation().num_chains() > 1) ) {
164  TR<<"Translating along jump #"<<jump_num_<<std::endl;
166  translate->step_size( 1000.0 );
167  translate->apply( pose );
168  }
169  mm_general->set_bb( false );
170  mm_general->set_jump( false );
171  protocols::simple_moves::MinMover min_mover( mm_general, scorefxn_, "dfpmin_armijo_nonmonotone", 1e-5, true/*nblist*/, false/*deriv_check*/ );
172  // pre-minimize sidechains
173  min_mover.apply( pose );
174 
175  if( basic::options::option[basic::options::OptionKeys::docking::dock_rtmin].user() ) {
177  rtmin.apply( pose );
178  }
179  else {
181  pack.apply( pose );
182  }
183 
184  // post-minimize
185  // using packer include_current() will make sure that these minimized rotamers are used.
186  TR << "Post-minimizing structure..." << std::endl;
187  min_mover.apply( pose );
188  TR << "Done!\n";
189 
190  // move back together
191  if( (jump_num_ > 0) && (pose.conformation().num_chains() > 1) ) {
192  translate->trans_axis().negate();
193  translate->apply( pose );
194  }
195 
196  //final rescore to get everyone on the same page
197  (*scorefxn_)(pose);
198  TR.flush();
199 }
200 
204 }
205 
206 void
208 {
209  std::string const scorefxn( tag->getOption<string>( "scorefxn", "score12" ));
210  jump_num_ = tag->getOption<core::Size>("jump_number", 1 );
211  scorefxn_ = new ScoreFunction( *data.get< ScoreFunction * >( "scorefxns", scorefxn) );
213  min_bb( tag->getOption< bool >( "min_bb", 0 ));
214  if( min_bb() ) {
216  mm()->clear();
218  }
219  TR << "Prepack mover with scorefxn " << scorefxn << " over jump number " << jump_num_ << "with min_bb "<<min_bb()<<std::endl;
220 }
221 
222 void
223 PrepackMover::min_bb( bool const m ){
224  min_bb_ = m;
225 }
226 
227 bool
229  return min_bb_;
230 }
231 
234  if( !min_bb() ) TR<<"Warning: movemap requested but min_bb is set to false. This is probably wrong!"<<std::endl;
235  return mm_;
236 }
237 
238 void
240  mm_ = mm;
241 }
242 
243 } //movers
244 } //protein_interface_design
245 } //protocols