IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
spb/Gaussian.h
Go to the documentation of this file.
1/**
2 * \file IMP/spb/Gaussian.h \brief Gaussian function.
3 *
4 * Copyright 2007-2022 IMP Inventors. All rights reserved.
5 */
6
7#ifndef IMPSPB_GAUSSIAN_H
8#define IMPSPB_GAUSSIAN_H
9
10#include <IMP/UnaryFunction.h>
11#include <IMP/utility.h>
12#include <IMP/spb/spb_config.h>
13
14IMPSPB_BEGIN_NAMESPACE
15
16//! %Gaussian function (symmetric about the mean)
17/**
18 Senes at al., JMB 366, 436 (2007)
19 */
20class Gaussian : public UnaryFunction {
21 public:
22 /** Create with the given mean and the spring constant k */
23 Gaussian(Float Emin, Float Zmin, Float sigma)
24 : Emin_(Emin), Zmin_(Zmin), sigma_(sigma){};
25
26 /*IMP_UNARY_FUNCTION_INLINE(Gaussian,
27 Emin_ * exp( - (feature - Zmin_) * (feature - Zmin_)
28 / sigma_ / sigma_ / 2.0 ),
29 - Emin_ * exp( - (feature - Zmin_)*(feature - Zmin_)
30 / sigma_ / sigma_ / 2.0 ) * (feature - Zmin_)
31 / sigma_ / sigma_,
32 "Gaussian: " << Emin_ << " and " << Zmin_
33 << " and " << sigma_ << std::endl);
34 */
35
36 virtual DerivativePair evaluate_with_derivative(double feature) const
37 override {
38 return DerivativePair(evaluate(feature),
39 -Emin_ * exp(-(feature - Zmin_) * (feature - Zmin_) /
40 sigma_ / sigma_ / 2.0) *
41 (feature - Zmin_) / sigma_ / sigma_);
42 }
43
44 virtual double evaluate(double feature) const override {
45 return Emin_ *
46 exp(-(feature - Zmin_) * (feature - Zmin_) / sigma_ / sigma_ / 2.0);
47 }
48
50
51 private:
52 Float Emin_;
53 Float Zmin_;
54 Float sigma_;
55};
56
57IMPSPB_END_NAMESPACE
58
59#endif /* IMPSPB_GAUSSIAN_H */
Single variable function.
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
virtual double evaluate(double feature) const override
Calculate score with respect to the given feature.
Gaussian(Float Emin, Float Zmin, Float sigma)
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition types.h:22
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Various general useful functions for IMP.