7 #ifndef IMPCORE_HARMONIC_H
8 #define IMPCORE_HARMONIC_H
10 #include <IMP/core/core_config.h>
13 #include <cereal/access.hpp>
14 #include <cereal/types/base_class.hpp>
15 #include <cereal/types/polymorphic.hpp>
17 IMPCORE_BEGIN_NAMESPACE
34 double feature)
const override {
36 k_ * (feature - mean_));
39 virtual double evaluate(
double feature)
const override {
40 return 0.5 * k_ * square(feature - mean_);
69 const static Float R = 8.31441 / 4186.8;
70 return R * t / square(sd);
77 friend class cereal::access;
79 template<
class Archive>
void serialize(Archive &ar) {
80 ar(cereal::base_class<UnaryFunction>(
this), mean_, k_);
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.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Various general useful functions for IMP.
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)