Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Func.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/Func.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author Andrew Leaver-Fay
13 /// @author James Thompson
14 /// @author Oliver Lange
15 
16 #ifndef INCLUDED_core_scoring_constraints_Func_hh
17 #define INCLUDED_core_scoring_constraints_Func_hh
18 
19 #include <utility/pointer/ReferenceCount.hh>
20 
21 #include <core/types.hh>
23 
24 namespace core {
25 namespace scoring {
26 namespace constraints {
27 
28 /// @brief Func is an abstract base class representing a function used to define
29 /// constraints, in which func(r) gives the constraint score for the given value
30 /// r.
32 public:
33  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
34  virtual ~Func();
35 
36  virtual
37  FuncOP clone() const = 0;
38 
39  /// @brief initialize this Func from the given std::istream.
40  virtual
41  void read_data( std::istream & );
42 
43  /// @brief Returns a value representing this function evaluated at a given
44  /// point.
45  virtual
46  Real
47  func( Real const ) const = 0;
48 
49  /// @brief Returns a value representing the derivative of this function
50  /// evaluated at a given point.
51  virtual
52  Real
53  dfunc( Real const ) const = 0;
54 
55  /// @brief Estimates the derivative of this function at a given radius by
56  /// calculating the slope of the secant line from func(r) and func(r+1e-05).
57  virtual
58  Real estimate_dfunc( Real const r ) const;
59 
60  /// @brief Estimates the derivative of this function at a given radius by
61  /// calculating the slope of the secant line from func(r) and func(r+h).
62  virtual
63  Real estimate_dfunc( Real const r, Real const h ) const;
64 
65  /// @brief Prints out space-delimited columns for r, func, dfunc and
66  /// dfunc_est. The values for func, dfunc and dfunc_est are plotted as a
67  /// function of r, which is varied from 2-20 in steps of 0.5. The value for
68  /// dfunc_est is the estimated by the method estimate_dfunc( r ).
69  virtual void show( std::ostream & out ) const;
70 
71  /// @brief shows the definition of this function, usually the string type of
72  /// function and the parameters passed in to the constructor.
73  virtual void show_definition( std::ostream & out ) const;
74 
75  /// @brief show some sort of stringified representation of the violations for
76  /// this constraint.
77  virtual Size show_violations(
78  std::ostream& out, Real r, Size verbose_level, Real threshold = 1
79  ) const;
80 
81  friend std::ostream& operator<<(std::ostream& out, const Func& f );
82 }; // class Func
83 
84 } // constraints
85 } // scoring
86 } // core
87 
88 #endif