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>
22IMPCORE_BEGIN_NAMESPACE
31class GenericBoundingSphere3DSingletonScore :
public SingletonScore {
45 UF *get_unary_function()
const {
return f_; }
52#if !defined(SWIG) && !defined(IMP_DOXYGEN)
54GenericBoundingSphere3DSingletonScore<UF>::GenericBoundingSphere3DSingletonScore(
59 "The unary function should return "
60 " 0 when passed a value of 0. Not "
68 static const double MIN_DISTANCE = .000001;
72 double d_from_origin= v_from_origin.get_magnitude();
73 double d_from_surface= d_from_origin - sphere_.get_radius();
74 if(core::XYZR::get_is_setup(m,pi)){
76 d_from_surface += xyzr.get_radius();
78 bool inside = d_from_surface<MIN_DISTANCE;
82 IMP_LOG_VERBOSE(
"Particle " << Showable(pi) <<
" is outside sphere: " << xyz
83 <<
" of " << sphere_ << std::endl);
87 xyz.add_to_derivatives(deriv, *da);
90 return f_->evaluate(d_from_surface);
Single variable function.
Decorator for a sphere-like particle.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
Abstract class for scoring object(s) of type ParticleIndex.
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.
A decorator for a particle with x,y,z coordinates and a radius.
A decorator for a particle with x,y,z coordinates.
Compile-time generic restraint and constraint support.
#define IMP_LOG_VERBOSE(expr)
#define IMP_OBJECT_LOG
Set the log level to the object's log level.
SphereD< 3 > Sphere3D
Typedef for Python.
GenericBoundingSphere3DSingletonScore< UnaryFunction > BoundingSphere3DSingletonScore
Index< ParticleIndexTag > ParticleIndex
ParticlesTemp get_particles(Model *m, const ParticleIndexes &ps)
Get the particles from a list of indexes.
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
#define IMP_GENERIC_OBJECT(Name, lcname, targument, carguments, cparguments)
Typedefs a default instantiation for a generic (templated) object.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Macros for various classes.
#define IMP_SINGLETON_SCORE_METHODS(Name)
A smart pointer to a ref-counted Object that is a class member.