Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FlexbbRotamerSet.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/flexpack/rotamer_set/FlexbbRotamerSet.hh
11 /// @brief Declaration for a class to hold rotamers for a single backbone conformation in
12 /// a flexible packing run
13 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), Florian Richter (floric@u.washington.edu), sep 08
14 
17 
18 // Project Headers
20 #include <core/graph/Graph.hh>
22 #include <core/pose/Pose.hh>
24 
25 #include <utility/vector1.hh>
26 
27 
28 namespace protocols {
29 namespace flexpack {
30 namespace rotamer_set {
31 
33  : parent(), existing_residue_( 0 ), owner_( 0 )
34 {}
35 
37 {}
38 
39 void
41 {
42  owner_ = owner;
43 }
44 
45 
46 void
48  core::pack::rotamer_set::RotamerSets const & /*rotamer_sets*/,
49  core::pose::Pose const & /*pose*/,
50  core::scoring::ScoreFunction const & /*scorefxn*/,
51  core::pack::task::PackerTask const & /*task*/,
52  core::graph::GraphCOP /*packer_neighbor_graph*/
53 )
54 {
55  utility_exit_with_message("ERROR: FlexbbRotamerSet does not support build_dependent_rotamers");
56 }
57 
58 void
60 {
61  existing_residue_ = residue;
62 }
63 
64 
65 void
67  core::pose::Pose const & pose,
68  core::scoring::ScoreFunction const & scorefxn,
69  core::pack::task::PackerTask const & task,
70  core::chemical::ResidueTypeCOP concrete_residue,
71  core::graph::GraphCOP packer_neighbor_graph,
72  bool use_neighbor_context
73 )
74 {
75  build_rotamers_for_concrete( pose, scorefxn, task,
76  concrete_residue, *existing_residue_,
77  packer_neighbor_graph, use_neighbor_context );
78 }
79 
80 /// @brief Computes the "bump energy" of a rotamer: the bump energy is the
81 /// sum of rotamer's interactions with 1) the backbone-and-side chains of
82 /// neighboring residues that are held fixed during this repacking optimization
83 /// and 2) the backbones of neighboring residues that are changable during this
84 /// repacking optimization.
89  core::pose::Pose const & pose,
90  core::pack::task::PackerTask const & task,
91  core::graph::GraphCOP packer_neighbor_graph
92 ) const
93 {
94  /// iterate across neighbors and do shit... that's right
95 
96  using namespace core::scoring;
97  using namespace core::conformation;
98 
99  core::Real bumpE( 0.0 );
100 
102  ir = packer_neighbor_graph->get_node( resid() )->const_edge_list_begin(),
103  ire = packer_neighbor_graph->get_node( resid() )->const_edge_list_end();
104  ir != ire; ++ir ) {
105 
106  core::Real smallest_neighbor_bumpE( 0.0 );
107 
108  int const neighbor_id( (*ir)->get_other_ind( resid() ) );
109 
110  core::Size bbconfs_this_neighbor( owner_->nbbconfs_for_res( neighbor_id ) );
111 
112  typedef Residue const & resconstref;
113 
115 
116  if( bbconfs_this_neighbor == 1 ) check_residues.push_back( & pose.residue( neighbor_id ) );
117 
118  else{
119  for( core::Size bbconf = 1; bbconf <= bbconfs_this_neighbor ; ++bbconf) {
120  check_residues.push_back( & owner_->backbone_for_resid_bbconf( neighbor_id, bbconf ) );
121  }
122  }
123 
124  for( core::Size check_res = 1; check_res <= check_residues.size(); ++check_res) {
125 
126  EnergyMap emap;
127 
128  if ( ! task.pack_residue( neighbor_id ) ) {
129  sf.bump_check_full( *rotamer, *check_residues[ check_res ], pose, emap);
130  } else {
131  sf.bump_check_backbone( *rotamer, *check_residues[ check_res ], pose, emap);
132  }
133  core::Real cur_bumpE = sf.weights().dot( emap );
134 
135  if( check_res == 1 || cur_bumpE < smallest_neighbor_bumpE ) smallest_neighbor_bumpE = cur_bumpE;
136 
137  } //iterator over flexible states of this neighbor
138 
139  bumpE += smallest_neighbor_bumpE;
140 
141  } // iterator over neighbors
142 
143  return static_cast< core::PackerEnergy >( bumpE );
144 } //bump_check
145 
146 
147 }
148 }
149 }