Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnergyMethod.hh
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/method/EnergyMethod.hh
11 /// @brief Base class for energy classes
12 /// @author Phil Bradley
13 
14 
15 #ifndef INCLUDED_core_scoring_methods_EnergyMethod_hh
16 #define INCLUDED_core_scoring_methods_EnergyMethod_hh
17 
18 // Unit headers
20 
21 // Package headers
22 #include <core/types.hh>
23 // AUTO-REMOVED #include <core/scoring/DerivVectorPair.fwd.hh>
28 
29 // Project headers
32 
33 #include <core/pose/Pose.fwd.hh>
34 // AUTO-REMOVED #include <core/scoring/Energies.fwd.hh>
35 
37 
38 #include <core/id/AtomID.fwd.hh>
39 // AUTO-REMOVED #include <core/id/DOF_ID.fwd.hh>
40 // AUTO-REMOVED #include <core/id/TorsionID.fwd.hh>
41 
42 // Utility headers
43 #include <utility/vector1.hh>
44 #include <utility/pointer/ReferenceCount.hh>
45 
46 // Numeric headers
47 
48 
49 namespace core {
50 namespace scoring {
51 namespace methods {
52 
53 /// @brief base class for the energy method hierarchy
55 public:
57 
58 public:
59  /// @brief Constructor with EnergyMethodCreator, which lists the score
60  /// types that this energy method is responsible for.
62 
63  /// @brief Copy constructor copies over the score types of the source
64  EnergyMethod( EnergyMethod const & src );
65 
66  virtual
67  ~EnergyMethod();
68 
69  virtual
71  clone() const = 0;
72 
73  // @brief if an energy method needs to cache data in the Energies object,
74  // before packing begins, then it does so during this function. The packer
75  // must ensure this function is called. The default behavior is to do nothing.
76  virtual
77  void
79 
80  // @brief If an energy method needs to cache data in a packing::RotamerSet object before
81  // rotamer energies are calculated, it does so during this function. The packer
82  // must ensure this function is called. The default behavior is to do nothing.
83  virtual
84  void
86  pose::Pose const &,
88  ) const;
89 
90 
91  // @brief If the pose changes in the middle of a packing (as happens in rotamer trials) and if
92  // an energy method needs to cache data in the pose that corresponds to its current state,
93  // then the method must update that data when this function is called. The packer must
94  /// ensure this function gets called. The default behavior is to do nothing.
95  virtual
96  void
98  pose::Pose &,
99  Size resid
100  ) const;
101 
102  // @brief if an energy method needs to cache something in the pose (e.g. in pose.energies()),
103  // before scoring begins, it must do so in this method. All long range energy
104  // functions must initialize their LREnergyContainers before scoring begins.
105  // The default is to do nothing.
106  virtual
107  void
108  setup_for_scoring( pose::Pose &, ScoreFunction const & ) const;
109 
110  /// @brief Called at the beginning of atom tree minimization, this method
111  /// allows the derived class the opportunity to initialize pertinent data
112  /// that will be used during minimization. During minimzation, the chemical
113  /// structure of the pose is constant, so assumptions on the number of atoms
114  /// per residue and their identities are safe so long as the pose's Energies
115  /// object's "use_nblist()" method returns true.
116  virtual
117  void
119  pose::Pose & ,
120  ScoreFunction const & ,
122  ) const;
123 
124  /// @brief Called immediately before atom- and DOF-derivatives are calculated
125  /// allowing the derived class a chance to prepare for future calls.
126  virtual
127  void
128  setup_for_derivatives( pose::Pose & pose, ScoreFunction const & sfxn ) const;
129 
130  /// @brief called at the end of derivatives evaluation
131  virtual
132  void
134 
135  /// @brief Should this EnergyMethod have score and derivative evaluation
136  /// evaluated only in the context of the whole Pose, or can it be included
137  /// in a decomposed manner for a residue or a set of residue-pairs that are
138  /// not part of the Pose that's serving as their context? The default
139  /// method implemented in the base class returns true in order to grandfather
140  /// in EnergyMethods that have not had their derivatives changed to take
141  /// advantage of the new derivative-evaluation machinery. Methods that return
142  /// "true" will not have their residue-energy(-ext) / residue-pair-energy(-ext)
143  /// methods invoked by the ScoreFunction during its traversal of the
144  /// MinimizationGraph, and instead will be asked to perform all their work
145  /// during finalize_total_energies(). Similarly, they will be expected to
146  /// perform all their work during eval_atom_deriv() instead of during the
147  /// ScoreFunction's traversal of the MinimizationGraph for derivative evaluation.
148  /// IMPORTANT: Methods that return "true" cannot be included in RTMin.
149  virtual
150  bool
152 
153  /// @brief Should this EnergyMethod have score and derivative evaluation
154  /// evaluated both in the context of the whole Pose and in the context
155  /// of residue or residue-pairs? This covers scoring terms like env-smooth
156  /// wherein the CBeta's get derivatives for increasing the neighbor counts
157  /// for surrounding residues, and terms like constraints, which are definable
158  /// on arbitrary number of residues (e.g. more than 2); both of these terms
159  /// could be used in RTMin, and both should use the residue and residue-pair
160  /// evaluation scheme with the MinimizationGraph for the majority of the
161  /// work they do. (Now, high-order constraints (3-body or above) will not
162  /// be properly evaluated within RTMin.). The default implementation
163  /// returns "false".
164  virtual
165  bool
166  defines_high_order_terms( pose::Pose const & ) const;
167 
168  /// @brief Evaluate the XYZ derivative for an atom in the pose.
169  /// Called during the atomtree derivative calculation, atom_tree_minimize.cc,
170  /// through the ScoreFunction::eval_atom_derivative intermediary.
171  /// F1 and F2 should not zeroed, rather, this class should accumulate its contribution
172  /// from this atom's XYZ derivative
173  ///
174  /// @details The derivative scheme is based on that of Abe, Braun, Noguti and Go (1984)
175  /// "Rapid Calculation of First and Second Derivatives of Conformational Energy with
176  /// Respect to Dihedral Angles for Proteins. General Recurrent Equations"
177  /// Computers & Chemistry 8(4) pp. 239-247. F1 and F2 correspond roughly to Fa and Ga,
178  /// respectively, of equations 7a & 7b in that paper.
179  virtual
180  void
182  id::AtomID const & id,
183  pose::Pose const & pose,
184  kinematics::DomainMap const & domain_map,
185  ScoreFunction const & sfxn,
186  EnergyMap const & emap,
187  Vector & F1,
188  Vector & F2
189  ) const;
190 
191 
192 /* /// @brief Evaluate the derivative for a DOF in the atom tree.
193  virtual
194  Real
195  eval_dof_derivative(
196  id::DOF_ID const &,
197  id::TorsionID const &,
198  pose::Pose const &,
199  ScoreFunction const &,
200  EnergyMap const &
201  ) const;*/
202 
203  /// @brief called by the ScoreFunction at the end of energy evaluation.
204  /// The derived class has the opportunity to accumulate a score
205  /// into the pose's total_energy EnergyMap. WholeStructure energies
206  /// operate within this method; any method using a NeighborList during
207  /// minimization would also operate within this function call.
208  virtual
209  void
211  pose::Pose & pose,
212  ScoreFunction const & sfxn,
213  EnergyMap & total_energy
214  ) const;
215 
216  /// @brief Returns the score types that this energy method computes.
217  ScoreTypes const &
218  score_types() const
219  {
220  return score_types_;
221  }
222 
223  /// @brief Return one of the 7 kinds of energy methods that exist:
224  /// e.g. context-dependent-one-body vs whole-structure.
225  virtual
227  method_type() const = 0;
228 
229  /// @brief Indicate in the context-graphs-required list which
230  /// context-graphs this energy method requires that the Pose
231  /// maintain when doing neighbor evaluation. Context graphs are
232  /// allowed
233  virtual
235  utility::vector1< bool > & context_graphs_required
236  ) const = 0;
237 
238  ///@brief Return the version of the energy method
239  virtual
240  core::Size version() const = 0;
241 protected:
242 
243  void
245 
246 private:
248 
249 
250 };
251 
252 } // methods
253 } // scoring
254 } // core
255 
256 #endif // INCLUDED_core_scoring_ScoreFunction_HH