7 #ifndef IMPCORE_HARMONIC_H
8 #define IMPCORE_HARMONIC_H
10 #include <IMP/core/core_config.h>
14 IMPCORE_BEGIN_NAMESPACE
30 double feature)
const override {
32 k_ * (feature - mean_));
35 virtual double evaluate(
double feature)
const override {
36 return 0.5 * k_ * square(feature - mean_);
65 const static Float R = 8.31441 / 4186.8;
66 return R * t / square(sd);
Float get_k() const
Return the spring constant.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Single variable function.
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
void set_k(Float k)
Set the spring constant.
void set_mean(Float mean)
Set the mean of this function.
static Float get_k_from_standard_deviation(Float sd, Float t=297.15)
Return the k to use for a given Gaussian standard deviation.
virtual double evaluate(double feature) const override
Calculate score with respect to the given feature.
For backwards compatibility.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Float get_mean() const
Return the mean of this function.
double Float
Basic floating-point value (could be float, double...)
Harmonic(Float mean, Float k)
Abstract single variable functor class for score functions.
Harmonic function (symmetric about the mean)