8 #ifndef IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
9 #define IMPCONTAINER_CONSECUTIVE_PAIR_CONTAINER_H
11 #include <IMP/container/container_config.h>
20 IMPCONTAINER_BEGIN_NAMESPACE
41 if (!get_model()->get_has_attribute(key_, p[0]))
return false;
42 int ia = get_model()->get_attribute(key_, p[0]);
43 if (!get_model()->get_has_attribute(key_, p[1]))
return false;
44 int ib = get_model()->get_attribute(key_, p[1]);
45 return std::abs(ia - ib) == 1;
52 for (
unsigned int i = 1; i < ps_.size(); ++i) {
53 f->apply_index(get_model(),
59 std::string name =
"ConsecutivePairContainer%1%");
63 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
64 virtual
void do_before_evaluate() IMP_OVERRIDE;
82 return cpc_->get_contains(pip);
103 static IntKey get_exclusive_key() {
104 static IntKey k(
"exclusive consecutive numbering");
107 static ObjectKey get_exclusive_object_key() {
108 static ObjectKey k(
"exclusive consecutive container");
114 ExclusiveConsecutivePairContainer::get_exclusive_object_key();
115 if (!m->get_has_attribute(ok, pp[0]) || !m->get_has_attribute(ok, pp[1]))
120 IntKey k = ExclusiveConsecutivePairContainer::get_exclusive_key();
123 return std::abs(ia - ib) == 1;
131 for (
unsigned int i = 1; i < ps_.size(); ++i) {
132 f->apply_index(get_model(),
140 "ExclusiveConsecutivePairContainer%1%");
144 virtual kernel::
ParticleIndexes get_all_possible_indexes() const IMP_OVERRIDE;
145 virtual
void do_before_evaluate() IMP_OVERRIDE;
160 return ExclusiveConsecutivePairContainer::get_contains(m, pip);
172 IMPCONTAINER_END_NAMESPACE
ParticleIndexes get_indexes(const ParticlesTemp &ps)
virtual int get_value_index(kernel::Model *, const kernel::ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
Import IMP/kernel/pair_macros.h in the namespace.
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Import IMP/kernel/SingletonContainer.h in the namespace.
void apply_generic(F *f) const
apply to each item in container
void apply_generic(F *f) const
apply to each item in container
A smart pointer to a ref-counted Object that is a class memeber.
ParticlesTemp get_particles(kernel::Model *m, const ParticleIndexes &ps)
A container which contains all consecutive pairs from an input list.
#define IMP_PAIR_CONTAINER_METHODS(Name)
A shared container for Pairs.
virtual ParticleIndexPairs get_indexes() const =0
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
A class to store an fixed array of same-typed values.
virtual int get_value_index(kernel::Model *m, const kernel::ParticleIndexPair &pip) const
Compute the predicate and the derivative if needed.
Import IMP/kernel/PairContainer.h in the namespace.
Import IMP/kernel/PairPredicate.h in the namespace.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
#define IMP_PAIR_PREDICATE_METHODS(Name)
Define extra the functions needed for a PairPredicate.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual kernel::ModelObjectsTemp do_get_inputs(kernel::Model *m, const kernel::ParticleIndexes &pi) const
Store a list of ParticlePairsTemp.
Abstract predicate function.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
IMP::kernel::PairPredicate PairPredicate
Declare an efficient stl-compatible map.
Class for storing model, its restraints, constraints, and particles.
Import IMP/kernel/generic.h in the namespace.