Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SoedingFunc.cc
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/SoedingFunc.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author James Thompson
13 
14 // AUTO-REMOVED #include <numeric/util.hh>
15 
18 #include <core/types.hh>
19 #include <basic/options/option.hh>
20 #include <basic/options/keys/james.OptionKeys.gen.hh>
21 
22 // C++ Headers
23 #include <iostream>
24 
25 #include <utility/vector1.hh>
26 
27 //Auto Headers
28 #include <cmath>
29 
30 
31 namespace core {
32 namespace scoring {
33 namespace constraints {
34 
35 void
36 SoedingFunc::read_data( std::istream & in ) {
37  in >> w1_ >> mean1_ >> sdev1_ >> w2_ >> mean2_ >> sdev2_;
38 }
39 
40 Real
41 SoedingFunc::compute_func( Real const x ) const {
42  using std::exp;
43  using std::log;
44 
45  Real const numerator(
47  );
48  Real const denominator(
50  );
51 
52  //Real const score( log(numerator) - log(denominator) );
53  Real const score( log(denominator) - log(numerator) );
54  return score;
55 }
56 
57 Real
58 SoedingFunc::func( Real const x ) const {
59  using namespace basic::options;
60  using namespace basic::options::OptionKeys;
61 
62  Real const score( compute_func(x) );
63 
64  if ( option[ james::debug ]() ) {
65  //return std::min( score, compute_func(10) );
66  return std::min( score, 0.0 );
67  }
68  return score;
69 } // func
70 
71 Real
72 SoedingFunc::dfunc( Real const x ) const {
73  return estimate_dfunc(x);
74 } // dfunc
75 
76 void SoedingFunc::show_definition( std::ostream & out ) const {
77  out << "SOEDINGFUNC " << w1_ << " " << mean1_ << " " << sdev1_ << " "
78  << w2_ << " " << mean2_ << " " << sdev2_;
79 } // show_definition
80 
81 } // namespace constraints
82 } // namespace scoring
83 } // namespace core