Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HBondSet.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/hbonds/HBondSet.hh
11 /// @brief Hydrogen bond set class declaration
12 /// @author Phil Bradley
13 
14 
15 #ifndef INCLUDED_core_scoring_hbonds_HBondSet_hh
16 #define INCLUDED_core_scoring_hbonds_HBondSet_hh
17 
18 
19 // Unit Headers
21 
22 
23 // Package headers
27 
28 // Project headers
29 #include <core/pose/Pose.fwd.hh>
31 // AUTO-REMOVED #include <core/id/AtomID.hh>
32 #include <basic/datacache/CacheableData.hh>
33 // AUTO-REMOVED #include <core/pose/datacache/CacheableDataType.hh>
34 
35 
36 // Utility headers
37 //#include <utility/exit.hh>
38 // AUTO-REMOVED #include <utility/vector1.hh>
39 #include <utility/pointer/owning_ptr.hh>
40 #include <utility/pointer/ReferenceCount.hh>
41 
42 #include <utility/vector1.hh>
43 #include <numeric/xyzVector.hh>
44 
45 // C++
46 #include <map> // what is the right header for std::pair ?
47 
48 #include <core/id/AtomID.fwd.hh>
49 
50 //#include <set>
51 
52 
53 
54 namespace core {
55 namespace scoring {
56 namespace hbonds {
57 
59 
60 public:
61  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
62  virtual ~HBond();
63  HBond(
64  Size const dhatm,
65  bool const dhatm_is_protein_backbone,
66  bool const dres_is_protein,
67  bool const dres_is_dna,
68  bool const dhatm_is_backbone,
69  Size const dres,
70  Size const aatm,
71  bool const aatm_is_protein_backbone,
72  bool const ares_is_protein,
73  bool const ares_is_dna,
74  bool const aatm_is_backbone,
75  Size const ares,
76  HBEvalTuple const hbe_tuple,
77  Real const energy_in, // unweighted
78  Real const weight_in,
79  HBondDerivs const & derivs_in
80  );
81 
82  ///
83  Size
84  don_res() const;
85 
86  ///
87  Size
88  don_hatm() const;
89 
90  /// needed for silly allow logic
91  bool
93 
94  bool
95  don_res_is_protein() const;
96 
97  bool
98  don_res_is_dna() const;
99 
100  /// needed for silly allow logic
101  bool
102  don_hatm_is_backbone() const;
103 
104  ///
105  Size
106  acc_res() const;
107 
108  ///
109  Size
110  acc_atm() const;
111 
112  /// needed for silly allow logic
113  bool
115 
116  bool
117  acc_res_is_protein() const;
118 
119  bool
120  acc_res_is_dna() const;
121 
122  /// needed for silly allow logic
123  bool
124  acc_atm_is_backbone() const;
125 
126  /// NOTE: this is unweighted energy, see weight() for the weight
127  Real
128  energy() const;
129 
130  ///
131  Real
132  weight() const;
133 
134  ///
135  HBondDerivs const &
136  derivs() const;
137 
138  ///@brief The HBEval type encodes the evaluation type as a single
139  ///enum value
140  HBEvalType
141  eval_type() const;
142 
143  ///@brief The HBEvalTuple is a tuple of enums for each dimension of
144  ///the evaluation type
145  HBEvalTuple const &
146  eval_tuple() const;
147 
148  ///
149  bool
150  atom_is_donorH( id::AtomID const & atom ) const;
151 
152  ///
153  bool
154  atom_is_acceptor( id::AtomID const & atom ) const;
155 
156  ///@breif a bare bones description of the data contained in the hbond object
157  void
158  show( std::ostream & out ) const;
159 
160  ///@brief a prettier, more interpretable description of an hbond,
161  ///including pdb identified residues and the geometric dimensions of
162  ///the hydrogen bond.
163  void show(
164  pose::Pose const & pose,
165  bool const print_header,
166  std::ostream & out) const;
167 
168  // PyRosetta friendly version
169  void show(pose::Pose const & pose, bool const print_header=true) const { show(pose, print_header, std::cout); }
170 
171  friend
172  std::ostream &
173  operator<< ( std::ostream & out, const HBond & hbond );
174 
175  ///
176  friend
177  bool
178  operator==(HBond const & a, HBond const & b);
179 
180  ///////////////////////////////////////////////////////////////////////////////
181  static
182  bool
184 
185  ///////
186  // data
187 private:
188 
202 
206 
207 };
208 
209 
210 //////////////////////////////////////////////////////////////////////////////////////////////////////
211 //////////////////////////////////////////////////////////////////////////////////////////////////////
212 // HBondSet
213 //////////////////////////////////////////////////////////////////////////////////////////////////////
214 //////////////////////////////////////////////////////////////////////////////////////////////////////
215 
216 class HBondSet : public basic::datacache::CacheableData {
217 
218 public:
219  HBondSet();
220  ~HBondSet();
221 
222  HBondSet( Size const nres );
223  HBondSet( HBondOptions const & options );
224  HBondSet( HBondOptions const & options, Size const nres);
225 
226  ///@brief convenience constructor: Find all the hbonds in the pose.
227  HBondSet(
228  pose::Pose & pose);
229 
230  ///@brief convenience constructor: Find all the hbonds in the pose.
231  HBondSet(
232  HBondOptions const & options,
233  pose::Pose & pose);
234 
235 
236  HBondSet( HBondSet const & src );
237 
238  HBondSet( HBondSet const & src, utility::vector1< core::Size > exclude_list );
239 
240  HBondSet( HBondSet const & src, utility::vector1< bool > residue_mask );
241 
242  HBondSet( HBondSet const & src, Size seqpos );
243 
244  // typedefs
246 
247 public:
248 
249  /// @brief Clone this object
250  basic::datacache::CacheableDataOP
251  clone() const;
252 
253  /// \brief Number of hbonds
254  Size
255  nhbonds() const;
256 
257  // for accessing the nbrs, allows hacky non-tenA_nbr count
258  int
259  nbrs( Size const seqpos ) const;
260 
261  void
262  set_nbrs( Size const seqpos, Size value );
263 
264  /// \brief Access hbond
265  HBond const &
266  hbond( Size const number ) const;
267 
268  /// \brief Add a new hbond to the list
269  /// updates the "hbchk" array as necessary
270  void
271  append_hbond(
272  Size const dhatm,
273  conformation::Residue const & don_rsd,
274  Size const aatm,
275  conformation::Residue const & acc_rsd,
276  HBEvalTuple const & hbe_tuple,
277  Real const energy,
278  Real const weight,
279  HBondDerivs const & deriv
280  );
281 
282  /// \brief Is this hbond allowed under the bb-bb exclusion scheme?
283  bool
284  allow_hbond( Size const index ) const;
285 
286  bool
287  allow_hbond( HBond const & hbond ) const;
288 
289  /// @brief is the backbone bone acceptor group in a bb/bb hydrogen bond?
290  bool
291  acc_bbg_in_bb_bb_hbond( Size const residue ) const;
292 
293  /// @brief is the backbone bone donor group in a bb/bb hydrogen bond?
294  bool
295  don_bbg_in_bb_bb_hbond( Size const residue ) const;
296 
297  /// @Manually set the state of backbone-backbone acceptor. Used for symmetry.
298  void
299  set_backbone_backbone_acceptor( Size const residue, bool state )
300  {
301  backbone_backbone_acceptor_[ residue ] = state;
302  }
303 
304  /// @Manually set the state of backbone-backbone donor. Used for symmetry.
305  void
306  set_backbone_backbone_donor( Size const residue, bool state )
307  {
308  backbone_backbone_donor_[ residue ] = state;
309  }
310 
311  /// @brief Setup the mapping from atoms to hbonds
312  void
313  setup_atom_map() const;
314 
315  /// \brief Get a vector of all the hbonds involving this atom
317  atom_hbonds( AtomID const & atom ) const;
318 
319  /// \brief Delete all the data
320  void
321  clear();
322 
323  /// \brief Resize bb info arrays
324  void
325  resize_bb_donor_acceptor_arrays( Size const new_dimension );
326 
327  void
329 
330  ///
331  void
333  pose::Pose const & pose,
334  bool const calculate_derivative = false,
335  bool const backbone_only = true
336  );
337 
338  void
340 
341  /// @brief Read access to the stored hbond options
342  HBondOptions const &
343  hbond_options() const;
344 
345  /// @breif set the hbond options for this hbond set; clears all hbonds already stored
346  void set_hbond_options( HBondOptions const & options );
347 
348  friend
349  std::ostream &
350  operator<< ( std::ostream & out, const HBondSet & hbond_set );
351 
352  /// @brief Print just the information stored in each individual
353  /// hbond.
354  void show(std::ostream & out) const;
355 
356  // PyRosetta friendly version
357  void show() const { show(std::cout); };
358 
359 
360  /// @brief Print nicely formated summary of the hbonds and their geometry in the pose.
361  void show(
362  pose::Pose const & pose,
363  bool const print_header,
364  std::ostream & out) const;
365 
366  // PyRosetta friendly version
367  void show(
368  pose::Pose const & pose,
369  bool const print_header=true) const { show(pose, print_header, std::cout); }
370 
371 
372  /// @brief Print nicely formated summary of all the hbonds to a
373  /// specific residue
374  void show(
375  pose::Pose const & pose,
376  Size const residue,
377  bool const print_header,
378  std::ostream & out) const;
379 
380  // PyRosetta friendly version
381  void show(
382  pose::Pose const & pose,
383  Size const residue,
384  bool const print_header=true) const { show(pose, residue, print_header, std::cout); }
385 
386 
387  /// @brief equality operator
388  friend
389  bool
390  operator==(HBondSet const & a, HBondSet const & b);
391 
392 private:
393  typedef std::map< AtomID, utility::vector1< HBondCOP > > HBondAtomMap;
394 
395 private:
396  ////////
397  // data ---- IF YOU ADD DATA ALSO ADD IT TO THE COPY C-TOR
398 
400 
406  mutable bool atom_map_init_;
408 };
409 
410 } // namespace hbonds
411 } // namespace scoring
412 } // namespace core
413 
414 #endif // INCLUDED_core_scoring_ScoreFunction_HH