Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Mover.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
11 /// @brief
12 /// @author
13 
14 #ifndef INCLUDED_protocols_moves_Mover_hh
15 #define INCLUDED_protocols_moves_Mover_hh
16 
17 // Unit Headers
19 
20 // Package headers
21 // AUTO-REMOVED #include <protocols/moves/MoverStatistics.hh>
23 
24 // Project headers
25 #include <core/types.hh>
26 #include <core/pose/Pose.fwd.hh>
27 #include <utility/tag/Tag.fwd.hh>
29 
30 //#include <protocols/jobdist/Jobs.hh>
32 // ObjexxFCL Headers
33 
34 // Utility Headers
35 #include <utility/pointer/ReferenceCount.hh>
36 #include <utility/vector1.fwd.hh>
37 
38 // C++ Headers
39 #include <string>
40 #include <map>
41 #include <list>
42 
44 #include <utility/vector1.hh>
45 
46 #ifdef WIN32
47  #include <utility/tag/Tag.hh>
48 #endif
49 
50 #ifdef USELUA
51 #include <lua.hpp>
52 #include <luabind/luabind.hpp>
53 #endif
54 
56 #include <utility/lua/LuaObject.hh>
57 #include <utility/lua/LuaIterator.hh>
58 
59 namespace protocols {
60 namespace moves {
61 
62 #ifdef USELUA
63 void lregister_Mover( lua_State * lstate );
64 void lregister_SerializableState( lua_State * lstate );
68 #endif
69 
70 ///////////////////////////////////////////////////////////////////////////////
71 /// @brief:
72 /// A mover is an object that can apply a conformational change to a pose
73 ///
74 /// @detailed:
75 /// Each derived class should define its own apply() statement
76 /// DO NOT JUST GO ADDING FUNCTIONS TO THIS CLASS. YOU IMPLY EVERYONE WHO
77 /// DERIVES FROM IT IS OBLIGATED TO IMPLEMENT THAT FUNCTION, OR, IF THEY
78 /// DON'T, THAT THEY ARE IMPLICTLY AGREEING THAT THE BASE CLASS IMPLEMENTATION
79 /// IS CORRECT.
80 ///
81 /// @authors Monica Berrondo, Jeff Gray, Steven Lewis, Sarel Fleishman
82 ///
83 /// @last_modified
84 ///////////////////////////////////////////////////////////////////////////////
85 
87 public:
92  typedef std::list< std::string > Strings; // should match jd2::Job::Strings
93 
94 public:
95  Mover();
96  virtual ~Mover();
97  // Factory<Mover> functions
98  // this really should be pure
99  virtual MoverSP create();
100  static std::string name() {
101  return "UNDEFINED NAME";
102  }
103  // elscripts functions
104  virtual void apply( core::io::serialization::PipeMap & pmap);
105 
106  // called right before mover is used , allowing mover to set settings based on state
107  virtual void parse_state( SerializableState const & state );
108  // called once, when mover is instantiated
109  virtual void parse_def( utility::lua::LuaObject const & def,
110  utility::lua::LuaObject const & score_fxns,
111  utility::lua::LuaObject const & tasks,
112  MoverCacheSP cache );
113 
114  virtual void save_state( SerializableState & state );
115 
116  /// @brief sets the type for a mover; name_ has been removed (2010/05/14)
117  Mover( std::string const & type_name );
118 
119  Mover( Mover const & other );
120  Mover& operator=( Mover const& other );
121 
122 
123  virtual core::Real last_proposal_density_ratio() {return 1;} //ek added 2/25/10
124 
125  ///@brief overload this static method if you access options within the mover.
126  /// these options will end up in -help of your application if users of this mover call register_options. do this recursively!
127  /// if you use movers within your mover, call their register_options in your register_options() method.
128  static void register_options() {}
129 
130  virtual void apply( Pose & ) = 0;
131 
132  std::string const & type() const { return type_; }
133 
134  /// @brief A tag is a unique identifier used to identify structures produced
135  /// by this Mover. get_current_tag() returns the tag, and set_current_tag( std::string tag )
136  /// sets the tag. This functionality is not intended for use with the 2008 job distributor.
138  // if ( jd2::jd2_used() ) return jd2::current_output_name();
139  return current_tag_;
140  }
141 
142  void set_current_tag( std::string const & new_tag ) { current_tag_ = new_tag; }
143 
144  ///@brief setter for poses contained for rms
145  virtual void set_input_pose( PoseCOP pose );
146 
147  ///@brief setter for native poses contained for rms ---- we should get rid of this method? it is widely used, but a bit unsafe
148  virtual void set_native_pose( PoseCOP pose );
149 
150  PoseCOP get_input_pose() const;
151  PoseCOP get_native_pose() const; // ---- we should get rid of this method? it is widely used, but a bit unsafe
152 
153  ///@brief: Unit test support function. Apply one move to a given pose.
154  /// Allows extra test specific functions to be called before applying
155  virtual void test_move( Pose & pose ) {
156  apply( pose );
157  }
158 
159  //protected:
160  //OL 4/23/08 made this public. it is not really a safety issue to have that
161  //protected and it allows more detail in MC diagnosis
162  void type( const std::string & type_in ) { type_ = type_in; }
163 
164  /// @brief clone has to be overridden only if clone invocation is expected.
165  virtual MoverOP clone() const;
166 
167  //////////////////////////////////begin parser interface////////////////////////////
168 
169  /// @brief Called by MoverFactory when constructing new Movers. Takes care of the specific mover's parsing.
170  virtual
171  void parse_my_tag(
172  TagPtr const tag,
173  DataMap & data,
174  Filters_map const & filters,
175  Movers_map const & movers,
176  Pose const & pose
177  );
178 
179  /// @brief Each derived class must specify its name. The class name.
180  virtual std::string get_name() const = 0;
181  std::string get_type() const { return( type_ ); }
182 
183  ///end parser interface, start Job Distributor interface/////////////
184  //void output_intermediate_pose( Pose const & pose, std::string const & stage_tag );
185 
186  ///@brief returns status after an apply(). The job distributor (august 08 vintage) will check this function to see if your protocol wants to filter its results - if your protocol wants to say "that run was no good, skip it" then use the protected last_move_status(MoverStatus) to change the value that this function will return.
188 
189  ///@brief resets status to SUCCESS, meant to be used before an apply(). The job distributor (august 08 vintage) uses this to ensure non-accumulation of status across apply()s.
190  void reset_status();
191 
192  ///fpd
193  ///@brief Mechanism by which a mover may return multiple output poses from a single input pose.
194  virtual
196 
197  ///@brief Strings container can be used to return miscellaneous info (as std::string) from a mover, such as notes about the results of apply(). The job distributor (Apr 09 vintage) will check this function to see if your protocol wants to add string info to the Job that ran this mover. One way this can be useful is that later, a JobOutputter may include/append this info to an output file.
198  ///@brief clear_info is called by jd2 before calling apply
199  virtual void clear_info() { info_.clear(); }
200  ///@brief non-const accessor
201  virtual Strings & info() { return info_; }
202  ///@brief const accessor
203  virtual Strings const & info() const { return info_; }
204 
205  ///@brief this function informs the job distributor (august 08 vintage) whether this object needs to be freshly regenerated on each use.
206  virtual
207  bool
209 
210  ///@brief this function informs the job distributor (august 08 vintage) whether this object needs to be regenerated when the input pose is about to change (for example, if the mover has special code on the first apply() that is only valid for that one input pose).
211  virtual
212  bool
214 
215  ///@brief this is like clone(), except it generates a new mover object freshly created with the default ctor. This function _should_ be pure virtual but that would disrupt the code base; MAKE SURE YOU DEFINE IT if you want to have your mover be a protocol handed to the job distributor (august 08 vintage).
216  virtual
217  MoverOP
218  fresh_instance() const;
219 
220  ///////////////////////////////end Job Distributor interface////////////////////////////////////////
221 
223 
225 
226 protected:
227  ///@brief nonvirtual setter for MoverStatus last_status_. Protected means that only the mover itself will be able to change its own status. The job distributor (august 08 vintage) is aware of status set with this function and will do what the MoverStatus says.
228  void
230 
231 private:
232 
235 
238 
239  ///@brief used to track if movers fail their filters - jobdist::BasicJob Distributor queries for this value
241  ///@brief miscellaneous info: optional notes about mover results. Fed to Job by JobDistributor (jd2), allowing JobOutputters to optionally report this information in some way.
243 
244  ///@brief this field can be NULL or it refers to the current JOB this mover is working on.
246 
247 }; // end Mover base class
248 
249 /// @brief Test IO operator for debug and Python bindings
250 std::ostream & operator << ( std::ostream & os, Mover const & mover);
251 
252 } // moves
253 } // protocols
254 
255 #endif //INCLUDED_protocols_moves_Mover_HH