IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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>
18#include <IMP/scoped.h>
19#include <IMP/internal/container_helpers.h>
21
22IMPATOM_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 */
30class IMPATOMEXPORT BondPairContainer : public PairContainer {
32
33 virtual std::size_t do_get_contents_hash() const override {
34 return sc_->get_contents_hash();
35 }
36
37 public:
38 template <class F>
39 void apply_generic(F* f) const {
40 for(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
51 virtual ParticleIndexPairs get_indexes() const override;
52 virtual ParticleIndexPairs get_range_indexes() const override;
53 virtual ModelObjectsTemp do_get_inputs() const override {
54 return ModelObjects(1, sc_);
55 }
59};
60
62
63IMPATOM_END_NAMESPACE
64
65#endif /* IMPATOM_BOND_PAIR_CONTAINER_H */
A container for Pairs.
A Modifier on ParticlePairsTemp.
Apply a PairScore to a Pair.
Define PairScore.
A container for Singletons.
Contains decorators for a bond.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Definition Decorator.h:211
A shared container for Singletons.
A container that returns pairs of the endpoints of the bonds.
virtual ParticleIndexPairs get_range_indexes() const override
BondPairContainer(SingletonContainer *sc)
The container containing the bonds.
virtual ParticleIndexPairs get_indexes() const override
virtual ModelObjectsTemp do_get_inputs() const override
ParticleIndexes get_all_possible_indexes() const override
Get contained particles.
A decorator for wrapping a particle representing a molecular bond.
Bonded get_bonded(unsigned int i) const
Get the atom i of the bond.
Compile-time generic restraint and constraint support.
IMP::Vector< IMP::Pointer< BondPairContainer > > BondPairContainers
IMP::Vector< IMP::Pointer< ModelObject > > ModelObjects
Definition base_types.h:122
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
IMP::Vector< ParticleIndexPair, std::allocator< ParticleIndexPair > > ParticleIndexPairs
Definition base_types.h:208
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
Definition base_types.h:199
Array< 2, ParticleIndex > ParticleIndexPair
An ordered pair of particles, each identified by its ParticleIndex.
Definition base_types.h:202
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
#define IMP_PAIR_CONTAINER_METHODS(Name)
Temporarily set particle attributes.
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144