Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoreEvaluator.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 relax_initialization_protocols
11 /// @brief initialization protocols for relax
12 /// @detailed
13 /// Contains currently: Classic Abinitio
14 ///
15 ///
16 /// @author Oliver Lange
17 
18 
19 // Unit Headers
21 
22 // Package Headers
24 
25 // Project Headers
27 #include <core/pose/Pose.hh>
31 #include <basic/options/option.hh>
32 
34 // AUTO-REMOVED #include <iterator>
35 
36 // Utility headers
37 #include <basic/Tracer.hh>
38 #include <basic/prof.hh>
39 static basic::Tracer tr("protocols.evalution.Score");
40 
41 
42 // option key includes
43 // option key includes
44 
45 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
46 #include <basic/options/keys/in.OptionKeys.gen.hh>
47 
50 #include <utility/vector1.hh>
51 
52 
53 
54 // ObjexxFCL Headers
55 
56 // Utility headers
57 
58 //// C++ headers
59 
60 namespace protocols {
61 namespace simple_filters {
62 
63 using namespace core;
64 
66  evaluation::SingleValuePoseEvaluator< Real >( ( !fullname ? ("score"+tag) : tag ) ),
67  scorefxn_ ( NULL )
68 
69 {
70  if( !scorefxn ) {
71  utility_exit_with_message("Score evaluator score function is NULL");
72  } else {
73  scorefxn_ = scorefxn->clone();
74  }
75  tr.Info << "ScoreEvaluator: " << "score" << tag << " " << std::endl;
76  scorefxn->show( tr.Info );
77 }
78 
80 
83  core::pose::Pose& pose
84 ) const {
86  core::pose::Pose chainbreak_pose( pose );
87  core::pose::Pose nochainbreak_pose( pose );
89  // js.remove_chainbreaks( nochainbreak_pose ); --- whatever comes in should be consistent with constraints..this might make it worse
90  scoring::ScoreFunction chainbreaks_scfxn;
93  chainbreaks_scfxn.set_weight( scoring::chainbreak, scorefxn.get_weight( scoring::chainbreak ) );
96  scorefxn.set_weight( scoring::chainbreak, 0);
97  core::Real val = scorefxn( nochainbreak_pose );
98  return val + chainbreaks_scfxn( chainbreak_pose );
99 }
100 
102  bool centroid( scorefxn_->get_weight( scoring::vdw ) > 0.0 );
103  bool fa( scorefxn_->get_weight( scoring::fa_atr ) > 0.0 );
104  bool pose_fa( pose.is_fullatom() );
105  return (!fa && !centroid) || ( pose_fa && fa && !centroid ) || ( !pose_fa && centroid && !fa );
106 }
107 
109  std::string tag,
110  core::scoring::ResidueSelectionVector const& selection,
112  bool fullname
113 ) :
114  ScoreEvaluator( tag, scorefxn, fullname ),
115  selection_( selection ),
116  rdcs_( NULL )
117 {
118  nres_ = 400; //no worries: if the pose turns out to be larger we repeat that inversion in apply().
120  if ( tr.Trace.visible() ) {
121  for ( core::scoring::ResidueSelectionVector::const_iterator it = selection.begin(); it != selection.end(); ++it ) {
122  tr.Trace << *it << " ";
123  }
124  tr.Trace << std::endl;
125  scorefxn->show( tr.Trace );
126  }
127  if ( !rdcs_ && scorefxn->get_weight( scoring::rdc ) > 0.0 && basic::options::option[ basic::options::OptionKeys::in::file::rdc ].user() ) {
128  rdcs_ = new SelectRDC_Evaluator( selection_, "none");
129  }
130 }
131 
133 
135  // core::Pose my_pose( pose );
136  PROF_START( basic::TRUNCATED_SCORE_EVALUATOR );
138  if ( !scorefxn ) {
139  tr.Trace << "no scorefunction specified in TruncatedScoreEvaluator... make appropriate standard score " << std::endl;
140  if ( pose.is_fullatom() ) {
141  scorefxn = core::scoring::getScoreFunction();
142  } else {
144  }
145  scorefxn->set_weight( scoring::linear_chainbreak, 1.0 );
146  scorefxn->set_weight( scoring::overlap_chainbreak, 1.0 );
147  if ( pose.constraint_set()->has_residue_pair_constraints() ) {
148  scorefxn->set_weight( scoring::atom_pair_constraint, basic::options::option[ basic::options::OptionKeys::constraints::cst_weight ]() );
149  scorefxn->set_weight( scoring::angle_constraint, basic::options::option[ basic::options::OptionKeys::constraints::cst_weight ]() );
150  scorefxn->set_weight( scoring::dihedral_constraint, basic::options::option[ basic::options::OptionKeys::constraints::cst_weight ]() );
151  }
152  }
153 
154  if ( pose.total_residue() != nres_ ) {
155  nres_ = pose.total_residue();
157  }
158 
159  core::pose::Pose chainbreak_pose( pose );
160  core::pose::Pose nochainbreak_pose( pose );
162  // js.remove_chainbreaks( nochainbreak_pose );
163  scoring::ScoreFunction chainbreaks_scfxn;
164  chainbreaks_scfxn.set_weight( scoring::linear_chainbreak, scorefxn->get_weight( scoring::linear_chainbreak ) );
165  chainbreaks_scfxn.set_weight( scoring::overlap_chainbreak, scorefxn->get_weight( scoring::overlap_chainbreak ) );
166  chainbreaks_scfxn.set_weight( scoring::chainbreak, scorefxn->get_weight( scoring::chainbreak ) );
167  scorefxn->set_weight( scoring::linear_chainbreak, 0);
168  scorefxn->set_weight( scoring::overlap_chainbreak, 0);
169  scorefxn->set_weight( scoring::chainbreak, 0);
170 
171  tr.Debug << "compute score without using these residues: ";
172  std::copy( exclude_list_.begin(), exclude_list_.end(), std::ostream_iterator< Size >( tr.Debug, " " ));
173  tr.Debug << std::endl;
174  (*scorefxn)( nochainbreak_pose );
175  core::Real val = scorefxn->get_sub_score_exclude_res( nochainbreak_pose, exclude_list_ );
176  PROF_STOP( basic::TRUNCATED_SCORE_EVALUATOR );
177  if ( rdcs_ ) val += scorefxn->get_weight( scoring::rdc )*rdcs_->apply( nochainbreak_pose );
178  val += chainbreaks_scfxn( chainbreak_pose );
179  return val;
180 }
181 
182 }
183 }