Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictToTerminiOperation.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/toolbox/task_operations/RestrictToTerminiOperation.fwd.hh
11 /// @brief Restrict to packing only the residues at either or both termini
12 /// @author Arpit Tandon
13 /// @author Matthew O'Meara (mattjomeara@gmail.com)
14 
15 // Unit Headers
19 
20 // Project Headers
23 #include <core/pose/Pose.hh>
25 #include <core/types.hh>
26 #include <basic/Tracer.hh>
28 
29 // Utility Headers
30 
31 #include <utility/exit.hh>
32 #include <utility/vector0.hh>
33 #include <utility/vector1.hh>
34 #include <utility/tag/Tag.hh>
35 
36 
37 using basic::Error;
38 using basic::Warning;
39 static basic::Tracer TR( "protocols.toolbox.TaskOperations.RestrictToTerminiOperation" );
40 
41 namespace protocols {
42 namespace toolbox {
43 namespace task_operations {
44 
45 using utility::vector1;
46 using core::Size;
48 using core::pose::Pose;
51 
52 ////////////////// Creator ////////////////
55  return new RestrictToTerminiOperation;
56 }
57 ///////////////// End Creator ////////////
58 
59 
61  chain_(1),
62  repack_n_terminus_(true),
63  repack_c_terminus_(true)
64 {}
65 
67  Size const chain,
68  bool const repack_n_terminus,
69  bool const repack_c_terminus) :
70  chain_(chain),
71  repack_n_terminus_(repack_n_terminus),
72  repack_c_terminus_(repack_c_terminus)
73 {}
74 
76  RestrictToTerminiOperation const & src) :
77  chain_(src.chain_),
78  repack_n_terminus_(src.repack_n_terminus_),
79  repack_c_terminus_(src.repack_c_terminus_)
80 {}
81 
82 
84 
87  return new RestrictToTerminiOperation( *this );
88 }
89 
90 ///@brief restrict to pack only the N and/or C-termini
91 void
93  Pose const & pose,
94  PackerTask & task
95 ) const {
96 
97  if( chain_ > pose.conformation().num_chains()){
98  utility_exit_with_message(
99  "The pose does not contain the chain you have specified.");
100  }
101 
102  vector1<bool> repack_residues(pose.total_residue(), false);
103 
104  // N-terminus
105  if(repack_n_terminus_){
106  Size const n_terminus(pose.conformation().chain_begin(chain_));
107  repack_residues[n_terminus] = true;
108  }
109 
110  // C-terminus
111  if(repack_c_terminus_){
112  Size const c_terminus(pose.conformation().chain_end(chain_));
113  repack_residues[c_terminus] = true;
114  }
115 
116  for(Size i = 1; i <= repack_residues.size(); ++i){
117  if(repack_residues[i]){
119  } else {
121  }
122  }
123 }
124 
125 
126 void
128 {
129  chain_ = tag->getOption<Size>("chain", 1);
130  repack_n_terminus_ = tag->getOption<bool>("repack_n_terminus", true);
131  repack_c_terminus_ = tag->getOption<bool>("repack_c_terminus", true);
132 
133 }
134 
135 } //namespace
136 } //namespace
137 } //namespace