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
29 template <
class DistanceScoreT>
34 typedef DistanceScoreT DistanceScore;
37 std::string name =
"FunctorDistancePairScore %1%")
50 template <
class DistanceScore>
55 m->get_sphere(p[0]).get_center() - m->get_sphere(p[1]).get_center();
56 double sq = delta.get_squared_magnitude();
57 if (ds_.get_is_trivially_zero(m, p, sq)) {
60 double dist = std::sqrt(sq);
62 std::pair<double, double> sp = ds_.get_score_and_derivative(m, p, dist);
63 static const double MIN_DISTANCE = .00001;
65 if (dist > MIN_DISTANCE) {
68 uv = algebra::get_zero_vector_d<3>();
70 m->add_to_coordinate_derivatives(p[0], uv * sp.second, *da);
71 m->add_to_coordinate_derivatives(p[1], -uv * sp.second, *da);
74 return ds_.get_score(m, p, dist);
77 template <
class DistanceScore>
81 ret += ds_.get_inputs(m, pis);
86 IMPSCOREFUNCTOR_END_NAMESPACE
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_PAIR_SCORE_METHODS(Name)
Create efficient distance-based pair scores.
A class to store an fixed array of same-typed values.
Import IMP/kernel/PairScore.h in the namespace.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Class for storing model, its restraints, constraints, and particles.