Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GaussianFunc.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/GaussianFunc.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author James Thompson
13 
14 
15 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintIO.hh>
17 
19 
20 #include <core/types.hh>
21 
22 #include <utility/pointer/ReferenceCount.hh>
23 
24 // AUTO-REMOVED #include <numeric/angle.functions.hh>
25 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
26 // AUTO-REMOVED #include <basic/Tracer.hh>
27 
28 // C++ Headers
29 
30 #include <iostream>
31 
32 #include <utility/vector1.hh>
33 
34 
35 namespace core {
36 namespace scoring {
37 namespace constraints {
38 
39  void
40  GaussianFunc::read_data( std::istream& in ) {
41  in >> mean_ >> sd_;
42 
43  //I'm not sure what in.good() is meant to do here; it does NOT prevent GaussianFunc from chomping the next line of the constraint file as its tag if no tag is present. SML 08.21.12
44  if ( in.good() ) {
45  std::string tag;
46  in >> tag;
47 
48  if (tag == "NOLOG") {
49  use_log_score_ = false;
50  }
51  }
52 
53  }
54 
55  Real
56  GaussianFunc::func( Real const x ) const {
57  if ( use_log_score_ ) return - logdgaussian( x, mean_, sd_, 1 );
58  else return dgaussian( x, mean_, sd_, 1 );
59  } // func
60 
61  Real
62  GaussianFunc::dfunc( Real const x ) const {
63  if ( use_log_score_ ) return - logdgaussian_deriv( x, mean_, sd_, 1 );
64  else return gaussian_deriv( x, mean_, sd_, 1 );
65  } // dfunc
66 
67  void GaussianFunc::show_definition( std::ostream& out ) const {
68  out << "GAUSSIANFUNC " << mean_ << ' ' << sd_ << "\n";
69  }
70 
71 } // namespace constraints
72 } // namespace scoring
73 } // namespace core
74