IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
BondPairContainer.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/BondPairContainer.h
3  * \brief A fake container for bonds
4  *
5  * Copyright 2007-2021 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPATOM_BOND_PAIR_CONTAINER_H
9 #define IMPATOM_BOND_PAIR_CONTAINER_H
10 
11 #include <IMP/atom/atom_config.h>
12 #include "bond_decorators.h"
13 #include <IMP/generic.h>
14 #include <IMP/PairContainer.h>
15 #include <IMP/PairModifier.h>
16 #include <IMP/PairScore.h>
17 #include <IMP/SingletonContainer.h>
18 #include <IMP/scoped.h>
19 #include <IMP/internal/container_helpers.h>
20 #include <IMP/core/PairRestraint.h>
21 
22 IMPATOM_BEGIN_NAMESPACE
23 
24 //! A container that returns pairs of the endpoints of the bonds.
25 /** Turn a container of Bond particles into a container of ParticlePair
26  objects of the endpoints.
27  \ingroup bond
28  \see Bonded
29  */
30 class IMPATOMEXPORT BondPairContainer : public PairContainer {
32 
33  virtual std::size_t do_get_contents_hash() const IMP_OVERRIDE {
34  return sc_->get_contents_hash();
35  }
36 
37  public:
38  template <class F>
39  void apply_generic(F* f) const {
40  IMP_FOREACH(ParticleIndex pi, sc_->get_contents()) {
41  Bond bp(get_model(), pi);
42  f->apply_index(get_model(), ParticleIndexPair(
45  }
46  }
47 
48  //! The container containing the bonds
50 
54  return ModelObjects(1, sc_);
55  }
59 };
60 
62 
63 IMPATOM_END_NAMESPACE
64 
65 #endif /* IMPATOM_BOND_PAIR_CONTAINER_H */
virtual ParticleIndexPairs get_range_indexes() const =0
A shared container for Pairs.
Definition: PairContainer.h:37
Temporarily set particle attributes.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Definition: Decorator.h:188
A container for Singletons.
virtual ModelObjectsTemp do_get_inputs() const
void apply_generic(const PairModifier *m) const
Just use apply() in the base class.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Contains decorators for a bond.
#define IMP_PAIR_CONTAINER_METHODS(Name)
Definition: pair_macros.h:117
A container for Pairs.
#define IMP_FOREACH(v, r)
A decorator for wrapping a particle representing a molecular bond.
Define PairScore.
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:146
A Modifier on ParticlePairsTemp.
Bonded get_bonded(unsigned int i) const
Get the atom i of the bond.
A shared container for Singletons.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
IMP::Vector< IMP::Pointer< ModelObject > > ModelObjects
Definition: base_types.h:85
A container that returns pairs of the endpoints of the bonds.
virtual ParticleIndexPairs get_indexes() const =0
Apply a PairScore to a Pair.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Compile-time generic restraint and constraint support.