8 #ifndef IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_H
9 #define IMPSCORE_FUNCTOR_DISTANCE_PAIR_SCORE_H
11 #include <IMP/score_functor/score_functor_config.h>
15 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
28 template <
class DistanceScoreT>
33 typedef DistanceScoreT DistanceScore;
37 std::string name =
"FunctorDistancePairScore %1%")
59 template <
class DistanceScore>
64 m->get_sphere(p[0]).get_center() - m->get_sphere(p[1]).get_center();
65 double sq = delta.get_squared_magnitude();
66 if (ds_.get_is_trivially_zero(m, p, sq)) {
69 double dist = std::sqrt(sq);
71 std::pair<double, double> sp = ds_.get_score_and_derivative(m, p, dist);
72 static const double MIN_DISTANCE = .00001;
74 if (dist > MIN_DISTANCE) {
77 uv = algebra::get_zero_vector_d<3>();
79 m->add_to_coordinate_derivatives(p[0], uv * sp.second, *da);
80 m->add_to_coordinate_derivatives(p[1], -uv * sp.second, *da);
83 return ds_.get_score(m, p, dist);
86 template <
class DistanceScore>
90 ret += ds_.get_inputs(m, pis);
95 IMPSCOREFUNCTOR_END_NAMESPACE
DistanceScoreT & get_score_functor()
Class for adding derivatives from restraints to the model.
Import IMP/kernel/pair_macros.h in the namespace.
IMP::kernel::PairScore PairScore
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_PAIR_SCORE_METHODS(Name)
Create efficient distance-based pair scores.
A class to store an fixed array of same-typed values.
Abstract class for scoring object(s) of type ParticlePair.
Import IMP/kernel/PairScore.h in the namespace.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for storing model, its restraints, constraints, and particles.