IMP  2.1.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-2013 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/kernel/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 kernel::ParticlePair
26  objects of the endpoints.
27  \ingroup bond
28  \see Bonded
29  */
30 class IMPATOMEXPORT BondPairContainer : public PairContainer {
32  int sc_version_;
33 
34  public:
35  template <class F>
36  void apply_generic(F* f) const {
38  Bond bp(get_model(), _1);
39  f->apply_index(get_model(), kernel::ParticleIndexPair(
40  bp.get_bonded(0).get_particle_index(),
41  bp.get_bonded(1).get_particle_index()));
42  });
43  }
44 
45  //! The container containing the bonds
47 
48  virtual kernel::ParticleIndexPairs get_indexes() const IMP_OVERRIDE;
49  virtual kernel::ParticleIndexPairs get_range_indexes() const IMP_OVERRIDE;
50  virtual void do_before_evaluate() IMP_OVERRIDE;
51  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE {
53  ret.push_back(sc_);
54  return ret;
55  }
59 };
60 
62 
63 IMPATOM_END_NAMESPACE
64 
65 #endif /* IMPATOM_BOND_PAIR_CONTAINER_H */
Import IMP/kernel/scoped.h in the namespace.
virtual ParticleIndexes get_all_possible_indexes() const =0
Get contained particles.
virtual kernel::ModelObjectsTemp do_get_inputs() const
Import IMP/kernel/SingletonContainer.h in the namespace.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:146
#define IMP_PAIR_CONTAINER_METHODS(Name)
A shared container for Pairs.
virtual ParticleIndexPairs get_indexes() const =0
Contains decorators for a bond.
A class to store an fixed array of same-typed values.
Definition: base/Array.h:33
Import IMP/kernel/PairContainer.h in the namespace.
virtual ParticleIndexPairs get_range_indexes() const =0
A decorator for wrapping a particle representing a molecular bond.
Import IMP/kernel/PairScore.h in the namespace.
Import IMP/kernel/PairModifier.h in the namespace.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Bonded get_bonded(unsigned int i) const
Get the atom i of the bond.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
void apply_generic(const PairModifier *m) const
Just use apply() in the base class.
#define IMP_CONTAINER_FOREACH(ContainerType, container, operation)
A container that returns pairs of the endpoints of the bonds.
A shared container for Singletons.
Apply a PairScore to a Pair.
Import IMP/kernel/generic.h in the namespace.