Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PcsEnergyController.cc
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  //////////////////////////////////////////////
11  /// @begin
12  ///
13  /// @file protocols/topology_broker/PcsEnergyController.cc
14  ///
15  /// @brief
16  ///
17  /// @detailed
18  ///
19  /// @param
20  ///
21  /// @return
22  ///
23  /// @remarks
24  ///
25  /// @references
26  ///
27  /// @authorsv Christophe Schmitz & Oliver Lange
28  ///
29  /// @last_modified February 2010
30  ////////////////////////////////////////////////
31 
32 // Unit Headers
34 
35 // Package Headers
39 
40 // Project Headers
41 // AUTO-REMOVED #include <core/scoring/constraints/Constraint.hh>
42 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
43 
44 // Utility headers
45 #include <basic/Tracer.hh>
46 
47 #include <utility/vector1.hh>
48 #include <basic/options/keys/OptionKeys.hh>
49 
50 
51 // ObjexxFCL Headers
52 
53 // C++ headers
54 
55 static basic::Tracer TR_PcsEnergyController("protocols.topology_broker.PcsEnergyController");
56 
57 namespace protocols {
58 namespace topology_broker {
59 
60 using namespace core;
61  //using namespace scoring::constraints;
62 
63 
65 {
66 }
67 
70 {
71 }
72 
73 
75 }
76 
77 void
79  using namespace protocols::scoring::methods::pcs2;
80  PcsGridSearchParameterManager::get_instance()->incremente_n_multi_data();
81 }
82 
83 bool PcsEnergyController::read_tag( std::string tag, std::istream& is ) {
84  using namespace protocols::scoring::methods::pcs2;
85 
86  core::Size n_m_d;
87  n_m_d = PcsGridSearchParameterManager::get_instance()->get_n_multi_data();
88 
89  PcsGridSearchParameter & g = PcsGridSearchParameterManager::get_instance()->get_grid_search_parameters(n_m_d);
90 
91 
92 
93  if ( tag == "PCS_WEIGHT" ) {
94  if ((is >>
95  g.pcs_weight_stage1_ >>
96  g.pcs_weight_stage2_ >>
97  g.pcs_weight_stage3_ >>
98  g.pcs_weight_stage4_).fail()){
99  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
100  utility_exit();
101  }
102  return true;
103  }
104 
105 
106  if ( tag == "INCLUDE_ONLY" ) {
107  if ((is >>
108  g.include_only_start_stage1_ >>
109  g.include_only_end_stage1_
110  ).fail()){
111  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 2 positive integer" << std::endl;
112  utility_exit();
113  }
114  g.include_only_start_stage2_ = g.include_only_start_stage1_;
115  g.include_only_start_stage3_ = g.include_only_start_stage1_;
116  g.include_only_start_stage4_ = g.include_only_start_stage1_;
117 
118  g.include_only_end_stage2_ = g.include_only_end_stage1_;
119  g.include_only_end_stage3_ = g.include_only_end_stage1_;
120  g.include_only_end_stage4_ = g.include_only_end_stage1_;
121 
122  return true;
123  }
124 
125  if ( tag == "INDIVIDUAL_SCALE" ) {
126  if ((is >>
127  g.individual_scale_stage1_
128  ).fail()){
129  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 positive number" << std::endl;
130  utility_exit();
131  }
132  g.individual_scale_stage2_ = g.individual_scale_stage1_;
133  g.individual_scale_stage3_ = g.individual_scale_stage1_;
134  g.individual_scale_stage4_ = g.individual_scale_stage1_;
135 
136  return true;
137  }
138 
139  if ( tag == "N_TRIALS_MINIMIZATION" ) {
140  if ((is >>
141  g.n_trial_min_stage1_
142  ).fail()){
143  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 positive integer" << std::endl;
144  utility_exit();
145  }
146  g.n_trial_min_stage2_ = g.n_trial_min_stage1_;
147  g.n_trial_min_stage3_ = g.n_trial_min_stage1_;
148  g.n_trial_min_stage4_ = g.n_trial_min_stage1_;
149  return true;
150  }
151 
152 
153  if ( tag == "PCS_INPUT_FILE" ) {
154  core::Real weight;
156  if ((is >>
157  filename >>
158  weight
159  ).fail()){
160  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string followed by 1 number (integer or float)" << std::endl;
161  utility_exit();
162  }
163 
164  if(weight < 0){
165  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string followed by one POSITIVE weight" << std::endl;
166  utility_exit();
167  }
168  g.filenames_.push_back(filename);
169  g.individual_weights_.push_back(weight);
170  return true;
171  }
172 
173  std::cerr << "The following tag is unknown " << tag << std::endl;
174 
175 
176  return Parent::read_tag( tag, is );
177 }
178 
179 //This is called each time the stageID changed
181  moves::RandomMover& /* random_mover */,
182  core::pose::Pose const& /*pose*/,
183  abinitio::StageID stageID , /* abinitio sampler stage */
184  core::scoring::ScoreFunction const& /*scorefxn*/,
185  core::Real /*progress progress within stage */
186 )
187 {
188 
189  using namespace protocols::scoring::methods::pcs2;
190  using namespace basic::options;
191  using namespace basic::options::OptionKeys;
192 
193  PcsGridSearchParameterManager * pcs_g_s_p_m = PcsGridSearchParameterManager::get_instance();
194 
195  //utility::vector1< Size > vec_exclude;
196  //if ( option[ in::file::native_exclude_res].user() ) {
197  // vec_exclude = option[ in::file::native_exclude_res ]();
198  // PcsEnergyParameterManager::get_instance()->get_PCS_data_input_reference().set_vector_exclude_residues(vec_exclude);
199  //}
200 
201  core::Size i_multi_data;
202  core::Size n_m_d;
203 
204  n_m_d = pcs_g_s_p_m->get_n_multi_data();
205 
206  PcsEnergyParameterManager * pcs_e_p_m = PcsEnergyParameterManager::get_instance();
207 
208  for (i_multi_data = 1; i_multi_data <= n_m_d; ++i_multi_data){
209 
210  PcsGridSearchParameter & g = pcs_g_s_p_m->get_grid_search_parameters(i_multi_data);
211 
212  PcsEnergyParameter & pcs_e_p = pcs_e_p_m->get_PcsEnergyParameter_for(i_multi_data);
213 
214  if ( stageID == abinitio::STAGE_1 ) {
215 
216  pcs_e_p.set_grid_param(
222  );
223  TR_PcsEnergyController << "Switching STAGE_1; Grid parameters of center " << i_multi_data << " / " << n_m_d << std::endl;
224  TR_PcsEnergyController << pcs_e_p;
225  }
226 
227  if ( stageID == abinitio::STAGE_2 ) {
228 
229 
230  pcs_e_p.set_grid_param(
236  );
237  TR_PcsEnergyController << "Switching STAGE_2; Grid parameters of center " << i_multi_data << " / " << n_m_d << std::endl;
238  TR_PcsEnergyController << pcs_e_p;
239 
240  }
241 
242  if ( stageID == abinitio::STAGE_3a ) {
243 
244  pcs_e_p.set_grid_param(
250  );
251  TR_PcsEnergyController << "Switching STAGE_3a; Grid parameters of center " << i_multi_data << " / " << n_m_d << std::endl;
252  TR_PcsEnergyController << pcs_e_p;
253 
254  }
255 
256  if ( stageID == abinitio::STAGE_3b ) {
257 
258  pcs_e_p.set_grid_param(
264  );
265  TR_PcsEnergyController << "Switching STAGE_3b; Grid parameters of center " << i_multi_data << " / " << n_m_d << std::endl;
266  TR_PcsEnergyController << pcs_e_p;
267  }
268 
269  if ( stageID == abinitio::STAGE_4 ) {
270 
271  pcs_e_p.set_grid_param(
277  );
278  TR_PcsEnergyController << "Switching STAGE_4; Grid parameters of center " << i_multi_data << " / " << n_m_d << std::endl;
279  TR_PcsEnergyController << pcs_e_p;
280  }
281  } //for loop
282 }
283 
284 
285 //This is called after each PcsEnergyController CLAIMER is being read
286 void
288  using namespace protocols::scoring::methods::pcs2;
289 
290  core::Size n_m_d;
291 
292  PcsEnergyParameterManager * pcs_e_p_m = PcsEnergyParameterManager::get_instance();
293 
294  n_m_d = PcsGridSearchParameterManager::get_instance()->get_n_multi_data();
295 
296  PcsGridSearchParameter & g = PcsGridSearchParameterManager::get_instance()->get_grid_search_parameters(n_m_d);
297 
298  g.control_grid_param();
299 
300  using namespace basic::options;
301  using namespace basic::options::OptionKeys;
302  //utility::vector1< Size > vec_exclude;
303  //if ( option[ in::file::native_exclude_res ].user() ) {
304  // vec_exclude = option[ in::file::native_exclude_res ]();
305  //PcsEnergyParameterManager::get_instance()get_PCS_data_input_reference().->set_vector_exclude_residues(vec_exclude);
306  //}
307 
308  pcs_e_p_m->incremente_n_multi_data();
309 
310  pcs_e_p_m->get_PcsEnergyParameter_for(n_m_d).set_grid_param(
311  g.include_only_start_stage4_,
312  g.include_only_end_stage4_,
313  g.n_trial_min_stage4_,
314  g.pcs_weight_stage4_,
315  g.individual_scale_stage4_
316  );
317 
318  pcs_e_p_m->get_PcsEnergyParameter_for(n_m_d).set_vector_name_and_weight(g.filenames_, g.individual_weights_);
319 
320  /* core::Size k;
321  for(k = 1; k <= n_m_d; k++){
322  PcsGridSearchParameter & g_junk = PcsGridSearchParameterManager::get_instance()->get_grid_search_parameters(k);
323  std::cerr << g_junk << std::endl;
324  }
325  */
326 }
327 
328 } //topology_broker
329 } //protocols