IMP logo
IMP Reference Guide  develop.31a501ea3f,2026/01/29
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-2022 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 #include <cereal/access.hpp>
17 
18 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
19 
20 /** A DistanceScore that uses a UnaryFunction.*/
21 class UnaryFunctionEvaluate : public Score {
23 
24  friend class cereal::access;
25 
26  template<class Archive> void serialize(Archive &ar) {
27  ar(uf_);
28  }
29 
30  public:
33 
34  IMP::UnaryFunction *get_unary_function() const { return uf_; }
35 
36  template <unsigned int D>
37  double get_score(Model *,
39  double distance) const {
40  return uf_->evaluate(distance);
41  }
42  template <unsigned int D>
43  DerivativePair get_score_and_derivative(
44  Model *, const Array<D, ParticleIndex> &,
45  double distance) const {
46  return uf_->evaluate_with_derivative(distance);
47  }
48 };
49 
50 IMPSCOREFUNCTOR_END_NAMESPACE
51 
52 #endif /* IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H */
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
Definition: UnaryFunction.h:35
A class to store a fixed array of same-typed values.
Definition: Array.h:40
Single variable function.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
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:22
A nullptr-initialized pointer to an IMP Object.
Macros to help in implementing Value objects.
A functor for computing a distance based score for D particles.
Definition: Score.h:20
Abstract single variable functor class for score functions.
Definition: UnaryFunction.h:27