Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResidueNeighborList.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/ResidueNeighborList.hh
11 /// @brief A container class for use by the Etable and HackElec classes for storing
12 /// lists of atom neighbors
13 /// @author Andrew Leaver-Fay
14 
15 #ifndef INCLUDED_core_scoring_ResidueNeighborList_hh
16 #define INCLUDED_core_scoring_ResidueNeighborList_hh
17 
18 // Unit headers
20 
21 // Package headers
22 // AUTO-REMOVED #include <core/scoring/NeighborList.hh>
24 
25 // Project headers
26 #include <core/types.hh>
27 // AUTO-REMOVED #include <core/conformation/Atom.fwd.hh>
29 #include <basic/datacache/CacheableData.hh>
30 
31 // Utility headers
32 #include <utility/pointer/ReferenceCount.hh>
33 #include <utility/vector1.hh>
34 
35 //Auto Headers
36 namespace core {
37 namespace scoring {
38 
39 //enum AtomStatus { uptodate = 0, narrow_ood, wide_ood };
40 
41 class SmallAtNb
42 {
43 public:
44  SmallAtNb( Size at1, Size at2, Real weight ) : atomno1_( at1 ), atomno2_( at2 ), weight_( weight ) {}
45  Size atomno1() const { return atomno1_; }
46  Size atomno2() const { return atomno2_; }
47  Real weight() const { return weight_; }
48 private:
52 };
53 
54 /*class ResidueNblistData : public basic::datacache::CacheableData
55 {
56 public:
57  typedef basic::datacache::CacheableData parent;
58  typedef basic::datacache::CacheableDataOP CacheableDataOP;
59  typedef basic::datacache::CacheableDataCOP CacheableDataCOP;
60 
61  typedef utility::in_place_list< AtomNeighbor > AtomNeighbors;
62  typedef etable::count_pair::CountPairFunctionCOP CountPairFunctionCOP;
63 
64 public:
65  ResidueNblistData();
66  virtual ~ResidueNblistData();
67 
68  CacheableDataOP clone() const;
69 
70  void setup_for_intrares_nblist(
71  CountPairFunctionCOP cpfxn,
72  Real heavy_heavy_dist_cutoff,
73  Real heavy_hydrogen_dist_cutoff,
74  Real hydrogen_hydrogen_dist_cutoff
75  );
76 
77  void initialize( conformation::Residue const & res );
78  void update( conformation::Residue const & res );
79 
80  int is_H( Size atomno ) const { return is_H_[ atomno ]; }
81  AtomStatus atom_status( Size atomno ) const { return ood_status_[ atomno ]; }
82  Size nnarrow_ood() const { return nnarrow_ood_; }
83  Size nwide_ood() const { return nwide_ood_; }
84  utility::in_place_list< Size > const & narrow_ood_list() const { return narrow_ood_list_; }
85  utility::in_place_list< Size > const & wide_ood_list() const { return wide_ood_list_; }
86  Real narrow_bounding_radius() const { return narrow_bounding_radius_; }
87  Real wide_bounding_radius() const { return wide_bounding_radius_; }
88 
89  Vector const & narrow_coord( Size atomno ) const { return narrow_coord_[ atomno ]; }
90  Vector const & wide_coord( Size atomno ) const { return wide_coord_[ atomno ]; }
91 
92  AtomNeighbors const & narrow_neighbors( Size atomno ) const { return narrow_[ atomno ]; }
93  bool intrares_nblist_exists() const { return cpfxn_; }
94 
95  /// @brief Only use with no-update schemes
96  utility::vector1< utility::vector1< AtomNeighbor > > const & at_neighbors() const { return at_neighbors_; }
97 
98 private:
99  utility::vector1< int > is_H_;
100  utility::vector1< AtomStatus > ood_status_;
101  Size nnarrow_ood_;
102  Size nwide_ood_;
103  utility::in_place_list< Size > narrow_ood_list_;
104  utility::in_place_list< Size > wide_ood_list_;
105  utility::vector1< Vector > narrow_coord_;
106  utility::vector1< Vector > wide_coord_;
107 
108  utility::vector1< AtomNeighbors > narrow_;
109  utility::vector1< AtomNeighbors > wide_;
110 
111  utility::vector1< utility::vector1< AtomNeighbor > > at_neighbors_; // for no-update schemes
112 
113  Real narrow_bounding_radius_;
114  Real wide_bounding_radius_;
115 
116  CountPairFunctionCOP cpfxn_;
117  Real ncut2_[ 3 ];
118  Real wcut2_[ 3 ];
119 };
120 
121 /// @brief This class is used to represent for a pair of residues the subset
122 /// of atom-pair-interactions in a fixed-sequence structure which should be
123 /// evaluated during score-function evaluation and differentiation. This
124 /// class can indeed double as a container for intra-residue atom pair interactions
125 /// where the residue-1's neighbors for atom i hold the atom's "upper neighbors" --
126 /// atoms with a larger index -- and residue-2's neighbors for atom i hold
127 /// it's "lower neighbors".
128 class ResiduePairNeighborList : public basic::datacache::CacheableData
129 {
130 public:
131  typedef basic::datacache::CacheableData parent;
132  typedef basic::datacache::CacheableDataOP CacheableDataOP;
133  typedef basic::datacache::CacheableDataCOP CacheableDataCOP;
134 
135  typedef utility::in_place_list< AtomNeighbor > AtomNeighbors;
136  typedef etable::count_pair::CountPairFunctionCOP CountPairFunctionCOP;
137 
138 public:
139  static const Real narrow_reach; // = { 0.5 };
140  static const Real wide_reach; // = { 2.0 };
141 
142 public:
143  ResiduePairNeighborList();
144  virtual ~ResiduePairNeighborList();
145 
146  CacheableDataOP clone() const;
147 
148  AtomNeighbors const &
149  r1_narrow_neighbors( Size atind ) const {
150  return narrow(0)[ atind ];
151  }
152 
153  AtomNeighbors const &
154  r2_narrow_neighbors( Size atind ) const {
155  return narrow(1)[ atind ];
156  }
157 
158  void initialize_from_residues(
159  Real heavy_heavy_dist_cutoff,
160  Real heavy_hydrogen_dist_cutoff,
161  Real hydrogen_hydrogen_dist_cutoff,
162  conformation::Residue const & r1,
163  conformation::Residue const & r2,
164  ResidueNblistData const & r1dat,
165  ResidueNblistData const & r2dat,
166  etable::count_pair::CountPairFunctionCOP cpfxn
167  );
168 
169  void update(
170  Real heavy_heavy_dist_cutoff,
171  Real heavy_hydrogen_dist_cutoff,
172  Real hydrogen_hydrogen_dist_cutoff,
173  conformation::Residue const & r1,
174  conformation::Residue const & r2,
175  ResidueNblistData const & r1dat,
176  ResidueNblistData const & r2dat
177  );
178 
179 protected:
180 
181  AtomNeighbors const &
182  r1_wide_neighbors( Size atind ) const {
183  return wide(0)[ atind ];
184  }
185 
186  AtomNeighbors const &
187  r2_wide_neighbors( Size atind ) const {
188  return wide(1)[ atind ];
189  }
190 
191 
192 protected:
193 
194  /// Assert boundary conditions for index-by-0 arrays here
195 
196  utility::vector1< AtomNeighbors > &
197  narrow( int ind ) {
198  assert( ind == 0 || ind == 1 );
199  return narrow_[ ind ];
200  }
201 
202  utility::vector1< AtomNeighbors > const &
203  narrow( int ind ) const {
204  assert( ind == 0 || ind == 1 );
205  return narrow_[ ind ];
206  }
207 
208  utility::vector1< AtomNeighbors > &
209  wide( int ind ) {
210  assert( ind == 0 || ind == 1 );
211  return wide_[ ind ];
212  }
213 
214  utility::vector1< AtomNeighbors > const &
215  wide( int ind ) const {
216  assert( ind == 0 || ind == 1 );
217  return wide_[ ind ];
218  }
219 
220 public:
221 
222  /// @brief Only use with no-update schemes
223  utility::vector1< utility::vector1< AtomNeighbor > > const & r1_at_neighbors() const { return r1_at_neighbors_; }
224  /// @brief Only use with no-update schemes
225  utility::vector1< utility::vector1< AtomNeighbor > > const & r2_at_neighbors() const { return r2_at_neighbors_; }
226 
227  utility::in_place_list< Size > const & r1_nonempty() const { return r1_w_non_empty_narrow_; }
228 
229 private:
230  /// @brief debugging functionality: make sure that the atoms in the lists are the ones
231  /// that should be in the list.
232  bool
233  accurate(
234  Real heavy_heavy_dist_cutoff,
235  Real heavy_hydrogen_dist_cutoff,
236  Real hydrogen_hydrogen_dist_cutoff,
237  conformation::Residue const & r1,
238  conformation::Residue const & r2,
239  ResidueNblistData const & r1dat,
240  ResidueNblistData const & r2dat
241  ) const;
242 
243 
244 private:
245  etable::count_pair::CountPairFunctionCOP cpfxn_;
246 
247  utility::in_place_list< Size > r1_w_non_empty_narrow_;
248  utility::vector1< AtomNeighbors > narrow_[ 2 ];
249  utility::vector1< AtomNeighbors > wide_[ 2 ];
250 
251  utility::vector1< utility::vector1< AtomNeighbor > > r1_at_neighbors_; // for no-update schemes
252  utility::vector1< utility::vector1< AtomNeighbor > > r2_at_neighbors_; // for no-update schemes
253 
254  utility::vector1< AtomStatus > update_status_[ 2 ];
255 
256  Real ncut2_[ 3 ];
257  Real wcut2_[ 3 ];
258 
259 };*/
260 
261 class ResidueNblistData : public basic::datacache::CacheableData
262 {
263 public:
264  typedef basic::datacache::CacheableData parent;
265  typedef basic::datacache::CacheableDataOP CacheableDataOP;
266  typedef basic::datacache::CacheableDataCOP CacheableDataCOP;
267 
269 
270 public:
272  virtual ~ResidueNblistData();
273 
274  CacheableDataOP clone() const;
275 
276  /// @brief Initialize the residue-nblist; if there are no intra-residue interactions, then provide a null-pointing
277  /// count-pair function.
278  void initialize(
279  conformation::Residue const & res,
280  CountPairFunctionCOP cpfxn,
281  Real heavy_heavy_dist_cutoff = 0.0,
282  Real heavy_hydrogen_dist_cutoff = 0.0,
283  Real hydrogen_hydrogen_dist_cutoff = 0.0
284  );
285 
287 
288 private:
290 
291 };
292 
293 class ResiduePairNeighborList : public basic::datacache::CacheableData
294 {
295 public:
296  typedef basic::datacache::CacheableData parent;
297  typedef basic::datacache::CacheableDataOP CacheableDataOP;
298  typedef basic::datacache::CacheableDataCOP CacheableDataCOP;
299 
300  //typedef etable::count_pair::CountPairFunctionCOP CountPairFunctionCOP;
301 
302 public:
304  virtual ~ResiduePairNeighborList();
305  CacheableDataOP clone() const;
306 
308  Real vvd2,
309  Real hvd2,
310  Real hhd2,
311  conformation::Residue const & r1,
312  conformation::Residue const & r2,
314  );
315 
317 
318 private:
320 };
321 
322 }
323 }
324 
325 #endif