Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MetricCalculatorFitnessFunction.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 MetricCalculatorFitnessFunction.cc
11 /// @brief
12 /// @author Colin A. Smith
13 
15 
16 #include <core/pose/Pose.hh>
18 #include <basic/MetricValue.hh>
19 
20 #include <utility/vector1.hh>
21 
22 
23 namespace protocols {
24 namespace multistate_design {
25 
27  std::string const & calculator_name,
28  std::string const & key
29 ) :
31  calculator_name_(calculator_name),
32  key_(key)
33 {
34  if ( ! core::pose::metrics::CalculatorFactory::Instance().check_calculator_exists( calculator_name_ ) ) {
35  basic::Error() << "Tried to tie MetricCalculatorFitnessFunction to PoseMetricCalculator " <<
36  calculator_name_ << " but this calculator does not exist." << std::endl;
37  utility_exit();
38  }
39 }
40 
43  core::pose::Pose const & pose
44 ) const
45 {
46  basic::MetricValue<core::Real> fitness_value;
47  pose.metric(calculator_name_, key_, fitness_value);
48 
49  return fitness_value.value();
50 }
51 
52 } // namespace multistate_design
53 } // namespace protocols