IMP  2.0.1
The Integrative Modeling Platform
ClosePairsPairScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ClosePairsPairScore.h
3  * \brief Apply a PairScore to close pairs.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPCORE_CLOSE_PAIRS_PAIR_SCORE_H
9 #define IMPCORE_CLOSE_PAIRS_PAIR_SCORE_H
10 
11 #include <IMP/core/core_config.h>
12 #include "XYZR.h"
13 #include "RigidClosePairsFinder.h"
14 
15 #include <IMP/PairScore.h>
16 #include <IMP/UnaryFunction.h>
17 #include <IMP/Pointer.h>
18 #include <IMP/Refiner.h>
19 #include <IMP/internal/container_helpers.h>
20 
21 IMPCORE_BEGIN_NAMESPACE
22 /** Apply a score to a fixed number of close pairs from the two sets.
23 
24  Apply the score to either the k closest pairs (sphere distance). The
25  envisioned use case is that the two particles each represent a protein
26  and the refiners return the geometry for that protein.
27  \see ClosePairsScoreState
28  */
29 class IMPCOREEXPORT KClosePairsPairScore : public PairScore
30 {
31  IMP::OwnerPointer<Refiner> r_;
32  IMP::OwnerPointer<PairScore> f_;
33  int k_;
34  mutable double last_distance_;
35  IMP::OwnerPointer<RigidClosePairsFinder> cpf_;
36  ParticleIndexPairs get_close_pairs(Model *m,
37  const ParticleIndexPair &pp) const;
38 
39 public:
40  /** only score the k closest pairs.
41  */
43  int k=1);
44 
45  ParticlePairsTemp get_close_pairs(const ParticlePair &pp) const {
46  return IMP::internal::get_particle(pp[0]->get_model(),
47  get_close_pairs(pp[0]->get_model(),
49  }
50 
52  const ParticleIndexPair &vt) const;
53 
55 };
56 
57 
58 
59 /** Apply the score to all pairs whose
60  spheres are within a certain distance threshold.
61 
62  \see ClosePairsScoreState
63  */
64 class IMPCOREEXPORT ClosePairsPairScore : public PairScore
65 {
66  IMP::OwnerPointer<Refiner> r_;
67  IMP::OwnerPointer<PairScore> f_;
68  Float th_;
69  IMP::OwnerPointer<RigidClosePairsFinder> cpf_;
70  ParticleIndexPairs get_close_pairs(Model *m,
71  const ParticleIndexPair &pp) const;
72 public:
73  /** \param[in] r The Refiner to call on each particle
74  \param[in] f The pair score to apply to the generated pairs
75  \param[in] max_distance Only score pairs which are close than
76  the max_distance
77  */
79  Float max_distance);
80 
81  ParticlePairsTemp get_close_pairs(const ParticlePair &pp) const {
82  return IMP::internal::get_particle(pp[0]->get_model(),
83  get_close_pairs(pp[0]->get_model(),
85  }
87  const ParticleIndexPair &vt) const;
88 
90 };
91 
92 IMPCORE_END_NAMESPACE
93 
94 #endif /* IMPCORE_CLOSE_PAIRS_PAIR_SCORE_H */