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%")
40 virtual double evaluate_index(
Model *m,
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>
88 Model *m,
const ParticleIndexes &pis)
const {
90 ret += ds_.get_inputs(m, pis);
95 IMPSCOREFUNCTOR_END_NAMESPACE
Abstract class for scoring object(s) of type ParticleIndexPair.
DistanceScoreT & get_score_functor()
Macros for various classes.
#define IMP_PAIR_SCORE_METHODS(Name)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Create efficient distance-based pair scores.
A more IMP-like version of the std::vector.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Class for storing model, its restraints, constraints, and particles.
Class for adding derivatives from restraints to the model.