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>
18IMPSCOREFUNCTOR_BEGIN_NAMESPACE
22template <
class BaseDistanceScore>
23class 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) {}
36 double get_x0()
const {
return x0_; }
38 template <
unsigned int D>
39 double get_score(
Model *m,
41 double distance)
const {
42 return P::get_score(m, pi, distance - x0_);
44 template <
unsigned int D>
47 double distance)
const {
48 return P::get_score_and_derivative(m, p, distance - x0_);
50 template <
unsigned int D>
51 double get_maximum_range(
53 return P::get_maximum_range(m, pi) - x0_;
55 bool get_is_trivially_zero(
Model *m,
57 double squared_distance)
const {
58 return squared_distance >
59 algebra::get_squared(P::get_maximum_range(m, pi) + x0_);
63IMPSCOREFUNCTOR_END_NAMESPACE
Storage of a model, its restraints, constraints and particles.
Functions to deal with very common math operations.
A class to store a fixed array of same-typed values.
Class for storing model, its restraints, constraints, and particles.
Array< 2, ParticleIndex > ParticleIndexPair
An ordered pair of particles, each identified by its ParticleIndex.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Functions and adaptors for dealing with particle indexes.