Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictToLoopsAndNeighbors.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/RestrictToLoopsAndNeighbors.cc
11 /// @brief
12 /// @author Brian D. Weitzner (brian.weitzner@gmail.com)
13 
14 // Unit headers
17 
18 // Package headers
19 #include <protocols/loops/Loops.hh>
22 
23 // Project headers
25 #include <core/pose/Pose.hh>
26 #include <core/pose/PDBInfo.hh>
28 
29 // Utility headers
30 #include <utility/exit.hh>
31 
32 
33 
34 namespace protocols {
35 namespace toolbox {
36 namespace task_operations {
37 
38 using core::pose::Pose;
42 
43 ///////////////////////////////////////////////////////////////////////////////////////////////////////
44 ////////////////////////////////////////////// BOILER PLATE CODE //////////////////////////////////////
45 ///////////////////////////////////////////////////////////////////////////////////////////////////////
46 
47 ///@brief default constructor
49 {
50  init();
51 }
52 
53 ///@brief copy constructor
55 {
57 }
58 
59 ///@brief assignment operator
61  //abort self-assignment
62  if ( this == &rhs ) return *this;
63  parent::operator=( rhs );
65  return *this;
66 }
67 
68 //destructor
70 
71 //@brief clone operator, calls the copy constructor
74 {
75  return new RestrictToLoopsAndNeighbors( *this );
76 }
77 
78 ///////////////////////////////////////////////////////////////////////////////////////////////////////
79 /////////////////////////////////////// END OF BOILER PLATE CODE //////////////////////////////////////
80 ///////////////////////////////////////////////////////////////////////////////////////////////////////
81 
82 
83 void RestrictToLoopsAndNeighbors::apply( Pose const & pose, PackerTask & task ) const
84 {
85 
86  if ( ! loops() ) return;
87 
90 
91  // Get an up-to-date list of the residues that can be packed
92  utility::vector1<bool> is_packable( pose.total_residue(), false );
93  select_loop_residues( pose, *loops(), include_neighbors(), is_packable, cutoff_distance() );
94 
95  core::pose::symmetry::make_residue_mask_symmetric( pose, is_packable ); // does nothing if pose is not symm
96 
97  // If we're designing, allow design at loop positions
98  utility::vector1< bool > is_designable( pose.total_residue(), false );
99  if ( design_loop() ) {
100  loops()->transfer_to_residue_vector( is_designable, true );
101  }
102 
103  for ( Size residue_number = 1; residue_number <= pose.total_residue(); ++residue_number )
104  {
105  if ( is_packable[ residue_number ] && ! is_designable[ residue_number ] )
106  {
107  turn_off_design.include_residue( residue_number );
108  }
109  else if ( ! is_packable[ residue_number ] )
110  {
111  turn_off_packing.include_residue( residue_number );
112  }
113  }
114 
115  turn_off_design.apply( pose, task );
116  turn_off_packing.apply( pose, task );
117 }
118 
120 {
121  set_design_loop( false );
122  set_include_neighbors( true );
123  set_cutoff_distance( 10.0 );
124  set_loops( NULL );
125 }
126 
128 {
129  // copy all data members from rhs to lhs
130  lhs.design_loop_ = rhs.design_loop_;
133  lhs.loops_ = rhs.loops_;
134 }
135 
137 {
138  return design_loop_;
139 }
140 
142 {
144 }
145 
147 {
148  return include_neighbors_;
149 }
150 
152 {
154 }
155 
157 {
158  return cutoff_distance_;
159 }
160 
162 {
163  if ( cutoff_distance >= 0.0 && cutoff_distance <= 10.0 )
164  {
166  }
167 }
168 
170 {
171  return loops_;
172 }
173 
175 {
176  loops_ = loops;
177 }
178 
180 {
181  return new RestrictToLoopsAndNeighbors;
182 }
183 
184 } //namespace task_operations
185 } //namespace toolbox
186 } //namespace protocols