Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ShortLoopClosure.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
11 /// @brief
12 /// @detailed
13 /// @author Oliver Lange
14 ///
15 
16 
17 // Unit Headers
19 
20 // Package Headers
21 // AUTO-REMOVED #include <protocols/loops/Loops.hh>
22 // AUTO-REMOVED #include <protocols/loops/CcdLoopClosureMover.hh>
23 
24 // Project Headers
25 #include <core/pose/Pose.hh>
26 // AUTO-REMOVED #include <core/pose/util.hh>
27 
30 
33 
34 #include <core/fragment/Frame.hh>
36 
37 #include <core/fragment/FragSet.hh>
38 #ifdef WIN32
39 #include <core/fragment/FragID.hh>
40 #endif
41 
43 
45 
46 
48 // AUTO-REMOVED #include <protocols/moves/TrialMover.hh>
49 // ObjexxFCL Headers
50 
51 // Utility headers
52 #include <basic/Tracer.hh>
53 //numeric headers
54 // AUTO-REMOVED #include <numeric/random/random.hh>
55 
56 //// C++ headers
57 // AUTO-REMOVED #include <cstdlib>
58 #include <string>
59 
61 #include <utility/vector1.hh>
62 
63 //Auto Headers
64 
65 
66 
67 
68 namespace protocols {
69 namespace loops {
70 namespace loop_closure {
71 namespace ccd {
72 
73 using namespace core;
74 using namespace pose;
75 
76 static basic::Tracer tr("protocols.loops.loop_closure.ccd.ShortLoopClosure");
77 
78 //static numeric::random::RandomGenerator RG(1341412); // <- Magic number, do not change it!
79 
80 //c'stor
82  fragment::FragSetCOP fragset,
83  Loop loop_def,
85 ) : LoopClosure(),
86  orig_loop_( loop_def )
87 {
89  scorefxn->set_weight( scoring::linear_chainbreak, 1.0 );
90  scorefxn->set_weight( scoring::overlap_chainbreak, 3.0 );
91  set_scorefxn( scorefxn );
92 
93  set_temperature( 0.0 );
94 
95 // this is now done in base-class
97 // //*movemap = *movemap_in; no copying since seqpos don't make sense
98  movemap->set_bb( true ); //alternatively go through "movemap_in and translate settings for each bb
99  movemap->set_bb( 1, false );
100  movemap->set_bb( loop_def.size()+2, false); //two padding residues on each side of loop
101  set_movemap( movemap );
102 
103  runtime_assert( loop_def.start() >= 2 );
104  int const loop_offset(loop_def.start() - 2); //offset
105  Loop short_loop( 2, // new start
106  loop_def.size()+1, // new end
107  loop_def.cut() - loop_def.start() + 2, //new cut
108  0.0 //skip_rate
109  );
110  set_loop( short_loop );
111 
112  using namespace fragment;
113  FragSetOP short_frags = fragset->empty_clone(); // a fragset of same type should be able to handle everything
114  FrameList loop_frames;
115  fragset->region_simple( loop_def.start(), loop_def.stop(), loop_frames );
116  for ( FrameList::const_iterator it = loop_frames.begin(),
117  eit = loop_frames.end(); it!=eit; ++it ) {
118  FrameOP short_frame = (*it)->clone_with_frags();
119  short_frame->shift_to( short_frame->start() - loop_offset );
120  short_frags->add( short_frame );
121  tr.Trace << "ShortLoopClosure: short_frame->start" << short_frame->start() << std::endl;
122  tr.Trace << "add Frame for ShortLoopClosure: "; short_frame->show_header( tr.Trace );
123  }
124  set_fragset( short_frags );
125 
126  init();
127 }
128 
129 bool ShortLoopClosure::apply( Pose const& pose ) {
130  mc_->set_update_boinc(false); // Dont send poses to observer cos they're truncated and the energies are meaningless.
131  //copy loop segment into special purpose short_pose
132  Pose short_pose;
133  Size const short_size( orig_loop_.size() + 2 );
134  std::string sequence = pose.sequence();
136  short_pose,
137  sequence.substr( orig_loop_.start() - 2, orig_loop_.size() + 2 ),
138  *( chemical::ChemicalManager::get_instance()->residue_type_set( chemical::CENTROID ))
139  );
140  short_pose.copy_segment( short_size, pose, 1, orig_loop_.start() - 1 );
141 
142  // make one jump fold-tree that connects the two fixed padding residues on either end
143  kinematics::FoldTree f( short_size );
144  f.new_jump( 1, short_size, loop().cut() );
145  short_pose.fold_tree( f );
146  tr.Debug << "FoldTree for short-pose segment in ShortLoopClosure "<< f << std::endl;
147  // do the loop closure thing on this construct
148  return Parent::apply( short_pose );
149 }
150 
151 void ShortLoopClosure::catch_fragment( Pose const& short_pose ) {
153  aFrame->shift_to( 2 );
154  aFrame->steal( short_pose );
155  aFrame->shift_to( orig_loop_.start() );
156 }
157 
158 } // namespace ccd
159 } // namespace loop_closure
160 } // namespace loops
161 } // namespace protocols