IMP logo
IMP Reference Guide  2.7.0
The Integrative Modeling Platform
IMP::core::RigidClosePairsFinder Class Reference

Perform more efficient close pair finding when rigid bodies are involved. More...

#include <IMP/core/RigidClosePairsFinder.h>

+ Inheritance diagram for IMP::core::RigidClosePairsFinder:

Detailed Description

Perform more efficient close pair finding when rigid bodies are involved.

The class finds all close pairs consisting of particles taken from the passed list(s) (if they are not rigid bodies) or members of rigid bodies passed as input. That is, given an input list l, for each pair of particles p, q taken from the list that are closer than the distance threshold, it returns

  • (p,q) if neither p or q are RigidBody particles
  • all (r,s) where r is a member of p, s is a member of q, and r and s are closer than the distance threshold if both p and q are RigidBody particles
  • pairs (p,s) or (r,q) as appropriate if only one of p or q is a rigid body.

Consequently, the user must ensure that each RigidBody is assigned a radius that encloses all of its RigidMember particles.

It uses another ClosePairsFinder to find which pairs of particles in the input list or lists are close. Your choice of this can be passed to the constructor.

Note
The bipartite method will also not return any pairs where both members are in the same rigid body.
The bounding spheres are kept in internal coordinates for the rigid body and transformed on the fly. It would probably be faster to cache the transformed results.
The particles are divided up using a grid. The number of grid cells to use should be explored. In addition, with highly eccentric sets of points, there will be too many cells.
Do not reuse RigidClosePairsFinders for different sets of particles from the same rigid body.
1 ## \example core/rigid_collisions.py
2 # Collision detection and building of a non-bonded list can be sped up when rigid bodies are used.
3 # To do this, use a RigidClosePairsFinder.
4 
5 import IMP
6 import IMP.core
7 import IMP.atom
8 import IMP.container
9 import sys
10 
11 IMP.setup_from_argv(sys.argv, "rigid collisions")
12 
13 # This example addes a restraint on nonbonded interactions
14 # Since it is between two rigid bodies, internal interactions are ignored
15 
16 m = IMP.Model()
17 # The particles in the rigid bodies
18 rbps0 = IMP.core.create_xyzr_particles(m, 3, 1)
19 rbps1 = IMP.core.create_xyzr_particles(m, 3, 1)
20 
21 rbp0 = IMP.Particle(m)
22 rbp1 = IMP.Particle(m)
23 
25 
27 
29 lsc.add(rbps0)
30 lsc.add(rbps1)
31 
32 # Set up the nonbonded list
34  lsc, 0, IMP.core.RigidClosePairsFinder(), 2.0)
35 
36 # Set up excluded volume
38 evr = IMP.container.PairsRestraint(ps, nbl)
40 
41 # Set up optimizer
43 o.set_scoring_function(sf)
44 
45 done = False
46 while not done:
47  try:
48  o.optimize(1000)
49  except IMP.ModelException:
50  for d in [rbss0, rbss1]:
51  d.set_transformation(
57  0, 0, 0),
58  IMP.algebra.Vector3D(10, 10, 10)))))
59  else:
60  done = True

The class RigidClosePairsFinder uses CGAL in order to improve its functionality. It will fall back on less good code without it.

See Also
ClosePairsScoreState
RigidBody
cover_members()

Definition at line 59 of file RigidClosePairsFinder.h.

Public Member Functions

 RigidClosePairsFinder (ClosePairsFinder *cpf=nullptr)
 
virtual ModelObjectsTemp do_get_inputs (Model *m, const ParticleIndexes &pis) const
 Overload this method to specify the inputs. More...
 
ParticleIndexPairs get_close_pairs (Model *m, ParticleIndex a, ParticleIndex b, const ParticleIndexes &pa, const ParticleIndexes &pb) const
 
virtual IntPairs get_close_pairs (const algebra::BoundingBox3Ds &bbs) const
 
virtual IntPairs get_close_pairs (const algebra::BoundingBox3Ds &bas, const algebra::BoundingBox3Ds &bbs) const
 
virtual ParticleIndexPairs get_close_pairs (Model *m, const ParticleIndexes &pc) const
 return all close pairs among pc in model m More...
 
virtual ParticleIndexPairs get_close_pairs (Model *m, const ParticleIndexes &pca, const ParticleIndexes &pcb) const
 return all close pairs among pc in model m More...
 
virtual std::string get_type_name () const
 
virtual ::IMP::VersionInfo get_version_info () const
 Get information about the module and version of the object. More...
 
void set_distance (double d)
 
- Public Member Functions inherited from IMP::core::ClosePairsFinder
 ClosePairsFinder (std::string name)
 
double get_distance () const
 
void remove_pair_filter (PairPredicate *d)
 
void remove_pair_filters (const PairPredicates &d)
 
void set_pair_filters (const PairPredicates &ps)
 
void set_pair_filters_order (const PairPredicates &objs)
 
unsigned int add_pair_filter (PairPredicate *obj)
 
void add_pair_filters (const PairPredicates &objs)
 
void clear_pair_filters ()
 
unsigned int get_number_of_pair_filters () const
 
bool get_has_pair_filters ()
 
PairPredicateget_pair_filter (unsigned int i) const
 
PairPredicates get_pair_filters () const
 
void reserve_pair_filters (unsigned int sz)
 
- Public Member Functions inherited from IMP::ParticleInputs
ModelObjectsTemp get_inputs (Model *m, const ParticleIndexes &pis) const
 Get the ModelObjects read when the given list of particles is used. More...
 
- Public Member Functions inherited from IMP::Object
virtual void clear_caches ()
 
CheckLevel get_check_level () const
 
LogLevel get_log_level () const
 
void set_check_level (CheckLevel l)
 
void set_log_level (LogLevel l)
 Set the logging level used in this object. More...
 
void set_was_used (bool tf) const
 
void show (std::ostream &out=std::cout) const
 
const std::string & get_name () const
 
void set_name (std::string name)
 

Additional Inherited Members

- Protected Member Functions inherited from IMP::Object
 Object (std::string name)
 Construct an object with the given name. More...
 
virtual void do_destroy ()
 

Member Function Documentation

virtual ModelObjectsTemp IMP::core::RigidClosePairsFinder::do_get_inputs ( Model m,
const ParticleIndexes pis 
) const
virtual

Overload this method to specify the inputs.

Implements IMP::ParticleInputs.

virtual ParticleIndexPairs IMP::core::RigidClosePairsFinder::get_close_pairs ( Model m,
const ParticleIndexes pc 
) const
virtual

return all close pairs among pc in model m

Implements IMP::core::ClosePairsFinder.

virtual ParticleIndexPairs IMP::core::RigidClosePairsFinder::get_close_pairs ( Model m,
const ParticleIndexes pca,
const ParticleIndexes pcb 
) const
virtual

return all close pairs among pc in model m

Implements IMP::core::ClosePairsFinder.

virtual ::IMP::VersionInfo IMP::core::RigidClosePairsFinder::get_version_info ( ) const
virtual

Get information about the module and version of the object.

Reimplemented from IMP::Object.

Definition at line 93 of file RigidClosePairsFinder.h.


The documentation for this class was generated from the following file: