Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopOver.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/protein_interface_design/movers/LoopOver.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 
14 // Unit headers
18 #include <utility/tag/Tag.hh>
19 #include <basic/Tracer.hh>
20 #include <core/pose/Pose.hh>
21 
22 #include <utility/vector0.hh>
23 #include <utility/vector1.hh>
24 
25 
26 namespace protocols {
27 namespace protein_interface_design {
28 namespace movers {
29 
30 using namespace core;
31 using namespace std;
32 using namespace protocols::moves;
33 
34 static basic::Tracer TR( "protocols.protein_interface_design.movers.LoopOver" );
35 
38 {
40 }
41 
44  return new LoopOver;
45 }
46 
49 {
50  return "LoopOver";
51 }
52 
54  protocols::moves::Mover( LoopOverCreator::mover_name() ),
55  max_iterations_( 10 ),
56  ms_whenfail_( protocols::moves::MS_SUCCESS )
57 {}
58 
60  core::Size max_iterations,
64 ):
65  protocols::moves::Mover( LoopOverCreator::mover_name() ),
66  max_iterations_( max_iterations ),
67  mover_( mover->clone() ),
68  condition_( condition->clone() ),
69  ms_whenfail_( ms_whenfail )
70 {}
71 
73 
74 void
76 {
77  core::Size count( 0 );
78  core::pose::Pose const saved_pose( pose );
79 
80  // clear out any existing info (from prior LoopOver::apply calls)
81  info().clear();
82 
83  //fpd
84  if (mover_->get_additional_output())
85  utility_exit_with_message("Movers returning multiple poses are unsupported by LoopOver.");
86 
87  bool filter_result( false );
88  while( !filter_result && count < max_iterations_ ){
89  if( !drift_ )
90  pose = saved_pose; // to prevent drift
91  TR<<"Loop iteration "<<count<<std::endl;
92  // clear out any existing info (from prior mover_->apply calls)
93  mover_->info().clear();
94  mover_->apply( pose );
95  // inherit Mover info: jd2 JobDistributor passes this info to Job,
96  // and JobOutputters may then write this info to output files
97  info().insert( info().end(), mover_->info().begin(), mover_->info().end() );
98 
99  // condition is evaluated only when mover has the status, MS_SUCCESS
100  if( mover_->get_last_move_status() == protocols::moves::MS_SUCCESS ) {
101  filter_result = condition_->apply( pose );
102  }
103  ++count;
104  }
105  if( !filter_result ){
107  if( !drift_ ) pose = saved_pose;
108  } else {
110  }
111 }
112 
116 }
117 
118 void
120 {
121  using namespace filters;
122 
123  TR<<"loop\n";
124  drift_ = tag->getOption< bool >( "drift", 1 );
125  std::string const mover_name( tag->getOption< std::string >( "mover_name" ));
126  std::string const filter_name( tag->getOption< std::string >( "filter_name", "false_filter" ) );
127  max_iterations_ = tag->getOption< core::Size >( "iterations", 10 );
128 
129  std::string const mover_status( tag->getOption< std::string >( "ms_whenfail", "MS_SUCCESS" ));
131 
132  Movers_map::const_iterator find_mover( movers.find( mover_name ) );
133  Filters_map::const_iterator find_filter( filters.find( filter_name ));
134  if( find_mover == movers.end() ) {
135  TR<<"WARNING WARNING!!! mover not found in map. skipping:\n"<<tag<<std::endl;
136  runtime_assert( find_mover != movers.end() );
137  }
138  if( find_filter == filters.end() ) {
139  TR<<"WARNING WARNING!!! filter not found in map. skipping:\n"<<tag<<std::endl;
140  runtime_assert( find_filter == filters.end() );
141  }
142  mover_ = find_mover->second; // no cloning to allow other movers to change this mover at their parse time
143  condition_ = find_filter->second->clone();
144  TR << "with mover \"" << mover_name << "\" and filter \"" << filter_name << "\" and " << max_iterations_<< " max iterations\n";
145  TR.flush();
146 }
147 
148 
149 } //movers
150 } //protein_interface_design
151 } //protocols
152