Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AsymFoldandDockMoveRbJumpMover.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file MinMover.cc
10 /// @brief
11 /// @author Ingemar Andre
12 
13 // Unit headers
15 #include <core/pose/Pose.hh>
19 
20 // Package headers
21 
22 // options
23 
24 // ObjexxFCL Headers
25 
26 // C++ Headers
27 
28 // Utility Headers
29 #include <basic/Tracer.hh>
30 #include <utility/exit.hh>
31 #include <numeric/random/random.hh>
32 
33 //Auto Headers
34 #include <utility/vector1.hh>
35 //Auto Headers
36 #include <basic/options/keys/fold_and_dock.OptionKeys.gen.hh>
37 #include <basic/options/option.hh>
38 
39 
40 
41 namespace protocols {
42 namespace simple_moves {
43 namespace asym_fold_and_dock {
44 
45 static basic::Tracer TR("protocols.simple_moves.symmetry.AsymFoldandDockMoveRbJumpMover");
46 static numeric::random::RandomGenerator RG(44525243); // <- Magic number, do not change it!!!
47 
49  : protocols::moves::Mover("AsymFoldandDockMoveRbJumpMover"), chain_start_( chain_start )
50 {}
51 
52 void
54 {
55  find_new_jump_residue( pose );
56 }
57 
58 void
60 {
61  using namespace core::kinematics;
62 
63  core::Size nres ( pose.total_residue() );
64  core::Size nres_flexible_segment( nres - chain_start_ );
65  // Does the chain start at a reasonable place in the sequence?
66  runtime_assert( chain_start_ > 1 && chain_start_ <= nres );
67 
68  // find the anchor
69  FoldTree f( pose.fold_tree() );
70  Size anchor_start(0); //
71  int jump_number(1);
72  Size residue_that_builds_anchor(0);
73  for ( Size i=1; i<= f.num_jump(); ++i ) {
74  Size res( f.downstream_jump_residue( i ) );
75  Size res_start( f.upstream_jump_residue( i ) );
76  if ( res >= chain_start_ ) {
77  anchor_start = res;
78  residue_that_builds_anchor = res_start;
79  jump_number = i;
80  }
81  }
82  runtime_assert(anchor_start > 0 && residue_that_builds_anchor > 0 );
83 
84  TR << "The anchor residues are at residue " << residue_that_builds_anchor << " : " << anchor_start << std::endl;
85 
86  //Looking in central half of each segment -- pick a random point.
87  Size anchor_chain1 = static_cast<Size>( RG.uniform() * (chain_start_) ) + 1;
88  Size anchor_chain2 = static_cast<Size>( RG.uniform() * (nres_flexible_segment) ) +
89  chain_start_ + 1;
90 
91  if ( basic::options::option[ basic::options::OptionKeys::fold_and_dock::set_anchor_at_closest_point ] )
92  {
93  //Find Closest point of contact to the anchor of in the non-moving subunit. Really silly, should be the real minimal distance!!!
94  core::Real mindist = pose.residue(residue_that_builds_anchor).xyz("CEN").distance( pose.residue(anchor_chain2).xyz("CEN") );
95  for (Size i = chain_start_; i <= nres; i++) {
96  core::Real dist = pose.residue(residue_that_builds_anchor).xyz("CEN").distance( pose.residue(i).xyz("CEN") );
97  if ( dist < mindist ){
98  mindist = dist;
99  anchor_chain2 = i;
100  }
101  }
102  }
103 
104 
105  TR << "The anchor residues are moved to residue " << anchor_chain1 << " : " << anchor_chain2 << std::endl;
106  // Setyp the lists of jumps and cuts
107  Size num_jumps( f.num_jump() );
108  Size num_cuts( f.num_cutpoint() );
109 
110  utility::vector1< int > cuts_vector( f.cutpoints() );
111  ObjexxFCL::FArray1D_int cuts( num_cuts );
112  ObjexxFCL::FArray2D_int jumps( 2, num_jumps );
113 
114  // Initialize jumps
115  for ( Size i = 1; i<= num_jumps; ++i ) {
116  int down ( f.downstream_jump_residue(i) );
117  int up ( f.upstream_jump_residue(i) );
118  if ( down < up ) {
119  jumps(1,i) = down;
120  jumps(2,i) = up;
121  } else {
122  jumps(1,i) = up;
123  jumps(2,i) = down;
124  }
125  }
126 
127  for ( Size i = 1; i<= num_cuts; ++i ) {
128  cuts(i) = cuts_vector[i];
129  }
130 
131  int root ( f.root() );
132 
133  jumps(1, jump_number ) = anchor_chain1;
134  jumps(2, jump_number ) = anchor_chain2;
135 
136  /* debug
137  std::cout<<"cuts ";
138  for ( Size i = 1; i<= num_cuts; ++i ) {
139  std::cout<< cuts(i) << ' ';
140  }
141  std::cout<<std::endl;
142  std::cout<<"jumps ";
143  for ( Size i = 1; i<= num_jumps; ++i ) {
144  std::cout<< " ( "<<jumps(1,i) << " , " << jumps(2,i) << " ) ";
145  }
146  std::cout<<std::endl; */
147  f.tree_from_jumps_and_cuts( pose.conformation().size(), num_jumps, jumps, cuts );
148  f.reorder( root );
149  pose.conformation().fold_tree( f );
150 
151 
152 }
153 
156  return "AsymFoldandDockMoveRbJumpMover";
157 }
158 
159 }
160 } // moves
161 } // protocols