IMP  2.0.1
The Integrative Modeling Platform
RigidClosePairsFinder.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/RigidClosePairsFinder.h
3  * \brief Handle rigid bodies by looking at their members
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H
9 #define IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H
10 
11 #include "ClosePairsFinder.h"
12 #include "rigid_bodies.h"
14 #include <IMP/internal/InternalListSingletonContainer.h>
15 #include <IMP/Refiner.h>
16 
17 IMPCORE_BEGIN_NAMESPACE
18 
19 //! Peform more efficient close pair finding when rigid bodies are involved.
20 /** The class finds all close pairs consisting of particles taken from the
21  passed list(s) (if they are not rigid bodies) or members of rigid
22  bodies passed as input. That is, given an input list \c l, for each
23  pair of particles \c p, \c q taken from the list, that are closer than
24  the distance threshold, it returns
25  - if neither \c p or \c q are RigidBody particles it returns
26  (\c p,\c q)
27  - if bother \c p and \c q are RigidBody particles, it returns
28  all \c (\c r,\c s) where \c r is a member of \c p and \c s is member of
29  \c q and \c r and \c s are closer than the distance threshold
30  - pairs \c (\c p,\c s) or \c (\c r,\c q) as appropriate if only one of
31  \c p or \c q is a rigid body.
32 
33  Consequently, the user must ensure that the RigidBody are
34  assigned a radius that encloses all of their RigidMember
35  particles.
36 
37  It uses another ClosePairsFinder to find which pairs of particles in
38  the input list or lists are close. Your choice of this can be passed
39  to the constructor.
40 
41  \note The bipartite method will also not return any pairs where
42  both members are in the same rigid body.
43 
44  \note The bounding spheres are kept in internal coordinates for
45  the rigid body and transformed on the fly. It would probably be
46  faster to cache the tranformed results.
47 
48  \note The particles are divided up using a grid. The number of
49  grid cells to use should be explored. In addition, with highly
50  excentric sets of points, there will be too many cells.
51 
52  \note Do not reuse RigidClosePairsFinders for different sets of
53  particles from the same rigid body.
54 
55  \pythonexample{rigid_collisions}
56 
57  \uses{class RigidClosePairsFinder, CGAL}
58  \see ClosePairsScoreState
59  \see RigidBody
60  \see cover_members()
61  */
62 class IMPCOREEXPORT RigidClosePairsFinder : public ClosePairsFinder
63 {
64  mutable IMP::OwnerPointer<ClosePairsFinder> cpf_;
65  ObjectKey k_;
66  public:
68 
69  ParticlePairsTemp get_close_pairs(Particle *a, Particle *b,
70  const ParticleIndexes &pa,
71  const ParticleIndexes &pb) const;
72 
73  void set_distance(double d) {
74  cpf_->set_distance(d);
75  ClosePairsFinder::set_distance(d);
76  }
77 
78 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
79  internal::MovedSingletonContainer *
80  get_moved_singleton_container(SingletonContainer *c,
81  double thresold) const;
82 #endif
84 
85 };
86 
87 IMPCORE_END_NAMESPACE
88 
89 #endif /* IMPCORE_RIGID_CLOSE_PAIRS_FINDER_H */