Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MiniRelax.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 MiniRelax.cc
11 /// @brief
12 /// @detailed
13 /// @author James Thompson
14 
18 
19 
20 // AUTO-REMOVED #include <core/chemical/ResidueType.hh>
22 
25 
26 // AUTO-REMOVED #include <core/conformation/Residue.functions.hh>
27 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
30 #include <core/pose/Pose.hh>
31 
32 #include <core/sequence/util.hh>
35 
36 #include <basic/Tracer.hh>
37 
38 #include <basic/options/option.hh>
39 #include <basic/options/keys/relax.OptionKeys.gen.hh>
40 
41 #include <core/kinematics/Jump.hh>
45 #include <utility/vector1.hh>
46 
47 
48 static basic::Tracer TR("protocols.relax.MiniRelax");
49 
50 ////////////////////////////////////////////////////////////////////////////////////////////////////
51 
52 namespace protocols {
53 namespace relax {
54 
57 ) :
58  parent(),
59  scorefxn_(scorefxn_in)
60 {}
61 
62 MiniRelax::MiniRelax( MiniRelax const & other ) :
63  //utility::pointer::ReferenceCount(),
64  parent( other ),
65  scorefxn_( other.scorefxn_ )
66 {}
67 
69 
72  return new MiniRelax(*this);
73 }
74 
75 ////////////////////////////////////////////////////////////////////////////////////////////////////
77  if ( !pose.is_fullatom() ) {
80  );
81  std::cerr << "Fullatom mode .... " << std::endl;
82  }
83 
85  pose.constraint_set()->clone()
86  );
87 
88  // add coordinate constraints
89  using core::Real;
91  using namespace basic::options;
92  using namespace core::scoring;
93  using namespace core::scoring::constraints;
94  using namespace basic::options::OptionKeys;
95  Real const default_coord_sdev( option[ OptionKeys::relax::minirelax_sdev ]() );
96  {
98  pose, alignment_from_pose(pose),
99  default_coord_sdev
100  );
101  scorefxn_->set_weight( coordinate_constraint, 1.0 );
102  }
103 
104  FastRelax relaxer( scorefxn_ );
105 
106  int const n_repeats( option[ OptionKeys::relax::minirelax_repeats ]() );
107  Real multiplier( 1.0 );
108  Real const growth_factor( 3.0 );
109 
112  for ( int ii = 1; ii <= n_repeats; ++ii ) {
113  Real const current_round_sdev( default_coord_sdev * multiplier );
114  // relax for a single round
115  apply_disulfides(pose);
116  relaxer.apply(pose);
117 
118  // generate a new set of coordinate constraints
119  using utility::vector1;
122  );
123  Real const clash_cutoff(2); // min fa-rep score for a clash
124 
125  vector1< Real > coord_sdevs;
126  for ( Size idx = 1; idx <= pose.total_residue(); ++ii ) {
127  Real coord_sdev(0);
128  if ( map[idx] != 0 ) {
129  // residue is aligned, sdev = default_coord_sdev
130  coord_sdev = default_coord_sdev;
131  }
132  if ( fa_reps[idx] > clash_cutoff ) {
133  // residue is aligned, sdev = default_coord_sdev * multiplier
134  coord_sdev = current_round_sdev;
135  }
136  ++idx;
137  coord_sdevs.push_back(coord_sdev);
138  }
139  // apply coordinate constraints
141  pose, coord_sdevs
142  );
143 
144  // increase multiplier by growth_factor
145  multiplier *= growth_factor;
146  } // n_repeats
147 
148  // clean up hydrogens
149  //{
150  // using namespace core::conformation;
151  // typedef core::conformation::ResidueOPs::iterator iter;
152  // for ( iter it = pose.res_begin(), end = pose.res_end();
153  // it != end; ++it
154  // ) {
155  // idealize_hydrogens( *(*it), pose.conformation() );
156  // }
157  //}
158 
160 
161  // one more round with no constraints
162  {
163  using namespace core::scoring;
164  scorefxn_->set_weight( coordinate_constraint, 0.0 );
165  FastRelax no_cst_relaxer( scorefxn_ , 1 );
166  no_cst_relaxer.apply(pose);
167  }
168 
169  apply_disulfides(pose);
170  pose.constraint_set( orig_cst_set );
171 } // apply
172 
175  return "MiniRelax";
176 }
177 
178 } // namespace relax
179 } // namespace protocols