Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictToInterfaceOperation.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/RestrictToInterfaceOperation.cc
11 /// @brief TaskOperation class that finds an interface and leaves it mobile in the PackerTask
12 /// @author Steven Lewis smlewi@unc.edu
13 
14 // Unit Headers
17 
18 // Project Headers
19 #include <core/pose/Pose.hh>
20 
24 // AUTO-REMOVED #include <basic/MetricValue.hh>
25 
26 // Utility Headers
27 #include <core/types.hh>
28 #include <utility/vector1_bool.hh>
29 #include <basic/Tracer.hh>
30 #include <utility/string_util.hh>
31 
32 // C++ Headers
33 #include <set>
34 
35 #include <utility/vector1.hh>
36 
37 
38 using basic::Error;
39 using basic::Warning;
40 static basic::Tracer TR( "protocols.toolbox.TaskOperations.RestrictToInterfaceOperation" );
41 
42 namespace protocols {
43 namespace toolbox {
44 namespace task_operations {
45 
46 ///@details this ctor assumes a pregenerated calculator - if you want a particular non-default cutoff distance
48  : parent(), calculator_name_(calculator)
49 {
50  //I suppose you could reasonably create this object BEFORE the calculator was generated/registered
51 // if( !core::pose::metrics::CalculatorFactory::Instance().check_calculator_exists( calculator_name_ ) ){
52 // utility_exit_with_message("In RestrictToInterfaceOperation, calculator " + calculator + " does not exist.");
53 // }
54 }
55 
56 ///@brief this ctor will generate the calculator for you (may use defaults)
58  : parent(), calculator_name_("")
59 {
60  make_calculator( upper_chain, lower_chain );
61 }
62 
63 ///@details private helper function to make calculator - runs in the ctor
65  make_name( upper_chain, lower_chain );
66 
67  using namespace core::pose::metrics;
68  if( CalculatorFactory::Instance().check_calculator_exists( calculator_name_ ) ){
69  Warning() << "In RestrictToInterfaceOperation, calculator " << calculator_name_
70  << " already exists, this is hopefully correct for your purposes" << std::endl;
71  } else {
73  CalculatorFactory::Instance().register_calculator( calculator_name_, new core::pose::metrics::simple_calculators::InterfaceNeighborDefinitionCalculator( upper_chain, lower_chain ) );
74  }
75 }
76 
77 ///@details private helper function to name calculator- runs in the ctor
79  calculator_name_ = "RTIO_interface_calculator_" + utility::to_string( upper_chain )
80  + '_' + utility::to_string( lower_chain );
81 }
82 
84 
87 {
89 }
90 
91 ///@details be warned if you use clone that you'll not get a new interface calculator
93 {
94  return new RestrictToInterfaceOperation( *this );
95 }
96 
97 void
99 {
100  //vector for filling packertask
101  utility::vector1_bool repack(pose.total_residue(), false);
102 
103  run_calculator(pose, calculator_name_, "interface_residues", repack);
104 
105  task.restrict_to_residues(repack);
106 }
107 
108 } //namespace protocols
109 } //namespace toolbox
110 } //namespace task_operations