8 #ifndef IMPSCORE_FUNCTOR_ADD_SCORES_H
9 #define IMPSCORE_FUNCTOR_ADD_SCORES_H
11 #include <IMP/score_functor/score_functor_config.h>
14 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
17 template <
class BaseDistanceScore0,
class BaseDistanceScore1>
19 typedef BaseDistanceScore0 P0;
20 typedef BaseDistanceScore1 P1;
25 AddScores(BaseDistanceScore0 p0, BaseDistanceScore1 p1) : p0_(p0), p1_(p1) {}
26 template <
unsigned int D>
29 double distance)
const {
30 return p0_.get_score(m, pi, distance) + p1_.get_score(m, pi, distance);
32 template <
unsigned int D>
35 double distance)
const {
36 DerivativePair ret0 = p0_.get_score_and_derivative(m, p, distance);
37 DerivativePair ret1 = p1_.get_score_and_derivative(m, p, distance);
38 return DerivativePair(ret0.first + ret1.first, ret0.second + ret1.second);
40 template <
unsigned int D>
43 double squared_distance)
const {
44 return p0_.get_is_trivially_zero(m, p, squared_distance) &&
45 p1_.get_is_trivially_zero(m, p, squared_distance);
49 template <
unsigned int D>
52 return std::max(p0_.get_maximum_range(m, p), p1_.get_maximum_range(m, p));
56 return p0_.get_inputs(m, pis) + p1_.get_inputs(m, pis);
58 void show(std::ostream &out)
const {
64 IMPSCOREFUNCTOR_END_NAMESPACE
double get_maximum_range(kernel::Model *m, const base::Array< D, kernel::ParticleIndex > &p) const
A class to store an fixed array of same-typed values.
Functions to deal with very common math operations.
A Score on the distance between a pair of particles.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Class for storing model, its restraints, constraints, and particles.