Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UnfoldedStateEnergy.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 core/scoring/methods/UnfoldedStateEnergy.cc
11 /// @brief Unfolded state energy method implementation; energies based on eneriges of residues in fragments
12 /// @author Ron Jacak (ronj@email.unc.edu)
13 
14 // Unit headers
17 
18 // Package headers
24 #include <basic/Tracer.hh>
25 
26 // Project headers
28 
29 #include <utility/vector1.hh>
30 
31 
32 static basic::Tracer TR("core.scoring.methods.UnfoldedStateEnergy");
33 
34 namespace core {
35 namespace scoring {
36 namespace methods {
37 
38 
39 /// @details This must return a fresh instance of the UnfoldedStateEnergy class, never an instance already in use
42 
43  if ( options.has_method_weights( unfolded ) ) {
44 
45  utility::vector1< Real > const & v = options.method_weights( unfolded );
46  assert( v.size() == scoring::n_score_types );
47 
48  // convert the vector of Reals into an EnergyMap, because that's what the constructor for USE takes.
49  // assumes that the vector of Reals coming in contains the weights for each of the score types in the
50  // scoring namespace enumeration, and more importantly, in the same order.
51  EnergyMap e;
52  for ( Size ii=1; ii < scoring::n_score_types; ++ii ) {
53  e[ (ScoreType) ii ] = v[ii];
54  }
55 
56  return new UnfoldedStateEnergy( options.unfolded_energies_type(), e );
57  }
58  return new UnfoldedStateEnergy( options.unfolded_energies_type() );
59 }
60 
63  ScoreTypes sts;
64  sts.push_back( unfolded );
65  return sts;
66 }
67 
68 
69 ///
70 /// UnfoldedStateEnergy class methods
71 ///
72 
75  type_( type ),
76  unf_state_potential_( ScoringManager::get_instance()->get_UnfoldedStatePotential( type ) ),
77  score_type_weights_( unf_state_potential_.get_unfoled_potential_file_weights() )
78 {
79  TR.Debug << "instantiating class with weights: " << score_type_weights_.show_nonzero() << std::endl;
80 }
81 
84  type_( type ),
85  unf_state_potential_( ScoringManager::get_instance()->get_UnfoldedStatePotential( type ) ),
86  score_type_weights_( emap_in )
87 {
88  TR.Debug << "instantiating class with weights: " << score_type_weights_.show_nonzero() << std::endl;
89 }
90 
92 
96 }
97 
98 void
100  conformation::Residue const & rsd,
101  pose::Pose const &,
102  EnergyMap & emap
103 ) const
104 {
105 
106  // the value this function returns depends on how this class was constructed. if a set of weights was
107  // passed in when the class was constructed, then this function will return a non-zero value.
108  // if no weights were passed in, the member variable energy map will be just zeros and the function
109  // will return 0.0. that's what we want during the first phase of optE. once a weight set has been
110  // established, this class will get recreated with that set of weights and the function will return
111  // meaningful energies.
112 
113  EnergyMap unweighted_unfolded_energies;
114  unf_state_potential_.raw_unfolded_state_energymap( rsd.type().name3(), unweighted_unfolded_energies );
115 
116  // don't forget to include the weight for the entire term. no, wait, that weight should get applied later
117  // in the scoring process. this method should just return the unweighted unfolded state energy.
118  emap[ unfolded ] += unweighted_unfolded_energies.dot( score_type_weights_ );
119 
120  return;
121 }
122 
123 void
127 {
128  return 1; // Initial versioning
129 }
130 
131 
132 } // methods
133 } // scoring
134 } // core
135