Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SearchPatternRotSetOp.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/hotspot_hashing/SearchPatternRotSetOp.cc
11 /// @brief Creates rigid body variants from search pattern during repacking.
12 /// @author Alex Ford (fordas@uw.edu)
13 
14 // Unit Headers
17 
18 #include <basic/Tracer.hh>
19 
20 //Project headers
21 #include <utility/exit.hh>
22 #include <core/kinematics/Stub.hh>
23 #include <core/kinematics/RT.hh>
25 #include <core/graph/Graph.hh>
28 #include <core/pose/Pose.hh>
33 
34 #include <utility/vector1.hh>
35 
36 namespace protocols {
37 namespace hotspot_hashing {
38 
39 static basic::Tracer TR( "protocols.hotspot_hashing.SearchPatternRotSetOp" );
40 
42  protocols::toolbox::rotamer_set_operations::RigidBodyMoveBaseRSO(),
43  search_stubs_(pattern->Searchpoints())
44 {}
45 
47  protocols::toolbox::rotamer_set_operations::RigidBodyMoveBaseRSO(),
48  search_stubs_(other.search_stubs_)
49 {}
50 
53 {
55  new SearchPatternRotSetOp(*this));
56 }
57 
58 
60  core::pose::Pose const & pose,
61  core::pack::task::PackerTask const & /*ptask*/,
62  core::Size residue_index)
63 {
65 
66 
67  // Create residue copy in centroid frame
68  core::conformation::ResidueOP source_residue(new core::conformation::Residue(pose.residue(residue_index)));
69  TR.Debug << "Setting rigid body confs for residue: " << residue_index << " " << source_residue->name() << std::endl;
71  TR.Trace << "Generated target residue centroid frame: ";
72  stub_to_points(TR.Trace, source_frame) << std::endl;
73 
74  StubGenerator::moveFromStubFrame(source_residue, source_frame);
75 
76  for(core::Size i = 1; i <= search_stubs_.size(); ++i)
77  {
78  // Create residue copies translating the search frame into the centroid frame
79 
80  core::conformation::ResidueOP search_residue(new core::conformation::Residue(*source_residue));
81 
83  StubGenerator::moveIntoStubFrame(search_residue, source_frame);
84 
85  if (TR.Trace.visible())
86  {
88  TR.Trace << "Generated alt rb residue: " << search_residue->name() << std::endl;
89  TR.Trace << "Generated alt rb residue residue centroid frame: ";
90  stub_to_points(TR.Trace, search_frame) << std::endl;
91  }
92 
93  result_residues.push_back(core::conformation::ResidueCOP(search_residue));
94  }
95 
96  TR.Debug << "Rigid body confs count: " << result_residues.size() << std::endl;
97 
98  return result_residues;
99 }
100 
102  core::pose::Pose const & pose,
104  core::Size residue_index
105 )
106 {
107  // Calculate the centroid frame and centroid location in the centroid frame
108  core::conformation::ResidueCOP source_residue(new core::conformation::Residue(pose.residue(residue_index)));
109  TR.Debug << "Increasing packer residue radius for residue: " << residue_index << " " << source_residue->name() << std::endl;
110 
111  core::kinematics::Stub centroid_frame = StubGenerator::residueStubCentroidFrame(source_residue);
112  Vector centroid_nbr_location = centroid_frame.global2local(source_residue->xyz(source_residue->nbr_atom()));
113 
114  // Calculate centroid frame coords of nbr atom location translated into all search frames
115  core::Real max_sq_dist(0.0);
116  for(core::Size i = 1; i <= search_stubs_.size(); ++i)
117  {
118  core::Vector search_nbr_location = search_stubs_[i].local2global(centroid_nbr_location);
119  core::Real sq_dist = (centroid_nbr_location - search_nbr_location).length_squared();
120 
121  if( sq_dist > max_sq_dist )
122  {
123  max_sq_dist = sq_dist;
124  }
125  }
126 
127  core::Real max_distance = std::sqrt( max_sq_dist );
128 
129  // Return largest nbr_atom location displacement
130  TR.Debug << "Increased packer residue radius size: " << max_distance << std::endl;
131  return max_distance;
132 }
133 
135  core::Size target_residue,
136  SearchPatternOP pattern) :
137  target_residue_(target_residue),
138  pattern_(pattern)
139 {}
140 
142 
145 {
146  return new AddSearchPatternRotSetOp(*this);
147 }
148 
149 /// @details not valid now, extend with search pattern parsing
150 void
152 {
153  utility_exit_with_message("Can not parse tag for add search pattern rot set op.");
154 }
155 
156 void
158  core::pose::Pose const & /*pose*/,
160 ) const
161 {
162  if( !task.being_packed( target_residue_) )
163  {
164  return;
165  }
166 
169 }
170 
171 }
172 }