Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymRotamerTrialsMover.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file
10 /// @brief
11 /// @author Ingemar Andre
12 
13 // Unit headers
17 
18 #include <core/pose/PDBInfo.hh>
19 #include <core/pose/Pose.hh>
20 #include <core/scoring/Energies.hh>
30 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
31 
32 // AUTO-REMOVED #include <protocols/moves/DataMap.hh>
33 // AUTO-REMOVED #include <protocols/rosetta_scripts/util.hh>
34 #include <utility/tag/Tag.hh>
35 
36 #include <utility/vector0.hh>
37 #include <utility/vector1.hh>
38 
39 
40 namespace protocols {
41 namespace simple_moves {
42 namespace symmetry {
43 
44 // creator
48 }
49 
52  return new SymRotamerTrialsMover;
53 }
54 
57  return "SymRotamerTrialsMover";
58 }
59 
60 //////////////////////////
61 // default constructor
63 {
64  protocols::moves::Mover::type( "SymRotamerTrials" );
65 }
66 
67 // constructor with arguments
69  ScoreFunctionCOP scorefxn_in,
70  PackerTask & task_in
71 ) : protocols::simple_moves::RotamerTrialsMover(scorefxn_in, task_in )
72 {
73  protocols::moves::Mover::type( "SymRotamerTrials" );
74 }
75 
76 // constructor with arguments
78  ScoreFunctionCOP scorefxn_in,
79  TaskFactoryCOP factory_in
80 ) : protocols::simple_moves::RotamerTrialsMover(scorefxn_in, factory_in )
81 {
82  protocols::moves::Mover::type( "SymRotamerTrials" );
83 }
84 
86 
87 void
89 {
90  core::pack::task::PackerTaskOP symmetric_task( task(pose)->clone() );
91  make_symmetric_task( pose, symmetric_task );
92  core::pack::symmetric_rotamer_trials( pose, *scorefxn(), symmetric_task );
93 }
94 
97  return "SymEnergyCutRotamerTrialsMover";
98 }
99 
102  return "SymRotamerTrialsMover";
103 }
104 
105 void
107  core::pose::Pose & pose,
109 )
110 {
111  assert( core::pose::symmetry::is_symmetric( pose ) );
112  SymmetricConformation & SymmConf (
113  dynamic_cast<SymmetricConformation &> ( pose.conformation()) );
115 
116  utility::vector1<bool> allow_repacked( pose.total_residue(), false );
117  for (Size res=1; res <= pose.total_residue(); ++res )
118  {
119  if ( symm_info->fa_is_independent(res) ) allow_repacked.at(res) = true;
120  }
121  task->restrict_to_residues( allow_repacked );
122 }
123 
124 /// @brief parse xml
125 void
127  TagPtr const tag,
129  Filters_map const &fm,
131  Pose const &pose )
132 {
133  RotamerTrialsMover::parse_my_tag( tag,data,fm,mm,pose );
134 }
135 
136 /////////////////////////
137 // default constructor
140 {
141  protocols::moves::Mover::type( "SymEnergyCutRotamerTrials" );
142 }
143 
144 // constructor with arguments
146  ScoreFunctionCOP scorefxn_in,
147  PackerTask & task_in,
149  core::Real energycut_in
150 ) : SymRotamerTrialsMover(scorefxn_in, task_in), mc_( mc_in ), energycut_( energycut_in )
151 {
152  protocols::moves::Mover::type( "SymEnergyCutRotamerTrials" );
153 }
154 
155 // constructor with arguments
157  ScoreFunctionCOP scorefxn_in,
158  TaskFactoryCOP factory_in,
160  core::Real energycut_in
161 ) : SymRotamerTrialsMover(scorefxn_in, factory_in), mc_( mc_in ), energycut_( energycut_in )
162 {
163  protocols::moves::Mover::type( "SymEnergyCutRotamerTrials" );
164 }
165 
167 
168 void
170 {
171  PackerTaskOP rottrial_task( task(pose)->clone() );
172  ( *scorefxn() )(pose);
173  /// Now handled automatically. scorefxn()->accumulate_residue_total_energies( pose );
174  setup_energycut_task( pose, *mc(), *rottrial_task );
175  /// This call is dangerous. If sequence or length has changed since task was created, it will crash.
176  /// Not a problem if you used a TaskFactory
177  core::pack::symmetric_rotamer_trials( pose, *scorefxn(), rottrial_task );
178 }
179 
180 /// @details starting from a fresh task, it reduces the number of residues to be repacked to only
181 /// those whose energy has increased by energycut_ since the application of the last move.
182 void
184  core::pose::Pose const & pose,
185  protocols::moves::MonteCarlo const & mc,
187 ) const
188 {
189  using namespace core;
191 
192  //Size count_fixed( 0 ), count_repacked( 0 );
193 
194  task_in.restrict_to_repacking();
195 
196  for ( int i=1, i_end = pose.total_residue(); i<= i_end; ++i ) {
197  core::Real const resE ( pose.energies().residue_total_energy(i) );
198  core::Real const lowest_resE( mc.lowest_score_pose().energies().residue_total_energy(i) );
199  core::Real const deltaE ( resE - lowest_resE );
200  if ( deltaE < energycut_ ) {
202  //++count_fixed;
203  } else {
204  // let this residue be repacked
205  //++count_repacked;
206  }
207  }
208 }
209 // protected accessor function for derived mover
212 {
213  return mc_;
214 }
215 
216 void
218  core::pose::Pose & pose,
220 )
221 {
222  assert( core::pose::symmetry::is_symmetric( pose ) );
223  if( task->symmetrize_by_union() || task->symmetrize_by_intersection() ) return; // new machinery
224  SymmetricConformation & SymmConf (
225  dynamic_cast<SymmetricConformation &> ( pose.conformation()) );
227 
228  utility::vector1<bool> allow_repacked( pose.total_residue(), false );
229  for (Size res=1; res <= pose.total_residue(); ++res )
230  {
231  if ( symm_info->fa_is_independent(res) ) allow_repacked.at(res) = true;
232  }
233  task->restrict_to_residues( allow_repacked );
234 
235 }
236 
237 
238 } // symmetry
239 } // moves
240 } // protocols