Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TopologyClaimer.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/topology_broker/TopologyClaimer.hh
11 /// @author Oliver Lange
12 
13 #ifndef INCLUDED_protocols_topology_broker_TopologyClaimer_hh
14 #define INCLUDED_protocols_topology_broker_TopologyClaimer_hh
15 
16 // Unit headers
18 
19 // Package headers
25 
26 // Project Headers
28 #include <core/fragment/FragSet.hh>
30 #include <core/types.hh>
31 #include <core/pose/Pose.fwd.hh>
33 #include <protocols/moves/Mover.hh>
35 
36 // Utility headers
37 #include <utility/pointer/ReferenceCount.hh>
38 #include <utility/vector1_bool.hh>
39 
40 #include <utility/vector1.hh>
41 
42 
43 namespace protocols {
44 namespace topology_broker {
45 
46 /// @detail
47 // the claim functions are called from the Broker in this sequence
48 // generate_sequence_claims()
49 // initialize_residues() /// puts in the correct residue-types can copy segments of pose
50 // 1 x generate_claims()
51 // n x allow_claim()
52 // [ evtl. n x accept_declined_claim() ]
53 
54 // // here we don't call claim_accepted because I want to be able to take individual jumps out if they make fold-trees impossible
55 
56 // 1 x finalize_claims()
57 // n x allow_claim()
58 // [ evtl. n x accept_declined_claim() ]
59 // n x claim_accepted( ) //hopefully ;-)
60 
61 // initialize_dofs( init_claims [ subset of your claims ] ) ///only act on internal dofs -- no structure building
62 
64 public:
65  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
66  virtual ~TopologyClaimer();
67  TopologyClaimer() : abinitio_mover_weight_ ( new weights::ConstAbinitioMoverWeight( 1.0 ) ) {};
68 
69  ///@brief construct with weight-set ( how important is mover for different abinitio stages ? )
72  };
73 
74  ///@brief clone it!
75  virtual TopologyClaimerOP clone() const = 0;
76 
77  ///@brief name of Claimer
78  virtual std::string type() const = 0;
79 
80 
81  ///@brief read definition of Claimer from setup file, i.e., a CLAIMER <type> ... END_CLAIMER block
82  virtual void read( std::istream & );
83 
84  ///@brief generate claims that affect the sequence of the pose
85  virtual void generate_sequence_claims( DofClaims& ){}; //add to list ( never call clear() on list )
86 
87  ///@brief generate first round of DOF claims
88  virtual void generate_claims( DofClaims& ) {}; //add to list ( never call clear() on list )
89 
90  ///@brief is called after all round1 claims have been approved or retracted -- additional claims can be issued in this round
91  virtual void finalize_claims( DofClaims& ) {};
92 
93  ///@brief allow a claim from a foreign Claimer
94  virtual bool allow_claim( DofClaim const& /*foreign_claim*/ ) { return true; };
95 
96  ///@brief initialize sequence ( for approved sequence claims given as init_claim ) Claimer searches init_claims for claims owned by *this
97  virtual void initialize_residues( core::pose::Pose&, SequenceClaimOP init_claim, DofClaims& failed_to_init );
98 
99  ///@brief initialize dofs -- e.g., torsions, jumps -- Claimer searches init_claims for claims owned by *this
100  virtual void initialize_dofs( core::pose::Pose&, DofClaims const& init_claims, DofClaims& failed_to_init );
101 
102  ///@brief has this Claimer some side chain conformations to add?
103  /// starts with bNeedToRepack true for all residues... if you have a sidechain ---> copy it to pose and set needtoRepack false for this residue
104  virtual void switch_to_fullatom( core::pose::Pose&, utility::vector1< bool > /* bNeedToRepack */ ) const {};
105 
106  ///@brief multiply your bias to this -- if its zero don't change that, i.e., multiply only
107  /// this is used during fold-tree generation to set the cut-points. it starts with 1.0 for all residues.
108  /// Fragments can add their loop-fraction
109  virtual void manipulate_cut_bias( utility::vector1< core::Real >& /*cut_bias*/ ) {};
110 
111  ///@brief notification of declined claims: update your internal representation (e.g., movemap ) to remember this !
112  //// return false -- if you can't live without this claim being accepted. ( e.g., RigidChunks ... )
113  virtual bool accept_declined_claim( DofClaim const& /*was_declined*/ ) { return true; }
114 
115  ///@brief this claim of yours was accepted.... I so far haven't done anything with this... might go away.
116  virtual void claim_accepted( DofClaimOP my_claim ) {
117  current_claims_.push_back( my_claim );
118  }
119 
120  ///@brief add constraints to pose... might make this stage dependent as with movers...
121  virtual void add_constraints( core::pose::Pose& /*pose*/ ) const {};//some constraints are loaded...
122 
123  ///@brief return fragments that can be used for loop-sampling... unfortunately some loop-samplers need fragments, rather then fragmovers
124  /// (e.g. short-loop closure since it remaps them on a short pose containing only the loop-residues. )
125  /// overloaded e.g., by LoopFragmentClaimer.. returns a movemap and fragset good for loop-sampling
126  virtual core::fragment::FragSetCOP loop_frags( core::kinematics::MoveMap& /*returned! */ ) const { return NULL; };
127 
128  ///@brief claimers can add movers to the RandomMover (Container).
129  /// add your moves, make it dependent on stage if you want to. So far this is called only by abinitio...
130  /// if you don't want to do anything special --- don't overload this method!
131  /// default: adds mover given by virtual call get_mover() with stage-dependent weight given by abinitio_mover_weight_
132  virtual bool passes_filter(
133  core::pose::Pose const& /*pose*/,
134  abinitio::StageID /*stageID*/, /* abinitio sampler stage */
135  core::Real, /* progress */ /* progress within stage */
136  std::ostringstream& /*report*/
137  ) { return true; }
138 
139  ///@brief claimers can add movers to the RandomMover (Container).
140  /// add your moves, make it dependent on stage if you want to. So far this is called only by abinitio...
141  /// if you don't want to do anything special --- don't overload this method!
142  /// default: adds mover given by virtual call get_mover() with stage-dependent weight given by abinitio_mover_weight_
143  virtual void add_mover(
144  moves::RandomMover& /* random_mover */,
145  core::pose::Pose const& /*pose*/,
146  abinitio::StageID /*stageID*/, /* abinitio sampler stage */
147  core::scoring::ScoreFunction const& /*scorefxn*/,
148  core::Real /* progress */ /* progress within stage */
149  );
150 
152  abinitio_mover_weight_ = wset;
153  }
154 
156  return *abinitio_mover_weight_;
157  }
158 
159  ///@brief read mover weight from Stream. - so far recognizes: LargeStage, SmallStage, SmoothStage, AllStage
160  void read_mover_weight( std::istream& is );
161 
163 
164  ///@brief don't use this --- it is called by TopologyBroker add_claim only
166  broker_ = ptr;
167  }
168 
169  ///@brief return the broker we are collaborating with
170  TopologyBroker const& broker() const{
171  runtime_assert( broker_ ); //don't use before claimer is added to its broker
172  return *broker_;
173  }
174 
175  ///@brief a new decoy --- random choices to be made ? make them here
176  virtual void new_decoy() {};
177 
178  ///@brief an input pose is given, i.e., a starting structure for resampling
179  /// don't make random choices, base choices on given pose
180  virtual void new_decoy( core::pose::Pose const& ) { new_decoy(); };
181 
182  std::string const& label() const {
183  return label_;
184  }
185 
186  void set_label( std::string const& str ) {
187  label_ = str;
188  }
189 
190  virtual void receive_message( ClaimerMessage& ) {};
191 
192 protected:
193 
194  ///@brief what is your mover ... called by add_mover --- overload this or add_mover if you have movers too supply
195  virtual moves::MoverOP get_mover( core::pose::Pose const& /*pose*/ ) const { return NULL; };
196 
197  virtual bool read_tag( std::string tag, std::istream& is );
198 
199  virtual void set_defaults(); //eg before reading starts.
200 
201  virtual void init_after_reading() {};
202 
203 private:
204 
205  void unknown_tag( std::string tag, std::istream& is ) const;
206 
207  ///@brief currently accepted claims... dunno haven't used that yet.
209 
210  ///@brief weight set .. how often shall this claimer's mover be sampled during different stages ?
212 
213  ///@brief oh, our master. (use broker() to get this ).
215 
216  ///@brief a user defined string, can be used to send messages from claimer to claimer
218 }; //class TopologyClaimer
219 
220 inline std::istream& operator >> ( std::istream& is, TopologyClaimer& tc ) {
221  tc.read( is );
222  return is;
223 }
224 
225 }
226 }
227 
228 #endif