Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParsedProtocol.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 protocols/rosetta_scripts/ParsedProtocol.hh
11 /// @author Sarel Fleishman (sarelf@u.washington.edu)
12 
13 #ifndef INCLUDED_protocols_rosetta_scripts_ParsedProtocol_HH
14 #define INCLUDED_protocols_rosetta_scripts_ParsedProtocol_HH
15 
16 // Project Headers
17 #include <core/pose/Pose.fwd.hh>
18 #include <protocols/moves/Mover.hh>
19 //#include <protocols/moves/OutputMovers.hh>
20 
21 #include <core/types.hh>
22 #include <utility/tag/Tag.fwd.hh>
26 
27 #include <utility/exit.hh>
28 #include <protocols/moves/ResId.hh>
29 
30 // C++ headers
31 #include <string>
32 
33 // Unit headers
35 
36 #include <utility/vector1.hh>
37 
38 namespace protocols {
39 namespace rosetta_scripts {
40 
42 {
43 public:
44  typedef core::Real Real;
46  typedef std::pair< std::pair< protocols::moves::MoverOP, std::string >, protocols::filters::FilterOP > mover_filter_pair;
48  typedef MoverFilterVector::iterator iterator;
49  typedef MoverFilterVector::const_iterator const_iterator;
50 public:
52  virtual void apply( Pose & pose );
54  virtual std::string get_name() const;
55  /// Tricky! movers are cloned into the protocol b/c their apply functions (which are nonconst) could accumulate
56  /// state information. Filters are safe and are therefore merely registered.
57  /// Under this state of affairs, a mover or filter may be called many times in the protocol, and it will be
58  /// guaranteed to have no state accumulation.
59  void add_mover( protocols::moves::MoverCOP mover, std::string const mover_name, protocols::filters::FilterOP filter );
62  void final_score(core::pose::Pose & pose) const;
63  void report_all( Pose const & pose ) const; // cycles over all filter->report methods to output their values to a common stream.
64  void report_filters_to_job( Pose const & pose ) const; // as above but reports to job object
65  void report_all_sm( std::map< std::string, core::Real > & score_map, Pose const & pose ) const; // ditto, but outputs filter values into score_map object
66  protocols::moves::MoverCOP get_mover( core::Size const mover_number ) const {
67  runtime_assert( movers_.size() >= mover_number && mover_number > 0 );
68  return( movers_[ mover_number ].first.first );
69  }
70  void set_resid( core::Size const resid );
73  virtual void parse_my_tag( utility::tag::TagPtr const, protocols::moves::DataMap &, protocols::filters::Filters_map const &, protocols::moves::Movers_map const &, core::pose::Pose const & ); // this is defined as public here, b/c I need to circumvent the name-check, since this is called both by the Movers section (as ParsedProtocol) and the PROTOCOLS section.
74  void clear() { movers_.clear(); }
75  std::string mode() const{ return mode_; }
76  iterator begin();
77  const_iterator begin() const;
78  iterator end();
79  const_iterator end() const;
80  virtual ~ParsedProtocol();
83  core::Size size() { return movers_.size(); }
86  bool report_call_order() const { return report_call_order_; }
87  void report_call_order( bool const c ) { report_call_order_ = c; }
88  std::string call_order() const{ return call_order_; }
89 private:
90  void finish_protocol(Pose & pose);
91  bool apply_mover_filter_pair(Pose & pose, mover_filter_pair const & mover_pair);
92  bool apply_filter(Pose & pose, mover_filter_pair const & mover_pair);
93 
95  void random_order_protocol(Pose & pose);
96  void random_single_protocol(Pose & pose);
97 private:
98 
102  utility::vector1< core::Real > apply_probability_; // if mode_="single_random", assigns a probability of execution to each mover/filter pair. Defaults to equal probabilities to all.
103  core::Size last_attempted_mover_idx_; //index to last attempted mover; useful for adaptive monte carlo
104  bool report_call_order_; //dflt false; At the end of the run, write to out the sequence of mover/filter calls (good for stochastic application
105  std::string call_order_; // saved call order, not writeable
106 
107 };
108 
109 } // rosetta_scripts
110 } // protocols
111 
112 #endif //INCLUDED_protocols_rosetta_scripts_ParsedProtocol_HH