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);
101 IMPCORE_END_NAMESPACE
SphereD< 3 > Sphere3D
Typedef for Python.
GenericBoundingSphere3DSingletonScore< UnaryFunction > BoundingSphere3DSingletonScore
#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)
Get the particles from a list of indexes.
#define IMP_LOG_VERBOSE(expr)
A more IMP-like version of the std::vector.
#define IMP_GENERIC_OBJECT(Name, lcname, targument, carguments, cparguments)
Typedefs a default instantiation for a generic (templated) object.
Class for storing model, its restraints, constraints, and particles.
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.
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, ParticleIndex p, DerivativeAccumulator *da) const override
Compute the score and the derivative if needed.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Decorator for a sphere-like particle.
Class for adding derivatives from restraints to the model.
Compile-time generic restraint and constraint support.
A decorator for a particle with x,y,z coordinates and a radius.