Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SheetTranslate.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/moves/SheetTranslate.cc
11 /// @author Christopher Miles (cmiles@uw.edu)
12 
13 // Unit headers
15 
16 // C/C++ headers
17 #include <iostream>
18 #include <string>
19 
20 // Utility header
21 #include <basic/Tracer.hh>
22 #include <numeric/xyzVector.hh>
23 
24 // Project headers
26 #include <core/id/NamedAtomID.hh>
28 #include <core/kinematics/Jump.hh>
29 #include <core/kinematics/Stub.hh>
30 #include <core/pose/Pose.hh>
31 #include <protocols/loops/Loop.hh>
32 #include <protocols/loops/Loops.hh>
34 
35 // Package headers
36 #include <protocols/moves/Mover.hh>
37 
38 //Auto Headers
39 #include <utility/vector1.hh>
40 namespace protocols {
41 namespace nonlocal {
42 
43 static basic::Tracer TR("protocols.nonlocal.SheetTranslate");
44 
47 }
48 
50  initialize(sheet, distance_ang);
51 }
52 
54  sheet_ = sheet;
56 }
57 
63  using numeric::xyzVector;
66 
67  if (!is_valid()) {
68  TR.Warning << "SheetTranslate::apply() invoked with invalid or incomplete information." << std::endl;
69  TR.Warning << " sheet_ => " << get_sheet() << std::endl;
70  TR.Warning << " distance_ => " << get_distance() << std::endl;
71  return;
72  }
73 
74  // Retain a copy of the input fold tree, since we're responsible for restoring it
75  FoldTree input_tree = pose.fold_tree();
76 
77  // Configure new kinematics
78  Loops chunks;
79  decompose_structure(pose.total_residue(), &chunks);
80 
81  StarTreeBuilder builder;
82  builder.set_up(chunks, &pose);
83  TR.Debug << pose.fold_tree() << std::endl;
84 
85  // Define the axis of translation as the vector between the first and last residues of the sheet
86  xyzVector<double> axis = pose.xyz(NamedAtomID("CA", sheet_.stop())) - pose.xyz(NamedAtomID("CA", sheet_.start()));
87 
88  // Translation along the axis
89  unsigned jump_num = jump_containing_sheet(chunks);
90  Jump jump = pose.jump(jump_num);
92  pose.set_jump(jump_num, jump);
93 
94  // Restore input fold tree
95  builder.tear_down(&pose);
96  pose.fold_tree(input_tree);
97 }
98 
100  for (unsigned i = 1; i <= chunks.num_loop(); ++i) {
101  if (chunks[i].start() == sheet_.start())
102  return i;
103  }
104  return 0; // invalid
105 }
106 
107 void SheetTranslate::decompose_structure(unsigned num_residues, protocols::loops::Loops* chunks) const {
109  assert(chunks);
110  assert(num_residues > 0);
111 
112  const unsigned start = get_sheet().start();
113  const unsigned stop = get_sheet().stop();
114 
115  // Residues 1 to (sheet - 1)
116  if (start > 1) {
117  chunks->add_loop(Loop(1, start - 1));
118  }
119 
120  // Sheet
121  chunks->add_loop(Loop(start, stop));
122 
123  // Residues (sheet + 1) to end
124  if (stop < num_residues) {
125  chunks->add_loop(Loop(stop + 1, num_residues));
126  }
127 
128  chunks->sequential_order();
129 }
130 
132  return sheet_.start() > 0 && sheet_.start() < sheet_.stop();
133 }
134 
136  return sheet_;
137 }
138 
140  sheet_ = sheet;
141 }
142 
144  return distance_;
145 }
146 
147 void SheetTranslate::set_distance(double distance_ang) {
148  distance_ = distance_ang;
149 }
150 
152  return "SheetTranslate";
153 }
154 
156  return new SheetTranslate();
157 }
158 
160  return new SheetTranslate(*this);
161 }
162 
163 } // namespace moves
164 } // namespace protocols