Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWisePoseCombineSampleGenerator.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 StepWisePoseCombineSampleGenerator
11 /// @brief Subclass of StepWisePoseSampleGenerator
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
20 #include <core/types.hh>
21 // AUTO-REMOVED #include <core/pose/Pose.hh>
22 #include <utility/exit.hh>
23 // AUTO-REMOVED #include <ObjexxFCL/string.functions.hh>
24 
25 //Auto Headers
26 #include <utility/vector1.hh>
27 
28 using namespace core;
29 
30 namespace protocols {
31 namespace swa {
32 
33  //////////////////////////////////////////////////////////////////////////
34  //constructor!
35  StepWisePoseCombineSampleGenerator::StepWisePoseCombineSampleGenerator(
37  input_streams_( input_streams ),
38  need_to_initialize_( true )
39  {
40  if ( input_streams_.size() != 2 ) utility_exit_with_message( "PoseCombineSampleGenerator needs two sources of input!" );
41  reset();
42  }
43 
46  StepWisePoseSetupOP stepwise_pose_setup ):
47  input_streams_( input_streams ),
48  need_to_initialize_( true ),
49  stepwise_pose_setup_( stepwise_pose_setup )
50  {
51  if ( input_streams_.size() != 2 ) utility_exit_with_message( "PoseCombineSampleGenerator needs two sources of input!" );
52  reset();
53  }
54 
55  //////////////////////////////////////////////////////////////////////////
56  void
58  input_streams_[ 1 ]->reset();
59  input_streams_[ 2 ]->reset();
60  need_to_initialize_ = true;
61  }
62 
63  //////////////////////////////////////////////////////////////////////////
64  bool
66  return ( input_streams_[ 1 ]->has_another_pose() ||
67  input_streams_[ 2 ]->has_another_pose() );
68  }
69 
70  //////////////////////////////////////////////////////////////////////////
71  void
73  {
74 
75 
76  ////////////////////////////////////////////////////////////
77  if( input_streams_[ 2 ]->has_another_pose() ) {
78 
79  // This logic doesn't seem totally robust:
80  if ( need_to_initialize_ ){
81  input_streams_[ 1 ]->copy_next_pose_segment( pose );
82  need_to_initialize_ = false;
83  }
84 
85  input_streams_[ 2 ]->copy_next_pose_segment( pose );
86 
87  } else {
88 
89  if ( !input_streams_[ 1 ]->has_another_pose() ) utility_exit_with_message( "Asked PoseCombineSampleGenerator for another sample, but it did not have one!" );
90 
91  input_streams_[ 2 ]->reset();
92 
93  input_streams_[ 1 ]->copy_next_pose_segment( pose );
94  input_streams_[ 2 ]->copy_next_pose_segment( pose );
95 
96  }
97 
98  // This is annoying but necessary:
99  if ( stepwise_pose_setup_ && stepwise_pose_setup_->ready_to_align() ){
100  // std::cout << "ALIGNING POSE! " << std::endl;
101  stepwise_pose_setup_->align_pose( pose );
102  // static Size count( 0 );
103  // pose.dump_pdb( "blah_"+ObjexxFCL::string_of( count++ )+".pdb");
104  }
105 
106  }
107 
108  ///////////////////////////////////////////////////////
109  Size
111  //we don't know a priori how many combinations there will be...
112  // yes, I guess we could precompute this by looking through both streams ahead of time.
113  return 0;
114  }
115 
116 
117  ///////////////////////////////////////////////////////
118  void
120  stepwise_pose_setup_ = stepwise_pose_setup;
121  }
122 
123 }
124 }