Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DockSetupMover.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
11 /// @brief
12 /// @detailed
13 /// @author Oliver Lange
14 
15 //Unit Headers
18 
19 //Package Headers
25 //Project Headers
26 #include <core/pose/Pose.hh>
27 
28 // Utility Headers
29 #include <utility/tag/Tag.hh>
30 #include <utility/tools/make_vector1.hh>
31 
32 // ObjexxFCL Headers
33 #include <ObjexxFCL/string.functions.hh>
34 #include <ObjexxFCL/format.hh>
35 
36 //#include <numeric/trig.functions.hh>
37 //#include <numeric/xyzMatrix.fwd.hh>
38 
39 // C++ Headers
40 #include <string>
41 #include <basic/Tracer.hh>
42 
43 //Auto Headers
44 
45 
46 // cmd-line options
47 #include <basic/options/option_macros.hh>
48 #include <utility/excn/Exceptions.hh>
49 #include <basic/options/keys/docking.OptionKeys.gen.hh>
50 
51 static basic::Tracer tr("protocols.docking.DockSetupMover");
52 
53 using namespace core;
54 
55 namespace protocols {
56 namespace docking {
57 
58 //// ----------------------------------- BEGIN CONSTRUCTORS --------------------------------------------------
59 // Constructors
60 DockSetupMover::DockSetupMover() {
61  set_defaults();
62 }
63 
64 ///@brief clone operator, calls the copy constructor
67  return new DockSetupMover(*this);
68 }
69 
70 ///@brief copy ctor
71 DockSetupMover::DockSetupMover( DockSetupMover const & rhs ) : Mover(rhs) {
72  copy(*this, rhs);
73 }
74 
75 ///@brief assignment operator
77  //abort self-assignment
78  if (this == &rhs) return *this;
79  Mover::operator=(rhs);
80  copy(*this, rhs);
81  return *this;
82 }
83 
85  lhs.partners_ = rhs.partners_;
86  lhs.rb_mover_ = rhs.rb_mover_;
89 }
90 
91 //// ----------------------------------- END CONSTRUCTORS --------------------------------------------------
92 void
95  // runtime_assert( rb_mover_ );
96  // rb_mover_->clear_jumps(); //this doesn't work because of cloning --- have to communicate via data-map !
97  // for ( Size i=1; i<=pose.num_jump(); ++i ) {
98  // should honor movemap or movable_jumps_ here...
99  for ( Size i=1; i<=movable_jumps_.size(); ++i ) {
100  rigid_body_info_->add_jump( movable_jumps_[i] );
101  if ( rb_mover_ ) {
102  rb_mover_->add_jump( movable_jumps_[i] );
103  }
104  }
105  if ( rigid_body_info_->movable_jumps().empty() ) {
106  utility_exit_with_message( "RigidBodyInfo was not correctly set!" );
107  }
108 }
109 
110 //// --------------------------------- Setters -------------------------------------------------
111 
112 
113 
114 /// ----------------------------------------- Getters ------------------------------------------
115 
116 
117 /// ---------------------------- diagnostic output ------------------------------------------
118 
119 /// @details Show the complete setup of the docking protocol
120 void
121 DockSetupMover::show( std::ostream & out ) const {
122  using namespace ObjexxFCL::fmt;
123 // All output will be 80 characters - 80 is a nice number, don't you think?
124  std::string line_marker = "///";
125  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
126  out << line_marker << A( 47, "Rosetta 3 DockSetupMover" ) << space( 27 ) << line_marker << std::endl;
127  out << line_marker << space( 74 ) << line_marker << std::endl;
128  out << line_marker << A( 47, "partners: ") << A(10, partners_ ) << space(14) << line_marker << std::endl;
129  if ( movable_jumps_.size() ) {
130  out << line_marker << A( 47, "movable jumps: " ) << movable_jumps_.front() << space( 26 ) << line_marker<< std::endl;
131  }
132  // Close the box I have drawn
133  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
134 }
135 
136 std::ostream & operator<<(std::ostream& out, const DockSetupMover & dp ) {
137 
138  dp.show( out );
139  return out;
140 }
141 
142 /// ------------------ initializing helpers ---------------------------------
143 
144 void
146 {
147  using namespace basic::options;
148  partners_ = option[ OptionKeys::docking::partners ]();
149 }
150 
151 void
153  TagPtr const tag,
154  moves::DataMap& data_map,
156  moves::Movers_map const& movers,
157  core::pose::Pose const&
158 ) {
159  using namespace core::scoring;
160  //get through partners
161  if( tag->hasOption( "partners" ) ){
162  std::string const partners( tag->getOption<std::string>( "partners") );
163  set_partners(partners);
164  }
165  moves::MoverOP mover = rosetta_scripts::parse_mover( tag->getOption< std::string >( "rb_mover", "null" ), movers );
166  rb_mover_ = dynamic_cast< rigid::RigidBodyPerturbNoCenterMover* >( mover() );
167 // if ( !rb_mover_ ) {
168 // throw utility::excn::EXCN_RosettaScriptsOption( "DockSetupMover requires an rb_mover argument" );
169 // }
170  movable_jumps_.clear();
171  if ( tag->hasOption( "moveable_jump" ) ) {
172  movable_jumps_.push_back( tag->getOption< core::Size >( "moveable_jump" ));
173  }
174  if (partners_ == "_" && movable_jumps_.size()<1 ) {
175  movable_jumps_.push_back( 1 );
176  }
177  // using RigidBodyInfo to store movable_jumps, then rb_mover is free from DockSetupMover
178  if ( !data_map.has( "RigidBodyInfo", "docking_setup" ) ) {
179  // as member variable: RigidBodyInfoOP rigid_body_info_;
181  data_map.add( "RigidBodyInfo", "docking_setup", rigid_body_info_ );
182  tr.Debug << "added RigidBodyInfo into DataMap" << std::endl;
183  } else {
184  rigid_body_info_ = data_map.get< protocols::docking::RigidBodyInfo* >( "RigidBodyInfo", "docking_setup" );
185  assert( rigid_body_info_ );
186  tr.Debug << "RigidBodyInfo supposed to be in DataMap, but somehow failed to get it from DataMap" << std::endl;
187  }
188 }//end parse_my_tag
189 
190 
191 /// ------------------ End initializing helpers ---------------------------------
192 
195 {
197 }
198 
201  return new DockSetupMover();
202 }
203 
206 {
207  return "DockSetupMover";
208 }
209 } //docking
210 } //protocols