Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TrialMover.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 TrialMover
11 /// @brief performs a move and accepts it according to Monte Carlo accept/reject criterion.
12 /// @author Monica Berrondo
13 
14 
15 #ifndef INCLUDED_protocols_moves_TrialMover_hh
16 #define INCLUDED_protocols_moves_TrialMover_hh
17 
18 // Unit headers
20 
21 // Package headers
22 #include <protocols/moves/Mover.hh>
25 
27 
28 #include <core/types.hh>
29 
30 #include <core/pose/Pose.fwd.hh>
31 
32 // ObjexxFCL Headers
33 
34 // C++ Headers
35 #include <map>
36 #include <string>
37 
38 #include <utility/vector1.hh>
39 
40 
41 // Utility Headers
42 
43 
44 namespace protocols {
45 namespace moves {
46 
47 ///////////////////////////////////////////////////////////////////////////////
48 /// @brief A TrialMover applies a Mover and then accepts or rejects the move
49 /// according to a MonteCarlo object.
50 ///
51 /// @detailed:
52 /// Each derived class should define its own apply() statement
53 /// the apply (mc) which requires a monte carlo object and only keeps
54 /// the move if the monte carlo test allows it
55 ///
56 /// @authors Monica Berrondo
57 ///
58 /// @last_modified August 16 2007
59 ///////////////////////////////////////////////////////////////////////////////
60 
61 // silly little enum to keep track of how we want to
62 // keep track of statistics from this Mover. It's
63 // important with the current design that these are
64 // kept in a hierarchically increasing order, so that
65 // the StatsType of i-1 keeps all of the same
66 // statistics as StatsType.
67 enum StatsType {
68  all_stats = 1, // scores, accepts and rejects
69  accept_reject, // only accept and reject counts
70  no_stats // no stats. Always keep last.
71 };
72 
73 
74 /// @brief the MCResetMover applies a monte carlo reset
75 
76 class MonteCarloUtil : public Mover {
77 public:
80  virtual ~MonteCarloUtil();
81  virtual void apply(Pose & pose);
82 
83  virtual void parse_my_tag(
84  utility::tag::TagPtr const tag,
85  protocols::moves::DataMap & /* data */,
86  protocols::filters::Filters_map const & /* filters */,
87  protocols::moves::Movers_map const & /* movers */,
88  core::pose::Pose const & /* pose */
89  );
90 
91  virtual protocols::moves::MoverOP clone() const;
92  virtual std::string get_name() const;
93 
94 
95 private:
98 
99 };
100 
101 /// @brief A TrialMover applies a Mover and then accepts or rejects the move
102 /// according to a MonteCarlo object.
103 ///
104 /// Common Methods:
105 /// TrialMover.apply
106 /// TrialMover.set_mc
107 class TrialMover : public Mover {
108 public:
109 
110  typedef core::Real Real;
111 
112 public:
113 
114  TrialMover();
115 
116  // constructor with arguments -- BAD, MOVE TO .CC
117  /// @brief Constructs a TrialMover
118  /// trialmover = TrialMover( mover_in , mc_in )
119  ///
120  /// Mover mover_in /object defining what move to make
121  /// MonteCarlo mc_in /object defining acceptance
122  TrialMover( MoverOP mover_in, MonteCarloOP mc_in );
123 
124  ~TrialMover();
125 
126 
127  // set the weights for the score_type for ramping -- BAD, MOVE TO .CC
128  virtual void initialize_weights(
129  Real const start_weight,
130  Real const end_weight,
131  core::scoring::ScoreType score_type,
132  int const ramp_cycles
133  );
134 
135  /// @brief Performs a single trial, apply the Mover and accept or
136  /// reject the move based on the MonteCarlo acceptance criteria
137  ///
138  /// example(s):
139  /// trialmover.apply(pose)
140  /// See Also:
141  /// Pose
142  /// MonteCarlo
143  /// MonteCarlo.boltzmann
144  /// RepeatMover
145  /// SequenceMover
146  /// TrialMover
147  virtual void apply( core::pose::Pose & pose );
148  virtual std::string get_name() const;
149  Real acceptance_rate() const;
150  /// @brief Returns the number of moves accepted by this TrialMover
151  int num_accepts() const;
152 
153  /// @brief Sets the MonteCarlo object to <mc_in>
154  ///
155  /// example(s):
156  /// trialmover.set_mc(mc)
157  /// See Also:
158  /// MonteCarlo
159  /// MonteCarlo.boltzmann
160  /// TrialMover
161  void set_mc( MonteCarloOP mc_in );
162 
163  /// @brief Returns the underlying Mover
164  MoverOP mover() const {
165  return mover_;
166  }
167 
168  /// @brief Returns the underlying MonteCarlo object
169  MonteCarlo const& mc () const {
170  return *mc_;
171  }
172 
174  return stats_type_;
175  }
176 
177  void keep_stats_type( StatsType setting ) {
178  stats_type_ = setting;
179  }
180 
181  // @brief Sets the input Pose also for the contained Mover
182  virtual void set_input_pose( PoseCOP pose );
183 
184  // @brief Sets the native Pose also for the contained Mover
185  virtual void set_native_pose( PoseCOP pose );
186 
187  /// @brief Requires that a MonteCarlo object has already been
188  /// loaded into the DataMap in a prior MONTECARLOS objects
189  /// section.
190  virtual void parse_my_tag(
191  TagPtr const tag,
192  DataMap & data,
193  Filters_map const & filters,
194  Movers_map const & movers,
195  Pose const &
196  );
197  friend std::ostream &operator<< (std::ostream &os, TrialMover const &mover);
198 
199 protected:
200 
204 
205 private:
211 }; // TrialMover base class
212 
213 } // moves
214 } // protocols
215 
216 
217 #endif //INCLUDED_protocols_moves_TrialMover_HH