IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
18IMPSCOREFUNCTOR_BEGIN_NAMESPACE
19
20/** A DistanceScore that uses a UnaryFunction.*/
21class 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:
31 UnaryFunctionEvaluate(IMP::UnaryFunction *uf) : uf_(uf) {}
32 UnaryFunctionEvaluate() {}
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(
45 double distance) const {
46 return uf_->evaluate_with_derivative(distance);
47 }
48};
49
50IMPSCOREFUNCTOR_END_NAMESPACE
51
52#endif /* IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H */
A nullptr-initialized pointer to an IMP Object.
A Score on the distance between a pair of particles.
Single variable function.
A class to store a fixed array of same-typed values.
Definition Array.h:40
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Abstract single variable functor class for score functions.
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition types.h:22
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144
Macros to help in implementing Value objects.