8#ifndef IMPSCORE_FUNCTOR_SURFACE_DISTANCE_PAIR_SCORE_H
9#define IMPSCORE_FUNCTOR_SURFACE_DISTANCE_PAIR_SCORE_H
11#include <IMP/score_functor/score_functor_config.h>
12#include <IMP/score_functor/internal/surface_helpers.h>
13#include <IMP/score_functor/internal/direction_helpers.h>
17IMPSCOREFUNCTOR_BEGIN_NAMESPACE
31template <
class DistanceScoreT>
32class SurfaceDistancePairScore :
public PairScore {
41 return internal::get_distance_from_surface(center, normal, point, delta);
45 typedef DistanceScoreT DistanceScore;
47 SurfaceDistancePairScore(
48 const DistanceScore &t0,
49 std::string name =
"FunctorSurfaceDistancePairScore %1%")
50 : PairScore(name), ds_(t0) {}
63 DistanceScoreT& get_score_functor()
71template <
class DistanceScore>
78 m->get_sphere(std::get<0>(p)).get_center(),
79 internal::get_direction(m, std::get<0>(p)),
80 m->get_sphere(std::get<1>(p)).get_center(), &delta);
88 std::pair<double, double> sp = ds_.get_score_and_derivative(m, p, dist);
89 m->add_to_coordinate_derivatives(std::get<0>(p), -delta * sp.second, *da);
90 m->add_to_coordinate_derivatives(std::get<1>(p), delta * sp.second, *da);
93 return ds_.get_score(m, p, dist);
97template <
class DistanceScore>
99 DistanceScore>::do_get_inputs(
100 Model *m,
const ParticleIndexes &pis)
const {
102 ret += ds_.get_inputs(m, pis);
120#if defined(SWIG) || defined(IMP_DOXYGEN)
121template <
class DistanceScoreT>
122class SurfaceHeightPairScore :
public PairScore {
124 SurfaceHeightPairScore(
125 const DistanceScore &t0,
126 std::string name =
"FunctorSurfaceHeightPairScore %1%");
129template <
class DistanceScore>
136 return internal::get_height_above_surface(center, normal, point, delta);
139 SurfaceHeightPairScore(
140 const DistanceScore &t0,
141 std::string name =
"FunctorSurfaceHeightPairScore %1%")
142 : SurfaceDistancePairScore<DistanceScore>(t0, name) {}
159#if defined(SWIG) || defined(IMP_DOXYGEN)
160template <
class DistanceScoreT>
161class SurfaceDepthPairScore :
public PairScore {
163 SurfaceDepthPairScore(
164 const DistanceScore &t0,
165 std::string name =
"FunctorSurfaceDepthPairScore %1%");
168template <
class DistanceScore>
175 return internal::get_depth_below_surface(center, normal, point, delta);
178 SurfaceDepthPairScore(
179 const DistanceScore &t0,
180 std::string name =
"FunctorSurfaceDepthPairScore %1%")
181 : SurfaceDistancePairScore<DistanceScore>(t0, name) {}
185IMPSCOREFUNCTOR_END_NAMESPACE
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
Create efficient surface depth-based pair scores.
Create efficient surface distance-based pair scores.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const override
Overload this method to specify the inputs.
virtual double evaluate_index(Model *m, const ParticleIndexPair &pip, DerivativeAccumulator *da) const override
Compute the score and the derivative if needed.
Create efficient surface height-based pair scores.
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
Array< 2, ParticleIndex > ParticleIndexPair
An ordered pair of particles, each identified by its ParticleIndex.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
double get_distance(const VectorD< D > &v1, const VectorD< D > &v2)
Compute the distance between two vectors.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Macros for various classes.
#define IMP_PAIR_SCORE_METHODS(Name)