Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RigidBodyMover.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
11 /// @brief
12 /// @author Monica Berrondo
13 /// @author Ian Davis
14 /// @author Ingemar Andre
15 
16 
17 #ifndef INCLUDED_protocols_rigid_RigidBodyMover_hh
18 #define INCLUDED_protocols_rigid_RigidBodyMover_hh
19 
20 // Unit headers
22 
23 // Package headers
25 
26 #include <core/types.hh>
27 
28 #include <core/pose/Pose.fwd.hh>
29 
31 
32 //#include <core/chemical/ResidueTypeSet.hh>
33 //#include <core/scoring/ScoreFunction.fwd.hh>
34 
36 
37 // ObjexxFCL Headers
38 
39 #include <numeric/xyzMatrix.hh>
40 
41 // C++ Headers
42 #include <map>
43 
44 // Utility Headers
45 // AUTO-REMOVED #include <numeric/xyzVector.io.hh>
46 // AUTO-REMOVED #include <numeric/random/random.hh>
47 #include <utility/pointer/ReferenceCount.hh>
48 
49 #include <utility/vector1.hh>
50 #include <numeric/xyzVector.hh>
51 
52 
53 namespace protocols {
54 namespace rigid {
55 
56 /// @brief Partner, which partner gets moved
57 enum Partner {
60 } ;
61 
62 /// @brief Direction, which direction
63 enum Direction {
64  c2n=-1,
65  random=0,
66  n2c=1
67 } ;
68 
69 ///////////////////////////////////////////////////////////////////////////////
70 /// @brief Rigid-body random translate/rotate around centroid of downstream side of a jump.
71 /// @details We operate on a single jump rather than e.g. a randomly selected
72 /// jump from the mobile jumps in a MoveMap.
73 /// If you want a random choice among jumps, put multiple RigidBodyMovers
74 /// into a RandomMover (which will give you more control, anyway).
76 public:
78 
79 public:
80 
81  // default constructor
83 
84  // constructor with arguments
86  int const rb_jump_in,
87  Direction dir_in=n2c
88  );
89 
90  RigidBodyMover( RigidBodyMover const & src );
91 
92  virtual ~RigidBodyMover();
93 
94  /// @brief Manual override of rotation center.
95  void rot_center( core::Vector const rot_center_in ) { rot_center_ = rot_center_in; }
96 
97  virtual void apply( core::pose::Pose & pose ) = 0;
98  virtual std::string get_name() const;
99 
100  virtual
101  bool
102  preserve_detailed_balance() const { return true; }
103 
104  /// @brief set whether detailed balance is preserved (i.e. no branch angle optimization during moves)
105  virtual
106  void
108  bool
109  ) {};
110 
111  /// @brief get the TorsionIDs perturbed by the mover during moves, along with their ranges
112  virtual
115 
116  // data
117 protected:
118  int rb_jump_;
119  /// direction of folding (n-term to c-term)
121 
122  /// center of rotation
124  bool freeze_; // use the same movement as before (if one is set) during apply
125 
126 public:
127  // Can't change jump number after creation b/c it determines center of rotation!
128  //void rb_jump_( int const rb_jump_in ) { rb_jump_ = rb_jump_in; }
129  int rb_jump() const { return rb_jump_; }
130  void rb_jump(int jump_id){rb_jump_ = jump_id;} // set jump
131 
132  void unfreeze(){freeze_=false;} // create a new trans_axis during apply
133  void freeze(){freeze_=true;} // use the same trans_axis as before (if one is set) during apply
134 
135 };
136 
137 // does a perturbation defined by the rotational and translational magnitudes
139 public:
141 
142 public:
143  // default constructor
145 
146  // constructor with arguments (rb_jump defined)
148  int const rb_jump_in,
149  core::Real const rot_mag_in,
150  core::Real const trans_mag_in,
151  Partner const partner_in=partner_downstream,
152  bool interface_in=false //rot_center calculated at interface
153  );
154 
155  // constructor with arguments (rb_jump defined)
157  int const rb_jump_in,
158  core::Real const rot_mag_in,
159  core::Real const trans_mag_in,
160  Partner const partner_in,
161  utility::vector1< bool > ok_for_centroid_calculation
162  );
163 
164  // constructor with arguments (movable jumps defined by a movemap)
166  core::pose::Pose const & pose_in,
167  core::kinematics::MoveMap const & mm,
168  core::Real const rot_mag_in,
169  core::Real const trans_mag_in,
170  Partner const partner_in=partner_downstream,
171  bool interface_in=false //rot_center calculated at interface
172  );
173 
174  // constructor with arguments (overloaded for default jump, but defined rot/mag)
176  core::Real const rot_mag_in,
177  core::Real const trans_mag_in,
178  Partner const partner_in=partner_downstream,
179  bool interface_in=false //rot_center calculated at interface
180  );
181 
183  virtual ~RigidBodyPerturbMover();
184 
185  virtual void apply( core::pose::Pose & pose );
186  virtual std::string get_name() const;
187 
188  void rot_magnitude( core::Real const magnitude ) { rot_mag_ = magnitude; }
189 
190  void trans_magnitude( core::Real const magnitude ) { trans_mag_ = magnitude; }
191  core::Size get_trans_mag() const;
192  core::Size get_rot_mag() const;
193 
194  /// @brief Manual override of rotation center.
195  void rot_center( core::Vector const /*rot_center_in*/ ); // recreate unless freeze is specified.
196 
197  friend std::ostream &operator<< ( std::ostream &os, RigidBodyPerturbMover const &mover );
198 
199 protected:
200  /// perturbation magnitudes (rotational and translational)
203  utility::vector1<core::Real> rb_delta_; // size 6: translateXYZ, rotateXYZ
204 private:
209 };
210 
211 ///@brief does a perturbation defined by the rotational and translational magnitudes
212 /// without setting up the center
213 /// Can be defined through a move map or with rb_jump
214 /// Defining through a movemap with multiple jumps leads to a random jump being
215 /// chosen at apply time, NOT at construction time! This is done to simplify
216 /// docking with more than one active jump.
219 public:
220  // default constructor
222 
223  // constructor with arguments (rb_jump defined)
225  int const rb_jump_in,
226  core::Real const rot_mag_in,
227  core::Real const trans_mag_in
228  );
229 
230  // constructor with arguments (rb_jump not defined)
231  // movemap used instead, to allow multiple jumps
233  core::pose::Pose const & pose_in,
234  core::kinematics::MoveMap const & mm,
235  core::Real const rot_mag_in,
236  core::Real const trans_mag_in,
237  Direction dir_in
238  );
239 
240 // function for the parser with lots of accessors
241  void parse_my_tag(
242  utility::tag::TagPtr const tag,
246  core::pose::Pose const &
247  );
248 
251 
252  virtual void apply( core::pose::Pose & pose );
253  virtual std::string get_name() const;
254  void rot_magnitude( core::Real const magnitude ) { rot_mag_ = magnitude; }
255  void trans_magnitude( core::Real const magnitude ) { trans_mag_ = magnitude; }
256 
257  void add_jump( core::Size );
258  void clear_jumps();
259 
260  virtual moves::MoverOP clone() const;
261 
262 protected:
263  /// perturbation magnitudes (rotational and translational)
266 private:
269 };
270 
272 public:
274 
275 public:
276  // default constructor
278 
279  // constructor with arguments
281  core::pose::Pose const & pose_in,
282  int const rb_jump_in=1,
283  Partner const partner_in=partner_downstream,
284  int phi_angle=360,
285  int psi_angle=360,
286  bool update_center_after_move=true
287  );
288 
290  virtual ~RigidBodyRandomizeMover();
291 
292  virtual void apply( core::pose::Pose & pose );
293  virtual std::string get_name() const;
294  core::Size get_phi() const;
295  core::Size get_psi() const;
296  friend std::ostream &operator<< ( std::ostream &os, RigidBodyRandomizeMover const &randommover );
297 
298 private:
299  Partner partner_; // which partner gets randomized
302  numeric::xyzMatrix_double rotation_matrix_;
304 
305 };
306 
307 // spin about a random axis
309 public:
311 
312 public:
313  // default constructor
315 
316  ///@brief constructor with arguments
317  /// spin axis is initialized to 0 and then calculated during apply()
318  RigidBodySpinMover( int const rb_jump_in );
319 
320  RigidBodySpinMover( RigidBodySpinMover const & src );
322 
323  void spin_axis( core::Vector spin_axis_in );
324  void rot_center( core::Vector const rot_center_in );
325 
326  virtual void apply( core::pose::Pose & pose );
327  virtual std::string get_name() const;
328  friend std::ostream &operator<< ( std::ostream &os, RigidBodySpinMover const &spinmover );
329 
330 protected:
333 
334 };
335 
336 
338 public:
340 public:
341  //default ctor
343 
344  ///@brief constructor with arguments
345  /// spin axis is initialized to 0 then calculated during apply()
346  /// if spin_axis is not already set
347  RigidBodyDeterministicSpinMover( int const rb_jump_in, core::Vector spin_axis, core::Vector rotation_center, float angle_magnitude );
348 
349 
350  //copy ctor
352 
353  //dtor
355  void angle_magnitude( float angle_magnitude );
356  virtual void apply( core::pose::Pose & pose );
357  virtual std::string get_name() const;
358  friend std::ostream &operator<< ( std::ostream &os, RigidBodySpinMover const & spinmover );
359 
360 private:
362 };
363 
364 // translate down an axis
366 public:
368 
369 public:
370  // default constructor
372 
373  // constructor with arguments
375  core::pose::Pose const & pose_in,
376  int const rb_jump_in=1
377  );
378 
380  virtual ~RigidBodyTransMover();
381 
383  core::Vector trans_axis() const { return trans_axis_; }
384  void trans_axis( core::Vector trans_axis_in ) { trans_axis_ = trans_axis_in; }
385 
386  void step_size( core::Real step_size_in ) { step_size_ = step_size_in; }
387 
388  virtual void apply( core::pose::Pose & pose );
389  virtual std::string get_name() const;
390  friend std::ostream &operator<< ( std::ostream &os, RigidBodyTransMover const &mover );
391 
392 private:
395 
396 };
397 
398 
399 /// @brief Rigid-body move that evenly samples the space within a sphere
401 public:
403 
404 public:
405  // default constructor
407 
408  // constructor with arguments
410  int const rb_jump_in,
411  core::Real step_size_in
412  );
413 
416 
417  virtual void apply( core::pose::Pose & pose );
418  virtual std::string get_name() const;
419 
420 private:
421  void reset_trans_axis();
422 
423 private:
425  core::Real random_step_; // by saving these we can apply the same random step to other things after we freeze
426  core::Vector trans_axis_;// by saving these we can apply the same random step to other things after we freeze
427 };
428 
429 // Initialize all dofs in the system randomly. Start by rotation angles
430 // only.
432 public:
434 
435 public:
436  // default constructor
438 
439  // constructor with arguments
441  int const rb_jump_in,
443  );
444 
446  virtual ~RigidBodyDofRandomizeMover();
447 
448  virtual void apply( core::pose::Pose & pose );
449  virtual std::string get_name() const;
450 
451 private:
453 };
454 
455 // Initialize all dofs in the system randomly. Start by rotation angles
456 // only.
458 public:
460 
461 public:
462  // default constructor
464 
465  // constructor with arguments
467  std::map< Size, core::conformation::symmetry::SymDof > const & dofs
468  );
469 
472 
473  virtual void apply( core::pose::Pose & pose );
474  virtual std::string get_name() const;
475 
476 private:
477  std::map< Size, core::conformation::symmetry::SymDof > dofs_;
478 
479 };
480 
481 
482 // Translate down axis determined by the available dofs.
483 // Translations are made along all allowed directions (x,y or z)
484 // for a selected jump
486 public:
488 
489 public:
490  // default constructor
492 
493  // constructor with arguments
496  int const rb_jump_in,
498  );
499 
500  // constructor with arguments
502  std::map< Size, core::conformation::symmetry::SymDof > dofs
503  );
504 
507 
509  core::Vector trans_axis() const { return trans_axis_; }
510  void trans_axis( core::Vector trans_axis_in ) { trans_axis_ = trans_axis_in; }
511 
512  void step_size( core::Real step_size_in ) { step_size_ = step_size_in; }
513 
514  virtual void apply( core::pose::Pose & pose );
515  virtual std::string get_name() const;
516 
517 private:
521 
522 };
523 
524 // Translate down axis determined by the available dofs.
525 // Translation are made along all allowed directions (x,y or z)
526 // for all available jumps. Jumps are visited in random order
528 public:
530 
531 public:
532  // default constructor
534 
535  // constructor with arguments
537  std::map< Size, core::conformation::symmetry::SymDof > dofs
538  );
539 
542 
544  core::Vector trans_axis() const { return trans_axis_; }
545  void trans_axis( core::Vector trans_axis_in ) { trans_axis_ = trans_axis_in; }
546  void step_size( core::Real step_size_in ) { step_size_ = step_size_in; }
547 
548  virtual void apply( core::pose::Pose & pose );
549  virtual std::string get_name() const;
550 
551 private:
552  /// allowed dofs
553  std::map< Size, core::conformation::symmetry::SymDof > dofs_;
554  // allowed jumps
557  // silly, stores the direction only!!!
559 };
560 
561 // Translate down axis determined by the available dofs.
562 // Translation are made along all allowed directions (x,y or z)
563 // for a randomly selected jump.
565 public:
567 
568 public:
569  // default constructor
571 
572  // constructor with arguments
574  std::map< Size, core::conformation::symmetry::SymDof > dofs
575  );
576 
579 
581  core::Vector trans_axis() const { return trans_axis_; }
582  void trans_axis( core::Vector trans_axis_in ) { trans_axis_ = trans_axis_in; }
583  void step_size( core::Real step_size_in ) { step_size_ = step_size_in; }
584 
585  virtual void apply( core::pose::Pose & pose );
586  virtual std::string get_name() const;
587 
588 private:
589  /// allowed dofs
590  std::map< Size, core::conformation::symmetry::SymDof > dofs_;
591  // allowed jumps
594  // silly, stores the direction only!!!
596 };
597 
598 
599 
600 
601 ///@brief does a perturbation defined by the rotational and translational magnitudes
602 /// Allowed dofs are specified by a map
603 /// Can be defined through a move map or with rb_jump. A single jump is selected
605 public:
607 
608 public:
609  // default constructor makes no sense at all!!!
610  // RigidBodyDofPerturbMover() : RigidBodyMover(), rot_mag_( 1.0 ), trans_mag_( 3.0 )
611  // {
612  // moves::Mover::type( "RigidBodyDofPerturbMover" );
613  // }
614 
615  // constructor with arguments (rb_jump not defined)
616  // movemap used instead
618  std::map< Size, core::conformation::symmetry::SymDof > dofs,
619  core::Real const rot_mag_in = 1.0,
620  core::Real const trans_mag_in = 3.0
621  );
622 
624  int const rb_jump_in,
626  core::Real const rot_mag_in = 1.0,
627  core::Real const trans_mag_in = 3.0
628  );
629 
631  virtual ~RigidBodyDofPerturbMover();
632 
633  virtual void apply( core::pose::Pose & pose );
634  virtual std::string get_name() const;
635 
636  void rot_magnitude( core::Real const magnitude ) { rot_mag_ = magnitude; }
637  void trans_magnitude( core::Real const magnitude ) { trans_mag_ = magnitude; }
639 
640 private:
641  /// allowed dofs
643  /// perturbation magnitudes (rotational and translational)
646 };
647 
648 ///@brief does a perturbation defined by the rotational and translational magnitudes
649 /// Allowed dofs are specified by a map
650 /// Can be defined through a move map or with rb_jump. All jumps are selected in random order
652 public:
654 
655 public:
656  // default constructor makes no sense at all!!!
657 // RigidBodyDofSeqPerturbMover() : RigidBodyMover(), rot_mag_( 3.0 ), trans_mag_( 8.0 )
658 // {
659 // moves::Mover::type( "RigidBodyDofSeqPerturbMover" );
660 // }
661 
662  // constructor with arguments (rb_jump not defined)
663  // movemap used instead
665  std::map< Size, core::conformation::symmetry::SymDof > dofs,
666  core::Real const rot_mag_in = 1.0,
667  core::Real const trans_mag_in = 3.0
668  );
671 
672  virtual void apply( core::pose::Pose & pose );
673  virtual std::string get_name() const;
674 
675  void rot_magnitude( core::Real const magnitude ) { rot_mag_ = magnitude; }
676  void trans_magnitude( core::Real const magnitude ) { trans_mag_ = magnitude; }
677  void dofs( std::map< Size, core::conformation::symmetry::SymDof > dofs ) { dofs_ = dofs; }
678 
679 private:
680  /// allowed dofs
681  std::map< Size, core::conformation::symmetry::SymDof > dofs_;
682  // allowed jumps
684  /// perturbation magnitudes (rotational and translational)
687 };
688 
689 } // rigid
690 } // protocols
691 
692 
693 #endif //INCLUDED_protocols_rigid_RigidBodyMover_HH