8 #ifndef IMPSCORE_FUNCTOR_SPHERE_DISTANCE_H
9 #define IMPSCORE_FUNCTOR_SPHERE_DISTANCE_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>
24 friend class cereal::access;
25 template<
class Archive>
void serialize(Archive &ar) {
26 ar(cereal::base_class<BaseDistanceScore>(
this));
33 typedef BaseDistanceScore P;
34 static double get_rsum(
Model *m,
36 return m->get_sphere(pi[0]).get_radius() +
37 m->get_sphere(pi[1]).get_radius();
44 double distance)
const {
45 return P::get_score(m, pi, distance - get_rsum(m, pi));
49 double distance)
const {
50 return P::get_score_and_derivative(m, pi, distance - get_rsum(m, pi));
52 double get_maximum_range(
Model *m,
54 return P::get_maximum_range(m, pi) + get_rsum(m, pi);
56 bool get_is_trivially_zero(
Model *m,
58 double squared_distance)
const {
59 return squared_distance >
60 algebra::get_squared(P::get_maximum_range(m, pi) + get_rsum(m, pi));
64 IMPSCOREFUNCTOR_END_NAMESPACE
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.
Helper macros for throwing and handling exceptions.