Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FullatomRelaxMover.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;
2 // rm-trailing-spaces:t -*-
3 // vi: set ts=2 noet:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available
7 // under license.
8 // (c) The Rosetta software is developed by the contributing members of the
9 // Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org.
11 // Questions about this can be
12 // (c) addressed to University of Washington UW TechTransfer,
13 // email: license@u.washington.edu.
14 
15 /// @file FullatomRelaxMover.cc
16 /// @author Robin A Thottungal (rathottungal@gmail.com)
17 
18 //Unit header
20 
21 // Package header
24 
25 // Project headers
26 
30 #include <protocols/docking/DockFilters.hh> // get error if you did not include
33 
35 #include <protocols/moves/Mover.hh>
41 
43 
46 #include <protocols/jd2/Job.hh>
47 
53 
54 #include <core/pose/Pose.hh>
55 #include <basic/options/option.hh>
56 #include <basic/options/keys/run.OptionKeys.gen.hh>
57 #include <core/pose/PDBInfo.hh>
58 #include <basic/Tracer.hh>
60 
61 // Numeric Headers
62 #include <numeric/random/random.hh>
63 
64 // C++ Headers
65 #include <utility/exit.hh>
66 #include <basic/prof.hh>
67 #include <basic/Tracer.hh>
68 
69 #include <ctime>
70 
71 using basic::T;
72 using basic::Error;
73 using basic::Warning;
74 
75 static basic::Tracer TR("protocols.SurfaceDocking.FullatomRelaxMover");
76 static numeric::random::RandomGenerator RG(27510);
77 
78 namespace protocols {
79 namespace surface_docking {
80 
81 using namespace core;
83 
84 //constructor
86  // initilized here to avoid warning!
87  nmoves_=6;
88  temperature_=0.5;
89  kT_=0.5;
90  Mover::type("FullatomRelaxMover");
91  TR << "FullatomRelaxMover Constructor Called" << std::endl;
93 }
94 
95 //destructor
97 
98 
100  TR << "Setting Defaults" << std::endl;
101  // setting MoveMaps
102  //Setting up default scorefunction --> rosetta++ modified score12
104  ( "standard","score12" );
105  // setting weighs for score12
106  TR << "Setting Weighs for score12" << std::endl;
107  score_high_res_->set_weight( core::scoring::hack_elec, 0.25 );
108  //score_high_res_->set_weight(core::scoring::fa_atr,0.95);
109  //score_high_res_->set_weight(core::scoring::fa_sol,0.90);
110  //score_high_res_->set_weight(core::scoring::fa_rep,0.70);
111  // added by Robin on Jun 17
112  //score_high_res_->set_weight( core::scoring::hack_elec, 0.5 );
113  smallmin_type_="linmin";
114  shearmin_type_="dfpmin";
115  benchmark_=false;
116  encounter_cycle_= RG.random_range(1,5); //2; // need to get replaced by a random number
117  TR << "Random Number Generated:" <<encounter_cycle_<< std::endl;
118  setupMovers();
119  }
120 
122  using namespace basic::options;
123  using namespace basic::options::OptionKeys;
124  benchmark_ = option[ OptionKeys::run::benchmark ]();
125 
126 }
127 
129  // Setting Common Parameters for movers
131  //moveMapOP_->set_bb( true );
132  Real tolerance=0.001;// for minimizer
133  //Setting up smallTrialMover
134  //Creating smallMove; temperature_ : explanation;
135  // nnmoves_ : number of residues to move(Robin thinks its a
136  // good idea to change this based on length of peptide !!!!
138  // temp commented out
139  //smallmover_->angle_max(30); // max angle deviation.
140 
141  //Default Values copied from MinMover.cc
143  score_high_res_,smallmin_type_,tolerance,true,false,false);
144  //smallsequenceMover_ =
145  /// new moves::SequenceMover(smallmover_,smallminmover_);
147  smallsequenceMover_->add_mover(smallmover_);
149 
150  //Setting up shearTrialMover
151  //Creating smallMove; temperature_ : explanation;
152  // nnmoves_ : number of residues to move
154  // Jeff thinks its a large perturbation
155  //shearmover_->angle_max(30);
156 
157  //Default Values copied from MinMover.cc
159  shearmin_type_,tolerance,true,false,false);
160  //shearsequenceMover_ =
161  // new moves::SequenceMover(shearmover_,shearminmover_);
163  shearsequenceMover_->add_mover(shearmover_);
165 
166 }
167 
168 
170 {
171  TR << "Finalizing Movers" << std::endl;
172  // Setting the move map for the peptide
173  // For setting movemap in fullatom
174  Size protein_startseqnum;
175  for (Size i=1; i<=pose.total_residue(); ++i){
176  if (pose.residue_type(i).is_protein()){
177  protein_startseqnum=i;
178  break;
179  }
180 
181  }
182  TR<<"Protein Start Location:"<<protein_startseqnum<<std::endl;
183  moveMapOP_->set_bb_true_range(protein_startseqnum,pose.total_residue());
184  // Add flexibility to the sidechains in move_map
185  moveMapOP_->set_chi( protein_startseqnum,pose.total_residue() );
186  // Setting the jump between the protein and the surface movable
187  moveMapOP_->set_jump(pose.num_jump(),true);
188 
189  // To init the final part of the min_trial_small & mini_trial_shear mover
190  // Creating a global mc object that can be used by both
191  // small_min_trial_mover() and shear_min_trial_mover()
193  //smallTrialMover
197  //shearTrialMover
201 }
202 
204  smallmover_->angle_max('H',scale/3);
205  smallmover_->angle_max('E',scale/2);
206  smallmover_->angle_max('L',scale);
207 }
208 
210  score_high_res_->set_weight(core::scoring::fa_rep,weight_scale);
211 }
212 
214  encounter_=ecount;
215 }
216 
217 
219 {
220  using namespace docking;
221  using namespace moves;
222  FinalizeMovers(pose);
223 
224  TR << "Starting FullatomRelax" << std::endl;
225 
226 
227  core::Size upper_limit=5;
228  if ( basic::options::option[ basic::options::OptionKeys::run::benchmark ] ) {upper_limit = 1;}
229  TR<<"SolutionState Cycle Number:"<<encounter_cycle_<<std::endl;
230  // object for slide into contact
231  FaSlideIntoSurface surfaceContact( pose.num_jump());
232  for ( Size j = 1; j <=upper_limit; ++j ){ // Original is 5
233  if ( encounter_ > encounter_cycle_ ){
234  //slide into contact
235  surfaceContact.apply( pose );
236  }
237 
238  smallminmover_->min_type("dfpmin");
239  shearminmover_->min_type("dfpmin");
240  small_trial_min_mover_->apply(pose); // dfpmin
241  shear_trial_min_mover_->apply(pose); //dfpmin
242  //crank mover is missing
243  for ( Size k = 1; k <= upper_limit; ++k ){//k<=5 original value;k=2 test
244  smallminmover_->min_type("linmin");
245  shearminmover_->min_type("linmin");
246  small_trial_min_mover_->apply(pose); //linmin
247  shear_trial_min_mover_->apply(pose); //linmin
248  //crank mover is missing
249  }
250  if ( encounter_ == encounter_cycle_ && j%upper_limit == 0 ){//original 5
251  TR<<"Solution State Structure Found"<<std::endl;
252  //Write the solutionState Structure
253  //getting lowest energy pose
254  monteCarlo_->recover_low(pose);
255  monteCarlo_->show_state();
256  monteCarlo_->show_counters();
257  TR<<"Calculating Secondary Structure of Solution State:"<<std::endl;
258  CalcSecondayStruct(pose);
259  // Creating a job compatible with JD2
263  job_outputter()->output_name( job2 ) );
264  job2->add_string_string_pair("SolState_SecondaryStructure:",SecStruct_);
266  other_pose( job2,pose, "SolState_");
267 
268  // Random Orient the Partner (make sure this is the peptide)
269  TR<<"Preparing for Docking Protein to Surface"<<std::endl;
270  TR<<"RigidBodyRandomizeMover"<<std::endl;
271  Size rb_jump_=pose.num_jump(); //default value
273  rmover.apply( pose );
274  //Axis Spin
275  rigid::RigidBodySpinMover smover( rb_jump_ );
276  smover.apply( pose );
277  // SurfaceOrient Mover
280  sf->apply(pose);
281  surfaceContact.apply( pose );
282  //resetting the monteCarlo object
283  monteCarlo_->reset(pose);
284  TR<<"Protein adsorbed onto the Surface:"<<std::endl;
285  }
286  if ( encounter_ >= encounter_cycle_ && j%upper_limit== 0 ){
287  //original 5
288  TR<<"Started HighResolution Surface Docking "<<std::endl;
289  moveMapOP_->set_chi(true);
290  DockingHighResOP dockmcm =new DockMCMProtocol(pose.num_jump());
291  dockmcm->apply(pose);
292 
293  }
294 
295  }
296 
297 
298 }
299 
301  nmoves_ = nmoves_in;
302  }
303 
305  return "FullatomRelaxMover";
306  }
307 
309  SecStruct_="";
310  // creating a new pose and splitting!
311  //split the pose into separate chains
312  pose::PoseOP pose_tmp=new pose::Pose(pose);
313  utility::vector1< pose::PoseOP > singlechain_poses;
314  singlechain_poses = pose_tmp->split_by_chain();
315  core::scoring::dssp::Dssp dssp( *singlechain_poses[2] );
316  dssp.insert_ss_into_pose( *singlechain_poses[2] );
317  for ( Size ii = 1; ii <= singlechain_poses[2]->total_residue(); ++ii ) {
318  SecStruct_+=singlechain_poses[2]->secstruct(ii);
319  }
320 }
321 
323  return SecStruct_;
324 }
325 
326 
327 
328 }//surfaceDockingProtocol
329 
330 } //protocol