IMP  2.0.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/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 :
31  public PairContainer
32 {
33  IMP::OwnerPointer<SingletonContainer> sc_;
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(),
40  ParticleIndexPair(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 ParticleIndexPairs get_indexes() const IMP_OVERRIDE;
49  virtual ParticleIndexPairs get_range_indexes() const IMP_OVERRIDE;
50  virtual void do_before_evaluate() IMP_OVERRIDE;
51  virtual ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE {
52  ModelObjects ret;
53  ret.push_back(sc_);
54  return ret;
55  }
56  IMP_IMPLEMENT_PAIR_CONTAINER(BondPairContainer);
57 };
58 
60 
61 IMPATOM_END_NAMESPACE
62 
63 #endif /* IMPATOM_BOND_PAIR_CONTAINER_H */