47 #include <basic/Tracer.hh>
50 #include <utility/vector1.hh>
51 #include <basic/options/keys/OptionKeys.hh>
59 static basic::Tracer
tr_control(
"protocols.topology_broker.PseudocontactShiftEnergyController");
62 namespace topology_broker {
65 using namespace core::scoring::constraints;
68 grid_edge_stage1_ = 50.0;
69 grid_edge_stage2_ = 50.0;
70 grid_edge_stage3_ = 50.0;
71 grid_edge_stage4_ = 50.0;
73 grid_step_stage1_ = 3.0;
74 grid_step_stage2_ = 3.0;
75 grid_step_stage3_ = 3.0;
76 grid_step_stage4_ = 3.0;
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;
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;
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;
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;
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;
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";
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";
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;
118 minimize_best_tensor_stage1_ =
false;
119 minimize_best_tensor_stage2_ =
false;
120 minimize_best_tensor_stage3_ =
false;
121 minimize_best_tensor_stage4_ =
false;
123 pcs_weight_stage1_ = 10.0;
124 pcs_weight_stage2_ = 10.0;
125 pcs_weight_stage3_ = 10.0;
126 pcs_weight_stage4_ = 10.0;
136 if ( tag ==
"GRID_EDGE_SIZE" ) {
141 grid_edge_stage4_).fail()){
142 std::cerr <<
"problem while parsing the tag '" << tag <<
"' . Expecting 4 numbers (integer or float)" << std::endl;
148 if ( tag ==
"GRID_STEP_SIZE" ) {
153 grid_step_stage4_).fail()){
154 std::cerr <<
"problem while parsing the tag '" << tag <<
"' . Expecting 4 numbers (integer or float)" << std::endl;
160 if ( tag ==
"GRID_SMALL_CUTOFF" ) {
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;
172 if ( tag ==
"GRID_LARGE_CUTOFF" ) {
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;
184 if ( tag ==
"GRID_CONE_ANGLE_CUTOFF" ) {
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;
196 if ( tag ==
"VECTOR_ATOM1_NAME" ) {
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;
208 if ( tag ==
"VECTOR_ATOM2_NAME" ) {
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;
220 if ( tag ==
"VECTOR_ATOM1_RESIDUE_NUM" ) {
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;
232 if ( tag ==
"VECTOR_ATOM2_RESIDUE_NUM" ) {
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;
244 if ( tag ==
"K_VECTOR" ) {
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;
256 if ( tag ==
"MINIMIZE_BEST_TENSOR" ) {
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;
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;
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);
276 if ( tag ==
"PCS_WEIGHT" ) {
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;
319 if ( tag ==
"PCS_INPUT_FILE" ) {
325 std::cerr <<
"problem while parsing the tag '" << tag <<
"' . Expecting 1 string" << std::endl;
332 std::cerr <<
"problem while parsing the tag '" << tag <<
"' . Expecting 1 string" << std::endl;
335 filenames_.push_back(filename);
336 individual_weights_.push_back(weight);
340 std::cerr <<
"The following tag is unknown " << tag << std::endl;
343 return Parent::read_tag( tag, is );
356 using namespace basic::options;
357 using namespace basic::options::OptionKeys;
367 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
385 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
402 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
419 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
436 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
456 control_grid_param();
458 using namespace basic::options;
459 using namespace basic::options::OptionKeys;
467 PCS_Energy_parameters_manager::get_instance()->set_grid_param(grid_edge_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_,
481 PCS_Energy_parameters_manager::get_instance()->set_vector_name_and_weight(filenames_, individual_weights_);
488 if((grid_edge_stage1_ <= 0)||
489 (grid_edge_stage2_ <= 0)||
490 (grid_edge_stage3_ <= 0)||
491 (grid_edge_stage4_ <= 0)||
493 (grid_step_stage1_ <= 0)||
494 (grid_step_stage2_ <= 0)||
495 (grid_step_stage3_ <= 0)||
496 (grid_step_stage4_ <= 0)||
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_)||
503 (grid_small_cutoff_stage1_ < 0)||
504 (grid_small_cutoff_stage2_ < 0)||
505 (grid_small_cutoff_stage3_ < 0)||
506 (grid_small_cutoff_stage4_ < 0)||
508 (grid_large_cutoff_stage1_ <= 0)||
509 (grid_large_cutoff_stage2_ <= 0)||
510 (grid_large_cutoff_stage3_ <= 0)||
511 (grid_large_cutoff_stage4_ <= 0)||
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_)||
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)||
527 (pcs_weight_stage1_ < 0)||
528 (pcs_weight_stage2_ < 0)||
529 (pcs_weight_stage3_ < 0)||
530 (pcs_weight_stage4_ < 0)
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");
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")||
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")||
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)||
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");