Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RemodelDesignMover.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 /// @file protocols/forge/remodel/RemodelLoopMover.cc
11 /// @brief Loop modeling protocol based on routines from Remodel and EpiGraft
12 /// packages in Rosetta++.
13 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
14 /// @author Possu Huang (possu@u.washington.edu)
15 
16 // unit headers
18 // AUTO-REMOVED #include <protocols/forge/remodel/RemodelMover.hh>
21 
22 // package headers
23 
24 // project headers
25 #include <basic/Tracer.hh>
26 #include <basic/MetricValue.hh>
31 
34 // AUTO-REMOVED #include <core/scoring/ScoreFunctionFactory.hh>
38 #include <basic/options/option.hh>
39 #include <basic/options/keys/remodel.OptionKeys.gen.hh>
40 // AUTO-REMOVED #include <basic/options/keys/packing.OptionKeys.gen.hh>
41 // AUTO-REMOVED #include <core/pack/task/PackerTask_.hh>
44 // AUTO-REMOVED #include <protocols/toolbox/task_operations/RestrictOperationsBase.hh>
46 // AUTO-REMOVED #include <protocols/forge/build/BuildInstruction.hh> // REQUIRED FOR WINDOWS
47 
48 // numeric headers
49 #include <numeric/random/random.hh>
50 
51 #include <utility/vector0.hh>
52 #include <utility/vector1.hh>
53 
54 
55 // boost headers
56 
57 // C++ headers
58 
59 
60 namespace protocols {
61 namespace forge{
62 namespace remodel{
63 
64 // Tracer instance for this file
65 // Named after the original location of this code
66 static basic::Tracer TR( "protocols.forge.remodel.RemodelDesignMover" );
67 
68 // RNG
69 static numeric::random::RandomGenerator RG( 2342342 ); // magic number, don't change
70 
71 
72 // @brief default constructor
74 // has to reinitialize state before apply
75  state_.clear();
76 }
77 
78 /// @brief value constructor
79 RemodelDesignMover::RemodelDesignMover(RemodelData const & remodel_data, RemodelWorkingSet const & working_model, ScoreFunctionOP const & sfxn)
80 {
81  using namespace basic::options;
84 
85  remodel_data_ = remodel_data;
86  working_model_ = working_model;
87  archived_starting_task_ = working_model.task;
88  score_fxn_ = sfxn->clone();
89 
90  // setup calculators
91  CalculatorFactory::Instance().remove_calculator( "neighborhood_calc" );
92 
93  std::set< core:: Size > und_pos;
94 
95  std::set< core::Size > uup = working_model.manager.union_of_intervals_containing_undefined_positions();
96 
97  if (option[ OptionKeys::remodel::repeat_structure].user()){
98  Size repeatCount = option[ OptionKeys::remodel::repeat_structure];
99  for (Size rep = 0; rep < repeatCount ; rep++){
100  for (std::set< core::Size >::iterator it = uup.begin(); it != uup.end(); ++it){
101  //DEBUG
102  // std::cout << *it + remodel_data.blueprint.size()*rep << std::endl;
103  // std::cout << "manger size" << working_model.manager.union_of_intervals_containing_undefined_positions().size() << std::endl;
104  // std::cout << *it << std::endl;
105  if ( !(*it+remodel_data.blueprint.size()*rep > (remodel_data.blueprint.size()*repeatCount)) ){ //Extrapolation of positions shouldn't go beyond the length of pose
106  und_pos.insert(*it + remodel_data.blueprint.size()*rep);
107  }
108  }
109  }
110  }
111  else {
113  }
114 
115 
116  CalculatorFactory::Instance().register_calculator(
117  "neighborhood_calc",
118  new NeighborhoodByDistanceCalculator( und_pos )
119  );
120 
121 }
122 /// @brief copy constructor
123 
124 /// @brief default destructor
126 
127 /// @brief clone this object
129  return new RemodelDesignMover( *this );
130 }
131 
132 
133 /// @brief create this type of object
135  return new RemodelDesignMover();
136 }
137 
139 {
140  using namespace basic::options;
141  if ( basic::options::option[basic::options::OptionKeys::remodel::design::no_design].user() ){
142  TR << "bypassing design due to invokation of -no_design" << std::endl;
143  return;
144  }
145 
146 
147  // make decision as to which mode to apply
148  bool manual = remodel_data_.has_design_info_;
149  bool neighbor = basic::options::option[basic::options::OptionKeys::remodel::design::find_neighbors].user();
150  bool design = basic::options::option[basic::options::OptionKeys::remodel::design::design_neighbors].user();
151 
152  if (!check_state()){
153  basic::Error() << "check_state failed, has to set_state first " << std::endl;
154  }
155 
156  if ( manual ){
157  if (neighbor){
158  if (design){
159  mode5_packertask(pose);
160  } else {
161  mode6_packertask(pose);
162  }
163  } else {
164  mode4_packertask(pose);
165  }
166  } else {
167  if (neighbor){
168  if (design){
169  mode2_packertask(pose);
170  } else {
171  mode3_packertask(pose);
172  }
173  } else {
174  mode1_packertask(pose);
175  }
176  }
177 
178  if (option[ OptionKeys::remodel::repeat_structure].user()){
179  //try turning off bumpcheck
180  //TR << "bumpcheck off" << std::endl;
181  working_model_.task->set_bump_check(true);
182 
183 
184  //make rotamer links
186  linkOP->apply(pose, *working_model_.task);
187  }
188 
189  if (!strcmp(state_.c_str(), "stage")){
190  if (manual){
191  //do nothing
192  }
193  else { //auto build always reduce task
194 
195  if (!basic::options::option[basic::options::OptionKeys::remodel::design::skip_partial].user()){
196  reduce_task(pose, working_model_.task, true, true, false);
197  }
198  else {
199  reduce_task(pose, working_model_.task, true, true, true);
200  }
201  }
202  }
203  else if (!strcmp(state_.c_str(), "finish")){
204  if (manual){
205  //do nothing
206  }
207  else {
208  // if finishing design, no need to reduce, but require resetting positios
209  //if (!basic::options::option[basic::options::OptionKeys::remodel::design::skip_partial].user()){
210  reduce_task(pose, working_model_.task, true, true, true);
211  }
212  }
213 
214  //debug
215  //TR.Debug << working_model_.task->task_string(pose) << std::endl;
216  //TR.Debug << *working_model_.task << std::endl;
217 
219  score_fxn_->show(TR, pose);
220  TR << std::endl;
221 
222 // pose.dump_pdb("junkCheck.pdb");
223 // core::pack::pack_rotamers(pose, *scorefxn , working_model_.task);
224 // core::pack::pack_rotamers(pose, *scorefxn , working_model_.task);
225 // core::pack::task::TaskFactoryOP TF = new core::pack::task::TaskFactory;
226 //TF->create_packer_task(pose);
227 // core::pack::pack_rotamers(pose, *scorefxn , TF->create_packer_task(pose));
228 // core::pack::pack_rotamers(pose, *scorefxn , TF->create_packer_task(pose));
229 // core::pack::pack_rotamers(pose, *scorefxn , TF->create_packer_task(pose));
230 }
231 
234  return "RemodelDesignMover";
235 }
236 
238  if (state_.empty()) {
239  return false;
240  TR << "state tag not set " << std::endl;
241  } else {
242  TR << "Design Mover State: " << state_ << std::endl;
243  return true;
244  }
245 }
246 
248  state_ = state_tag;
249  //reset the task
251 }
252 
253 
254 void
256  core::pose::Pose const & pose,
257  std::string const & calculator,
258  std::string const & calculation,
259  utility::vector1_bool & residues )
260 {
261  runtime_assert(residues.size() == pose.total_residue());
262 
263  //find the set of residues
264  typedef std::set< core::Size > SizeSet;
265  basic::MetricValue< SizeSet > mv_sizeset;
266  pose.metric(calculator, calculation, mv_sizeset);
267  SizeSet const & sizeset(mv_sizeset.value());
268  //TR << "runCAlculator " << std::endl;
269  //insert this into the vector
270  for(SizeSet::const_iterator it(sizeset.begin()), end(sizeset.end()) ; it != end; ++it){
271  //TR << *it << " debug run_calc " << std::endl;
272  residues[*it] = true; }
273 
274  return;
275 }
276 
277 void RemodelDesignMover::reduce_task( Pose & pose, core::pack::task::PackerTaskOP &task, bool core, bool boundary, bool surface){
278 
279  // setup calculators
280  using namespace basic::options;
284 
285  //std::cout << "START REDUCE" << std::endl;
286  //std::cout << *task << std::endl;
287 
288  // need to collect all positions before reduction
289  CalculatorFactory::Instance().remove_calculator( "reducetask_calc" );
290  utility::vector1_bool boollist(pose.total_residue());
291  run_calculator(pose, "neighborhood_calc", "neighbors", boollist);
292  std::set<Size> positionList;
293  for (Size i = 1; i <= pose.total_residue(); i++){
294  if (boollist[i]){
295  positionList.insert(i);
296  }
297  }
298 
299  CalculatorFactory::Instance().register_calculator(
300  "reducetask_calc",
301  new NeighborhoodByDistanceCalculator( positionList )
302  );
303 
304  utility::vector1_bool resclass(pose.total_residue(),false);
305  utility::vector1_bool neighbor_count(pose.total_residue(),false);
306  utility::vector1<Size> corePos;
307  utility::vector1<Size> boundaryPos;
308  utility::vector1<Size> surfPos;
309 
310  Size CORE_CUTOFF = option[ OptionKeys::remodel::core_cutoff ];
311  Size BOUNDARY_CUTOFF = option[ OptionKeys::remodel::boundary_cutoff ];
312 
313  //get num_neighbors for each position
314  basic::MetricValue< std::map< core::Size, core::Size > >nbr_map;
315  pose.metric("reducetask_calc", "num_neighbors_map", nbr_map);
316  std::map< core::Size, core::Size > sizemap=nbr_map.value();
317 
318  TR.Debug << "sizemap content " << sizemap.size() << std::endl;
319 
320  for (std::map< core::Size, core::Size>::iterator it= sizemap.begin(); it!=sizemap.end(); it++){
321  TR.Debug << "neighborlist " << (*it).first << " " << (*it).second << std::endl;
322  }
323 
324  if (option[ OptionKeys::remodel::repeat_structure].user()){
325 
326  utility::vector1<bool> visited(pose.total_residue(),false);
327 
328  for (Size i = 1; i<= resclass.size(); i++){ //check everyposition in the packertask
329 
330  if (visited[i]){
331  continue;
332  }
333  // process linkage info
334  utility::vector1<int> copies = task->rotamer_links()->get_equiv( i );
335 
336  int coreCount = 0;
337  int boundaryCount = 0;
338  int surfCount = 0;
339 
340  for (unsigned jj = 1; jj <= copies.size(); ++jj){
341 
342  visited[ copies[jj] ] = true;
343 
344  TR.Debug << "sizemap in repeat decision " << copies[jj] << " " << sizemap[ copies[jj] ] << std::endl;
345 
346  //take the counts for each set
347  if ( sizemap[ copies[jj] ] >= CORE_CUTOFF){
348  coreCount++;
349  } else if ( sizemap[ copies[jj] ] < CORE_CUTOFF && sizemap[ copies[jj] ] >= BOUNDARY_CUTOFF ){
350  boundaryCount++;
351  } else if ( sizemap[ copies[jj] ] < BOUNDARY_CUTOFF){
352  surfCount++;
353  } else {
354  TR << "RESCLASS ERROR" << sizemap[i] << std::endl;
355  }
356  }
357 
358  //assign
359  if (coreCount > 0) { //if any of them is core, turn everythign to core
360  //std::cout << "core: ";
361  for (unsigned jj = 1; jj <= copies.size(); ++jj){
362  corePos.push_back(copies[jj]);
363  //std::cout << copies[jj] << " " ;
364  }
365  //std::cout << std::endl;
366  }
367  else if (coreCount == 0 && boundaryCount > 0){
368  //std::cout << "boundary: ";
369  for (unsigned jj = 1; jj <= copies.size(); ++jj){
370  boundaryPos.push_back(copies[jj]);
371  //std::cout << copies[jj] << " " ;
372  }
373  //std::cout << std::endl;
374  }
375  else if (coreCount == 0 && boundaryCount == 0){
376  //std::cout << "surf: ";
377  for (unsigned jj = 1; jj <= copies.size(); ++jj){
378  surfPos.push_back(copies[jj]);
379  //std::cout << copies[jj] << " " ;
380  }
381  //std::cout << std::endl;
382  }
383  else {
384  TR << "no idea what kind of scenario this would be" << std::endl;
385  }
386 
387  }
388  } //if repeat
389  else {
390  for (Size i = 1; i<= resclass.size(); i++){ //check everyposition in the packertask
391  if (task->nonconst_residue_task(i).being_packed() && sizemap[i]){
392  TR << "touch position " << i << std::endl;
393  if (sizemap[i] >= CORE_CUTOFF){
394  corePos.push_back(i);
395  } else if ( sizemap[i] < CORE_CUTOFF && sizemap[i] >= BOUNDARY_CUTOFF){
396  boundaryPos.push_back(i);
397  } else if ( sizemap[i] < BOUNDARY_CUTOFF){
398  surfPos.push_back(i);
399  } else {
400  TR << "RESCLASS ERROR" << sizemap[i] << std::endl;
401  }
402  }
403  }
404  }
405 
406  //std::cout << "MID REDUCE" << std::endl;
407  //std::cout << *task << std::endl;
408 
409 /*
410  //debug:
411  for (utility::vector1<Size>::iterator it= corePos.begin(), end=corePos.end(); it!=end; it++){
412  TR.Debug << "DEBUG: core positions:" << *it << std::endl;
413  }
414  for (utility::vector1<Size>::iterator it= boundaryPos.begin(), end=boundaryPos.end(); it!=end; it++){
415  TR.Debug << "DEBUG: boundary positions:" << *it << std::endl;
416  }
417  for (utility::vector1<Size>::iterator it= surfPos.begin(), end=surfPos.end(); it!=end; it++){
418  TR.Debug << "DEBUG: surface positions:" << *it << std::endl;
419  }
420 */
421  //build new reduced task
422 // core::pack::task::TaskFactoryOP TF = protocols::forge::methods::remodel_generic_taskfactory();
423 // task=TF->create_task_and_apply_taskoperations( pose );
424 
425  //borrow RESFILE command for the job -- save a lot of coding effort.
426  if ( core ){
427  for (utility::vector1<Size>::iterator it= corePos.begin(), end=corePos.end(); it!=end; it++){
430  decoy.push_back("APOLAR");
431  Size resid = *it;
432  TR << "APOLAR " << resid << std::endl;
433  Size whichtoken = 1;
434  command->initialize_from_tokens(decoy, whichtoken, resid );
435  command->residue_action(*task, resid); //not sure about this token thing...
436  }
437  } else {
438  for (utility::vector1<Size>::iterator it= corePos.begin(), end=corePos.end(); it!=end; it++){
441  decoy.push_back("NATRO");
442  Size resid = *it;
443  TR << "NATRO " << "(" << pose.residue(resid).name() << ")"<< std::endl;
444  Size whichtoken = 1;
445  command->initialize_from_tokens(decoy, whichtoken, resid );
446  command->residue_action(*task, resid); //not sure about this token thing...
447  }
448  }
449 
450  if ( boundary ){
451  for (utility::vector1<Size>::iterator it= boundaryPos.begin(), end=boundaryPos.end(); it!=end; it++){
452  ResfileCommandOP command = new core::pack::task::ALLAAxc; //note! no cys
454  decoy.push_back("ALLAAxc");
455  Size resid = *it;
456  TR << "ALLAAxc " << resid << std::endl;
457  Size whichtoken = 1;
458  command->initialize_from_tokens( decoy, whichtoken, resid);
459  command->residue_action(*task, resid); //not sure about this token thing...
460  }
461  } else {
462  for (utility::vector1<Size>::iterator it= boundaryPos.begin(), end=boundaryPos.end(); it!=end; it++){
465  decoy.push_back("NATRO");
466  Size resid = *it;
467  TR << "NATRO " << resid << "(" << pose.residue(resid).name() << ")" << std::endl;
468  Size whichtoken = 1;
469  command->initialize_from_tokens( decoy, whichtoken, resid);
470  command->residue_action( *task, resid); //not sure about this token thing...
471  }
472  }
473 
474 
475  if ( surface ){
476  for (utility::vector1<Size>::iterator it= surfPos.begin(), end=surfPos.end(); it!=end; it++){
479  decoy.push_back("POLAR");
480  Size resid = *it;
481  TR << "POLAR " << resid << std::endl;
482  Size whichtoken = 1;
483  command->initialize_from_tokens(decoy, whichtoken, resid);
484  command->residue_action( *task, resid); //not sure about this token thing...
485  }
486  } else {
487  for (utility::vector1<Size>::iterator it= surfPos.begin(), end=surfPos.end(); it!=end; it++){
490  decoy.push_back("NATRO");
491  Size resid = *it;
492  TR << "NATRO " << resid << " (" << pose.residue(resid).name() << ")" << std::endl;
493  Size whichtoken = 1;
494  command->initialize_from_tokens(decoy, whichtoken, resid);
495  command->residue_action(*task, resid); //not sure about this token thing...
496  }
497  }
498 
499  //std::cout << "END REDUCE" << std::endl;
500  //std::cout << *task << std::endl;
501 
502 }
503 
504 
505 bool RemodelDesignMover::find_disulfides_in_the_neighborhood(Pose & pose, utility::vector1<std::pair<Size,Size> > & disulf_partners){
506 
508  using namespace basic::options;
509  using namespace core::chemical;
510 
511  bool pass=0;
512 
513  DisulfideMatchingPotential disulfPot;
514  core::Energy match_t;
515  core::Energy match_r;
516  core::Energy match_rt;
517 
518 //initialize default
519  Size landingRangeStart = 1;
520  Size landingRangeStop = pose.total_residue();
521 
522 //alternatively via blueprint
523  if (remodel_data_.disulfLandingRange.size() != 0){
524  landingRangeStart = remodel_data_.disulfLandingRange[0];
525  landingRangeStop = remodel_data_.disulfLandingRange[1];
526  TR << "Assignging Landing Range by Blueprint: " << landingRangeStart << " to " << landingRangeStop << std::endl;
527  }
528 
529  if (option[ OptionKeys::remodel::disulf_landing_range].user()){ //overwrite ranges if existed
530  landingRangeStart = option[ OptionKeys::remodel::disulf_landing_range]()[1];
531  landingRangeStop = option[ OptionKeys::remodel::disulf_landing_range]()[2];
532  TR << "Assignging Landing Range by Arguments: " << landingRangeStart << " to " << landingRangeStop << std::endl;
533  }
534 
535 
536  TR << "FINDING DISULF" << std::endl;
537  utility::vector1_bool modeled_clusters(pose.total_residue(), false);
538  utility::vector1_bool residue_clusters(pose.total_residue(), false);
539  utility::vector1<Size> cen_res;
540  utility::vector1<Size> nbr_res;
541  run_calculator(pose, "neighborhood_calc", "neighbors", residue_clusters);
542  run_calculator(pose, "neighborhood_calc", "central_residues", modeled_clusters);
543 
544 //manual overwrite of the disulfide mobile range
545  if (remodel_data_.disulfMobileRange.size() != 0){
546 
547  Size i = 1;
548 
549  for (utility::vector1_bool::iterator itr=modeled_clusters.begin(), end=modeled_clusters.end(); itr !=end; itr++){
550 
551  *itr = false;
552 
553  if ( i == remodel_data_.disulfMobileRange[0] ){
554  *itr=true;
555  TR << "Use disulf mobile range start: " << i << std::endl;
556  }
558  *itr=true;
559  }
560  else if ( i == remodel_data_.disulfMobileRange[1] ){
561  *itr=true;
562  TR << "Use disulf mobile range stop: " << i << std::endl;
563  }
564  i++;
565  }
566  }
567 
568 //debug
569  Size i=1;
570  for (utility::vector1_bool::iterator itr=modeled_clusters.begin(), end=modeled_clusters.end(); itr !=end; itr++){
571  //TR << *itr<< std::endl;
572 // if (modeled_clusters[i] == 0 && residue_clusters[i] == 1) {
573  if ( residue_clusters[i] == 1) {
574  // TR << "neighbor " << i << std::endl;
575  nbr_res.push_back(i);
576  }
577  if (modeled_clusters[i] == 1){
578  // TR << "central " << i << std::endl;
579  cen_res.push_back(i);
580  }
581  i++;
582  }
583  TR << "central residues: ";
584  for (utility::vector1<Size>::iterator itr = cen_res.begin(), end=cen_res.end(); itr!=end; itr++){
585  TR << *itr << ",";
586  }
587  TR << std::endl;
588 
589  TR << "neighbor residues: ";
590  for (utility::vector1<Size>::iterator itr = nbr_res.begin(), end=nbr_res.end(); itr!=end; itr++){
591  TR << *itr << ",";
592  }
593  TR << std::endl;
594 
595  for (utility::vector1<Size>::iterator itr = cen_res.begin(), end=cen_res.end(); itr!=end; itr++){
596  for (utility::vector1<Size>::iterator itr2 = nbr_res.begin(), end2=nbr_res.end(); itr2!=end2 ; itr2++){
597  //TR << "DISULF " << *itr << "x" << *itr2 << std::endl;
598  //disance check
599  if (pose.residue(*itr).aa() != aa_gly && pose.residue(*itr2).aa() != aa_gly){
600  //TR << "DISULF " << *itr << "x" << *itr2 << std::endl;
601  Real dist = pose.residue(*itr).xyz("CB").distance_squared(pose.residue(*itr2).xyz("CB"));
602  if (dist > 25){
603  //TR << "TOO FAR " << dist << std::endl;
604  }
605  else {
606  disulfPot.score_disulfide(pose.residue(*itr), pose.residue(*itr2), match_t, match_r, match_rt);
607  //TR << "match_t " << match_t << std::endl;
608  //TR << "match_r " << match_r << std::endl;
609  int seqGap = (int)*itr2-(int)*itr;
610  if (match_rt < option[OptionKeys::remodel::match_rt_limit] && std::abs(seqGap)>1 && (*itr2) <= landingRangeStop && (*itr2) >= landingRangeStart){
611  TR << "DISULF possible " << dist << std::endl;
612  TR << "DISULF " << *itr << "x" << *itr2 << std::endl;
613  TR << "match_rt " << match_rt << std::endl;
614  std::pair<Size, Size> temp_pair;
615  temp_pair = std::make_pair(*itr, *itr2);
616  disulf_partners.push_back(temp_pair);
617  pass = 1;
618  }
619  }
620  }
621  }
622  }
623 
624  return pass;
625 
626 }
627 
628 void RemodelDesignMover::make_disulfide(Pose & pose, utility::vector1<std::pair<Size, Size> > & disulf_partners, core::kinematics::MoveMapOP mm){
629  //utility::vector1<std::pair<Size,Size>> dummy_vector;
630  for (utility::vector1<std::pair<Size,Size> >::iterator itr = disulf_partners.begin(); itr != disulf_partners.end(); itr++){
631  core::conformation::form_disulfide(pose.conformation(), (*itr).first, (*itr).second);
632  core::util:: rebuild_disulfide(pose, (*itr).first,(*itr).second, NULL /*task*/, NULL /*scfxn*/, mm, NULL /*min scfxn*/);
633  TR << "build_disulf between " << (*itr).first << " and " << (*itr).second << std::endl;
634  // pose.dump_pdb("disulf.pdb");
635  }
636 }
637 
638 
639 
640 /// these are split up for convenience reasons, so one can bypass blueprint setting if needed be
641 void RemodelDesignMover::mode1_packertask(Pose & pose){ // auto loop only
642  TR << "MODE 1: AUTO DESIGN of remodeled regions only" << std::endl;
643 
645 
646  //if need more operations added, put them here.
647 
648  //create the real task
649  working_model_.task = TF->create_task_and_apply_taskoperations( pose );
650  utility::vector1_bool additional_sites(pose.total_residue(), false);
651 
652  run_calculator(pose, "neighborhood_calc", "central_residues", additional_sites);
653 
654  working_model_.task->restrict_to_residues( additional_sites );
655 
656  TR << "number to be packed after adding sites: " << working_model_.task->num_to_be_packed() << std::endl;
657 
658 }
659 
660 void RemodelDesignMover::mode2_packertask(Pose & pose){ // auto loop with design neighbor
661  TR << "MODE 2: AUTO DESIGN of remodeled regions and neighbors" << std::endl;
662 
664 
665  //if need more operations added, put them here.
666 
667  //create the real task
668  working_model_.task = TF->create_task_and_apply_taskoperations( pose );
669  utility::vector1_bool additional_sites(pose.total_residue(), false);
670 
671  run_calculator(pose, "neighborhood_calc", "neighbors", additional_sites);
672 
673  working_model_.task->restrict_to_residues( additional_sites );
674 
675  TR << "number to be packed after adding sites: " << working_model_.task->num_to_be_packed() << std::endl;
676 
677 }
678 
679 void RemodelDesignMover::mode3_packertask(Pose & pose){ // auto loop with repack neighbor
680  TR << "MODE 3: AUTO DESIGN of remodeled regions and repack neighbors only" << std::endl;
681 
683 
684  //if need more operations added, put them here.
685 
686  //create the real task
687  working_model_.task = TF->create_task_and_apply_taskoperations( pose );
688  utility::vector1_bool additional_sites(pose.total_residue(), false);
689  utility::vector1_bool core_sites(pose.total_residue(), false);
690 
691  run_calculator(pose, "neighborhood_calc", "neighbors", additional_sites);
692  run_calculator(pose, "neighborhood_calc", "central_residues", core_sites);
693 
694  working_model_.task->restrict_to_residues( additional_sites );
695 
696  //lock down the rest of the positions to repack only
697  for (Size ii = 1; ii <= core_sites.size();++ii){
698  if ( !core_sites[ii] ){
699  if (working_model_.task->nonconst_residue_task(ii).being_packed()){
700  working_model_.task->nonconst_residue_task(ii).restrict_to_repacking();
701  //debug TR << "restrict position " << ii << " to repack only" << std::endl;
702  }
703  }
704  }
705 
706  TR << "number to be packed after adding sites: " << working_model_.task->num_to_be_packed() << std::endl;
707 
708 }
709 
710 
711 void RemodelDesignMover::mode4_packertask(Pose & pose){ // full manuaing namespace core::scoring;
712 
713  TR << "MODE 4: Manual DESIGN REMODEL" << std::endl;
715 
716 }
717 
718 
719 void RemodelDesignMover::mode5_packertask(Pose & pose){ // manual with auto design neighbor
720 
721  TR << "MODE 5: Manual DESIGN REMODEL with DESIGN NEIGHBOR" << std::endl;
722 
724 
725  //if need more operations added, put them here.
726 
727  //create the real task
728  working_model_.task = TF->create_task_and_apply_taskoperations( pose );
729 
730  utility::vector1_bool additional_sites(pose.total_residue(), false);
731 
732  //debug run_calculator(pose, "neighborhood_calc", "central_residues", additional_sites);
733  run_calculator(pose, "neighborhood_calc", "neighbors", additional_sites);
734 
735  // identify all the positions to change -- this includes central_residues and
736  // neighbors from calculator runs
737  working_model_.task->restrict_to_residues( additional_sites );
738 
739  // process the information in blueprint and save the positions touched.
741 
742  TR << "number to be packed after adding sites: " << working_model_.task->num_to_be_packed() << std::endl;
743 }
744 
745 
746 void RemodelDesignMover::mode6_packertask(Pose & pose){ // manual with auto repack neighbor
747 
748  //build the base task with positions designed
749  mode5_packertask(pose);
750 
751  TR << "MODE 6: Manual DESIGN REMODEL with REPACK NEIGHBOR" << std::endl;
752 
753  //lock down the rest of the positions to repack only
754  for (Size ii = 1; ii <= non_default_positions_.size();++ii){
755  if ( !non_default_positions_[ii] ){
756  if (working_model_.task->nonconst_residue_task(ii).being_packed()){
757  working_model_.task->nonconst_residue_task(ii).restrict_to_repacking();
758  //debug TR << "restrict position " << ii << " to repack only" << std::endl;
759  }
760  }
761  }
762 }
765  return working_model_.task;
766 }
767 
769  score_fxn_ = sfxn->clone();
770 }
771 
772 
773 
774 
775 } // remodel
776 } // forge
777 } // protocol