Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoreMover.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 ScoreMover.cc
11 ///
12 /// @brief
13 /// @author Monica Berrondo
14 
15 // unit headers
18 
19 // type headers
20 #include <core/types.hh>
21 
22 // project headers
23 // AUTO-REMOVED #include <core/chemical/ChemicalManager.hh>
24 #include <basic/options/option.hh>
25 #include <basic/options/keys/score.OptionKeys.gen.hh>
26 #include <basic/options/keys/corrections.OptionKeys.gen.hh>
27 #include <basic/options/keys/evaluation.OptionKeys.gen.hh>
28 #include <basic/options/keys/loops.OptionKeys.gen.hh>
29 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
30 #include <core/pose/Pose.hh>
31 #include <core/pose/util.hh>
33 #include <core/scoring/Energies.hh>
34 #include <core/scoring/rms_util.hh>
37 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintIO.hh>
38 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.hh>
39 #include <basic/Tracer.hh>
40 
41 #include <basic/datacache/DiagnosticData.hh>
42 #include <basic/datacache/BasicDataCache.hh>
43 
45 // AUTO-REMOVED #include <protocols/jobdist/standard_mains.hh>
46 // AUTO-REMOVED #include <protocols/evaluation/RmsdEvaluator.hh>
48 #include <protocols/loops/util.hh>
49 #include <protocols/loops/Loops.hh>
50 
52 // utility headers
53 #include <utility/file/FileName.hh>
54 #include <utility/tag/Tag.hh>
55 #include <utility/exit.hh>
56 // AUTO-REMOVED #include <protocols/filters/Filter.hh>
57 
58 // ObjexxFCL headers
59 #include <ObjexxFCL/FArray1D.hh>
60 
61 // C++ headers
62 // AUTO-REMOVED #include <fstream>
63 #include <iostream>
64 #include <string>
65 
66 #include <utility/vector0.hh>
67 #include <utility/excn/Exceptions.hh>
68 #include <utility/vector1.hh>
69 
70 
71 
72 namespace protocols {
73 namespace simple_moves {
74 
75 using namespace utility::tag;
76 using namespace core;
77 using namespace basic::options;
78 using namespace scoring;
79 
80 using basic::T;
81 using basic::Error;
82 using basic::Warning;
83 static basic::Tracer TR("protocols.simple_moves.ScoreMover");
84 
87 {
89 }
90 
93  return new ScoreMover;
94 }
95 
98 {
99  return "ScoreMover";
100 }
101 
103  moves::Mover( ScoreMoverCreator::mover_name() ),
104  score_function_( getScoreFunction() ),
105  verbose_(true),
106  scorefile_("")
107 {}
108 
110 
112  std::string const & weights, std::string const & patch /* = "" */
113 ) :
114  protocols::moves::Mover( ScoreMoverCreator::mover_name() ),
115  score_function_(0),
116  verbose_(true),
117  scorefile_("")
118 {
119  // score function setup
120  using namespace scoring;
121  if ( patch == "" ) {
123  } else {
125  }
126 }
127 
129  protocols::moves::Mover( ScoreMoverCreator::mover_name() ),
130  score_function_( score_function_in ),
131  verbose_(true),
132  scorefile_("")
133 {}
134 
136  return new ScoreMover( *this );
137 }
139  return new ScoreMover;
140 }
141 
142 void
144  using namespace pose;
145  //using datacache::CacheableDataType::SCORE_MAP;
146 
147  (*score_function_)(pose);
148 
149  if ( verbose_ ) {
150  /// Now handled automatically. score_function_->accumulate_residue_total_energies( pose );
151 
153  pose.data().set(core::pose::datacache::CacheableDataType::SCORE_MAP, new basic::datacache::DiagnosticData(score_map_));
154  pose.energies().show( TR );
156 
157  score_function_->show(TR, pose);
158  TR << std::endl;
159  }
160 
161  // More decoy quality data (rms, maxsub, GDTM)
162  if ( get_native_pose() ) {
163  Pose npose = *get_native_pose();
164  if ( npose.total_residue() == pose.total_residue() ) {
166  setPoseExtraScores( pose, "allatom_rms", all_atom_rmsd( *get_native_pose(), pose ) );
167  setPoseExtraScores( pose, "maxsub", CA_maxsub( *get_native_pose(), pose ) );
168  setPoseExtraScores( pose, "maxsub2.0", CA_maxsub( *get_native_pose(), pose, 2.0 ) );
169  Real gdtmm, m_1_1, m_2_2, m_3_3, m_4_3, m_7_4;
170  gdtmm = CA_gdtmm( *get_native_pose(), pose, m_1_1, m_2_2, m_3_3, m_4_3, m_7_4 );
171  setPoseExtraScores( pose, "gdtmm", gdtmm);
172  setPoseExtraScores( pose, "gdtmm1_1", m_1_1);
173  setPoseExtraScores( pose, "gdtmm2_2", m_2_2);
174  setPoseExtraScores( pose, "gdtmm3_3", m_3_3);
175  setPoseExtraScores( pose, "gdtmm4_3", m_4_3);
176  setPoseExtraScores( pose, "gdtmm7_4", m_7_4);
177  }
178  }
179 
180  using namespace basic::options;
181  using namespace basic::options::OptionKeys;
182  if ( option[ OptionKeys::loops::loopscores].user() ) {
183  core::pose::Pose native_pose;
184  if ( get_native_pose() ) {
185  native_pose = *get_native_pose();
186  } else {
187  native_pose = pose;
188  }
189  protocols::loops::Loops my_loops( option[ OptionKeys::loops::loopscores]() );
190  protocols::loops::addScoresForLoopParts( pose, my_loops, (*score_function_), native_pose, my_loops.size() );
191  }
192 
193  if ( option[ OptionKeys::evaluation::score_exclude_res ].user() ) {
194  utility::vector1<int> exclude_list = option[ OptionKeys::evaluation::score_exclude_res ];
195 
196  setPoseExtraScores( pose, "select_score", score_function_->get_sub_score_exclude_res( pose, exclude_list ) );
197  }
198 
199 }
200 
204 }
205 
207  TagPtr const tag,
208  moves::DataMap & datamap,
210  moves::Movers_map const &,
211  Pose const &
212 ) {
213  if ( tag->hasOption("scorefxn") ) {
214  std::string const scorefxn_key( tag->getOption<std::string>("scorefxn") );
215  if ( datamap.has( "scorefxns", scorefxn_key ) ) {
216  score_function_ = datamap.get< ScoreFunction* >( "scorefxns", scorefxn_key );
217  } else {
218  throw utility::excn::EXCN_RosettaScriptsOption("ScoreFunction " + scorefxn_key + " not found in protocols::moves::DataMap.");
219  }
220  }
221 
222  if ( tag->hasOption("verbose") ) {
223  verbose_ = tag->getOption<bool>("verbose");
224  }
225 }
226 
227 void ScoreMover::parse_def( utility::lua::LuaObject const & def,
228  utility::lua::LuaObject const & score_fxns,
229  utility::lua::LuaObject const & /*tasks*/,
230  protocols::moves::MoverCacheSP /*cache*/ ){
231  if( def["scorefxn"] ) {
232  score_function_ = protocols::elscripts::parse_scoredef( def["scorefxn"], score_fxns );
233  }
234 
235  if ( def["verbose"] ) {
236  verbose_ = def["verbose"].to<bool>();
237  }
238 }
239 
241  return score_function_;
242 }
243 
245  using namespace basic::options::OptionKeys;
246  option.add_relevant( score::weights );
247  option.add_relevant( score::patch );
248  option.add_relevant( corrections::score::dun10);
249  option.add_relevant( score::empty );
250  option.add_relevant( score::fa_max_dis );
251  option.add_relevant( score::fa_Hatr );
252  option.add_relevant( score::no_smooth_etables);
253  option.add_relevant( score::output_etables );
254  option.add_relevant( score::rms_target );
255  option.add_relevant( score::ramaneighbors );
256  option.add_relevant( score::optH_weights );
257  option.add_relevant( score::optH_patch );
258 }
259 
260 } // simple_moves
261 } // protocols