8 #ifndef IMPCORE_PREDICATES_H
9 #define IMPCORE_PREDICATES_H
11 #include <IMP/core/core_config.h>
16 IMPCORE_BEGIN_NAMESPACE
24 "InBoundingBox3DSingletonPredicate%1%")
28 return bb_.get_contains(
XYZ(m, pi).get_coordinates()) ? 1 : 0;
45 "AttributeSingletonPredicate%1%")
49 return m->get_attribute(bb_, pi);
70 m->get_sphere(pi[0]).get_radius() + m->get_sphere(pi[1]).get_radius();
71 #if IMP_HAS_CHECKS > 1
74 for (
unsigned int i = 0; i < 3; ++i) {
75 double delta = std::abs(m->get_sphere(pi[0]).get_center()[i] -
76 m->get_sphere(pi[1]).get_center()[i]);
84 m->get_sphere(pi[1]).get_center()) <
85 algebra::get_squared(sr);
102 template <
class Predicate,
class Score = SingletonScore>
107 Score *get_score(
int val)
const {
108 if (val < offset_ || val > scores_.size() + offset_) {
111 return scores_[val + offset_];
117 std::string name =
"PredicateScore%1%")
119 void set_singleton_score(
int val, Score *score) {
121 "Negative predicate values not supported yet");
122 scores_.resize(std::max<int>(val + 1, scores_.size()));
123 scores_[val] = score;
133 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
134 template <
class Predicate,
class Score>
138 int val = pred_->get_value(m, p);
139 Score *s = get_score(val);
141 return s->Score::evaluate_index(m, p, da);
149 template <
class Predicate,
class Score>
150 inline PredicateSingletonScore<Predicate, Score> *
154 ret->set_score(val, score);
158 IMPCORE_END_NAMESPACE
Class for adding derivatives from restraints to the model.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
virtual int get_value_index(kernel::Model *m, kernel::ParticleIndex pi) const
Compute the predicate and the derivative if needed.
virtual int get_value_index(kernel::Model *m, kernel::ParticleIndex pi) const
Compute the predicate and the derivative if needed.
double get_squared_distance(const VectorD< D > &v1, const VectorD< D > &v2)
compute the squared distance between two vectors
Import IMP/kernel/singleton_macros.h in the namespace.
IMP::kernel::SingletonPredicate SingletonPredicate
A smart pointer to a reference counted object.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Import IMP/kernel/SingletonPredicate.h in the namespace.
A class to store an fixed array of same-typed values.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
virtual int get_value_index(kernel::Model *m, const kernel::ParticleIndexPair &pi) const
Compute the predicate and the derivative if needed.
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.
A decorator for a particle with x,y,z coordinates.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_SINGLETON_PREDICATE_METHODS(Name)
Define extra the functions needed for a SingletonPredicate.
Abstract predicate function.
Abstract predicate function.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
IMP::kernel::PairPredicate PairPredicate
double Float
Basic floating-point value (could be float, double...)
PredicateSingletonScore< Predicate, Score > * create_predicates_singleton_score(Predicate *pred, int val, Score *score)
IMP::kernel::SingletonScore SingletonScore
#define IMP_SINGLETON_SCORE_METHODS(Name)
Class for storing model, its restraints, constraints, and particles.
A decorator for a particle with x,y,z coordinates and a radius.