Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RemoveCsts.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/constraints/RemoveCsts.cc
11 ///
12 /// @brief
13 /// @author Tom Linsky (tlinsky@uw.edu), Nov 2012
14 
15 // Unit header
18 
19 // Package headers
20 #include <core/pose/Pose.hh>
22 
23 // Project headers
27 
28 // utility headers
29 #include <basic/Tracer.hh>
30 #include <utility/tag/Tag.hh>
31 #include <utility/vector1.hh>
32 
33 
34 static basic::Tracer TR( "protocols.forge.constraints.RemoveCsts" );
35 
36 namespace protocols{
37 namespace forge{
38 namespace constraints{
39 
42 {
44 }
45 
48  return new RemoveCsts();
49 }
50 
53 {
54  return "RemoveCsts";
55 }
56 
57 /// @brief
59  : Mover(),
60  generator_( NULL ),
61  generator_id_( "" )
62 {}
63 
65  : Mover( rval ),
66  generator_( rval.generator_ ),
67  generator_id_( rval.generator_id_ )
68 {}
69 
70 /// @brief
72  : Mover()
73 {
74  set_generator( generator );
75 }
76 
77 /// @brief
79 
80 void
84  protocols::moves::Movers_map const & movers,
85  core::pose::Pose const & )
86 {
87  generator_id_ = tag->getOption< std::string >( "generator", generator_id_ );
88  if ( generator_id_ == "" ) {
89  utility_exit_with_message( "No Cst Generator was specified in the XML for RemoveCsts." );
90  }
92  assert( utility::pointer::dynamic_pointer_cast< protocols::forge::remodel::RemodelConstraintGenerator >( mover ) );
94  if ( (rcg = utility::pointer::static_pointer_cast< protocols::forge::remodel::RemodelConstraintGenerator >( mover )) ) {
95  set_generator( rcg );
96  } else {
97  utility_exit_with_message( "Error parsing generator option to RemoveCsts: the specified mover " + generator_id_ + " is not a constraint generator." );
98  }
99  TR << "Cst generator =" << generator_->get_name() << " with name=" << generator_id_ << std::endl;
100 }
101 
104 {
106 }
107 
110 {
111  return new RemoveCsts();
112 }
113 
116 {
117  return new RemoveCsts( *this );
118 }
119 
120 void
122 {
123  runtime_assert( generator );
124  generator_ = generator;
125 }
126 
127 /// @brief find the constraint set added by the generator and remove them
128 void
130 {
131  runtime_assert( generator_ || ( generator_id_ != "" ) );
132  // if the generator_id_ is set, look up constraints in the static map and remove them.
133  if ( generator_id_ != "" ) {
134  TR << "Before removing csts from " << generator_->get_name() << ", there were " << pose.constraint_set()->get_all_constraints().size() << " constraints in the pose." << std::endl;
136  TR << "There are " << pose.constraint_set()->get_all_constraints().size() << " constraints remaining in the pose." << std::endl;
137  } else {
138  // otherwise, use the pointer
139  TR << "Before removing csts from " << generator_->get_name() << ", there were " << pose.constraint_set()->get_all_constraints().size() << " constraints in the pose." << std::endl;
140  generator_->remove_remodel_constraints_from_pose( pose );
141  TR << "There are " << pose.constraint_set()->get_all_constraints().size() << " constraints remaining in the pose." << std::endl;
142  }
143 }
144 
145 
146 } //namespace constraints
147 } //namespace forge
148 } //namespace protocols