Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConstraintsEnergy.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/constraints/ConstraintsEnergy.hh
11 /// @brief Constraints Energy Method declaration
12 /// @author Andrew Leaver-Fay
13 
14 
15 
16 #ifndef INCLUDED_core_scoring_constraints_ConstraintsEnergy_hh
17 #define INCLUDED_core_scoring_constraints_ConstraintsEnergy_hh
18 
19 // Unit headers
21 
22 // Package headers
23 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintEnergyContainer.fwd.hh>
24 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintGraph.fwd.hh>
25 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.fwd.hh>
26 
32 
34 
35 // AUTO-REMOVED #include <core/scoring/ContextGraphTypes.hh>
36 
37 // Project headers
39 #include <core/pose/Pose.fwd.hh>
40 #include <core/id/TorsionID.fwd.hh>
41 
42 #include <utility/vector1.hh>
43 
44 
45 
46 namespace core {
47 namespace scoring {
48 namespace constraints {
49 
50 
52 public:
55 
56 public:
58  virtual ~ConstraintsEnergy();
59 
60  virtual EnergyMethodOP clone() const;
61 
62  /// @brief Identification for this LR2B energy that links it with the
63  /// long-range energy container that it stores in the Energies object
65 
66  /// @brief Interface from the LongRangeTwoBodyEnery base class; returns "true" if there's any non-zero
67  /// or potentially non-zero interaction between a pair of residues in a pose.
68  virtual
69  bool
71  pose::Pose const & pose,
72  Size res1,
73  Size res2
74  ) const;
75 
76  ///
77  virtual
78  void
80  conformation::Residue const & rsd1,
81  conformation::Residue const & rsd2,
82  pose::Pose const & pose,
83  ScoreFunction const & sfxn,
84  EnergyMap & emap
85  ) const;
86 
87  /////////////////////////////////////////////////////////////////////////////
88  // methods for ContextIndependentTwoBodyEnergies
89  /////////////////////////////////////////////////////////////////////////////
90 
91  virtual
92  bool
94 
95  /// @brief Returns true as the ConstraintsEnergy caches its residue pair constraints in
96  /// the ResPairMinimicationData objects stored on edges in the MinimizationGraph
97  virtual
98  bool
100 
101  /// @brief The ConstraintsEnergy caches all residue-pair constraints operating between a particular
102  /// pair of residues in the min_data object so that it does not need to search for those constraints
103  /// when scoring during minimization.
104  virtual
105  void
107  conformation::Residue const & rsd1,
108  conformation::Residue const & rsd2,
109  ResPairMinimizationData const & min_data,
110  pose::Pose const & pose,
111  ScoreFunction const & sfxn,
112  EnergyMap & emap
113  ) const;
114 
115  /// @brief Returns false if residue1 and residue2 have no inter-residue pair constraints
116  /// or if the two residues are not moving wrt each other.
117  virtual
118  bool
120  conformation::Residue const & res1,
121  conformation::Residue const & res2,
122  bool res_moving_wrt_eachother
123  ) const;
124 
125 
126  /// @brief Cache the intra-residue constraints in the ResSingleMinimizationData object
127  /// for rapid retrieval during minimization and allow the constraints to store data
128  /// in the res_data_cache if they need to.
129  virtual
130  void
132  conformation::Residue const & rsd,
133  pose::Pose const & pose,
134  ScoreFunction const & sfxn,
135  kinematics::MinimizerMapBase const & minmap,
136  ResSingleMinimizationData & res_data_cache
137  ) const;
138 
139  /// @brief Cache the residue-pair constraints in the ResPairMinimizationData object
140  /// for rapid retrieval during minimization and allow constraints to cache useful
141  /// data in the respair_data_cache if they need to
142  virtual
143  void
145  conformation::Residue const & rsd1,
146  conformation::Residue const & rsd2,
147  pose::Pose const & pose,
148  ScoreFunction const & sfxn,
149  kinematics::MinimizerMapBase const & minmap,
150  ResSingleMinimizationData const & res1_data_cache,
151  ResSingleMinimizationData const & res2_data_cache,
152  ResPairMinimizationData & respair_data_cache
153  ) const;
154 
155 
156  /// @brief Request the opportunity to setup for scoring
157  virtual
158  bool
160 
161  /// @brief Do any setup work should the coordinates of a pair of residues, who are still guaranteed to be
162  /// of the same residue type as when setup_for_minimizing_for_residue was called, have changed so dramatically
163  /// as to possibly require some amount of setup work before scoring should proceed
164  virtual
165  void
167  conformation::Residue const & rsd1,
168  conformation::Residue const & rsd2,
169  ResSingleMinimizationData const & minsingle_data1,
170  ResSingleMinimizationData const & minsingle_data2,
171  pose::Pose const & pose,
172  ScoreFunction const & sfxn,
173  ResPairMinimizationData & data_cache
174  ) const;
175 
176  /// @brief Ask for the opportunity to setup for derivative evaluation
177  virtual
178  bool
180 
181  /// @brief Do any setup work necessary before evaluating the derivatives for this residue pair
182  virtual
183  void
185  conformation::Residue const & rsd1,
186  conformation::Residue const & rsd2,
187  ResSingleMinimizationData const & minsingle_data1,
188  ResSingleMinimizationData const & minsingle_data2,
189  pose::Pose const & pose,
190  ScoreFunction const & sfxn,
191  ResPairMinimizationData & data_cache
192  ) const;
193 
194  /// @brief Evaluate the derivative for an atom in rsd1 with respect to rsd2 in the context
195  /// of a particular pose, and increment the F1 and F2 vectors.
196  /*virtual
197  void
198  eval_atom_derivative_for_residue_pair(
199  Size const atom_index,
200  conformation::Residue const & rsd1,
201  conformation::Residue const & rsd2,
202  ResSingleMinimizationData const & minsingle_data1,
203  ResSingleMinimizationData const & minsingle_data2,
204  ResPairMinimizationData const & minpair_data,
205  pose::Pose const & pose, // provides context
206  kinematics::DomainMap const & domain_map,
207  ScoreFunction const & sfxn,
208  EnergyMap const & weights,
209  Vector & F1,
210  Vector & F2
211  ) const;*/
212 
213  virtual
214  void
216  conformation::Residue const & rsd1,
217  conformation::Residue const & rsd2,
220  ResPairMinimizationData const & min_data,
221  pose::Pose const & pose, // provides context
222  EnergyMap const & weights,
223  utility::vector1< DerivVectorPair > & r1_atom_derivs,
224  utility::vector1< DerivVectorPair > & r2_atom_derivs
225  ) const;
226 
227 
228  void
230 
231  // check compatibility with atomtypeset and store a constraint graph in
232  // the pose.energies object
233  virtual
234  void
235  setup_for_scoring( pose::Pose &pose, ScoreFunction const &scfxn ) const;
236 
237  /// @brief Make sure that the ConstraintsEnergyContainer is ready for packing.
238  virtual
239  void
241  pose::Pose & pose,
242  utility::vector1< bool > const & residues_repacking,
243  utility::vector1< bool > const & residues_designing
244  ) const;
245 
246  // call the cst setup_for_derivatives wrapper
247  virtual
248  void
249  setup_for_derivatives( pose::Pose &pose, ScoreFunction const &scfxn ) const;
250 
251  /// @brief Returns true if there are three-body or higher-body constraints that the user
252  /// has defined. High-order terms will not be correctly evaluated in RTMin or other
253  /// extra-pose techniques for minimization (but will work correctly when minimizing an entire Pose).
254  bool
255  defines_high_order_terms( pose::Pose const & ) const;
256 
257  virtual
258  bool
259  defines_intrares_energy( EnergyMap const & weights ) const;
260 
261  /// @brief Evaluate the intra-residue constraint energy for a given residue
262  virtual
263  void
265  conformation::Residue const & rsd,
266  pose::Pose const & pose,
267  ScoreFunction const & sfxn,
268  EnergyMap & emap
269  ) const;
270 
271  /// @brief request of minimization routines that they use the extended intraresidue energy
272  /// interface
273  virtual
274  bool
276 
277  /// @brief Evaluate the intra-residue energies using ConstraintCOPs cached in the data_cache object
278  virtual
279  void
281  conformation::Residue const & rsd,
282  ResSingleMinimizationData const & data_cache,
283  pose::Pose const & pose,
284  ScoreFunction const & sfxn,
285  EnergyMap & emap
286  ) const;
287 
288  /// @brief Ask for the opportunity to setup for scoring for evaluating 1-body constraints
289  virtual
290  bool
292 
293  /// @brief Allow the component constraints to setup for scoring for a particular residue
294  virtual
295  void
297  conformation::Residue const & rsd,
298  pose::Pose const & pose,
299  ScoreFunction const & sfxn,
300  ResSingleMinimizationData & min_data
301  ) const;
302 
303  /// @brief Does this EnergyMethod require the opportunity to examine each residue before derivative evaluation begins? Not
304  /// all energy methods would. The ScoreFunction will not ask energy methods to examine residue pairs that are uninterested
305  /// in doing so.
306  virtual
307  bool
309 
310  /// @brief Do any setup work necessary before evaluating the derivatives for this residue
311  virtual
312  void
314  conformation::Residue const & rsd,
315  pose::Pose const & pose,
316  ScoreFunction const & sfxn,
317  ResSingleMinimizationData & min_data
318  ) const;
319 
320  void
322  conformation::Residue const & rsd,
323  ResSingleMinimizationData const & min_data,
324  pose::Pose const & pose,
325  EnergyMap const & weights,
327  ) const;
328 
329  /// @brief The DunbrackConstraint, which adds a "constant term" to the energy for a particular
330  /// rotamer so that the particular rotamer matches the score of the best rotamer at a particular
331  /// phi/psi, defines derivatives for phi and psi. or rather -- it doesn't, but it should.
332  virtual
333  bool
334  defines_intrares_dof_derivatives( pose::Pose const & p ) const;
335 
336  /// @brief Evaluate the DOF derivative for a particular residue. The Pose merely serves as context,
337  /// and the input residue is not required to be a member of the Pose.
338  virtual
339  Real
341  conformation::Residue const & rsd,
342  ResSingleMinimizationData const & min_data,
343  id::DOF_ID const & dof_id,
344  id::TorsionID const & torsion_id,
345  pose::Pose const & pose,
346  ScoreFunction const & sfxn,
347  EnergyMap const & weights
348  ) const;
349 
350  /// called at the end of energy evaluation
351  virtual
352  void
354  pose::Pose & pose,
355  ScoreFunction const &,
356  EnergyMap & totals
357  ) const;
358 
359 
360  /// called during gradient-based minimization inside dfunc
361  /**
362  F1 and F2 are not zeroed -- contributions from this atom are
363  just summed in
364  **/
365  virtual
366  void
368  id::AtomID const & id,
369  pose::Pose const & pose,
370  kinematics::DomainMap const &, // domain_map,
371  ScoreFunction const & sfxn,
372  EnergyMap const & weights,
373  Vector & F1,
374  Vector & F2
375  ) const;
376 
377 
378  ///@brief Evaluate dof derivatives when DOF_constraints are in use
379  Real
381  id::DOF_ID const & id,
382  id::TorsionID const & tor,
383  pose::Pose const & pose,
384  ScoreFunction const & scorefxn,
385  EnergyMap const & weights
386  ) const;
387 
388 
389  virtual
390  void indicate_required_context_graphs( utility::vector1< bool > & /*context_graphs_required*/ ) const;
391 virtual
392 core::Size version() const;
393 
394 };
395 
396 
397 
398 } // constraints
399 } // scoring
400 } // core
401 
402 
403 #endif // INCLUDED_core_scoring_EtableEnergy_HH