Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RotateJumpAxisMover.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 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/rigid/RotateJumpAxisMover.cc
11 /// @brief RotateJumpAxisMover methods implemented
12 /// @author Steven Lewis
13 
14 // Unit Headers
16 
17 // Project Headers
19 #include <core/conformation/util.hh> //get_anchor_and_root_atoms
21 #include <core/pose/Pose.hh>
22 
24 #include <core/kinematics/Stub.hh>
25 #include <core/kinematics/Jump.hh>
26 
27 // Numeric Headers
28 #include <numeric/xyzMatrix.hh>
29 #include <numeric/xyzVector.hh>
30 #include <numeric/xyz.functions.hh>
31 #include <numeric/conversions.hh> //degrees-radians
32 
33 #include <numeric/random/random.hh>
34 
35 // Utility Headers
36 #include <basic/Tracer.hh>
37 #include <core/types.hh>
38 
39 // C++ Headers
40 #include <string>
41 
42 #include <utility/vector1.hh>
43 
44 
45 using basic::Error;
46 using basic::Warning;
47 
48 static numeric::random::RandomGenerator RG(11001001); //it means #116, not 201, get it?
49 static basic::Tracer TR( "protocols.rigid.RotateJumpAxisMover" );
50 
51 namespace protocols {
52 namespace rigid {
53 
55 
56  //first determine where the jump is
57  core::kinematics::Edge const & rb_jump(pose.fold_tree().jump_edge(rb_jump_num_));
58  core::Size const upstream_resid(rb_jump.start());
59  core::Size const downstream_resid(rb_jump.stop());
60  //these fail if for an underspecified jump (meaning, !edge.has_atom_info())
61  //std::string const upstream_atom(pose.fold_tree().jump_edge(rb_jump_num_).upstream_atom());
62  //std::string const downstream_atom(pose.fold_tree().jump_edge(rb_jump_num_).downstream_atom());
63  core::conformation::Residue const & upstream_res(pose.residue(upstream_resid));
64  core::conformation::Residue const & downstream_res(pose.residue(downstream_resid));
65 
66  //Use Phil's lookup to protect from !edge.has_atom_info()
67  core::Size upstream_atomno, downstream_atomno;
69  upstream_res,
70  downstream_res,
71  rb_jump,
72  upstream_atomno,
73  downstream_atomno);
74 
75  //calculate the rotation axis and angle
76  //looking down the axis from the upstream to downstream atom, positive rotations are counterclockwise
77  core::Vector axis( upstream_res.atom(upstream_atomno).xyz()//minus
78  - downstream_res.atom(downstream_atomno).xyz() );
79  core::Angle angle(calc_angle());
80 
81  TR << angle << std::endl;
82  numeric::xyzMatrix< core::Angle > rotation_matrix( numeric::rotation_matrix(axis, angle));
83 
84  //make new jump and apply to pose
87  Stub const S1( pose.conformation().upstream_jump_stub( rb_jump_num_ ) );
88  Stub const S2( pose.conformation().downstream_jump_stub( rb_jump_num_ ) );
89  pose.set_jump(rb_jump_num_, Jump(S1, Stub(rotation_matrix * S2.M, S2.v )));
90  return;
91 }//apply
92 
95  return "RotateJumpAxisMover";
96 }
97 
99 { return numeric::conversions::radians(lower_angle_ + ((upper_angle_ - lower_angle_) * RG.uniform())); }
100 
101 ///@details random angle constructor. rb_jump_num is the number of the jump. Magic numbers 180 and -179.9999999... maintain the uniform range. I'm sure there's a better way to get [180, -180) but I can't figure out what it is.
103  : moves::Mover(), rb_jump_num_(rb_jump_num), upper_angle_(180.0), lower_angle_(-179.9999999999999999999999999999999999999999999999)
104 { Mover::type( "RotateJumpAxisMover" ); }
105 
106 ///@details range of angles constructor - takes DEGREES not RADIANS. rb_jump_num is the number of the jump.
107 RotateJumpAxisMover::RotateJumpAxisMover( core::Size const rb_jump_num, core::Angle const upper, core::Angle const lower )
108  : moves::Mover(), rb_jump_num_(rb_jump_num), upper_angle_(upper), lower_angle_(lower)
109 { Mover::type( "RotateJumpAxisMover" ); }
110 
111 ///@details particular angle constructor - takes DEGREES not RADIANS. rb_jump_num is the number of the jump.
113  : moves::Mover(), rb_jump_num_(rb_jump_num), upper_angle_(angle), lower_angle_(angle)
114 { moves::Mover::type( "RotateJumpAxisMover" ); }
115 
117 
118 }//rigid
119 }//protocols