Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SlideIntoSurface.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;
2 // rm-trailing-spaces:t -*-
3 // vi: set ts=2 noet:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available
7 // under license.
8 // (c) The Rosetta software is developed by the contributing members of the
9 // Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org. Questions about
11 // this can be
12 // (c) addressed to University of Washington UW TechTransfer,
13 // email: license@u.washington.edu.
14 
15 /// @file SurfaceOrientMover.cc
16 /// @author Robin A Thottungal (rathottungal@gmail.com)
17 /**
18 
19 **/
20 
21 // Unit Headers
24 
25 // Package Headers
26 
27 // Project headers
28 #include <protocols/moves/Mover.hh>
30 
33 #include <core/scoring/Energies.hh>
36 #include <core/pose/Pose.hh>
37 #include <core/pose/PDBInfo.hh>
39 #include <basic/datacache/BasicDataCache.hh>
40 
41 // for adding data to pose
42 #include <basic/datacache/BasicDataCache.hh>
44 
45 //Utility Headers
46 #include <utility/exit.hh>
47 #include <basic/prof.hh>
48 #include <basic/Tracer.hh>
49 
50 
51 using basic::T;
52 using basic::Error;
53 using basic::Warning;
54 
55 static basic::Tracer TR("protocols.SurfaceDocking.SlideIntoSurface");
56 
57 namespace protocols {
58 namespace surface_docking {
59 
60 using namespace protocols;
61 using namespace core;
62 using namespace core::scoring;
63 using namespace protocols::moves;
64 
65 
66 // default constructor
68 {
69  Mover::type( "SlideIntoSurface" );
70  rb_jump_ = 1;
74 }
75 
76 //constructor
78  core::Size const rb_jump
79 ) : Mover(), rb_jump_(rb_jump)
80 {
81  Mover::type( "DockingSlideIntoContact" );
85 }
86 
87 //destructor
89 
90 
92 {
93  using namespace moves;
94  /***
95  // Extracting surfaceVector info
96  std::string SurfVectors[3];
97  for(Size i=0; i<pose.pdb_info()->remarks().size(); i++) {
98  TR << pose.pdb_info()->remarks().at(i).num << " " << pose.pdb_info()->remarks().at(i).value << std::endl;
99  SurfVectors[i]=pose.pdb_info()->remarks().at(i).value;
100  }
101  surface_docking::SurfaceParametersOP surfaceParams=
102  new surface_docking::SurfaceParameters(SurfVectors[0],SurfVectors[1],SurfVectors[2]);
103  **/
104  surface_docking::SurfaceParameters & surfaceParams=
105  *( static_cast< surface_docking::SurfaceParameters * >
108  //TR<<"SlideAxis Vector:"<<surfaceParams.slideaxis<<std::endl;
109  mover->trans_axis(-1*surfaceParams.slideaxis);
110  ( *scorefxn_ )( pose );
111  TR<<"Initial Score:"<<pose.energies().total_energies()
112  [scoring::interchain_vdw ]<<std::endl;
113  TR << "Moving away" << std::endl;
114  core::Size const counter_breakpoint( 500 );
115  core::Size counter( 0 );
116  // first try moving away from each other
117  while ( pose.energies().total_energies()[ scoring::interchain_vdw ] > 0.1
118  && counter <= counter_breakpoint ) {
119  mover->apply( pose );
120  ( *scorefxn_ )( pose );
121  TR<<"current score:"<<pose.energies().total_energies()
122  [ scoring::interchain_vdw ]<<std::endl;
123  ++counter;
124  }
125  if( counter > counter_breakpoint ){
126  TR<<"failed moving away with original vector.Aborting SlideIntoSurface"
127  <<std::endl;
128  set_current_tag( "fail" );
129  return;
130  }
131  counter = 0;
132  // then try moving towards each other
133  TR << "Moving together" << std::endl;
134  //mover->trans_axis().negate();
135  while ( counter <= counter_breakpoint && pose.energies().total_energies()
136  [ scoring::interchain_vdw ] < 0.1 ) {
137  mover->apply( pose );
138  //TR<<"current score:"<<pose.energies().total_energies()
139  //[ scoring::interchain_vdw ]<<std::endl;
140  ( *scorefxn_ )( pose );
141  TR<<"Initial Score:"<<pose.energies().total_energies()<<std::endl;
142  ++counter;
143  }
144  if( counter > counter_breakpoint ){
145  TR<<"moving together failed. Aborting SlideIntoSurface"<<std::endl;
146  set_current_tag( "fail" );
147  return;
148  }
149  // move away again until just touching
150  mover->trans_axis().negate();
151  mover->apply( pose );
152 }
153 
155  return "SlideIntoSurface";
156 }
157 
158 /////////////////////////////// FaSlideIntoSurface/////////////////////////////
159 // default constructor
161 {
162 
163  Mover::type( "FaSlideIntoSurface" );
164  rb_jump_ = 1;
166  scorefxn_->set_weight( core::scoring::fa_rep, 1.0 );
167 }
168 
169 
170 //constructor
172  core::Size const rb_jump
173  //protocols::surface_docking::SurfaceParametersOP surfParams
174 ) : Mover(), rb_jump_(rb_jump), tolerance_(0.2)
175 {
176  Mover::type( "FaSlideIntoSurface" );
178  scorefxn_->set_weight( core::scoring::fa_rep, 1.0 );
179 }
180 
181 //destructor
183 
185 {
186  using namespace core::scoring;
187 
188  // A very hacky way of guessing whether the components are touching:
189  // if pushed together by 1A, does fa_rep change at all?
190  // (The docking rb_* score terms aren't implemented as of this writing.)
191  // Reading datacache for surface Vectors
192  //scoring::SurfaceParameters & surfaceParams =
193  // *( static_cast< core::scoring::SurfaceParameters * >
194  // ( pose.data().get_ptr( SURFACE_PARAMS )() ));
195  /***
196  // Extracting surfaceVector info
197  std::string SurfVectors[3];
198  for(Size i=0; i<pose.pdb_info()->remarks().size(); i++) {
199  TR << pose.pdb_info()->remarks().at(i).num << " " << pose.pdb_info()->remarks().at(i).value << std::endl;
200  SurfVectors[i]=pose.pdb_info()->remarks().at(i).value;
201  }
202  surface_docking::SurfaceParametersOP surfaceParams=
203  new surface_docking::SurfaceParameters(SurfVectors[0],SurfVectors[1],SurfVectors[2]);
204  **///does not work!
205  surface_docking::SurfaceParameters & surfaceParams=
206  *( static_cast< surface_docking::SurfaceParameters * >
209  TR<<"SlideAxis Vector:"<<surfaceParams.slideaxis<<std::endl;
210  trans_mover->trans_axis(-1*surfaceParams.slideaxis);
211 
212  (*scorefxn_)( pose );
213  core::Real const initial_fa_rep = pose.energies().total_energies()[ fa_rep ];
214  bool are_touching = false;
215  //moves::RigidBodyTransMover trans_mover( pose, rb_jump_ );
216 
217  //int i=1;
218  // Take 2A steps till clash, then back apart one step. Now you're within 2A of touching.
219  // Repeat with 1A steps, 0.5A steps, 0.25A steps, etc until you're as close are you want.
220  for( core::Real stepsize = 2.0; stepsize > tolerance_; stepsize /= 2.0 ) {
221  trans_mover->trans_axis( trans_mover->trans_axis().negate() ); // now move together
222  trans_mover->step_size(stepsize);
223  core::Size const counter_breakpoint( 500 );
224  core::Size counter( 0 );
225  do
226  {
227  trans_mover->apply( pose );
228  (*scorefxn_)( pose );
229  core::Real const push_together_fa_rep = pose.energies().total_energies()[ fa_rep ];
230  //std::cout << "fa_rep = " << push_together_fa_rep << std::endl;
231  are_touching = (std::abs(initial_fa_rep - push_together_fa_rep) > 1e-4);
232  //std::ostringstream s;
233  //s << "snapshot" << i << ".pdb";
234  //pose.dump_pdb(s.str());
235  //i += 1;
236  ++counter;
237  } while( counter <= counter_breakpoint && !are_touching );
238  if( counter > counter_breakpoint ){
239  TR<<"Failed Fadocking Slide Together. Aborting."<<std::endl;
240  set_current_tag( "fail" );
241  }
242  trans_mover->trans_axis( trans_mover->trans_axis().negate() ); // now move apart
243  trans_mover->apply( pose );
244  }
245 }
246 
249  return "FaSlideIntoSurface";
250 }
251 
252 
253 
254 /////////////////////////////// FaSlideAwayFromSurface/////////////////////////////
255 // default constructor
257 {
258 
259  Mover::type( "FaSlideIntoSurface" );
260  rb_jump_ = 1;
262  scorefxn_->set_weight( core::scoring::fa_rep, 1.0 );
263 }
264 
265 
266 //constructor
268  core::Size const rb_jump
269 ) : Mover(), rb_jump_(rb_jump), tolerance_(0.2)
270 {
271  Mover::type( "FaSlideIntoSurface" );
273  scorefxn_->set_weight( core::scoring::fa_rep, 1.0 );
274 }
275 
276 //destructor
278 
280 {
281  using namespace core::scoring;
282 
283  // A very hacky way of guessing whether the components are touching:
284  // if pushed together by 1A, does fa_rep change at all?
285  // (The docking rb_* score terms aren't implemented as of this writing.)
286  // Reading datacache for surface Vectors
287  surface_docking::SurfaceParameters & surfaceParams=
288  *( static_cast< surface_docking::SurfaceParameters * >
291  TR<<"SlideAxis Vector:"<<surfaceParams.slideaxis<<std::endl;
292  trans_mover->trans_axis(-1*surfaceParams.slideaxis);
293 
294  (*scorefxn_)( pose );
295  //core::Real const initial_fa_rep = pose.energies().total_energies()[ fa_rep ];
296  //bool are_touching = false;
297  //moves::RigidBodyTransMover trans_mover( pose, rb_jump_ );
298 
299  //Moving away
300  TR<<"Moving Away"<<std::endl;
301  trans_mover->trans_axis( trans_mover->trans_axis() ); // now move away
302  trans_mover->step_size(100);
303  trans_mover->apply( pose );
304 
305  /***
306  //int i=1;
307  // Take 2A steps till clash, then back apart one step. Now you're within 2A of touching.
308  // Repeat with 1A steps, 0.5A steps, 0.25A steps, etc until you're as close are you want.
309  for( core::Real stepsize = 2.0; stepsize > tolerance_; stepsize /= 2.0 ) {
310  trans_mover->trans_axis( trans_mover->trans_axis().negate() ); // now move together
311  trans_mover->step_size(stepsize);
312  core::Size const counter_breakpoint( 500 );
313  core::Size counter( 0 );
314  do
315  {
316  trans_mover->apply( pose );
317  (*scorefxn_)( pose );
318  core::Real const push_together_fa_rep = pose.energies().total_energies()[ fa_rep ];
319  //std::cout << "fa_rep = " << push_together_fa_rep << std::endl;
320  are_touching = (std::abs(initial_fa_rep - push_together_fa_rep) > 1e-4);
321  //std::ostringstream s;
322  //s << "snapshot" << i << ".pdb";
323  //pose.dump_pdb(s.str());
324  //i += 1;
325  ++counter;
326  } while( counter <= counter_breakpoint && !are_touching );
327  if( counter > counter_breakpoint ){
328  TR<<"Failed Fadocking Slide Together. Aborting."<<std::endl;
329  set_current_tag( "fail" );
330  }
331  trans_mover->trans_axis( trans_mover->trans_axis().negate() ); // now move apart
332  trans_mover->apply( pose );
333  }
334  **/
335 }
336 
339  return "FaSlideAwayFromSurface";
340 }
341 
342 } //surfaceDockingProtocol
343 
344 } //protocol