Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SmoothFragmentMover.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 /// @brief Cost computation for Gunn Moves
11 /// @author Oliver Lange
12 
13 // Unit Headers
15 
16 // Package Headers
17 // AUTO-REMOVED #include <protocols/simple_moves/ClassicAbinitio.hh>
18 
19 // Project Headers
20 #include <core/fragment/FragSet.hh>
21 #include <core/fragment/Frame.hh>
23 // AUTO-REMOVED #include <core/pose/Pose.hh>
25 #include <core/types.hh>
26 #include <basic/prof.hh>
27 
28 #include <protocols/moves/Mover.hh>
29 // AUTO-REMOVED #include <protocols/moves/MoverContainer.hh> // SequenceMover
30 // AUTO-REMOVED #include <protocols/moves/TrialMover.hh>
31 
32 // ObjexxFCL Headers
33 
34 // Utility headers
35 #include <utility/vector1.fwd.hh>
36 #include <utility/pointer/ReferenceCount.hh>
37 // AUTO-REMOVED #include <numeric/numeric.functions.hh>
38 #include <numeric/random/random.hh>
39 
40 //// C++ headers
41 #include <cstdlib>
42 #include <string>
43 
44 #include <utility/vector1.hh>
45 
46 
47 namespace protocols {
48 namespace simple_moves {
49 
50 /// @details Auto-generated virtual destructor
52 
53 static numeric::random::RandomGenerator RG(345); // <- Magic number, do not change it!
54 
55 using namespace core;
56 
59  FragmentCostOP cost ) :
60  ClassicFragmentMover( fragset, "SmoothFragmentMover_"+cost->type() ),
61  cost_( cost )
62 {}
63 
64 
68  FragmentCostOP cost ) :
69  ClassicFragmentMover( fragset, movemap, "SmoothFragmentMover_"+cost->type() ),
70  cost_( cost )
71 {}
72 
76  FragmentCostOP cost,
77  std::string move_type ) :
78  ClassicFragmentMover( fragset, movemap, move_type+"_"+cost->type() ),
79  cost_( cost )
80 {}
81 
84  return "SmoothFragmentMover";
85 }
86 
88 
89 bool
91  core::fragment::FrameList const& frames,
92  core::pose::Pose const& pose,
93  Size &frame_num,
94  Size &frag_num
95 ) const
96 {
97 
98  PROF_START( basic::TEST4 );
99 
100  //std::cout << "SmoothFragmentMover::choose_fragment" << std::endl;
101  typedef std::pair< Size, Size > FragID;
103  goodfrag.reserve( frames.size()*200 );
104 
105  Real costmin = 1000;
106  FragID minfrag ( 0 , 0 );
107 
108  for ( Size fnr = 1; fnr <= frames.size(); fnr++ ) {
109  //compute scores
110  ScoreList scores;
111  fragment::Frame const& frame( *( frames[ fnr ] ) );
112  cost_->score( frame, pose, scores );
113 
114  for ( Size j = 1; j <= frame.nr_frags(); ++j ) {
115  Real s = scores[ j ];
116  //std::cout << "SmoothFragmentMover::choose_fragment: " << j << " score: " << s << std::endl;
117  if ( s < costmin ) {
118  costmin = s;
119  minfrag = FragID( fnr, j );
120  }
121  if ( s < cost_->cutoff() ) {
122  goodfrag.push_back( FragID( fnr, j ) );
123  }
124  }
125  //choose randomly one fragment of all those that are below cutoff
126  //or choose the best fragment. Fail if the minimal cost is > 12.0
127  }
128 
129  PROF_STOP( basic::TEST4 );
130 
131  if ( goodfrag.size()< 1 ) {
132  if ( costmin > 12. ) return false;
133  frame_num = minfrag.first;
134  frag_num = minfrag.second;
135  } else {
136  FragID choice = goodfrag[ static_cast< int >( RG.uniform() * goodfrag.size() )+1 ];
137  frame_num = choice.first;
138  frag_num = choice.second;
139  }
140  return true;
141 }
142 
143 
144 bool
146 {
147  return true;
148 }
149 
150 
151 } // simple_moves
152 } // protocols