Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymDockingLowRes.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file DockingLowRes
10 /// @brief protocols that are specific to docking low resolution
11 /// @detailed This is to a very large extent a copy of the docking
12 /// @detailed protocol. Should derive out of that class instead.
13 /// @author Ingemar Andre
14 
16 
17 // Rosetta Headers
19 
20 #include <basic/options/option.hh>
21 #include <basic/options/keys/OptionKeys.hh>
22 
24 
25 #include <core/pose/Pose.hh>
26 
28 // AUTO-REMOVED #include <core/kinematics/FoldTree.hh>
30 #include <protocols/moves/Mover.hh>
35 
40 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
41 
42 // ObjexxFCL Headers
43 #include <ObjexxFCL/string.functions.hh>
44 
45 // C++ Headers
46 #include <string>
47 
48 //Utility Headers
49 // AUTO-REMOVED #include <numeric/conversions.hh>
50 
51 #include <basic/options/keys/docking.OptionKeys.gen.hh>
52 
53 #include <numeric/trig.functions.hh>
54 #include <numeric/xyzMatrix.fwd.hh>
55 
56 #include <basic/Tracer.hh>
57 
59 #include <utility/vector0.hh>
60 #include <utility/vector1.hh>
61 
62 using basic::T;
63 using basic::Error;
64 using basic::Warning;
65 
66 static basic::Tracer TR("protocols.symetric_docking.SymDockingLowRes");
67 
68 // originally from dock_structure.cc Jeff Gray April 2001
69 //
70 //
71 
72 using namespace core;
73 
74 namespace protocols {
75 namespace symmetric_docking {
76 
77  // constructor with arguments
78  SymDockingLowRes::SymDockingLowRes(
80  ) : Mover(), scorefxn_(scorefxn_in)
81  {
82  moves::Mover::type( "SymDockingLowRes" );
83  }
84 
86 
89  return new SymDockingLowRes( *this );
90  }
91 
92  void
94  using namespace basic::options;
95 
96  // sets up the stuff in pose
97  (*scorefxn_)( pose );
98 
99  // cycles
100  inner_cycles_ = option[ OptionKeys::docking::docking_centroid_inner_cycles ]();
101  outer_cycles_ = option[ OptionKeys::docking::docking_centroid_outer_cycles ]();
102 
103  if ( option[ OptionKeys::docking::dock_mcm_trans_magnitude ].user() ) {
104  trans_magnitude_ = option[ OptionKeys::docking::dock_mcm_trans_magnitude ]();
105  } else {
106  trans_magnitude_ = 1.5;
107  }
108 
109  if ( option[ OptionKeys::docking::dock_mcm_rot_magnitude ].user() ) {
110  rot_magnitude_ = option[ OptionKeys::docking::dock_mcm_rot_magnitude ]();
111  } else {
112  rot_magnitude_ = 4;
113  }
114 
115  chi_ = false;
116  bb_ = false;
117 
118  temperature_ = 0.8;
119 
120  nb_list_ = true; /// not sure if this should be true or not
121  accept_rate_ = 0.0;
122 
123  set_default_mc( pose );
124  set_default_move_map( pose );
125  set_default_protocol( pose );
126  }
127 
130 
131  void
133  // create the monte carlo object and movemap
134  mc_ = new moves::MonteCarlo( pose, *scorefxn_, temperature_ );
135  }
136 
138  using namespace core::conformation::symmetry;
139 
141  movemap_->set_bb( bb_ );
142  movemap_->set_chi( chi_ );
144 
145 }
146 
148  using namespace moves;
149  using namespace conformation::symmetry;
150 
151  assert( core::pose::symmetry::is_symmetric( pose ));
152  SymmetricConformation & symm_conf (
153  dynamic_cast<SymmetricConformation & > ( pose.conformation()) );
154 
155  std::map< Size, SymDof > dofs ( symm_conf.Symmetry_Info()->get_dofs() );
156 
158 
159  docking_lowres_protocol_ = new SequenceMover;
160  docking_lowres_protocol_->add_mover( rb_mover_ );
161 
162  if( basic::options::option[basic::options::OptionKeys::docking::multibody].user() ){
163  utility::vector1<int> mbjumps = basic::options::option[basic::options::OptionKeys::docking::multibody]();
164  for(Size ij = 1; ij <= symm_conf.Symmetry_Info()->get_njumps_subunit(); ++ij){
165  if( mbjumps.size()==0 || std::find(mbjumps.begin(),mbjumps.end(),ij)!=mbjumps.end() ){
166  TR << "add subunit jump mover " << ij << std::endl;
168  }
169  }
170  }
171 
172 }
173 ////////////////////////////////////////////////////////////////////////////////
174 /// @begin DockingLowRes.apply
175 ///
176 /// @brief Perform several cycles of rigid-body Monte Carlo moves
177 /// and adapt the step size.
178 /// @detailed
179 ///
180 /// @remarks
181 /// currently used only in the low-resolution step (centroid mode)
182 ///
183 /// @references pose_docking_centroid_rigid_body_adaptive from pose_docking.cc and
184 /// rigid_body_MC_cycle_adaptive from dock_structure.cc
185 ///
186 /// @authors Monica Berrondo October 22 2007
187 ///
188 /// @last_modified October 22 2007
189 /////////////////////////////////////////////////////////////////////////////////
191 {
192  using namespace scoring;
193 
194  TR << "in DockingLowRes.apply\n";
195 
196  set_default( pose );
197 
198  TR << "::::::::::::::::::Centroid Rigid Body Adaptive:::::::::::::::::::\n";
199 
200  for ( int i=1; i<=outer_cycles_; ++i) {
201  rigid_body_trial( pose );
202  if ( accept_rate_ < 0.5 ) {
203  trans_magnitude_ *= 0.9;
204  rot_magnitude_ *= 0.9;
205  } else {
206  trans_magnitude_ *= 1.1;
207  rot_magnitude_ *= 1.1;
208  }
209  // if ( jump_out_check() ) return;
210  }
211  mc_->recover_low( pose );
212  TR.flush();
213  //pose.energies().show( std::cout );
214 }
215 
218  return "SymDockingLowRes";
219 }
220 
221 ////////////////////////////////////////////////////////////////////////////////
222 /// @begin rigid_body_trial
223 ///
224 /// @brief Perform a cycle of rigid-body Monte Carlo moves
225 ///
226 /// @detailed Performs a number (nattempts) of MC rigid-body moves
227 /// (of size trans_magnitude, rot_magnitude). The number of successful
228 /// attempts is stored in accept_rate_ and used in adaptive trials.
229 ///
230 /// @remarks the success_rate defines
231 /// whether the translation/rotation size is increased or decreased for
232 /// the next cycle.
233 /// currently used only in the low-resolution step (centroid mode)
234 ///
235 /// @references pose_docking_rigid_body_trial from pose_docking.cc and
236 /// rigid_body_MC_cycle from dock_structure.cc
237 ///
238 /// @authors Monica Berrondo October 22 2007
239 ///
240 /// @last_modified October 22 2007
241 /////////////////////////////////////////////////////////////////////////////////
243 {
244  using namespace moves;
245 
246  PDBDumpMoverOP dump = new PDBDumpMover("lowres_cycle_");
247 // dump->apply( pose );
248  MCShowMoverOP mc_show = new MCShowMover( mc_ );
249 // mc_show->apply( pose );
250 
251  rb_mover_->rot_magnitude( rot_magnitude_ );
252  rb_mover_->trans_magnitude( trans_magnitude_ );
253 
254  TrialMoverOP rb_trial = new TrialMover( docking_lowres_protocol_, mc_ );
255  rb_trial->keep_stats_type( moves::accept_reject );
256 
257  RepeatMoverOP rb_cycle = new RepeatMover( rb_trial, inner_cycles_ );
258 
259  rb_cycle->apply( pose );
260 
261  pose = mc_->lowest_score_pose();
262  //pose.energies().show( std::cout );
263  mc_->reset( pose );
264 
265  accept_rate_ = rb_trial->acceptance_rate();
266 }
267 
268 } // namespace docking
269 } // namespace protocols