Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOGFunc.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.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author James Thompson
13 
14 #ifndef INCLUDED_core_scoring_constraints_SOGFunc_hh
15 #define INCLUDED_core_scoring_constraints_SOGFunc_hh
16 
18 #include <core/types.hh>
19 
22 
23 // C++ Headers
24 
25 // AUTO-REMOVED #include <ostream>
26 
27 #include <utility/vector1.hh>
28 
29 
30 namespace core {
31 namespace scoring {
32 namespace constraints {
33 
34 /// @brief Derived class of class Func representing a SOG distribution with a user-specified
35 /// mean and standard deviation.
36 class SOGFunc : public Func {
37 public:
38 
39  SOGFunc() {}
40 
41  SOGFunc(
42  const utility::vector1< core::Real >& means,
43  const utility::vector1< core::Real >& sdevs,
44  const utility::vector1< core::Real >& weights
45  );
46 
47  SOGFunc( core::Real mean, core::Real sdev );
48 
49  /// @brief returns a clone of this SOGFunc
50  FuncOP clone() const { return new SOGFunc( *this ); }
51 
52  /// @brief Returns the value of this SOGFunc evaluated at distance x.
53  Real func( Real const x ) const;
54 
55  /// @brief Returns the value of the first derivative of this SOGFunc at distance x.
56  Real dfunc( Real const x ) const;
57 
58  void check_bounds( Real const x, Real const val ) const;
59 
60  /// @brief show the definition of this SOGFunc to the specified output stream.
61  virtual void show_definition( std::ostream &out ) const;
62 
63  /// @brief Calls show( out ) on this SOGFunc.
64  friend std::ostream& operator<<(std::ostream& out, const SOGFunc& f ) {
65  f.show( out );
66  return out;
67  } // operator<<
68 
69 
70  /// @brief Initializes this SOGFunc from the given istream.
71  /// @detailed The parameters are:
72  /*!
73  * Initializes this SOGFunc from the given istream. An example
74  * of the type of string from which the istream should be constructed is:
75  * "SOGFUNC 2 19.396 7.643 0.4 17.312 2.4 0.6". The interpretation is to
76  * create initialize this SOGFunc object with the following parameters:
77  * - one Gaussian function with mean 19.396 and sd 7.643, weighted with a
78  * weight of 0.4
79  * - another Gaussian function with mean of 17.312 and sd 2.4, with a weight
80  * of 0.6.
81  * Weights need not add up to 1, but many times they will.
82  */
83  void read_data( std::istream & in );
84 
85 private:
86  void clear_();
87  core::Real get_alt_score_( core::Real const x ) const;
88 
90 };
91 
92 
93 
94 } // constraints
95 } // scoring
96 } // core
97 
98 #endif