IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
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
{
20
IMP::base::OwnerPointer<IMP::UnaryFunction>
uf_;
21
public
:
22
UnaryFunctionEvaluate
(
IMP::UnaryFunction
*uf): uf_(uf){}
23
template
<
unsigned
int
D>
24
double
get_score(
Model
*,
const
base::Array<D, ParticleIndex>
&,
25
double
distance)
const
{
26
return
uf_->evaluate(distance);
27
}
28
template
<
unsigned
int
D>
29
DerivativePair
get_score_and_derivative(
Model
*,
30
const
base::Array<D, ParticleIndex>
&,
31
double
distance)
const
{
32
return
uf_->evaluate_with_derivative(distance);
33
}
34
};
35
36
IMPSCOREFUNCTOR_END_NAMESPACE
37
38
#endif
/* IMPSCORE_FUNCTOR_UNARY_FUNCTION_EVALUATE_H */