8 #ifndef IMPCORE_SPHERE_DISTANCE_PAIR_SCORE_H
9 #define IMPCORE_SPHERE_DISTANCE_PAIR_SCORE_H
11 #include <IMP/core/core_config.h>
21 IMPCORE_BEGIN_NAMESPACE
25 typedef score_functor::SphereDistance<score_functor::UnaryFunctionEvaluate>
34 IMP_FUNCTOR_DISTANCE_PAIR_SCORE(SphereDistancePairScore,
38 =
"SphereDistancePairScore%1%"),
53 HarmonicUpperBoundSphereDistanceScore,
56 =
"HarmonicUpperBoundSphereDistancePairScore%1%"),
75 double get_rest_length()
const {
78 double get_stiffness()
const {
101 HarmonicSphereDistanceScore,
102 (
double x0,
double k,
104 =
"HarmonicSphereDistancePairScore%1%"),
113 HarmonicUpperBoundSphereDiameterPairScore::evaluate_index(
Model *m,
114 const ParticleIndexPair& p,
117 - m->get_sphere(p[1]).get_center();
118 static const double MIN_DISTANCE = .00001;
119 double distance= delta.get_magnitude();
120 double shifted_distance = distance- x0_
121 + m->get_sphere(p[0]).get_radius()
122 + m->get_sphere(p[1]).get_radius();
123 if (shifted_distance < 0)
return 0;
124 double score= .5*k_*square(shifted_distance);
125 if (da && distance > MIN_DISTANCE) {
126 double deriv= k_*shifted_distance;
128 m->add_to_coordinate_derivatives(p[0], uv*deriv, *da);
129 m->add_to_coordinate_derivatives(p[1], -uv*deriv, *da);
144 IMP::OwnerPointer<UnaryFunction> f_;
162 IMP::OwnerPointer<UnaryFunction> f_;
180 SoftSphereDistanceScore,
183 =
"SoftSpherePairScore%1%"),
187 IMPCORE_END_NAMESPACE