Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OopRandomPuckMover.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/OopRandomPuckMover.cc
11 /// @brief OopRandomPuckMover methods implemented
12 /// @author Kevin Drew, kdrew@nyu.edu
13 
14 // Unit Headers
19 // Package Headers
20 
21 // Project Headers
32 #include <core/pose/Pose.hh>
33 #include <core/id/AtomID.hh>
34 // Random number generator
35 #include <numeric/random/random.hh>
36 // Utility Headers
37 #include <numeric/xyz.functions.hh>
38 #include <basic/Tracer.hh>
39 #include <basic/basic.hh>
40 #include <core/types.hh>
41 
42 // C++ Headers
43 
44 using basic::T;
45 using basic::Error;
46 using basic::Warning;
47 
48 static numeric::random::RandomGenerator RG(956733);
49 static basic::Tracer TR( "protocols.simple_moves.oop.OopRandomPuckMover" );
50 
51 
52 using namespace core;
53 using namespace conformation;
54 using namespace chemical;
55 using namespace core::id;
56 using namespace protocols;
57 using namespace protocols::moves;
58 using namespace protocols::simple_moves;
59 using namespace protocols::simple_moves::chiral;
60 
61 namespace protocols {
62 namespace simple_moves {
63 namespace oop {
64 
65 ///@details
66 void OopRandomPuckMover::apply( core::pose::Pose & pose ){
67 
68  TR<< "in OopRandomPuckMover::apply" << std::endl;
69  //kdrew: for all positions in oop_seq_positions_, input assertion check
70  for(Size i = 1; i <= oop_seq_positions_.size(); i++)
71  {
72  Size oop_pre_pos = oop_seq_positions_[i];
73  Size oop_post_pos = oop_pre_pos+1;
74  TR<< "oop_pre_pos:" << oop_pre_pos << " oop_post_pos:" << oop_post_pos << std::endl;
75 
76  runtime_assert ( pose.residue(oop_pre_pos).has_variant_type(chemical::OOP_PRE) == 1) ;
77  runtime_assert ( pose.residue(oop_post_pos).has_variant_type(chemical::OOP_POST) == 1) ;
78 
79  //kdrew: an oop pre position cannot be last position
80  runtime_assert ( oop_pre_pos != pose.total_residue() );
81  //kdrew: an oop post position cannot be first position
82  runtime_assert ( oop_post_pos != 1 );
83 
84  }//for
85 
86  //kdrew: randomly choose position from oop_seq_positions
87  core::Size random_pos = oop_seq_positions_[int(RG.uniform()*oop_seq_positions_.size())+1];
88 
89  //kdrew: randomly choose conformation up, down or small angle move
90  std::string random_pucker = available_moves_[int(RG.uniform()*available_moves_.size())+1];
91 
92  runtime_assert ( random_pucker == "OOP_PUCK_PLUS" || random_pucker == "OOP_PUCK_MINUS" );
93  TR << random_pucker <<std::endl;
94 
95  oop::OopMoverOP oop_mover;
96  ResidueType restype = pose.residue_type( random_pos );
97 
98  //kdrew: determine which mover should be used, use D puck movers for chiral D oops
99  if ( random_pucker == "OOP_PUCK_PLUS" )
100  {
101  if ( is_d_chiral( restype ) )
102  {
103  oop_mover = new oop::OopDPuckPlusMover( random_pos ) ;
104  }
105  else
106  {
107  oop_mover = new oop::OopPuckPlusMover( random_pos ) ;
108  }
109  }
110  else if (random_pucker == "OOP_PUCK_MINUS" )
111  {
112  if ( is_d_chiral ( restype ) )
113  {
114  oop_mover = new oop::OopDPuckMinusMover( random_pos ) ;
115  }
116  else
117  {
118  oop_mover = new oop::OopPuckMinusMover( random_pos ) ;
119  }
120  }
121 
122  oop_mover->apply( pose );
123 
124 
125 }//apply
126 
128 OopRandomPuckMover::get_name() const {
129  return "OopRandomPuckMover";
130 }
131 
132 ///@brief
133 OopRandomPuckMover::OopRandomPuckMover(
134 ) : Mover()
135 {
136  Mover::type( "OopRandomPuckMover" );
137 }
138 
140  utility::vector1< core::Size > oop_seq_positions
141  ): Mover(), oop_seq_positions_(oop_seq_positions)
142 {
143  Mover::type( "OopRandomPuckMover" );
144 
145  available_moves_.push_back("OOP_PUCK_PLUS");
146  available_moves_.push_back("OOP_PUCK_MINUS");
147 }
148 
150 
151 }//oop
152 }//simple_moves
153 }//protocols
154