8 #ifndef IMPSCORE_FUNCTOR_SPHERE_DISTANCE_H
9 #define IMPSCORE_FUNCTOR_SPHERE_DISTANCE_H
11 #include <IMP/score_functor/score_functor_config.h>
16 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
20 template <
class BaseDistanceScore>
26 typedef BaseDistanceScore P;
27 static double get_rsum(
Model *m,
29 return m->get_sphere(pi[0]).get_radius() +
30 m->get_sphere(pi[1]).get_radius();
36 double distance)
const {
37 return P::get_score(m, pi, distance - get_rsum(m, pi));
41 double distance)
const {
42 return P::get_score_and_derivative(m, pi, distance - get_rsum(m, pi));
44 double get_maximum_range(
Model *m,
46 return P::get_maximum_range(m, pi) + get_rsum(m, pi);
48 bool get_is_trivially_zero(
Model *m,
50 double squared_distance)
const {
51 return squared_distance >
52 algebra::get_squared(P::get_maximum_range(m, pi) + get_rsum(m, pi));
56 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.