Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OopRandomSmallMover.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/simple_moves/oop/OopRandomSmallMover.cc
11 /// @brief OopRandomSmallMover methods implemented
12 /// @author Kevin Drew, kdrew@nyu.edu
13 
14 // Unit Headers
19 // Package Headers
20 
21 // Project Headers
31 #include <core/pose/Pose.hh>
32 #include <core/id/AtomID.hh>
33 // Random number generator
34 #include <numeric/random/random.hh>
35 // Utility Headers
36 #include <numeric/xyz.functions.hh>
37 #include <basic/Tracer.hh>
38 #include <basic/basic.hh>
39 #include <core/types.hh>
40 
41 // C++ Headers
42 
43 using basic::T;
44 using basic::Error;
45 using basic::Warning;
46 
47 static numeric::random::RandomGenerator RG(956734);
48 static basic::Tracer TR( "protocols.simple_moves.oop.OopRandomSmallMover" );
49 
50 
51 using namespace core;
52 using namespace conformation;
53 using namespace chemical;
54 using namespace core::id;
55 
56 namespace protocols {
57 namespace simple_moves {
58 namespace oop {
59 
60 ///@details
61 void OopRandomSmallMover::apply( core::pose::Pose & pose ){
62 
63  using numeric::conversions::radians;
64  using numeric::conversions::degrees;
65 
66  TR<< "in OopRandomSmallMover::apply" << std::endl;
67  //kdrew: for all positions in oop_seq_positions_, input assertion check
68  for(Size i = 1; i <= oop_seq_positions_.size(); i++)
69  {
70  Size oop_pre_pos = oop_seq_positions_[i];
71  Size oop_post_pos = oop_pre_pos+1;
72  TR<< "oop_pre_pos:" << oop_pre_pos << " oop_post_pos:" << oop_post_pos << std::endl;
73 
74  runtime_assert ( pose.residue(oop_pre_pos).has_variant_type(chemical::OOP_PRE) == 1) ;
75  runtime_assert ( pose.residue(oop_post_pos).has_variant_type(chemical::OOP_POST) == 1) ;
76  //kdrew: an oop pre position cannot be last position
77  runtime_assert ( oop_pre_pos != pose.total_residue() );
78  //kdrew: an oop post position cannot be first position
79  runtime_assert ( oop_post_pos != 1 );
80 
81  }//for
82 
83 
84  //kdrew: randomly choose position from oop_seq_positions
85  core::Size random_pos = oop_seq_positions_[int(RG.uniform()*oop_seq_positions_.size())+1];
86 
87  oop::OopMoverOP oop_mover ( new oop::OopMover( random_pos ) );
88  Real small_angle = max_small_angle_/2.0; ///< this is max_angle/2, which is the deviation from the angle input
89  Real phi_angle = basic::periodic_range( pose.phi( random_pos ) - small_angle + RG.uniform() * max_small_angle_, 360.0 );
90  //kdrew: no phi angle for n-terms, angle that gets changed is CYP-N-Ca-C
91  if( pose.residue_type( random_pos ).is_lower_terminus() )
92  {
93  AtomID aidCYP( pose.residue(random_pos).atom_index("CYP"), random_pos );
94  AtomID aidN( pose.residue(random_pos).atom_index("N"), random_pos );
95  AtomID aidCA( pose.residue(random_pos).atom_index("CA"), random_pos );
96  AtomID aidC( pose.residue(random_pos).atom_index("C"), random_pos );
97 
98  Real CYP_N_Ca_C_angle = degrees( pose.conformation().torsion_angle( aidCYP, aidN, aidCA, aidC ) );
99  phi_angle = basic::periodic_range( CYP_N_Ca_C_angle - small_angle + RG.uniform() * max_small_angle_, 360.0 ) - 180.0;
100  }
101 
102  Real psi_angle = basic::periodic_range( pose.psi( random_pos ) - small_angle + RG.uniform() * max_small_angle_, 360.0 );
103  oop_mover->set_phi( phi_angle );
104  oop_mover->set_psi( psi_angle );
105  oop_mover->apply( pose );
106  //oop_puck_mover_helper( pose, random_pos, phi_angle, psi_angle );
107 
108 }//apply
109 
111 OopRandomSmallMover::get_name() const {
112  return "OopRandomSmallMover";
113 }
114 
115 ///@brief
116 OopRandomSmallMover::OopRandomSmallMover(
117 ) : Mover()
118 {
119  Mover::type( "OopRandomSmallMover" );
120 }
121 
122 OopRandomSmallMover::OopRandomSmallMover( utility::vector1< core::Size > oop_seq_positions ): Mover(), oop_seq_positions_(oop_seq_positions), max_small_angle_(0.0)
123 {
124  Mover::type( "OopRandomSmallMover" );
125 }
126 
127 OopRandomSmallMover::OopRandomSmallMover( utility::vector1< core::Size > oop_seq_positions, core::Real max_small_angle ): Mover(), oop_seq_positions_(oop_seq_positions), max_small_angle_( max_small_angle )
128 {
129  Mover::type( "OopRandomSmallMover" );
130 }
131 
133 
134 
135 }//oop
136 }//simple_moves
137 }//protocols
138