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%"):
45 template <
class DistanceScore>
50 m->get_sphere(p[1]).get_center();
51 double sq= delta.get_squared_magnitude();
52 if (ds_.get_is_trivially_zero(m, p, sq)) {
return 0;}
53 double dist= std::sqrt(sq);
55 std::pair<double, double> sp=
56 ds_.get_score_and_derivative(m, p, dist);
57 static const double MIN_DISTANCE = .00001;
59 if (dist > MIN_DISTANCE) {
62 uv= algebra::get_zero_vector_d<3>();
64 m->add_to_coordinate_derivatives(p[0], uv*sp.second, *da);
65 m->add_to_coordinate_derivatives(p[1], -uv*sp.second, *da);
68 return ds_.get_score(m, p, dist);
71 template <
class DistanceScore>
73 do_get_inputs(
Model *m,
74 const ParticleIndexes &pis)
const {
76 ret+= ds_.get_inputs(m, pis);
79 template <
class DistanceScore>
80 inline void DistancePairScore<DistanceScore>::
81 do_show(std::ostream &)
const {
87 IMPSCOREFUNCTOR_END_NAMESPACE