Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RampingMover.hh
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 RampingMover.cc
11 /// @brief Mover class for ramping a score function over the course of
12 /// apply evaluations.
13 /// @author Monica Berrondo
14 
15 #ifndef INCLUDED_protocols_moves_RampingMover_hh
16 #define INCLUDED_protocols_moves_RampingMover_hh
17 
18 // Unit Headers
20 #include <protocols/moves/Mover.hh>
21 
22 // Package headers
23 // AUTO-REMOVED #include <protocols/moves/MoverStatistics.hh>
24 
25 // Project headers
26 #include <core/types.hh>
27 
28 #include <core/pose/Pose.fwd.hh>
29 
34 
36 #include <utility/vector1.hh>
37 
38 
39 // ObjexxFCL Headers
40 
41 // C++ Headers
42 
43 namespace protocols {
44 namespace moves {
45 
47 {
48 public:
49  typedef core::Real Real;
50 public:
51  virtual
52  ~RampingFunc();
53 
54  /// @brief Func must be defined (and finite) over the range from 0 and 1.
55  virtual
56  Real
57  func( Real ) const = 0;
58 
59 };
60 
61 class LinearFunc : public RampingFunc
62 {
63 public:
64  virtual ~LinearFunc();
65 
66  virtual
67  Real
68  func( Real x ) const
69  {
70  return x;
71  }
72 };
73 
75 {
76 public:
78  Real xval_start_ramp,
79  Real xval_end_ramp
80  );
81 
82  virtual ~FastLinearFunc();
83  virtual
84  Real
85  func( Real x ) const;
86 
87 private:
90 
91 };
92 
93 
94 /// @brief Ramps rapidly from the starting value to the final value.
95 /// Not 1 at x=1. Doesn't really finish at (1,1).
96 /// func(x) = 1 - exp( -1 * x * inv_xval_at_0p5 * 0.6931 );
97 class GeometricFunc : public RampingFunc
98 {
99 public:
100  GeometricFunc( Real xval_at_0p5 );
101  GeometricFunc();
102 
103  virtual ~GeometricFunc();
104 
105  virtual
106  Real
107  func( Real x ) const;
108 
109 private:
111 
112 };
113 
114 /// @brief Ramps slowly from the starting value to the final value
115 /// Non-zero for x = 0. Doesn't really start at (0,0).
116 /// func(x) = exp( -1 * ( 1 - x ) / ( 1 - xval_at_0p5 ) * 0.6931 );
118 {
119 public:
120  InvGeometricFunc( Real xval_at_0p5 );
122 
123  virtual ~InvGeometricFunc();
124 
125  virtual
126  Real
127  func( Real x ) const;
128 
129 private:
131 
132 };
133 
134 
135 class RampingMover : public Mover {
136 public:
137  // default constructor -- what good is a default constructor if you don't
138  // have mutators for the majority of the parameters?
139  RampingMover();
140 
141  ~RampingMover();
142 
143  /// Takes a scorefunciton OP because the score function it modifies is shared
144  /// between many movers.
145  RampingMover(
146  MoverOP mover_in,
147  core::scoring::ScoreFunctionOP scorefxn_in,
148  core::scoring::ScoreType score_type_in,
149  int outer_cycles_in,
150  int inner_cycles_in,
151  MonteCarloOP mc_in,
152  bool geometric_in = false
153  );
154 
155  RampingMover(
156  MoverOP mover_in,
157  core::scoring::ScoreFunctionOP scorefxn_in,
158  core::scoring::EnergyMap start_weights,
159  core::scoring::EnergyMap end_weights,
160  int outer_cycles_in,
161  int inner_cycles_in,
162  MonteCarloOP mc_in
163  );
164 
165  virtual MoverOP clone() const;
166 
167  virtual void apply( core::pose::Pose & pose );
168  virtual std::string get_name() const;
169 
170  virtual void parse_my_tag(
171  utility::tag::TagPtr const tags,
172  protocols::moves::DataMap & datamap,
173  protocols::filters::Filters_map const & filters,
174  protocols::moves::Movers_map const & movers,
175  core::pose::Pose const & pose);
176 
178  void start_weight( core::Real start_weight_in );
179  void end_weight ( core::Real end_weight_in );
180 
182 
183 private:
184 
185  // private functions used with weight ramping
186  void update_weights( int round );
187  void set_weights( core::scoring::EnergyMap const & emap );
188 
190  std::string const & func_name,
191  utility::tag::TagPtr const tag_ptr ) const;
192 
193 private:
194 
197 
198  bool ramp_one_weight_; /// Are we ramping one weight or several weights?
199  core::scoring::ScoreType score_type_; // The single weight that will be ramped
200 
204 
205  // Once it's set, its immutable.
207 
209 
211 }; // end class RampingMover
212 
213 } // moves
214 } // protocols
215 
216 
217 #endif //INCLUDED_protocols_moves_RampingMover_HH