IMP logo
IMP Reference Guide  2.7.0
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-2017 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/value_macros.h>
15 #include <IMP/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(Model *,
27  double distance) const {
28  return uf_->evaluate(distance);
29  }
30  template <unsigned int D>
31  DerivativePair get_score_and_derivative(
32  Model *, const Array<D, ParticleIndex> &,
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 class to store an fixed array of same-typed values.
Definition: Array.h:33
Single variable function.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
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: types.h:23
A nullptr-initialized pointer to an IMP Object.
Various general useful macros for IMP.
A functor for computing a distance based score for two particles.
Definition: Score.h:20
Abstract single variable functor class for score functions.
Definition: UnaryFunction.h:25