Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PseudocontactShiftEnergyController.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 PseudocontactShiftEnergyController.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 June 2009
30  ////////////////////////////////////////////////
31 
32 // Unit Headers
34 
35 // Package Headers
37 // Project Headers
40 
41 //TEMP
42 // AUTO-REMOVED #include <basic/options/option.hh>
43 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
44 
45 // Utility headers
46 // AUTO-REMOVED #include <utility/excn/Exceptions.hh>
47 #include <basic/Tracer.hh>
48 
50 #include <utility/vector1.hh>
51 #include <basic/options/keys/OptionKeys.hh>
52 
53 
54 // ObjexxFCL Headers
55 
56 // C++ headers
57 
58 
59 static basic::Tracer tr_control("protocols.topology_broker.PseudocontactShiftEnergyController");
60 
61 namespace protocols {
62 namespace topology_broker {
63 
64 using namespace core;
65 using namespace core::scoring::constraints;
67 {
68  grid_edge_stage1_ = 50.0;
69  grid_edge_stage2_ = 50.0;
70  grid_edge_stage3_ = 50.0;
71  grid_edge_stage4_ = 50.0;
72 
73  grid_step_stage1_ = 3.0;
74  grid_step_stage2_ = 3.0;
75  grid_step_stage3_ = 3.0;
76  grid_step_stage4_ = 3.0;
77 
78  grid_small_cutoff_stage1_ = 0.0;
79  grid_small_cutoff_stage2_ = 0.0;
80  grid_small_cutoff_stage3_ = 0.0;
81  grid_small_cutoff_stage4_ = 0.0;
82 
83  grid_large_cutoff_stage1_ = 25.0;
84  grid_large_cutoff_stage2_ = 25.0;
85  grid_large_cutoff_stage3_ = 25.0;
86  grid_large_cutoff_stage4_ = 25.0;
87 
88  grid_cone_angle_cutoff_stage1_ = 180.0;
89  grid_cone_angle_cutoff_stage2_ = 180.0;
90  grid_cone_angle_cutoff_stage3_ = 180.0;
91  grid_cone_angle_cutoff_stage4_ = 180.0;
92 
93  grid_residue_num_1_stage1_ = -1;
94  grid_residue_num_1_stage2_ = -1;
95  grid_residue_num_1_stage3_ = -1;
96  grid_residue_num_1_stage4_ = -1;
97 
98  grid_residue_num_2_stage1_ = -1;
99  grid_residue_num_2_stage2_ = -1;
100  grid_residue_num_2_stage3_ = -1;
101  grid_residue_num_2_stage4_ = -1;
102 
103  grid_atom_name_1_stage1_ = "BAD";
104  grid_atom_name_1_stage2_ = "BAD";
105  grid_atom_name_1_stage3_ = "BAD";
106  grid_atom_name_1_stage4_ = "BAD";
107 
108  grid_atom_name_2_stage1_ = "BAD";
109  grid_atom_name_2_stage2_ = "BAD";
110  grid_atom_name_2_stage3_ = "BAD";
111  grid_atom_name_2_stage4_ = "BAD";
112 
113  grid_k_vector_stage1_ = 0.0;
114  grid_k_vector_stage2_ = 0.0;
115  grid_k_vector_stage3_ = 0.0;
116  grid_k_vector_stage4_ = 0.0;
117 
118  minimize_best_tensor_stage1_ = false;
119  minimize_best_tensor_stage2_ = false;
120  minimize_best_tensor_stage3_ = false;
121  minimize_best_tensor_stage4_ = false;
122 
123  pcs_weight_stage1_ = 10.0;
124  pcs_weight_stage2_ = 10.0;
125  pcs_weight_stage3_ = 10.0;
126  pcs_weight_stage4_ = 10.0;
127 }
128 void
130 
131 }
132 
134  using namespace protocols::scoring::methods::pcs;
135 
136  if ( tag == "GRID_EDGE_SIZE" ) {
137  if ((is >>
138  grid_edge_stage1_ >>
139  grid_edge_stage2_ >>
140  grid_edge_stage3_ >>
141  grid_edge_stage4_).fail()){
142  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
143  utility_exit();
144  }
145  return true;
146  }
147 
148  if ( tag == "GRID_STEP_SIZE" ) {
149  if ((is >>
150  grid_step_stage1_ >>
151  grid_step_stage2_ >>
152  grid_step_stage3_ >>
153  grid_step_stage4_).fail()){
154  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
155  utility_exit();
156  }
157  return true;
158  }
159 
160  if ( tag == "GRID_SMALL_CUTOFF" ) {
161  if ((is >>
162  grid_small_cutoff_stage1_ >>
163  grid_small_cutoff_stage2_ >>
164  grid_small_cutoff_stage3_ >>
165  grid_small_cutoff_stage4_).fail()){
166  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
167  utility_exit();
168  }
169  return true;
170  }
171 
172  if ( tag == "GRID_LARGE_CUTOFF" ) {
173  if ((is >>
174  grid_large_cutoff_stage1_ >>
175  grid_large_cutoff_stage2_ >>
176  grid_large_cutoff_stage3_ >>
177  grid_large_cutoff_stage4_).fail()){
178  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
179  utility_exit();
180  }
181  return true;
182  }
183 
184  if ( tag == "GRID_CONE_ANGLE_CUTOFF" ) {
185  if ((is >>
186  grid_cone_angle_cutoff_stage1_ >>
187  grid_cone_angle_cutoff_stage2_ >>
188  grid_cone_angle_cutoff_stage3_ >>
189  grid_cone_angle_cutoff_stage4_).fail()){
190  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
191  utility_exit();
192  }
193  return true;
194  }
195 
196  if ( tag == "VECTOR_ATOM1_NAME" ) {
197  if ((is >>
198  grid_atom_name_1_stage1_ >>
199  grid_atom_name_1_stage2_ >>
200  grid_atom_name_1_stage3_ >>
201  grid_atom_name_1_stage4_).fail()){
202  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 strings" << std::endl;
203  utility_exit();
204  }
205  return true;
206  }
207 
208  if ( tag == "VECTOR_ATOM2_NAME" ) {
209  if ((is >>
210  grid_atom_name_2_stage1_ >>
211  grid_atom_name_2_stage2_ >>
212  grid_atom_name_2_stage3_ >>
213  grid_atom_name_2_stage4_).fail()){
214  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 strings" << std::endl;
215  utility_exit();
216  }
217  return true;
218  }
219 
220  if ( tag == "VECTOR_ATOM1_RESIDUE_NUM" ) {
221  if ((is >>
222  grid_residue_num_1_stage1_ >>
223  grid_residue_num_1_stage2_ >>
224  grid_residue_num_1_stage3_ >>
225  grid_residue_num_1_stage4_).fail()){
226  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 integers" << std::endl;
227  utility_exit();
228  }
229  return true;
230  }
231 
232  if ( tag == "VECTOR_ATOM2_RESIDUE_NUM" ) {
233  if ((is >>
234  grid_residue_num_2_stage1_ >>
235  grid_residue_num_2_stage2_ >>
236  grid_residue_num_2_stage3_ >>
237  grid_residue_num_2_stage4_).fail()){
238  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 integers" << std::endl;
239  utility_exit();
240  }
241  return true;
242  }
243 
244  if ( tag == "K_VECTOR" ) {
245  if ((is >>
246  grid_k_vector_stage1_ >>
247  grid_k_vector_stage2_ >>
248  grid_k_vector_stage3_ >>
249  grid_k_vector_stage4_).fail()){
250  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
251  utility_exit();
252  }
253  return true;
254  }
255 
256  if ( tag == "MINIMIZE_BEST_TENSOR" ) {
257  core::Size a, b, c, d;
258  if ((is >> a >> b >>c >> d).fail()){
259  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 integers between 0 and 1" << std::endl;
260  utility_exit();
261  }
262  if(((a != 0) && (a != 1)) ||
263  ((b != 0) && (b != 1)) ||
264  ((c != 0) && (c != 1)) ||
265  ((d != 0) && (d != 1))){
266  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 integers between 0 and 1" << std::endl;
267  utility_exit();
268  }
269  minimize_best_tensor_stage1_ = (a == 1);
270  minimize_best_tensor_stage2_ = (b == 1);
271  minimize_best_tensor_stage3_ = (c == 1);
272  minimize_best_tensor_stage4_ = (d == 1);
273  return true;
274  }
275 
276  if ( tag == "PCS_WEIGHT" ) {
277  if ((is >>
278  pcs_weight_stage1_ >>
279  pcs_weight_stage2_ >>
280  pcs_weight_stage3_ >>
281  pcs_weight_stage4_).fail()){
282  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 4 numbers (integer or float)" << std::endl;
283  utility_exit();
284  }
285  return true;
286  }
287 
288 
289 
290 
291 
292 
293 
294 
295 
296 
297  /*
298  the weighting scheme is not working properly for the moment.
299  if ( tag == "PCS_INPUT_FILE" ) {
300  core::Real weight;
301  std::string filename;
302  if ((is >>
303  filename >>
304  weight).fail()){
305  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string followed by 1 number (integer or float) positif" << std::endl;
306  utility_exit();
307  }
308  if(weight < 0){
309  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string followed by 1 number (integer or float) positif" << std::endl;
310  utility_exit();
311  }
312  filenames_.push_back(filename);
313  individual_weights_.push_back(weight);
314  return true;
315  }
316  */
317 
318 
319  if ( tag == "PCS_INPUT_FILE" ) {
320  core::Real weight;
322  if ((is >>
323  filename
324  ).fail()){
325  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string" << std::endl;
326  utility_exit();
327  }
328  //TODO: work with weigth scheme for individual lanthanide? this is temporary.
329  weight = 1.0;
330 
331  if(weight < 0){
332  std::cerr << "problem while parsing the tag '" << tag << "' . Expecting 1 string" << std::endl;
333  utility_exit();
334  }
335  filenames_.push_back(filename);
336  individual_weights_.push_back(weight);
337  return true;
338  }
339 
340  std::cerr << "The following tag is unknown " << tag << std::endl;
341 
342 
343  return Parent::read_tag( tag, is );
344 }
345 
347  moves::RandomMover& /* random_mover */,
348  core::pose::Pose const& /*pose*/,
349  abinitio::StageID stageID , /* abinitio sampler stage */
350  core::scoring::ScoreFunction const& /*scorefxn*/,
351  core::Real /*progress progress within stage */
352 )
353 {
354 
355  using namespace protocols::scoring::methods::pcs;
356  using namespace basic::options;
357  using namespace basic::options::OptionKeys;
358  //utility::vector1< Size > vec_exclude;
359  //if ( option[ in::file::native_exclude_res].user() ) {
360  // vec_exclude = option[ in::file::native_exclude_res ]();
361  // PCS_Energy_parameters_manager::get_instance()->set_vector_exclude_residues(vec_exclude);
362  //}
363 
364 
365  if ( stageID == abinitio::STAGE_1 ) {
366 
367  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage1_,
368  grid_step_stage1_,
369  grid_small_cutoff_stage1_,
370  grid_large_cutoff_stage1_,
371  grid_cone_angle_cutoff_stage1_,
372  grid_atom_name_1_stage1_,
373  grid_atom_name_2_stage1_,
374  grid_residue_num_1_stage1_,
375  grid_residue_num_2_stage1_,
376  grid_k_vector_stage1_,
377  minimize_best_tensor_stage1_,
378  pcs_weight_stage1_
379  );
380  }
381 
382  if ( stageID == abinitio::STAGE_2 ) {
383 
384 
385  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage2_,
386  grid_step_stage2_,
387  grid_small_cutoff_stage2_,
388  grid_large_cutoff_stage2_,
389  grid_cone_angle_cutoff_stage2_,
390  grid_atom_name_1_stage2_,
391  grid_atom_name_2_stage2_,
392  grid_residue_num_1_stage2_,
393  grid_residue_num_2_stage2_,
394  grid_k_vector_stage2_,
395  minimize_best_tensor_stage2_,
396  pcs_weight_stage2_
397  );
398  }
399 
400  if ( stageID == abinitio::STAGE_3a ) {
401 
402  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage3_,
403  grid_step_stage3_,
404  grid_small_cutoff_stage3_,
405  grid_large_cutoff_stage3_,
406  grid_cone_angle_cutoff_stage3_,
407  grid_atom_name_1_stage3_,
408  grid_atom_name_2_stage3_,
409  grid_residue_num_1_stage3_,
410  grid_residue_num_2_stage3_,
411  grid_k_vector_stage3_,
412  minimize_best_tensor_stage3_,
413  pcs_weight_stage3_
414  );
415  }
416 
417  if ( stageID == abinitio::STAGE_3b ) {
418 
419  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage3_,
420  grid_step_stage3_,
421  grid_small_cutoff_stage3_,
422  grid_large_cutoff_stage3_,
423  grid_cone_angle_cutoff_stage3_,
424  grid_atom_name_1_stage3_,
425  grid_atom_name_2_stage3_,
426  grid_residue_num_1_stage3_,
427  grid_residue_num_2_stage3_,
428  grid_k_vector_stage3_,
429  minimize_best_tensor_stage3_,
430  pcs_weight_stage3_
431  );
432  }
433 
434  if ( stageID == abinitio::STAGE_4 ) {
435 
436  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage4_,
437  grid_step_stage4_,
438  grid_small_cutoff_stage4_,
439  grid_large_cutoff_stage4_,
440  grid_cone_angle_cutoff_stage4_,
441  grid_atom_name_1_stage4_,
442  grid_atom_name_2_stage4_,
443  grid_residue_num_1_stage4_,
444  grid_residue_num_2_stage4_,
445  grid_k_vector_stage4_,
446  minimize_best_tensor_stage4_,
447  pcs_weight_stage4_
448  );
449  }
450 }
451 
452 
453 void
455  using namespace protocols::scoring::methods::pcs;
456  control_grid_param();
457 
458  using namespace basic::options;
459  using namespace basic::options::OptionKeys;
460  //utility::vector1< Size > vec_exclude;
461  //if ( option[ in::file::native_exclude_res ].user() ) {
462  // vec_exclude = option[ in::file::native_exclude_res ]();
463  //PCS_Energy_parameters_manager::get_instance()->set_vector_exclude_residues(vec_exclude);
464  //}
465 
466 
467  PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_stage4_,
468  grid_step_stage4_,
469  grid_small_cutoff_stage4_,
470  grid_large_cutoff_stage4_,
471  grid_cone_angle_cutoff_stage4_,
472  grid_atom_name_1_stage4_,
473  grid_atom_name_2_stage4_,
474  grid_residue_num_1_stage4_,
475  grid_residue_num_2_stage4_,
476  grid_k_vector_stage4_,
477  minimize_best_tensor_stage4_,
478  pcs_weight_stage4_
479  );
480 
481  PCS_Energy_parameters_manager::get_instance()->set_vector_name_and_weight(filenames_, individual_weights_);
482 
483 }
484 
485 void
487 
488  if((grid_edge_stage1_ <= 0)||
489  (grid_edge_stage2_ <= 0)||
490  (grid_edge_stage3_ <= 0)||
491  (grid_edge_stage4_ <= 0)||
492 
493  (grid_step_stage1_ <= 0)||
494  (grid_step_stage2_ <= 0)||
495  (grid_step_stage3_ <= 0)||
496  (grid_step_stage4_ <= 0)||
497 
498  (grid_edge_stage1_ < grid_step_stage1_)||
499  (grid_edge_stage2_ < grid_step_stage2_)||
500  (grid_edge_stage3_ < grid_step_stage3_)||
501  (grid_edge_stage4_ < grid_step_stage4_)||
502 
503  (grid_small_cutoff_stage1_ < 0)||
504  (grid_small_cutoff_stage2_ < 0)||
505  (grid_small_cutoff_stage3_ < 0)||
506  (grid_small_cutoff_stage4_ < 0)||
507 
508  (grid_large_cutoff_stage1_ <= 0)||
509  (grid_large_cutoff_stage2_ <= 0)||
510  (grid_large_cutoff_stage3_ <= 0)||
511  (grid_large_cutoff_stage4_ <= 0)||
512 
513  (grid_large_cutoff_stage1_ <= grid_small_cutoff_stage1_)||
514  (grid_large_cutoff_stage2_ <= grid_small_cutoff_stage2_)||
515  (grid_large_cutoff_stage3_ <= grid_small_cutoff_stage3_)||
516  (grid_large_cutoff_stage4_ <= grid_small_cutoff_stage4_)||
517 
518  (grid_cone_angle_cutoff_stage1_ < 0)||
519  (grid_cone_angle_cutoff_stage2_ < 0)||
520  (grid_cone_angle_cutoff_stage3_ < 0)||
521  (grid_cone_angle_cutoff_stage4_ < 0)||
522  (grid_cone_angle_cutoff_stage1_ > 180)||
523  (grid_cone_angle_cutoff_stage2_ > 180)||
524  (grid_cone_angle_cutoff_stage3_ > 180)||
525  (grid_cone_angle_cutoff_stage4_ > 180)||
526 
527  (pcs_weight_stage1_ < 0)||
528  (pcs_weight_stage2_ < 0)||
529  (pcs_weight_stage3_ < 0)||
530  (pcs_weight_stage4_ < 0)
531  ){
532 
533  std::cerr << "In the definition of the grid search parameters for the PseudocontactShift, you should ensure that for all stages:" << std::endl;
534  std::cerr << "1. the GRID_EDGE_SIZE is strictly positif" << std::endl;
535  std::cerr << "2. the GRID_STEP_SIZE is strictly positif" << std::endl;
536  std::cerr << "3. the GRID_STEP_SIZE is smaller than the GRID_EDGE_SIZE" << std::endl;
537  std::cerr << "4. the GRID_SMALL_CUTOFF is positif" << std::endl;
538  std::cerr << "5. the GRID_LARGE_CUTOFF is strictly positif" << std::endl;
539  std::cerr << "6. the GRID_LARGE_CUTOFF is strictly larger than the GRID_SMALL_CUTOFF" << std::endl;
540  std::cerr << "7. the GRID_CONE_ANGLE_CUTOFF is between 0 and 180" << std::endl;
541  std::cerr << "8. the PCS_WEIGHT is positif" << std::endl;
542  utility_exit_with_message("Please, review your PseudocontactShift grid search parameter file and correct it");
543  }
544 
545  if((grid_atom_name_1_stage1_ == "BAD")||
546  (grid_atom_name_1_stage2_ == "BAD")||
547  (grid_atom_name_1_stage3_ == "BAD")||
548  (grid_atom_name_1_stage4_ == "BAD")||
549 
550  (grid_atom_name_2_stage1_ == "BAD")||
551  (grid_atom_name_2_stage2_ == "BAD")||
552  (grid_atom_name_2_stage3_ == "BAD")||
553  (grid_atom_name_2_stage4_ == "BAD")||
554 
555  (grid_residue_num_1_stage1_ == -1)||
556  (grid_residue_num_1_stage2_ == -1)||
557  (grid_residue_num_1_stage3_ == -1)||
558  (grid_residue_num_1_stage4_ == -1)||
559 
560  (grid_residue_num_2_stage1_ == -1)||
561  (grid_residue_num_2_stage2_ == -1)||
562  (grid_residue_num_2_stage3_ == -1)||
563  (grid_residue_num_2_stage4_ == -1)){
564  std::cerr << "In the definition of the grid search parameters for the PseudocontactShift, you must define the four following flags:" << std::endl;
565  std::cerr << "VECTOR_ATOM1_NAME" << std::endl;
566  std::cerr << "VECTOR_ATOM2_NAME" << std::endl;
567  std::cerr << "VECTOR_ATOM1_RESIDUE_NUM" << std::endl;
568  std::cerr << "VECTOR_ATOM1_RESIDUE_NUM" << std::endl;
569  utility_exit_with_message("Please, review your PseudocontactShift grid search parameter file and correct it");
570  }
571 }
572 } //topology_broker
573 } //protocols