Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CircularSigmoidalFunc.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/CircularSigmoidalFunc.cc
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author Robert Vernon
13 
15 #include <numeric/angle.functions.hh>
16 #include <core/types.hh>
17 #ifdef _WIN32
18 #define _USE_MATH_DEFINES
19 #include <math.h>
20 #endif
21 #include <cmath>
22 
23 #include <iostream>
24 
25 namespace core {
26 namespace scoring {
27 namespace constraints {
28 
29 Real
31  Real const x0 = numeric::nearest_angle_radians(x,xC_)-xC_;
32 
33  //std::cout << "SIG_FUNC " << M_E << " " << x << " " << xC_ << " " << x0 << " " << o1_ << " " << o2_ << " " << m_ << " " << offset_ << " " << (1/(1+ std::pow( M_E, (-m_*(x0-o1_)) ))) << " " << (1/(1+ std::pow( M_E, (-m_*(x0-o2_)) ))) << std::endl;
34 
35  Real const z = offset_ + (1/(1+ std::pow( M_E, (-m_*(x0-o1_)) ))) - (1/(1+ std::pow( M_E, (-m_*(x0-o2_)) )));
36 
37  return z;
38 }
39 
40 Real
42 
43  Real const x0 = numeric::nearest_angle_radians(x,xC_)-xC_;
44 
45  Real const z = m_*std::pow(M_E,m_*x0+m_*o1_)/(2*std::pow(M_E,m_*x0+m_*o1_)+std::pow(M_E,2*m_*x0)+std::pow(M_E,2*m_*o1_))
46  - m_*std::pow(M_E,m_*x0+m_*o2_)/(2*std::pow(M_E,m_*x0+m_*o2_)+std::pow(M_E,2*m_*x0)+std::pow(M_E,2*m_*o2_));
47 
48  return z;
49 }
50 
51 void
52 CircularSigmoidalFunc::read_data( std::istream & in ) {
53  in >> xC_ >> m_ >> o1_ >> o2_;
54 }
55 
56 void CircularSigmoidalFunc::show_definition( std::ostream & out ) const
57 {
58  out << "CircularSigmoidalFunc " << xC_ << ' ' << m_ << ' ' << o1_ << ' ' << o2_;
59 }
60 
61 } // namespace constraints
62 } // namespace scoring
63 } // namespace core
64