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>
14 #include <cereal/access.hpp>
15 #include <cereal/types/base_class.hpp>
17 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
30 template <
class DistanceScoreT>
34 friend class cereal::access;
36 template<
class Archive>
void serialize(Archive &ar) {
37 ar(cereal::base_class<PairScore>(
this), ds_);
41 typedef DistanceScoreT DistanceScore;
45 std::string name =
"FunctorDistancePairScore %1%")
49 virtual double evaluate_index(
Model *m,
68 template <
class DistanceScore>
73 m->get_sphere(p[0]).get_center() - m->get_sphere(p[1]).get_center();
74 double sq = delta.get_squared_magnitude();
75 if (ds_.get_is_trivially_zero(m, p, sq)) {
78 double dist = std::sqrt(sq);
80 std::pair<double, double> sp = ds_.get_score_and_derivative(m, p, dist);
81 static const double MIN_DISTANCE = .00001;
83 if (dist > MIN_DISTANCE) {
86 uv = algebra::get_zero_vector_d<3>();
88 m->add_to_coordinate_derivatives(p[0], uv * sp.second, *da);
89 m->add_to_coordinate_derivatives(p[1], -uv * sp.second, *da);
92 return ds_.get_score(m, p, dist);
95 template <
class DistanceScore>
97 Model *m,
const ParticleIndexes &pis)
const {
99 ret += ds_.get_inputs(m, pis);
104 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.