Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StartStructClaimer.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
21 // Project Headers
22 #include <core/pose/Pose.hh>
23 
25 // AUTO-REMOVED
26 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
27 
28 #include <core/fragment/FragSet.hh>
30 #include <core/fragment/util.hh>
33 
35 
36 // ObjexxFCL Headers
37 
38 // Utility headers
39 #include <utility/excn/Exceptions.hh>
40 //#include <utility/io/izstream.hh>
41 //#include <utility/io/ozstream.hh>
42 //#include <utility/io/util.hh>
43 #include <basic/Tracer.hh>
44 //#include <basic/options/option.hh>
45 #include <numeric/random/random.hh>
46 
48 #include <utility/vector1.hh>
49 
50 
51 //// C++ headers
52 
53 static numeric::random::RandomGenerator RG(199234234);
54 
55 
56 static basic::Tracer tr("protocols.topo_broker",basic::t_info);
57 //static numeric::random::RandomGenerator RG(181134);
58 
59 namespace protocols {
60 namespace topology_broker {
61 
62 using namespace core;
63 
64 StartStructClaimer::StartStructClaimer() : bUseInputPose_( true ), perturb_( 0.0 )
65 {
67  set_bInitDofs( true );
68 }
69 
70 StartStructClaimer::StartStructClaimer( core::pose::Pose const& pose ) : bUseInputPose_( true ), perturb_( 0.0 )
71 {
73  // generate_init_frags( pose );
74  start_pose_ = pose;
75  set_bInitDofs( true );
76 }
77 
79  // start_pose_.clear();
80 }
81 
83  if ( bUseInputPose_ ) {
84  start_pose_ = pose;
85  }
86  //CANNOT do this here since SEQUENCE_CLAIMS need to be resolved first to know the sequence-offset
87  // generate_init_frags( start_pose_ );
88 
89  // start_pose_.clear();
90 }
91 
93  new_claims.push_back( new SequenceClaim( this, 0, 0, label(), DofClaim::NEED_TO_KNOW /* for now... eventually CAN_INIT ? */ ) );
94 }
95 
97  std::set< Size > start_region;
98  get_sequence_region( start_region );
99  //for ( Size i = 1; i<= pose.total_residue(); ++i ) {
100  // start_region.insert( i );
101  // }
102  if (tr.Trace.visible() ) {
103  tr.Trace << " start region for StartStructClaimer "<< std::endl;
104  for ( std::set< Size >::iterator it = start_region.begin(); it != start_region.end(); ++it ) {
105  tr.Trace << *it << " ";
106  }
107  tr.Trace << std::endl;
108  }
109 
110 
111  using namespace fragment;
113  steal_frag_set_from_pose( pose, *fragset, new FragData( new BBTorsionSRFD, 1 ), start_region );
115  mover->set_check_ss( false ); /* not good if we want to initialize from 1mer fragments */
116  set_mover( mover );
117 
118 }
119 
121  //now the sequence is known:
122  if ( start_pose_.total_residue() > 0 ) {
123  generate_init_frags( start_pose_ ); //requires sequence definition --- had to wait until now.
124  }
125  //start_pose_.clear(); // save the space..
126 }
127 
128 
130  core::pose::Pose& pose,
131  DofClaims const& init_dofs,
132  DofClaims& failed_to_init
133 ) {
134 
135  try{
136  mover();
137  } catch( utility::excn::EXCN_NullPointer excn ) {
138  throw( EXCN_Input( "StartStructureClaimer needs JobInputter or FILE <pdb-file> entry in broker-setup"));
139  }
140 
141  FragmentClaimer::initialize_dofs( pose, init_dofs, failed_to_init );
142  if ( perturb_ == 0.0 ) return;
143  for ( DofClaims::const_iterator it = init_dofs.begin(), eit = init_dofs.end();
144  it != eit; ++it ) {
145  //don't really know how this looks for jumps
146  if ( (*it)->type() == DofClaim::BB ) {
147  Size pos( (*it)->pos( 1 ) );
148  pose.set_phi( pos, pose.phi( pos ) + RG.gaussian()*perturb_ );
149  pose.set_psi( pos, pose.psi( pos ) + RG.gaussian()*perturb_ );
150  }
151  }
152 }
153 
154 bool StartStructClaimer::read_tag( std::string tag, std::istream& is ) {
155  if ( tag == "file" || tag == "FILE" ) {
157  is >> filename;
158  tr.Debug << type() << " initialized with file " << filename << std::endl;
159  core::pose::Pose pose;
162  filename );
163  } else if ( tag == "PERTURB" ) {
164  is >> perturb_;
165  } else if ( tag =="NO_USE_INPUT_POSE" ) {
166  bUseInputPose_ = false;
167  } else return FragmentClaimer::read_tag( tag, is );
168  return true;
169 }
170 
171 
172 
173 } //topology_broker
174 } //protocols