Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KarplusFunc.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/KarplusFunc.cc
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author Nikolas Sgourakis
13 
15 // AUTO-REMOVED #include <numeric/angle.functions.hh>
16 #include <core/types.hh>
17 
18 #include <iostream>
19 
20 #include <cmath>
21 
22 
23 namespace core {
24 namespace scoring {
25 namespace constraints {
26 
27 Real
28 KarplusFunc::func( Real const x ) const {
29  Real const cosine = cos( x + Dphi_ );
30  Real const j = A_ * cosine * cosine + B_ * cosine + C_;
31  Real const z = (j - x0_) / sd_;
32  return z * z;
33 
34 }
35 
36 Real
37 KarplusFunc::dfunc( Real const x ) const {
38  Real const sine = sin (x+Dphi_);
39  Real const cosine = cos (x+Dphi_);
40  Real const j = A_ * cosine * cosine + B_ * cosine + C_;
41  return -2 *( (j -x0_ ) / (sd_ * sd_) ) * sine *(2*A_*cosine + B_ ) ;
42 }
43 
44 void
45 KarplusFunc::read_data( std::istream & in ) {
46  in >> A_ >> B_ >>C_ >> Dphi_ >> x0_ >> sd_ >>offset_;
47 }
48 
49 void KarplusFunc::show_definition( std::ostream & out ) const
50 {
51  out << "KarplusFunc " << A_ <<' ' << B_ << ' ' << C_ << ' ' << Dphi_ << ' '<< x0_ << ' ' << sd_ << ' ' << offset_;
52 }
53 
54 } // namespace constraints
55 } // namespace scoring
56 } // namespace core
57