Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MinScoreScoreFunction.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 core/scoring/ScoreFunction.cc
10 /// @brief ScoreFunction class definition. A easy way to deal with the low-res score function problem in replica docking
11 /// @author Zhe Zhang
12 
13 
14 // Unit headers
16 
17 // Package headers
18 
19 // // Project headers
20 #include <core/pose/Pose.hh>
21 #include <core/pose/util.hh>
22 #include <core/kinematics/Jump.hh>
24 #include <core/scoring/Energies.hh>
25 #include <basic/Tracer.hh>
26 
27 static basic::Tracer tr("core.scoring.MinScoreScoreFunction");
28 
29 namespace core {
30 namespace scoring {
31 
32 ///////////////////////////////////////////////////////////////////////////////
35  {}
36 
37 ///////////////////////////////////////////////////////////////////////////////
40 {
41  return new MinScoreScoreFunction( *this );
42 }
43 
44 ///////////////////////////////////////////////////////////////////////////////
47 {
49  return *this;
50 }
51 
52 ///////////////////////////////////////////////////////////////////////////////
54  ScoreFunction( src ),
55  min_score_( src.min_score_ )
56 {}
57 
59  ScoreFunction( src )
60 {
61  min_score_ = min_score;
62 }
63 
65  ScoreFunction( *src )
66 {
67  min_score_ = min_score;
68 }
69 
71  ScoreFunction( *src )
72 {
73  min_score_ = min_score;
74 }
75 
76 ///////////////////////////////////////////////////////////////////////////////
77 
78 // to start out, just thinking fullatom energies
79 //
80 // NOTE: no freakin rotamer trials inside scoring!
81 Real
83 {
84  ScoreFunction::operator()( pose ); //score -- but without atom_pair_constraints..
85  // is probably cheaper to not apply a completely new scorefunction...
86  EnergyMap cst_free_weights( weights() );
87  Real cst_weight = cst_free_weights.get( atom_pair_constraint );
88  cst_free_weights[ atom_pair_constraint ] = 0;
89  Real uncst_energy = pose.energies().total_energies().dot( cst_free_weights );
90  Real min_energy = uncst_energy < min_score_ ? min_score_ : uncst_energy;
91  tr.Debug << "uncst_energy: " << uncst_energy << " min_energy: " << min_energy << std::endl;
92  pose.energies().total_energies()[ total_score ] = min_energy + pose.energies().total_energies()[ atom_pair_constraint ]*cst_weight;
93  pose::setPoseExtraScores( pose, "min_score", uncst_energy );
94  return pose.energies().total_energies()[ total_score ];
95 }
96 
97 
98 ///////////////////////////////////////////////////////////////////////////////
99 } // namespace scoring
100 } // namespace core