Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KinematicPerturber.hh
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/loops/loop_closure/kinematic_closure/KinematicPerturber.hh
11 /// @brief Header file for KinematicPerturbers used by the kineamtic mover
12 /// @author Florian Richter, floric@u.washington.edu, march 2009
13 /// @author Amelie Stein, amelie.stein@ucsf.edu, October 2012 -- refactoring vicinity sampling & new perturbers
14 
15 #ifndef INCLUDED_protocols_loops_loop_closure_kinematic_closure_KinematicPerturber_hh
16 #define INCLUDED_protocols_loops_loop_closure_kinematic_closure_KinematicPerturber_hh
17 
20 
21 // Rosetta Headers
22 #include <core/types.hh>
23 #include <core/pose/Pose.fwd.hh>
26 #include <core/chemical/AA.hh>
27 
29 
30 // Utility Headers
31 #include <utility/LexicographicalIterator.hh> //not OPable; needs full header
32 #include <utility/vector1.hh>
33 #include <utility/pointer/ReferenceCount.hh>
34 
35 // C++ Headers
36 #include <string>
37 #include <map>
38 
39 namespace protocols {
40  namespace loops {
41  namespace loop_closure {
42  namespace kinematic_closure {
43 
44  /// @brief pure virtual base class for KinematicPerturber. KinematicPerturbers determine HOW loops should be perturbed. The base class contains a provision for determining WHERE they should be perturbed: MoveMap sensitivity.
46 
47  public:
48 
50  virtual ~KinematicPerturber();
51 
52  virtual
53  std::string perturber_type() const = 0;
54 
55  void
56  set_kinmover( KinematicMoverCAP kinmover ){ kinmover_ = kinmover; }
57 
58  void
60 
62  get_movemap() const ;
63 
64  /// @brief function that perturbs the chain, i.e. sets new values
65  /// @brief for the torsions, bond angles and bond lengths
66  /// @brief note: the torsions/angles/lengths that are input to this
67  /// @brief function will be identical to the ones in the pose,
68  /// @brief i.e. only the dof values that are explicitly set by
69  /// @brief this function plus the pivots will have changed after loop closure
70  virtual
71  void
73  core::pose::Pose const & pose,
77  ) = 0; // needs to be non-const for Taboo Sampling
78 
79 
80  /// @brief after the kinmover has closed the loop, the perturber needs
81  /// @brief to put the solutions into the pose
82  /// @brief note: the base class version of this function sets the torsions,
83  /// @brief so any KinematicPerturber that only changes the torsions will not have
84  /// @brief to implement this function
85  virtual
86  void
88  core::pose::Pose & pose,
89  utility::vector1< core::Real> const & torsions,
90  utility::vector1< core::Real> const & , //bond_ang,
91  utility::vector1< core::Real> const & ,//bond_len,
92  bool //closure_successful
93  ) const;
94 
95  virtual
96  bool perturber_exhausted() const {
97  return false; }
98 
99  void
101  max_sample_iterations_ = sample_its; }
102 
103  core::Size
105  return max_sample_iterations_; }
106 
107  void clear_torsion_string_stack() { } // only actually used for TabooSampling
108 
109  protected:
110 
111  //for access to the kinematic mover that owns this perturber
113 
115 
116  private:
118 
119  };
120 
121 
122 
123  /// @brief torsion sampling kinematic perturber
125 
126  public:
127 
129 
131 
133 
135  return "TorsionSampleKinematicPerturber"; }
136 
137  ///@brief varies torsions always and bond angles sometimes. Currently torsion varying will respect a movemap if present; angles do NOT look for a movemap.
138  void
140  core::pose::Pose const & pose,
143  utility::vector1< core::Real> & //bond_len
144  ) ;
145 
146 
147  void
149  core::pose::Pose & pose,
150  utility::vector1< core::Real> const & torsions,
151  utility::vector1< core::Real> const & bond_ang,
152  utility::vector1< core::Real> const & bond_len,
153  bool closure_successful
154  ) const;
155 
156  void
157  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
158  vary_ca_bond_angles_ = vary_ca_bond_angles; }
159 
160  private:
161 
164 
166 
167  };
168 
169 
170  /// @brief vicinity sampling kinematic perturber
171  /// @author Amelie Stein (just the refactoring)
173 
174  public:
175 
177 
179 
181 
183  return "VicinitySampleKinematicPerturber"; }
184 
185  ///@brief varies torsions always and bond angles sometimes. Currently torsion varying will respect a movemap if present; angles do NOT look for a movemap. -- note that the analytic closure and pivot selection currently do not respect movemaps though
186  void
188  core::pose::Pose const & pose,
191  utility::vector1< core::Real> & //bond_len
192  ) ;
193 
194 
195  void
197  core::pose::Pose & pose,
198  utility::vector1< core::Real> const & torsions,
199  utility::vector1< core::Real> const & bond_ang,
200  utility::vector1< core::Real> const & bond_len,
201  bool closure_successful
202  ) const;
203 
204  void
205  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
206  vary_ca_bond_angles_ = vary_ca_bond_angles; }
207 
208 
209  void
210  set_degree_vicinity( core::Real degree_vicinity ) {
211  degree_vicinity_ = degree_vicinity; }
212 
213  private:
214 
218 
219  };
220 
221 
222 
223  /// @brief WARNING WARNING UNTESTED!!!! torsion sweeping kinematic perturber
224  /// @brief WARNING WARNING UNTESTED!!!! used to work in other implementation
225  /// @brief probably works now, but to make sure you shoud doublecheck
226  // @brief if you plan to use
227  ///@details Here's some commentary on why the TorsionSweepingKinematicPerturber is Fun and Awesome to use! Basically, you take the loop as given and search for solutions nearby. Its purpose is not to produce large changes, but instead to produce small perturbations to find the bottom of the current energy well. It's not meant to be used for the original KIC protocol, in which the pivots are changed regularly: you can't sweep through nonpivot torsion space if the pivots don't stay the same.
229 
230  public:
231 
234 
236  return "TorsionSweepingKinematicPerturber"; }
237 
238  ///@brief movemap control NOT IMPLEMENTED in TorsionSweepingKP. It is also NOT NEEDED because you can use set_nonpivot_res_to_sweep instead.
239  void
241  core::pose::Pose const & pose,
244  utility::vector1< core::Real > & //bond_len
245  ) ;
246 
247  bool perturber_exhausted() const {
248  return sweep_iterator_.at_end(); }
249 
251  void set_nonpivot_bb_torsion_id( utility::vector1< Size > const & bbtorids );
252  void set_sweep_start_angle( utility::vector1< core::Real > const & angles_in_degrees );
253  void set_sweep_step_size( utility::vector1< core::Real > const & angle_steps_in_degrees );
254  void set_sweep_nsteps( utility::vector1< Size > const & nsteps );
255 
256 
257  private:
258 
263  mutable utility::LexicographicalIterator sweep_iterator_;
264 
265  }; // TorsionSweepingKinematicPerturber
266 
267 
268 
269  /// @author Amelie Stein
270  /// @brief neighbor-dependent torsion sampling kinematic perturber -- uses rama2b for phi/psi lookup
272 
273  public:
274 
276 
278 
280 
282  return "NeighborDependentTorsionSamplingKinematicPerturber"; }
283 
284  void
286  core::pose::Pose const & pose,
289  utility::vector1< core::Real> & //bond_len
290  ) ;
291 
292 
293  void
295  core::pose::Pose & pose,
296  utility::vector1< core::Real> const & torsions,
297  utility::vector1< core::Real> const & bond_ang,
298  utility::vector1< core::Real> const & bond_len,
299  bool closure_successful
300  ) const;
301 
302  void
303  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
304  vary_ca_bond_angles_ = vary_ca_bond_angles; }
305 
306 
307  private:
308 
311 
313 
314  };
315 
316 
317 
318 
319 
320 
321  /// @brief torsion-restricted kinematic perturber (still samples randomly, but only within a given torsion bin)
322  /// @author Amelie Stein
324 
325  public:
326 
328 
330 
332 
334  return "TorsionRestrictedKinematicPerturber"; }
335 
336  void
338  core::pose::Pose const & pose,
341  utility::vector1< core::Real> & //bond_len
342  ) ;
343 
344 
345  void
347  core::pose::Pose & pose,
348  utility::vector1< core::Real> const & torsions,
349  utility::vector1< core::Real> const & bond_ang,
350  utility::vector1< core::Real> const & bond_len,
351  bool closure_successful
352  ) const;
353 
354  void
355  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
356  vary_ca_bond_angles_ = vary_ca_bond_angles; }
357 
358 
359  private:
360 
364 
366 
367  };
368 
369 
370 
371 
372 
373  /// @brief Taboo-sampling kinematic perturber (still samples randomly, but only within a specific torsion bin, and the Taboo sampler ensures that this torsion bin is varied in each iteration)
374  /// @author Amelie Stein
376 
377  public:
378 
380 
381  // check if both c'tors are used -- if not, remove the unused one
383 
385 
387  return "TabooSamplingKinematicPerturber"; }
388 
389  void
391  core::pose::Pose const & pose,
394  utility::vector1< core::Real> & //bond_len
395  ) ;
396 
397 
398  void
400  core::pose::Pose & pose,
401  utility::vector1< core::Real> const & torsions,
402  utility::vector1< core::Real> const & bond_ang,
403  utility::vector1< core::Real> const & bond_len,
404  bool closure_successful
405  ) const;
406 
407  void
408  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
409  vary_ca_bond_angles_ = vary_ca_bond_angles; }
410 
411 
413  random_torsion_strings_.clear();
414  }
415 
416  protected:
417 
418  void
420 
423 
424  private:
425 
428 
429  // for Taboo Sampling
431  utility::vector1< std::string > random_torsion_strings_; // holds a list of random torsion bin strings to be sampled, to ensure diversity -- accessed (and filled, if necessary) by next_torsion_string( pose )
432 
434 
435 
436 
437  };
438 
439 
440 
441  /// @brief Neighbor-dependent Taboo-sampling kinematic perturber (still samples randomly, but only within a given torsion bin; the Taboo sampler ensures that this torsion bin is varied in each iteration) that uses neighbor-dependent Ramachandran distributions (rama2b)
442  /// @author Amelie Stein
443  /// @date Mon May 21 11:39:26 PDT 2012
445 
446  public:
447 
449 
451 
453 
455  return "NeighborDependentTabooSamplingKinematicPerturber"; }
456 
457  void
459  core::pose::Pose const & pose,
462  utility::vector1< core::Real> & //bond_len
463  ) ;
464 
465 
466  void
468  core::pose::Pose & pose,
469  utility::vector1< core::Real> const & torsions,
470  utility::vector1< core::Real> const & bond_ang,
471  utility::vector1< core::Real> const & bond_len,
472  bool closure_successful
473  ) const;
474 
475  void
476  set_vary_ca_bond_angles( bool vary_ca_bond_angles ) {
477  vary_ca_bond_angles_ = vary_ca_bond_angles; }
478 
479 
481  random_torsion_strings_.clear();
482  }
483 
484  protected:
485 
486  void
488 
491 
492  private:
493 
496 
497 
499  utility::vector1< std::string > random_torsion_strings_; // holds a list of random torsion bin strings to be sampled, to ensure diversity -- accessed (and filled, if necessary) by next_torsion_string( pose )
500 
502 
503 
504 
505  }; // NeighborDependentTabooSamplingKinematicPerturber
506 
507 
508 
509 
510 
511 
512 
513  } // namespace kinematic_closure
514  } // namespace loop_closure
515  } // namespace moves
516 } // namespace protocols
517 
518 #endif //INCLUDED_protocols_loops_loop_closure_kinematic_closure_KinematicPerturber_hh