8 #ifndef IMPSCORE_FUNCTOR_SHIFT_H
9 #define IMPSCORE_FUNCTOR_SHIFT_H
11 #include <IMP/score_functor/score_functor_config.h>
15 #include <cereal/access.hpp>
16 #include <cereal/types/base_class.hpp>
18 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
22 template <
class BaseDistanceScore>
23 class Shift :
public BaseDistanceScore {
24 typedef BaseDistanceScore P;
27 friend class cereal::access;
28 template<
class Archive>
void serialize(Archive &ar) {
29 ar(cereal::base_class<BaseDistanceScore>(
this), x0_);
33 Shift(
double x0, BaseDistanceScore base) : P(base), x0_(x0) {}
35 template <
unsigned int D>
36 double get_score(
Model *m,
38 double distance)
const {
39 return P::get_score(m, pi, distance - x0_);
41 template <
unsigned int D>
44 double distance)
const {
45 return P::get_score_and_derivative(m, p, distance - x0_);
47 template <
unsigned int D>
48 double get_maximum_range(
50 return P::get_maximum_range(m, pi) - x0_;
52 bool get_is_trivially_zero(
Model *m,
54 double squared_distance)
const {
55 return squared_distance >
56 algebra::get_squared(P::get_maximum_range(m, pi) + x0_);
60 IMPSCOREFUNCTOR_END_NAMESPACE
Functions and adaptors for dealing with particle indexes.
A class to store a fixed array of same-typed values.
Storage of a model, its restraints, constraints and particles.
Class for storing model, its restraints, constraints, and particles.
Functions to deal with very common math operations.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.