IMP logo
AllPairContainer.h
Go to the documentation of this file.
1 /**
2  * \file AllPairContainer.h
3  * \brief Return all pairs from a SingletonContainer
4  *
5  * This file is generated by a script (core/tools/make-container).
6  * Do not edit directly.
7  *
8  * Copyright 2007-2012 IMP Inventors. All rights reserved.
9  */
10 
11 #ifndef IMPCONTAINER_ALL_PAIR_CONTAINER_H
12 #define IMPCONTAINER_ALL_PAIR_CONTAINER_H
13 
14 #include "container_config.h"
15 #include <IMP/generic.h>
16 #include <IMP/PairContainer.h>
17 #include <IMP/SingletonContainer.h>
19 #include <IMP/pair_macros.h>
20 IMPCONTAINER_BEGIN_NAMESPACE
21 
22 //! Return all unordered pairs of particles taken from the SingletonContainer
23 /** Here is an example using this container to restrain all particles in a set
24  to be within a a certain distance of one another.
25  \verbinclude restrain_diameter.py
26 
27  \note Sequential access is much more efficient than random access which is
28  suicidally slow for now. Complain if you want fast(er) random access.
29  We might listen.
30 
31  \usesconstraint
32  */
33 class IMPCONTAINEREXPORT AllPairContainer : public PairContainer
34 {
36  friend class AllBipartitePairContainer;
37 #define IMP_AP_LOOP(body) \
38  ParticleIndexes pis= c_->get_indexes(); \
39  for (unsigned int i=0; i< pis.size(); ++i) { \
40  for (unsigned int j=0; j< i; ++j) { \
41  ParticleIndexPair item(pis[i], pis[j]); \
42  body; \
43  } \
44  }
45 
47  IMP_AP_LOOP);
48 
49 #undef IMP_AP_LOOP
50 
51 public:
52  //! Get the individual particles from the passed SingletonContainer
54  std::string name="AllPairContainer%1%");
55 
57 };
58 
59 IMP_OBJECTS(AllPairContainer,AllPairContainers);
60 
61 IMPCONTAINER_END_NAMESPACE
62 
63 #endif /* IMPCONTAINER_ALL_PAIR_CONTAINER_H */

Generated on Tue May 22 2012 23:33:12 for IMP by doxygen 1.8.1