Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SmoothEnvPairPotential.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/SmoothEnvPairPotential.cc
11 /// @brief Smooth, differentiable version of centroid env and pair terms
12 /// @author Frank DiMaio
13 
14 #ifndef INCLUDED_core_scoring_SmoothEnvPairPotential_hh
15 #define INCLUDED_core_scoring_SmoothEnvPairPotential_hh
16 
18 
20 #include <core/pose/Pose.fwd.hh>
21 #include <core/types.hh>
22 
23 #include <numeric/constants.hh>
24 
25 #include <basic/datacache/CacheableData.hh>
26 
27 // AUTO-REMOVED #include <ObjexxFCL/FArray1D.hh>
28 // AUTO-REMOVED #include <ObjexxFCL/FArray2D.hh>
29 // AUTO-REMOVED #include <ObjexxFCL/FArray3D.hh>
30 
31 #include <utility/vector1_bool.hh>
32 
33 #include <utility/vector1.hh>
34 #include <numeric/xyzVector.hh>
35 
36 
37 
38 namespace core {
39 namespace scoring {
40 
41 ////////////////////////////////////////////////////////////////////////////////////////////////////
42 /// @brief Keep track of the cenlist information
43 /// stores both centroid counts (T = Real)
44 /// as well as d_centroid_counts (T = Vector)
45 template<class T>
46 class SigmoidWeightedCenList : public basic::datacache::CacheableData {
47 public:
50  CacheableData() {
51  fcen6_ = src.fcen6_;
52  fcen10_ = src.fcen10_;
53  fcen12_ = src.fcen12_;
54  calculated_ = src.calculated_;
55  }
56 
57  basic::datacache::CacheableDataOP clone() const {
58  return new SigmoidWeightedCenList( *this );
59  }
60 
61  Size size() const { return fcen6_.size();}
62 
63  T fcen6( Size const seqpos ) const { return fcen6_[ seqpos ]; }
64  T & fcen6( Size const seqpos ) { return fcen6_[ seqpos ]; }
65 
66  T fcen10( Size const seqpos ) const { return fcen10_[ seqpos ]; }
67  T & fcen10( Size const seqpos ) { return fcen10_[ seqpos ]; }
68 
69  T fcen12( Size const seqpos ) const { return fcen12_[ seqpos ]; }
70  T & fcen12( Size const seqpos ) { return fcen12_[ seqpos ]; }
71 
72  bool calculated() const { return calculated_; }
73  bool & calculated() { return calculated_; }
74 
75  void initialize( Size nres, T val ) {
76  fcen6_.resize( nres );
77  fcen10_.resize( nres );
78  fcen12_.resize( nres );
79  std::fill( fcen6_.begin(), fcen6_.end(), val );
80  std::fill( fcen12_.begin(), fcen12_.end(), val );
81  std::fill( fcen10_.begin(), fcen10_.end(), val );
82  }
83 
84  // Setter functions
85  void set_fcen6( Size const seqpos, T value ) {
86  fcen6_[ seqpos ] = value;
87  }
88 
89  void set_fcen10( Size const seqpos, T value ) {
90  fcen10_[ seqpos ] = value;
91  }
92 
93  void set_fcen12( Size const seqpos, T value ) {
94  fcen12_[ seqpos ] = value;
95  }
96 
97 private:
102 };
103 
104 
105 
106 ///////////////////////////////////////////////////////////////////////////////////////////////
107 
108 
109 
110 ////////////////////////
111 // fpd helper class holds some # of gaussian + sigmoid coeffs + a shift
113 public:
115 
117  sigmoid_coeffs_.push_back( s_in );
118  }
120  // normalize gaussian
121  g_in[0] /= sqrt(2*numeric::constants::f::pi*g_in[2]*g_in[2]);
122  gaussian_coeffs_.push_back( g_in );
123  }
124  void shift(Real s_in) { shift_=s_in; }
125 
126  Size nsigmoids() { return sigmoid_coeffs_.size(); }
127  Size ngaussians() { return gaussian_coeffs_.size(); }
128 
130  return sigmoid_coeffs_[i];
131  }
133  return gaussian_coeffs_[i];
134  }
135  Real shift() { return shift_; }
136 
137  void clear() {
138  sigmoid_coeffs_.clear();
139  gaussian_coeffs_.clear();
140  shift_ = 0;
141  }
142 
143  Real func( Real x ) const;
144  Real dfunc( Real x ) const;
145 
146 private:
150 };
151 
152 ////////////////////////
153 ////////////////////////
154 
156 public:
158 
159  ///
160  void
162  pose::Pose & pose
163  ) const;
164 
165  ///
166  void
168  pose::Pose & pose
169  ) const;
170 
171  void
172  finalize( pose::Pose & pose ) const;
173 
174  ///
175  void
177  pose::Pose const & pose,
178  conformation::Residue const & rsd,
179  Real & env_score,
180  Real & cb_score6,
181  Real & cb_score12
182  ) const;
183 
184  ///
185  void
187  conformation::Residue const & rsd1,
188  conformation::Residue const & rsd2,
189  Real const cendist,
190  Real & pair_contribution,
191  Real & cenpack_contribution
192  ) const;
193 
194  ///
195  void
197  pose::Pose const & pose,
198  conformation::Residue const & rsd,
199  numeric::xyzVector<Real> & d_env_score,
200  numeric::xyzVector<Real> & d_cb_score6,
201  numeric::xyzVector<Real> & d_cb_score12
202  ) const;
203 
204  ///
205  void
207  conformation::Residue const & rsd1,
208  conformation::Residue const & rsd2,
209  Real const cendist,
210  Real & d_pair,
211  Real & d_cenpack
212  ) const;
213 
214 protected:
216 
219 
222 
223 private:
224 
225  void
228  Size const res1,
229  Size const res2,
230  Real const cendist
231  ) const;
232 
233  void
236  Size const res1,
237  Size const res2,
238  numeric::xyzVector<Real> const cendist
239  ) const;
240 
241  //fpd no need for this function anymore; functions are all defined (and well behaved) over all x
242  //void truncate_cenlist_values( SigmoidWeightedCenList & cenlist ) const;
243 
244 private: // data
245  //fpd --- just store the coefficients and compute as needed
251 };
252 
253 } // ns scoring
254 } // ns core
255 
256 #endif