Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOGFunc_Impl.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 src/core/scoring/constraints/SOGFunc_Impl.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author James Thompson
13 
14 #ifndef INCLUDED_core_scoring_constraints_SOGFunc_Impl_hh
15 #define INCLUDED_core_scoring_constraints_SOGFunc_Impl_hh
16 
18 #include <utility/pointer/ReferenceCount.hh>
19 #include <core/types.hh>
20 
21 // C++ Headers
22 // AUTO-REMOVED #include <ostream>
23 
24 #include <utility/vector1.hh>
25 
26 
27 namespace core {
28 namespace scoring {
29 namespace constraints {
30 
31 /// @brief Derived class of class Func representing a SOG distribution with a user-specified
32 /// mean and standard deviation.
34 public:
35 
36  /*!
37  * Constuctor for SOGFunc_Impl. Arguments to the constructor are:
38  * - mean: parameter representing the mean of this function.
39  * - sd: parameter representing the standard deviation of this function.
40  */
41 
43  const utility::vector1< core::Real >& means,
44  const utility::vector1< core::Real >& sdevs,
45  const utility::vector1< core::Real >& weights
46  ) :
47  means_ ( means ),
48  sdevs_ ( sdevs ),
49  weights_( weights )
50  {
51  upper_bound(10);
52  }
53 
55  means_.push_back ( 0.0 );
56  sdevs_.push_back ( 1.0 );
57  weights_.push_back( 1.0 );
58  upper_bound(10);
59  }
60  virtual ~SOGFunc_Impl();
61 
62  /// @brief Returns the value of this SOGFunc_Impl evaluated at distance x.
63  Real func( Real const x ) const;
64  Real prob_sum_of_gaussians( Real const x ) const;
65 
66  /// @brief Returns the value of the first derivative of this SOGFunc_Impl at distance x.
67  Real dfunc( Real const x ) const;
68 
69  void check_bounds( Real const x, Real const val ) const;
70  void renormalize_weights();
71 
72  /// @brief show the definitio of this SOGFunc_Impl to the specified output stream.
73  void show_definition( std::ostream & out ) const;
74 
75  /// @brief Initializes this SOGFunc_Impl from the given istream.
76  /// @detailed The parameters are:
77  /*!
78  * Initializes this SOGFunc_Impl from the given istream. An example
79  * of the type of string from which the istream should be constructed is:
80  * "SOGFUNC 2 19.396 7.643 0.4 17.312 2.4 0.6". The interpretation is to
81  * create initialize this SOGFunc_Impl object with the following parameters:
82  * - one Gaussian function with mean 19.396 and sd 7.643, weighted with a
83  * weight of 0.4
84  * - another Gaussian function with mean of 17.312 and sd 2.4, with a weight
85  * of 0.6.
86  * Weights need not add up to 1, but many times they will.
87  */
88  void read_data( std::istream & in );
89 
90  void clear_(); // remove private data associated with this SOGFunc_Impl
91  core::Real get_alt_score_( Real const x ) const;
92 
93  void upper_bound( const Real r );
94  Real upper_bound() const;
95  Real upper_bound_score() const;
96 
97  void smooth_to_zero( bool const setting );
98  bool smooth_to_zero() const;
99 
100  void set_defaults();
101 
102  core::Real sog_cst_param() const;
103  void sog_cst_param( core::Real const param );
104 
105 private:
109 
112 
114 
115  bool smooth_;
116 };
117 
118 } // constraints
119 } // scoring
120 } // core
121 
122 #endif