Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CircularPowerFunc.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/CircularPowerFunc.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author James Thompson
13 
15 #include <core/types.hh>
16 #include <numeric/angle.functions.hh>
17 
18 // C++ Headers
19 
20 namespace core {
21 namespace scoring {
22 namespace constraints {
23 
25  Real const x0_radians,
26  Real const sd_radians,
27  int const power,
28  Real const weight
29 ) :
30  x0_( x0_radians ),
31  sd_( sd_radians ),
32  power_( power ),
33  weight_( weight )
34 {
35  assert( std::abs( std::pow(3.0,2) - 9.0 ) < 1e-3 );
36  assert( power_ != 1 && power_ != 0 );
37 }
38 
39 FuncOP
41  return new CircularPowerFunc( *this );
42 }
43 
44 Real
45 CircularPowerFunc::func( Real const x ) const {
46  Real const z = ( numeric::nearest_angle_radians(x,x0_)-x0_ )/sd_;
47  return weight_ * std::pow( z, power_ );
48 }
49 
50 Real
51 CircularPowerFunc::dfunc( Real const x ) const {
52  Real const z = ( numeric::nearest_angle_radians(x,x0_)-x0_ )/sd_;
53  return weight_ * power_ * std::pow( z, power_ - 1 ) / sd_;
54 }
55 
56 } // constraints
57 } // scoring
58 } // core