Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RamachandranEnergy.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 core/scoring/methods/RamachandranEnergy.cc
11 /// @brief Ramachandran energy method class implementation
12 /// @author Phil Bradley
13 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
14 
15 // Unit Headers
18 
19 // Package Headers
24 
25 // Project headers
27 #include <core/pose/Pose.hh>
28 #include <core/id/TorsionID.hh>
29 
30 
31 // Utility headers
32 #include <numeric/conversions.hh>
33 
34 #include <utility/vector1.hh>
35 
36 
37 namespace core {
38 namespace scoring {
39 namespace methods {
40 
41 
42 /// @details This must return a fresh instance of the RamachandranEnergy class,
43 /// never an instance already in use
47 ) const {
48  return new RamachandranEnergy;
49 }
50 
53  ScoreTypes sts;
54  sts.push_back( rama );
55  return sts;
56 }
57 
58 
59 /// ctor
62  potential_( ScoringManager::get_instance()->get_Ramachandran() )
63 {}
64 
65 /// clone
68 {
69  return new RamachandranEnergy;
70 }
71 
72 /////////////////////////////////////////////////////////////////////////////
73 // methods for ContextIndependentOneBodyEnergies
74 /////////////////////////////////////////////////////////////////////////////
75 
76 ///
77 void
79  conformation::Residue const & rsd,
80  pose::Pose const &,
81  EnergyMap & emap
82 ) const
83 {
84  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
86  return;
87  }
88 
89  if ( rsd.is_protein() && rsd.aa() <= chemical::num_canonical_aas ) {
90  Real rama_score, drama_dphi, drama_dpsi;
91  potential_.eval_rama_score_residue( rsd, rama_score, drama_dphi, drama_dpsi );
92  emap[ rama ] += rama_score;
93  }
94 }
95 
96 bool
98 {
99  return true;
100 }
101 
102 Real
104  conformation::Residue const & rsd,
105  ResSingleMinimizationData const &, // min_data,
106  id::DOF_ID const &, //dof_id,
107  id::TorsionID const & tor_id,
108  pose::Pose const &, // pose,
109  ScoreFunction const &, // sfxn,
110  EnergyMap const & weights
111 ) const
112 {
113  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
115  return 0.0;
116  }
117 
118  Real deriv(0.0);
119  if ( tor_id.valid() && tor_id.type() == id::BB ) {
120  //conformation::Residue const & rsd( pose.residue( tor_id.rsd() ) );
121  if ( rsd.is_protein() && rsd.aa() != core::chemical::aa_unk && tor_id.torsion() <= 2 ) {
122  Real rama_score, drama_dphi, drama_dpsi;
123  potential_.eval_rama_score_residue( rsd, rama_score,
124  drama_dphi, drama_dpsi );
125  deriv = ( tor_id.torsion() == 1 ? drama_dphi : drama_dpsi );
126  }
127  }
128  // note that the atomtree PHI dofs are in radians
129  // use degrees since dE/dangle has angle in denominator
130  return numeric::conversions::degrees( weights[ rama ] * deriv );
131 
132 }
133 
134 
135 
136 Real
138  id::DOF_ID const &,// dof_id,
139  id::TorsionID const & tor_id,
140  pose::Pose const & pose,
141  ScoreFunction const &,// sfxn,
142  EnergyMap const & weights
143 ) const
144 {
145  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
146  if ( pose.residue(tor_id.rsd()).has_variant_type( core::chemical::REPLONLY ) ){
147  return 0.0;
148  }
149 
150  Real deriv(0.0);
151  if ( tor_id.valid() && tor_id.type() == id::BB ) {
152  conformation::Residue const & rsd( pose.residue( tor_id.rsd() ) );
153  if ( rsd.is_protein() &&
154  tor_id.torsion() <= 2 ) {
155  Real rama_score, drama_dphi, drama_dpsi;
156  potential_.eval_rama_score_residue( rsd, rama_score,
157  drama_dphi, drama_dpsi );
158  deriv = ( tor_id.torsion() == 1 ? drama_dphi : drama_dpsi );
159  }
160  }
161  // note that the atomtree PHI dofs are in radians
162  // use degrees since dE/dangle has angle in denominator
163  return numeric::conversions::degrees( weights[ rama ] * deriv );
164 }
165 
166 /// @brief Ramachandran Energy is context independent and thus indicates that no context graphs need to
167 /// be maintained by class Energies
168 void
170  utility::vector1< bool > & /*context_graphs_required*/
171 )
172 const
173 {}
176 {
177  return 1; // Initial versioning
178 }
179 
180 
181 } // methods
182 } // scoring
183 } // core
184