Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TopologyClaimer.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 TopologyBroker
11 /// @brief top-class (Organizer) of the TopologyBroker mechanism
12 /// @detailed responsibilities:
13 /// @author Oliver Lange
14 
15 // Unit Headers
17 
18 // Package Headers
20 
21 // Project Headers
27 
28 // Utility headers
29 #include <basic/Tracer.hh>
30 
31 // C/C++ headers
32 #ifdef WIN32
33 #include <algorithm>
34 #include <iterator>
35 #endif
36 
37 #include <vector>
38 
39 #include <utility/vector0.hh>
40 #include <utility/vector1.hh>
41 
42 
43 static basic::Tracer tr("protocols.topo_broker",basic::t_info);
44 
45 namespace protocols {
46 namespace topology_broker {
47 
48 /// @details Auto-generated virtual destructor
50 
51 using namespace core;
52 
53 void TopologyClaimer::initialize_dofs( core::pose::Pose&, DofClaims const& init_dofs, DofClaims& failed_to_init ) {
54  DofClaims my_claims;
55  for ( DofClaims::const_iterator it = init_dofs.begin(), eit = init_dofs.end();
56  it != eit; ++it ) {
57  if ( (*it)->owner()==this ) {
58  my_claims.push_back( *it );
59  }
60  }
61  if ( my_claims.size() ) {
62  tr.Warning << "[WARNING]" << type() << "did not initialize dofs as requested" << std::endl;
63  }
64  std::copy( my_claims.begin(), my_claims.end(), std::back_inserter( failed_to_init ) );
65 }
66 
68  runtime_assert( init_claim->owner()==this );
69  failed_to_init.push_back( init_claim );
70  tr.Warning << "[WARNING]" << type() << "did not initialize residues as requested for claim..." << *init_claim << std::endl;
71 }
72 
74  moves::RandomMover& random_mover,
75  core::pose::Pose const& pose,
76  abinitio::StageID stageID, /* abinitio sampler stage */
77  core::scoring::ScoreFunction const& /*scorefxn*/, /* scorefxn of this stage */
78  core::Real progress /* progress within stage */
79 ) {
80  moves::MoverOP mover = get_mover( pose );
81  if ( mover ) {
82  random_mover.add_mover( mover, abinitio_mover_weight_->weight( stageID, progress ) );
83  }
84 }
85 
86 void TopologyClaimer::read_mover_weight( std::istream& is ) {
87  std::string type;
88  core::Real weight;
89  is >> type >> weight;
90  if ( type == "LargeStage" ) { //sample when ClassicAbinitio likes to have "large" fragments
91  set_mover_weight( new weights::LargeFragWeight( weight ) );
92  } else if ( type == "SmallStage" ) { //sample when ClassicAbinitio likes to have "small" fragments
93  set_mover_weight( new weights::SmallFragWeight( weight ) );
94  } else if ( type == "SmoothStage" ) { //sample when ClassicAbinitio likes to have "small" fragments
95  set_mover_weight( new weights::SmoothFragWeight( weight ) );
96  } else if ( type == "AllStage" ) { //always on
97  set_mover_weight( new weights::ConstAbinitioMoverWeight( weight ) );
98  } else {
99  throw EXCN_Input( "weight can only by one of LargeStage, SmallStage or AllStage " );
100  }
101 }
102 
103 void TopologyClaimer::unknown_tag( std::string tag, std::istream& is ) const {
104  std::string line; getline(is, line);
105  throw EXCN_Input ("ERROR reading broker-setup. unknown tag: " + tag + " in line:\n " + tag + line + "\n");
106 }
107 
108 void TopologyClaimer::read( std::istream& is ) {
109  set_defaults();
110  std::string tag;
111  while ( is >> tag && tag != "END_CLAIMER" ) {
112  if ( tag[ 0 ] == '#' ) {
113  getline( is, tag );
114  continue;
115  }
116  tr.Trace << "READ_SETUP: tag = " << tag << std::endl;
117  if ( !read_tag( tag, is ) ) unknown_tag( tag, is );
118  }
119  init_after_reading();
120 }
121 
122 bool TopologyClaimer::read_tag( std::string tag, std::istream& is ) {
123  if ( tag == "LABEL" ) {
124  is >> label_;
125  } else return false;
126  return true;
127 }
128 
130  label_ = type();
131 }
132 
133 } //topology_broker
134 } //protocols