Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HBondEnergy.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/methods/HBondEnergy.hh
11 /// @brief Hydrogen bond energy method class declaration
12 /// @author Phil Bradley
13 /// @author Andrew Leaver-Fay
14 
15 
16 #ifndef INCLUDED_core_scoring_hbonds_HBondEnergy_hh
17 #define INCLUDED_core_scoring_hbonds_HBondEnergy_hh
18 
19 // Unit Headers
21 //pba
22 // AUTO-REMOVED #include <core/scoring/MembraneTopology.fwd.hh>
24 
25 // Package headers
29 //pba
30 // AUTO-REMOVED #include <core/scoring/hbonds/HBondSet.hh>
31 
33 // AUTO-REMOVED #include <core/scoring/hbonds/HBondOptions.hh>
34 // AUTO-REMOVED #include <core/scoring/hbonds/HBondDatabase.hh>
36 // AUTO-REMOVED #include <core/kinematics/MinimizerMapBase.hh>
37 
38 // Project headers
39 #include <core/pose/Pose.fwd.hh>
41 
45 #include <utility/vector1.hh>
46 
47 #ifdef PYROSETTA
50 #endif
51 
52 
53 namespace core {
54 namespace scoring {
55 namespace hbonds {
56 
57 ///
59 public:
61 public:
62 
63  ///
64  HBondEnergy( HBondOptions const & opts );
65 
66  ///
67  HBondEnergy( HBondEnergy const & src );
68 
69  virtual ~HBondEnergy();
70 
71  /// clone
72  virtual
74  clone() const;
75 
76  ///
77  virtual
78  void
80  pose::Pose & pose,
82  utility::vector1< bool > const & ) const;
83 
84  // Creates a rotamer trie for the input set of rotamers and stores the trie
85  // in the rotamer set.
86  virtual
87  void
89  pose::Pose const & pose,
90  conformation::RotamerSetBase & set ) const;
91 
92  // Updates the cached rotamer trie for a residue if it has changed during the course of
93  // a repacking
94  virtual
95  void
96  update_residue_for_packing( pose::Pose & pose, Size resid ) const;
97 
98  ///
99  virtual
100  void
101  setup_for_scoring( pose::Pose & pose, ScoreFunction const & ) const;
102 
103  ///
104  /*virtual
105  void
106  setup_for_derivatives( pose::Pose & pose, ScoreFunction const & ) const;*/
107 
108 
109  /////////////////////////////////////////////////////////////////////////////
110  // scoring
111  /////////////////////////////////////////////////////////////////////////////
112 
113  /// note that this only evaluates sc-sc and sc-bb energies
114  virtual
115  void
117  conformation::Residue const & rsd1,
118  conformation::Residue const & rsd2,
119  pose::Pose const & pose,
120  ScoreFunction const &,
121  EnergyMap & emap
122  ) const;
123 
124  /// @brief Returns false if two residues are not moving wrt each other; the two parts
125  /// of the HBondEnergy function which are non-pairwise-decomposable are held fixed
126  /// during minimization -- the neighbor counts, and the bb/bb hbond availability status.
127  /// This means that the hbond-energy function can be efficiently evaluated during minimization.
128  virtual
129  bool
131  conformation::Residue const & res1,
132  conformation::Residue const & res2,
133  bool res_moving_wrt_eachother
134  ) const;
135 
136  virtual
137  bool
139 
140  /// @brief Use the extended residue pair energy interface to distinguish between
141  /// score function evaluation during minimization from score function evaluation
142  /// during regular scoring.
143  virtual
144  bool
146 
147 
148  /// @brief Evaluate the energy between a pair of residues during minimization;
149  /// during minimization, the bb/bb hbond status is held fixed, so it is possible
150  /// to evaluate the bb/bb, bb/sc and sc/sc hydrogen bonds in this function call.
151  virtual
152  void
154  conformation::Residue const & rsd1,
155  conformation::Residue const & rsd2,
156  ResPairMinimizationData const & min_data,
157  pose::Pose const & pose,
158  ScoreFunction const & sfxn,
159  EnergyMap & emap
160  ) const;
161 
162  /// @brief Setup the bb/bb hbond presence data for a particular residue -- this data
163  /// is taken out of the HbondSet in the Pose.
164  virtual
165  void
167  conformation::Residue const & rsd,
168  pose::Pose const & pose,
169  ScoreFunction const & sfxn,
170  kinematics::MinimizerMapBase const & minmap,
171  ResSingleMinimizationData & res_data_cache
172  ) const;
173 
174  /// @brief Link the bb/bb hbond information in the ResidueSingleMinimizationData
175  /// to the ResiduePairMinimizationData.
176  virtual
177  void
179  conformation::Residue const & rsd1,
180  conformation::Residue const & rsd2,
181  pose::Pose const & pose,
182  ScoreFunction const & sfxn,
183  kinematics::MinimizerMapBase const & minmap,
184  ResSingleMinimizationData const & res1_data_cache,
185  ResSingleMinimizationData const & res2_data_cache,
186  ResPairMinimizationData & data_cache
187  ) const;
188 
189  /// @brief Construct the set of all hydrogen bonds between two residues before
190  virtual
191  bool
193 
194  /// @brief Do any setup work necessary before evaluating the derivatives for this residue
195  /*virtual
196  void
197  setup_for_derivatives_for_residue_pair(
198  conformation::Residue const & rsd1,
199  conformation::Residue const & rsd2,
200  ResSingleMinimizationData const & minsingle_data1,
201  ResSingleMinimizationData const & minsingle_data2,
202  pose::Pose const & pose,
203  ResPairMinimizationData & data_cache
204  ) const;*/
205 
206  /// @brief Retrieves the cached hbond data from the minpair_data object
207  /// and calculates the derivative for an atom on rsd1 wrt rsd2.
208  /// This method requires that setup_for_derivatives_for_residue_pair
209  /// have been called on this residue pair beforehand, and that
210  /// the two residues have not changed since that call.
211  /*virtual
212  void
213  eval_atom_derivative_for_residue_pair(
214  Size const atom_index,
215  conformation::Residue const & rsd1,
216  conformation::Residue const & rsd2,
217  ResSingleMinimizationData const & minsingle_data1,
218  ResSingleMinimizationData const & minsingle_data2,
219  ResPairMinimizationData const & minpair_data,
220  pose::Pose const & pose, // provides context
221  kinematics::DomainMap const & domain_map,
222  ScoreFunction const & sfxn,
223  EnergyMap const & weights,
224  Vector & F1,
225  Vector & F2
226  ) const;*/
227 
228  virtual
229  void
231  conformation::Residue const & rsd1,
232  conformation::Residue const & rsd2,
235  ResPairMinimizationData const & min_data,
236  pose::Pose const & pose, // provides context
237  EnergyMap const & weights,
238  utility::vector1< DerivVectorPair > & r1_atom_derivs,
239  utility::vector1< DerivVectorPair > & r2_atom_derivs
240  ) const;
241 
242 
243  virtual
244  void
246  conformation::Residue const & rsd,
247  ResSingleMinimizationData const & min_data,
248  pose::Pose const & pose,
249  EnergyMap const & weights,
251  ) const;
252 
253 
254  //pba
255  //virtual
256  void
258  EnergyMap const & weights,
259  HBondSet const & hbond_set,
260  HBondDatabaseCOP database,
261  conformation::Residue const & don_rsd,
262  conformation::Residue const & acc_rsd,
263  Size const don_nb,
264  Size const acc_nb,
265  bool const exclude_bsc, /* exclude if acc=bb and don=sc */
266  bool const exclude_scb, /* exclude if acc=sc and don=bb */
267  // output
268  utility::vector1< DerivVectorPair > & don_atom_derivs,
269  utility::vector1< DerivVectorPair > & acc_atom_derivs
270  ) const;
271 
272 
273  ///@brief Evaluates the interaction between the backbone of rsd1 and the
274  /// backbone of rsd2 and accumulates the unweighted energy.
275  virtual
276  void
278  conformation::Residue const & rsd1,
279  conformation::Residue const & rsd2,
280  pose::Pose const & pose,
281  ScoreFunction const & sfxn,
282  EnergyMap & emap
283  ) const;
284 
285 
286  ///@brief Evaluates the interaction between the backbone of rsd1 and the
287  /// sidechain of rsd2 and accumulates the unweighted energy.
288  virtual
289  void
291  conformation::Residue const & rsd1,
292  conformation::Residue const & rsd2,
293  pose::Pose const & pose,
294  ScoreFunction const & sfxn,
295  EnergyMap & emap
296  ) const;
297 
298  ///@brief Evaluates the interaction between the sidechain of rsd1 and the
299  /// sidechain of rsd2 and accumulates the unweighted energy.
300  virtual
301  void
303  conformation::Residue const & rsd1,
304  conformation::Residue const & rsd2,
305  pose::Pose const & pose,
306  ScoreFunction const & sfxn,
307  EnergyMap & emap
308  ) const;
309 
310 
311 
312  virtual
313  void
315  conformation::RotamerSetBase const & set1,
316  conformation::RotamerSetBase const & set2,
317  pose::Pose const & pose,
318  ScoreFunction const & sfxn,
319  EnergyMap const & weights,
320  ObjexxFCL::FArray2D< core::PackerEnergy > & energy_table
321  ) const;
322 
323 
324  //@brief overrides default rotamer/background energy calculation and uses
325  // the trie-vs-trie algorithm instead
326  virtual
327  void
329  conformation::RotamerSetBase const & set,
330  conformation::Residue const & residue,
331  pose::Pose const & pose,
332  ScoreFunction const & sfxn,
333  EnergyMap const & weights,
335  ) const;
336 
337 
338  ///
339  virtual
340  void
342  pose::Pose & pose,
343  ScoreFunction const &,
344  EnergyMap & totals
345  ) const;
346 
347  /// f1 and f2 are zeroed
348  /*virtual
349  void
350  eval_atom_derivative(
351  id::AtomID const & atom_id,
352  pose::Pose const & pose,
353  kinematics::DomainMap const &,
354  ScoreFunction const &,
355  EnergyMap const & weights,
356  Vector & F1,
357  Vector & F2
358  ) const;*/
359 
360 
361  virtual
362  Distance
364 
365 
366  virtual
367  bool
369  {
370  return true;
371  }
372 
373  Real
375 
376  ///@brief HBondEnergy is context sensitive
377  virtual
379  utility::vector1< bool > & context_graphs_required ) const;
380 
381  virtual
382  bool
383  defines_intrares_energy( EnergyMap const & weights ) const;
384 
385  virtual
386  void
388  conformation::Residue const & rsd,
389  pose::Pose const & pose,
390  ScoreFunction const & sfxn,
391  EnergyMap & emap
392  ) const;
393 
394  inline
396  hbtrie::HBAtom const & at1,
397  hbtrie::HBAtom const & at2,
398  DistanceSquared & d2,
399  Size & /*path_dist*/
400  ) const
401  {
402  d2 = at1.xyz().distance_squared( at2.xyz() );
403  return 0.0;
404  }
405 
406  inline
408  hbtrie::HBAtom const & at1, // atom 1 is the heavy atom, the acceptor unless it's a placeholder atom
409  hbtrie::HBAtom const & at2, // atom 2 is the hydrogen atom, the donor
410  bool flipped = false
411  ) const
412  {
413  DistanceSquared d2 = at1.xyz().distance_squared( at2.xyz() );
414  if ( d2 > MAX_R2 || d2 < MIN_R2 || at1.non_hbonding_atom() ) return 0.0;
415 
416  return drawn_out_heavyatom_hydrogenatom_energy( at1, at2, flipped );
417  }
418 
419  Energy
421  hbtrie::HBAtom const & at1, // atom 1 is the heavy atom, the acceptor
422  hbtrie::HBAtom const & at2, // atom 2 is the hydrogen atom, the donor
423  bool flipped
424  ) const;
425 
426  inline
428  hbtrie::HBAtom const & at1,
429  hbtrie::HBAtom const & at2,
430  Size & /*path_dist*/
431  ) const
432  {
433  return heavyatom_hydrogenatom_energy( at2, at1, true );
434  }
435 
436  inline
438  hbtrie::HBAtom const &,
439  hbtrie::HBAtom const &,
440  Size & /*path_dist*/
441  ) const
442  {
443  return 0.0;
444  }
445 
446 private:
447 
450  conformation::RotamerSetBase const & rotset,
451  pose::Pose const & pose
452  ) const;
453 
456  conformation::Residue const & res,
457  pose::Pose const & pose
458  ) const;
459 
460  /////////////////////////////////////////////////////////////////////////////
461  // data
462  /////////////////////////////////////////////////////////////////////////////
463 
464 private:
465 
468 
469  //pba FA membrane potential for membrane object initialization
471  mutable Vector normal_;
472  mutable Vector center_;
473  mutable Real thickness_;
474  mutable Real steepness_;
475 
476  // Used in the "const" evaluate_rotamer_pair_energies and evaluate_rotamer_background_energies
477  // methods to keep track of the sfxn weights and the neighbor counts for the two input residues
478  // so that the data may be retrieved from within the trie-vs-trie and trie-vs-path calls.
480  mutable int rotamer_seq_sep_;
481  mutable int res1_;
482  mutable int res2_;
483  mutable int res1_nb_;
484  mutable int res2_nb_;
485 
486  virtual
487  core::Size version() const;
488 
489 };
490 
491 } // hbonds
492 } // scoring
493 } // core
494 
495 #endif
496 
497