8 #ifndef IMPMISC_FREELY_JOINTED_CHAIN_H
9 #define IMPMISC_FREELY_JOINTED_CHAIN_H
11 #include <IMP/misc/misc_config.h>
15 IMPMISC_BEGIN_NAMESPACE
45 double N = (double) N_;
46 beta_ = 3. / 2. / N / b_ / b_;
47 z_min_ = 0.01 / sqrt(beta_);
48 z_min_deriv_ = -199.98 * sqrt(beta_);
49 z_min_int_ = 10.39631095 - std::log(beta_) / 2.;
54 : N_(link_num), b_(link_length) {
61 if (feature < 0) feature = 0;
62 if (feature < z_min_) {
67 2 * std::log(2 * feature) +
68 std::log(
PI / std::pow(beta_, 3)) / 2.,
69 2. * beta_ * feature - 2.0 / feature);
73 virtual double evaluate(
double feature)
const {
74 return evaluate_with_derivative(feature).first;
101 return 1. / sqrt(beta_);
106 return 2. / sqrt(
PI * beta_);
112 double beta_, z_min_, z_min_deriv_, z_min_int_;
115 IMPMISC_END_NAMESPACE
double get_average_distance() const
Get the average distance from the surface.
static const double PI
the constant pi
Various useful constants.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Score on end-to-end distance of freely jointed chain.
Single variable function.
void set_link_length(double b)
Set the length of each chain link.
double get_distance_at_minimum() const
Get the distance at which the score is at its minimum value.
double get_link_length() const
Get length of each chain link.
void set_link_number(int N)
Set the number of links in chain.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
virtual DerivativePair evaluate_with_derivative(double feature) const
Calculate score and derivative with respect to the given feature.
int get_link_number() const
Get number of links in chain.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
Abstract single variable functor class for score functions.