IMP  2.1.1
The Integrative Modeling Platform
UnaryFunctionEvaluate.h
Go to the documentation of this file.
1 /**
2  * \file IMP/score_functor/UnaryFunctionEvaluate.h
3  * \brief A Score on the distance between a pair of particles.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H
9 #define IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H
10 
11 #include <IMP/score_functor/score_functor_config.h>
12 #include "Score.h"
13 #include <IMP/UnaryFunction.h>
14 #include <IMP/base/value_macros.h>
15 #include <IMP/base/Pointer.h>
16 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
17 
18 /** A DistanceScore that uses a UnaryFunction.*/
19 class UnaryFunctionEvaluate : public Score {
21 
22  public:
24  template <unsigned int D>
25  double get_score(kernel::Model *,
27  double distance) const {
28  return uf_->evaluate(distance);
29  }
30  template <unsigned int D>
31  DerivativePair get_score_and_derivative(
33  double distance) const {
34  return uf_->evaluate_with_derivative(distance);
35  }
36 };
37 
38 IMPSCOREFUNCTOR_END_NAMESPACE
39 
40 #endif /* IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H */
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
Import IMP/kernel/UnaryFunction.h in the namespace.
Abstract single variable functor class for score functions.
A class to store an fixed array of same-typed values.
Definition: base/Array.h:33
A Score on the distance between a pair of particles.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition: base/types.h:23
Various general useful macros for IMP.
Class for storing model, its restraints, constraints, and particles.