Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LHRepulsiveRampLegacy.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
6 // (c) under license. The Rosetta software is developed by the contributing
7 // (c) members of the Rosetta Commons. For more information, see
8 // (c) http://www.rosettacommons.org. Questions about this can be addressed to
9 // (c) University of Washington UW TechTransfer, email:license@u.washington.edu
10 
11 /// @file protocols/antibody2/LHRepulsiveRampLegacy.cc
12 /// @brief Build a homology model of an antibody2
13 /// @detailed
14 ///
15 ///
16 /// @author Jianqing Xu (xubest@gmail.com)
17 
18 
19 
21 
22 #include <basic/options/option.hh>
23 #include <basic/options/keys/in.OptionKeys.gen.hh>
24 #include <basic/Tracer.hh>
25 
28 #include <protocols/loops/Loop.hh>
31 
32 
33 #include <core/pose/util.hh>
34 #include <core/pose/Pose.hh>
35 #include <core/pose/PDBInfo.hh>
36 #include <core/pose/util.hh>
39 
40 
42 
43 
44 
55 
56 
57 #include <ObjexxFCL/format.hh>
58 #include <ObjexxFCL/string.functions.hh>
59 using namespace ObjexxFCL::fmt;
60 
72 
73 
74 
75 
76 
77 
79 //JQX:: this header file took care of the "CUTPOINT_LOWER" options below
80 
81 
82 
83 using basic::T;
84 using basic::Error;
85 using basic::Warning;
86 
87 static basic::Tracer TR("protocols.antibody2.LHRepulsiveRampLegacy");
88 
89 
90 using namespace core;
91 namespace protocols {
92 namespace antibody2 {
93 
94 
95 
96 // default constructor
97 LHRepulsiveRampLegacy::LHRepulsiveRampLegacy() : Mover() {
98 
99 }
100 
101 
102 
104  user_defined_ = false;
105 
106  init(loops_in, false);
107 }
108 
109 
111  user_defined_ = false;
112 
113  init( *(antibody_in->get_AllCDRs_in_loopsop()),false);
114 }
115 
116 LHRepulsiveRampLegacy::LHRepulsiveRampLegacy(AntibodyInfoOP antibody_in, bool camelid) : Mover() {
117  user_defined_ = false;
118 
119  init(*(antibody_in->get_AllCDRs_in_loopsop()), camelid);
120 }
121 
122 
124  core::scoring::ScoreFunctionCOP dock_scorefxn,
125  core::scoring::ScoreFunctionCOP pack_scorefxn ) : Mover(){
126  user_defined_ = true;
127  dock_scorefxn_ = new core::scoring::ScoreFunction(*dock_scorefxn);
128  pack_scorefxn_ = new core::scoring::ScoreFunction(*pack_scorefxn);
129 
130  init(loops_in, false);
131 }
132 
134  core::scoring::ScoreFunctionCOP dock_scorefxn,
135  core::scoring::ScoreFunctionCOP pack_scorefxn ) : Mover(){
136  user_defined_ = true;
137  dock_scorefxn_ = new core::scoring::ScoreFunction(*dock_scorefxn);
138  pack_scorefxn_ = new core::scoring::ScoreFunction(*pack_scorefxn);
139 
140  init(*(antibody_in->get_AllCDRs_in_loopsop()),false);
141 }
142 
143 
144 // default destructor
146 
147 //clone
149  return( new LHRepulsiveRampLegacy() );
150 }
151 
152 
153 
154 
155 
156 void LHRepulsiveRampLegacy::init(loops::Loops loops_in, bool camelid )
157 {
158  set_default();
159 
160  is_camelid_ = camelid;
161  all_loops_ = loops_in;
162 
164 
165 }
166 
167 
169  benchmark_ = false;
170 
171  rep_ramp_cycles_ = 3 ;
172  rot_mag_ = 2.0 ;
173  trans_mag_ = 0.1 ;
174  temperature_ = 0.8;
175  min_threshold_ = 15.0;
176  num_repeats_ = 4;
177  min_type_ = "dfpmin_armijo_nonmonotone";
178 
179  if(!user_defined_){
181  dock_scorefxn_->set_weight( core::scoring::chainbreak, 1.0 );
182  dock_scorefxn_->set_weight( core::scoring::overlap_chainbreak, 10./3. );
184  }
185 
186 }
187 
188 
189 
190 
192  return "LHRepulsiveRampLegacy";
193 }
194 
195 
196 
197 
199  TR<<" start finalize_setup function ..."<<std::endl;
200 
201  tf_= setup_packer_task(pose);
202 
203 
204  ( *dock_scorefxn_ )( pose );
205 
206  //setting MoveMap
208  cdr_dock_map_->clear();
209  cdr_dock_map_->set_chi( false );
210  cdr_dock_map_->set_bb( false );
211  utility::vector1< bool> bb_is_flexible( pose.total_residue(), false );
212  utility::vector1< bool> sc_is_flexible( pose.total_residue(), false );
213 
214  select_loop_residues( pose, all_loops_, false/*include_neighbors*/, bb_is_flexible);
215  cdr_dock_map_->set_bb( bb_is_flexible );
216  select_loop_residues( pose, all_loops_, true/*include_neighbors*/, sc_is_flexible);
217  cdr_dock_map_->set_chi( sc_is_flexible );
218  cdr_dock_map_->set_jump( 1, true );
219  for( Size ii = 2; ii <= all_loops_.num_loop() + 1; ii++ )
220  cdr_dock_map_->set_jump( ii, false );
221 
222 
223 
224  //set up sidechain movers for rigid body jump and loop & neighbors
225  utility::vector1_size rb_jump;
226  rb_jump.push_back( 1 );
227  using namespace core::pack::task;
228  using namespace core::pack::task::operation;
229  // selecting movable c-terminal residues
230  ObjexxFCL::FArray1D_bool loop_residues( pose.total_residue(), false );
231  for( Size i = 1; i <= pose.total_residue(); i++ ) {
232  loop_residues(i) = sc_is_flexible[i];
233  } // check mapping
234 
235  using namespace protocols::toolbox::task_operations;
236  tf_->push_back( new RestrictToInterface( rb_jump, loop_residues ) );
237 
238 
239  TR<<" finish finalize_setup function !!!"<<std::endl;
240 
241 }
242 
243 
244 
245 
246 ///////////////////////////////////////////////////////////////////////////
247 /// @begin repulsive_ramp
248 ///
249 /// @brief ramping up the fullatom repulsive weight slowly to allow the
250 /// partners to relieve clashes and make way for each other
251 ///
252 /// @detailed This routine is specially targetted to the coupled
253 /// optimization of docking partners and the loop region. The
254 /// loop modelling & all previous steps involve mainly
255 /// centroid mode .On switching on fullatom mode, one is bound
256 /// to end up with clashes.To relieve the clashes, it is
257 /// essential to slowly dial up the repulsive weight instead of
258 /// turning it on to the maximum value in one single step
259 ///
260 /// @param[in] input pose which is assumed to have a docking fold tree
261 ///
262 /// @global_read fa_rep : fullatom repulsive weight
263 ///
264 /// @global_write fa_rep ( It is reset to the original value at the end )
265 ///
266 /// @remarks A particular portion is commented out,which can be
267 /// uncommented if one uses a low resolution homology model.
268 /// Check details in the beginning of the commented out region
269 ///
270 /// @references
271 ///
272 /// @authors Aroop 07/13/2010
273 ///
274 /// @last_modified 07/13/2010
275 ///////////////////////////////////////////////////////////////////////////
276 
278  TR<<"start apply function ..."<<std::endl;
279 
280 
281  finalize_setup(pose );
282 
283  // remove cutpoints variants for all cdrs
284  // "true" forces removal of variants even from non-cutpoints
285  loops::remove_cutpoint_variants( pose, true );
286  using namespace core::chemical;
288  it_end = all_loops_.end(); it != it_end; ++it ) {
291  }
292 
293  // add scores to map
294  ( *dock_scorefxn_ )( pose );
295 
296  // dampen fa_rep weight
297  core::Real rep_weight_max = dock_scorefxn_->get_weight( core::scoring::fa_rep );
298 
299  if( benchmark_ ) {
300  rep_ramp_cycles_ = 1;
301  num_repeats_ = 1;
302  min_threshold_ = 150.0;
303  }
304 
305 
306 
307  core::Real rep_ramp_step = (rep_weight_max - 0.02) / core::Real(rep_ramp_cycles_-1);
309 
310  for ( Size i = 1; i <= rep_ramp_cycles_; i++ ) {
311  core::Real rep_weight = 0.02 + rep_ramp_step * Real(i-1);
312  TR<<" repulsive ramp cycle "<<i<<": rep_weight = "<<rep_weight<<std::endl;
313  temp_scorefxn->set_weight( core::scoring::fa_rep, rep_weight );
314 
315  snugfit_MC_min(pose, temp_scorefxn);
316 
317  }
318 
319  TR<<"finish apply function !!!"<<std::endl;
320 
321 }
322 
323 
324 
325 
326 
327 //JQX: since the scorefxn needs to be changed, you have to
328 // completely re-build the "simple_mcm_repeat" mover
330 {
331  using namespace moves;
332 
334  min_mover = new simple_moves::MinMover( cdr_dock_map_, temp_scorefxn, min_type_, min_threshold_, true/*nb_list*/ );
335 
338 
340  pack_rottrial = new simple_moves::RotamerTrialsMover( pack_scorefxn_, tf_ );
341 
342  SequenceMoverOP rb_mover = new SequenceMover;
343  rb_mover->add_mover( rb_perturb );
344  rb_mover->add_mover( pack_rottrial );
345 
347  rb_mover_min = new JumpOutMover( rb_mover, min_mover, temp_scorefxn, min_threshold_ );
348 
349 
350  MonteCarloOP
351  mc = new MonteCarlo( pose, *temp_scorefxn, temperature_ );
352 
353  TrialMoverOP
354  rb_mover_min_trial = new TrialMover( rb_mover_min, mc);
355 
357  simple_mcm_repeat = new RepeatMover( rb_mover_min_trial, num_repeats_ );
358 
359 
360 
361  simple_mcm_repeat->apply( pose );
362 }
363 
364 
365 
366 
368  tf_ = new pack::task::TaskFactory(*tf);
369 }
370 
371 
372 
373 
374 } // namespace antibody2
375 } // namespace protocols
376 
377 
378 
379 
380