Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OmegaTetherEnergy.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/OmegaTetherEnergy.cc
11 /// @brief OmegaTether energy method class implementation
12 /// @author Phil Bradley
13 /// @author Mike Tyka (mtyka@u.washington.edu)
14 
15 // Unit Headers
18 
19 // Package Headers
24 
25 // Project headers
26 #include <core/id/TorsionID.hh>
27 #include <core/pose/Pose.hh>
28 
29 
30 // Utility headers
31 #include <numeric/conversions.hh>
32 
34 #include <utility/vector1.hh>
35 
36 
37 // C++
38 
39 
40 namespace core {
41 namespace scoring {
42 namespace methods {
43 
44 
45 /// @details This must return a fresh instance of the OmegaTetherEnergy class,
46 /// never an instance already in use
50 ) const {
51  return new OmegaTetherEnergy;
52 }
53 
56  ScoreTypes sts;
57  sts.push_back( omega );
58  return sts;
59 }
60 
61 
62 
63 /// ctor
66  potential_( ScoringManager::get_instance()->get_OmegaTether() )
67 {}
68 
69 /// clone
72 {
73  return new OmegaTetherEnergy;
74 }
75 
76 /////////////////////////////////////////////////////////////////////////////
77 // methods for ContextIndependentOneBodyEnergies
78 /////////////////////////////////////////////////////////////////////////////
79 
80 ///
81 void
83  conformation::Residue const & rsd,
84  pose::Pose const &,
85  EnergyMap & emap
86 ) const
87 {
88  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
89  if ( rsd.has_variant_type( core::chemical::REPLONLY ) ) return;
90 
91  if ( rsd.is_protein() ) {
92  Real omega_score, dscore_domega, dscore_dphi, dscore_dpsi;
93  potential_.eval_omega_score_residue( rsd, omega_score, dscore_domega, dscore_dphi, dscore_dpsi );
94  emap[ omega ] += omega_score;
95  }
96 }
97 
98 
99 /// @brief Use the dof_derivative interface for this energy method when
100 /// calculating derivatives? It is possible to define both dof_derivatives and
101 /// atom-derivatives; they are not mutually exclusive.
102 bool
104 {
105  return true;
106 }
107 
108 /// @brief Evaluate the DOF derivative for a particular residue. The Pose merely serves as context,
109 /// and the input residue is not required to be a member of the Pose.
110 Real
112  conformation::Residue const & rsd,
114  id::DOF_ID const &,
115  id::TorsionID const & tor_id,
116  pose::Pose const &,
117  ScoreFunction const &,
118  EnergyMap const & weights
119 ) const
120 {
121  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
123  return 0.0;
124  }
125 
126  Real deriv(0.0);
127  if ( tor_id.valid() && tor_id.type() == id::BB && tor_id.torsion() <= 3 && rsd.is_protein() ) {
128  Real omega_score, dscore_domega, dscore_dphi, dscore_dpsi;
129  potential_.eval_omega_score_residue( rsd, omega_score, dscore_domega, dscore_dphi, dscore_dpsi );
130  if (tor_id.torsion() == 1) deriv = dscore_dphi;
131  if (tor_id.torsion() == 2) deriv = dscore_dpsi;
132  if (tor_id.torsion() == 3) deriv = dscore_domega;
133  }
134  return numeric::conversions::degrees( weights[ omega ] * deriv );
135 }
136 
137 ///
138 Real
140  id::DOF_ID const &,// dof_id,
141  id::TorsionID const & tor_id,
142  pose::Pose const & pose,
143  ScoreFunction const &,// sfxn,
144  EnergyMap const & weights
145 ) const
146 {
147  // ignore scoring residues which have been marked as "REPLONLY" residues (only the repulsive energy will be calculated)
148  if ( pose.residue( tor_id.rsd() ).has_variant_type( core::chemical::REPLONLY ) ){
149  return 0.0;
150  }
151 
152  Real deriv(0.0);
153  if ( tor_id.valid() && tor_id.type() == id::BB ) {
154  conformation::Residue const & rsd( pose.residue( tor_id.rsd() ) );
155  if ( rsd.is_protein() &&
156  tor_id.torsion() <= 3 ) {
157  Real omega_score, dscore_domega, dscore_dphi, dscore_dpsi;
158  potential_.eval_omega_score_residue( rsd, omega_score, dscore_domega, dscore_dphi, dscore_dpsi );
159  if (tor_id.torsion() == 1) deriv = dscore_dphi;
160  if (tor_id.torsion() == 2) deriv = dscore_dpsi;
161  if (tor_id.torsion() == 3) deriv = dscore_domega;
162  }
163  }
164  // note that the atomtree Oomega dofs are in radians
165  // use degrees since dE/dangle has angle in denominator
166  return numeric::conversions::degrees( weights[ omega ] * deriv );
167 }
168 
169 /// @brief OmegaTether Energy is context independent and thus indicates that no context graphs need to
170 /// be maintained by class Energies
171 void
173  utility::vector1< bool > & /*context_graphs_required*/
174 )
175 const
176 {}
179 {
180  return 1; // Initial versioning
181 }
182 
183 
184 } // methods
185 } // scoring
186 } // core
187