Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SquareWell2Func.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/SquareWell2Func.hh
11 /// @brief Definition for functions used in definition of constraints.
12 /// @author Rhiju Das
13 /// @author Jianqing Xu
14 
15 
17 
18 #include <core/types.hh>
19 #include <numeric/angle.functions.hh>
20 #include <utility/pointer/ReferenceCount.hh>
21 #include <basic/Tracer.hh>
22 
23 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
24 // AUTO-REMOVED #include <basic/Tracer.hh>
25 
26 #include <utility/vector1.hh>
27 #include <sstream>
28 
29 static basic::Tracer TR("core.scoring.constraints.SquareWall2Func");
30 
31 // C++ Headers
32 
33 
34 namespace core {
35 namespace scoring {
36 namespace constraints {
37 
38 Real
39 SquareWell2Func::func( Real const x ) const
40 {
41  Real const z = ( numeric::nearest_angle_radians(x,x0_)-x0_ );
42 // TR<<"x="<<x<<" x0_="<<x0_<<" |x-x0|="<<std::fabs(z) <<" x_range_="<<x_range_<<std::endl;
43  if ( std::fabs(z) > x_range_ ) {
44  return well_depth_;
45  }
46  return 0.0;
47 }
48 
49 Real
50 SquareWell2Func::dfunc( Real const /*x*/ ) const
51 {
52  return 0.0; //This is bad news for the minimizer...
53 }
54 
55 void
56 SquareWell2Func::read_data( std::istream& in ) {
57  in >> x0_ >> x_range_ >>well_depth_;
58 }
59 
60 void
61 SquareWell2Func::show_definition( std::ostream &out ) const {
62  out << "SQUARE_WELL_2 " << x0_ << " " << x_range_ << " " << well_depth_ << std::endl;
63 }
64 
65 Size
66 SquareWell2Func::show_violations( std::ostream& out, Real x, Size verbose_level, Real threshold) const {
67  if (verbose_level > 100 ) {
68  out << "SQUARE_WELL_2 " << ( x < x0_ ) << std::endl;
69  }
70  return Func::show_violations( out, x, verbose_level, threshold);
71 }
72 
73 
74 } // namespace constraints
75 } // namespace scoring
76 } // namespace core
77