10 #ifndef IMPCORE_BOUNDING_SPHERE_3D_SINGLETON_SCORE_H
11 #define IMPCORE_BOUNDING_SPHERE_3D_SINGLETON_SCORE_H
13 #include <IMP/core/core_config.h>
22 IMPCORE_BEGIN_NAMESPACE
49 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
53 : f_(f), sphere_(sphere) {
55 "The unary function should return "
56 " 0 when passed a value of 0. Not "
64 static const double MIN_DISTANCE = .000001;
68 double d_from_origin= v_from_origin.get_magnitude();
69 double d_from_surface= d_from_origin - sphere_.get_radius();
70 if(core::XYZR::get_is_setup(m,pi)){
72 d_from_surface += xyzr.get_radius();
74 bool inside = d_from_surface<MIN_DISTANCE;
78 IMP_LOG_VERBOSE(
"Particle " << Showable(pi) <<
" is outside sphere: " << xyz
79 <<
" of " << sphere_ << std::endl);
83 xyz.add_to_derivatives(deriv, *da);
86 return f_->evaluate(d_from_surface);
92 IMP_GENERIC_OBJECT(BoundingSphere3DSingletonScore, bounding_sphere_3d_singleton_score,
SphereD< 3 > Sphere3D
Typedef for Python.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_OBJECT_LOG
Set the log level to the object's log level.
Single variable function.
Macros for various classes.
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
#define IMP_LOG_VERBOSE(expr)
A more IMP-like version of the std::vector.
Class for storing model, its restraints, constraints, and particles.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const
Overload this method to specify the inputs.
Abstract class for scoring object(s) of type ParticleIndex.
#define IMP_SINGLETON_SCORE_METHODS(Name)
A decorator for a particle with x,y,z coordinates.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Score XYZ or XYZR particles based on how far outside a sphere they are.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Decorator for a sphere-like particle.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
virtual double evaluate_index(Model *m, ParticleIndex p, DerivativeAccumulator *da) const
Compute the score and the derivative if needed.
Various important functionality for implementing decorators.
A decorator for a particle with x,y,z coordinates and a radius.