Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RRProtocolRotamerTrials.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 src/protocols/rotamer_recovery/RRProtocol.cc
11 /// @author Matthew O'Meara (mattjomeara@gmail.com)
12 
13 // Unit Headers
15 
16 // Project Headers
19 
20 // Platform Headers
21 #include <basic/Tracer.hh>
22 #include <basic/options/option.hh>
23 #include <basic/options/keys/packing.OptionKeys.gen.hh>
24 
25 // AUTO-REMOVED #include <core/chemical/ResidueType.hh>
26 #include <core/chemical/AA.hh>
27 // AUTO-REMOVED #include <core/conformation/Residue.hh>
28 #include <core/graph/Graph.hh>
35 #include <core/pose/Pose.hh>
36 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
38 
39 // C++ Headers
40 #include <string>
41 
42 //Auto Headers
43 #include <utility/vector1.hh>
44 using std::string;
45 using core::Size;
48 using core::pose::Pose;
51 using basic::Tracer;
52 
53 namespace protocols {
54 namespace rotamer_recovery {
55 
56 static Tracer TR("protocol.moves.RRProtocolRotamerTrials");
57 
59 
61 
63 
64 string
66  return "RRProtocolRotamerTrials";
67 }
68 
69 string
71  return "";
72 }
73 
74 
75 /// @details For each residue, minimize it, and measure the rotamer
76 /// compared to where it started
77 void
79  RRComparerOP comparer,
80  RRReporterOP reporter,
81  Pose const & pose,
82  ScoreFunction const & score_function,
83  PackerTask const & packer_task
84 ) {
85 
87 
88  // Assume score_function.setup_for_scoring(pose) has already been called.
89 
90  PackerTaskOP one_res_task( packer_task.clone() );
91  Pose working_pose = pose; // deep copy
92 
93  core::graph::GraphOP packer_neighbor_graph = core::pack::create_packer_graph( pose, score_function, one_res_task );
94 
95  // I don't know if rtmin looks at more than pack_residue(..)
96  one_res_task->temporarily_fix_everything();
97 
98  // For each residue in the packer task,
99  // rtmin residue -> and measure recovery
100  for( Size ii = 1; ii <= pose.total_residue(); ++ii ){
101  if ( !packer_task.pack_residue(ii) ) continue;
102 
103  one_res_task->temporarily_set_pack_residue( ii, true );
104  if ( ! packer_task.include_current(ii) ) {
105  // if we're not asking for the input sidechains, then don't use them -- replace the input sidechain with a rotamer that will be sampled inside
106  // rotamer trials anyways
109  rotset->set_resid( ii );
110  rotset->build_rotamers( pose, score_function, *one_res_task, packer_neighbor_graph );
111  if ( rotset->num_rotamers() > 0 ) {
112  working_pose.replace_residue( ii, *rotset->rotamer(1), false );
113  }
114  }
115 
116  core::pack::rotamer_trials( working_pose, score_function, one_res_task );
118  comparer, reporter,
119  pose, working_pose,
120  pose.residue(ii), working_pose.residue(ii) );
121  working_pose.replace_residue( ii, pose.residue( ii ), false ); // restore the original conformation
122  one_res_task->temporarily_set_pack_residue( ii, false );
123  }
124 }
125 
126 } // rotamer_recovery
127 } // protocols