IMP  2.3.1
The Integrative Modeling Platform
kernel/PairScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/PairScore.h
3  * \brief Define PairScore.
4  *
5  * WARNING This file was generated from PairScore.h
6  * in /tmp/nightly-build-29065/imp-2.3.1/tools/build/container_templates/kernel
7  * by tools/build/make_containers.py.
8  *
9  * Copyright 2007-2014 IMP Inventors. All rights reserved.
10  */
11 
12 #ifndef IMPKERNEL_PAIR_SCORE_H
13 #define IMPKERNEL_PAIR_SCORE_H
14 
15 #include <IMP/kernel/kernel_config.h>
16 #include "base_types.h"
17 #include "ParticleTuple.h"
18 #include "DerivativeAccumulator.h"
19 #include "internal/container_helpers.h"
21 #include "model_object_helpers.h"
22 
23 IMPKERNEL_BEGIN_NAMESPACE
24 
25 //! Abstract class for scoring object(s) of type ParticlePair
26 /** PairScore will evaluate the score and derivatives
27  for passed object(s) of type ParticlePair.
28 
29  Use in conjunction with various
30  restraints such as IMP::core::PairsRestraint or
31  IMP::core::PairRestraint. The restraints couple the score
32  functions with appropariate lists of object(s) of type ParticlePair.
33 
34  Implementers should check out IMP_PAIR_SCORE().
35 
36  \see PredicatePairRestraint
37 */
38 class IMPKERNELEXPORT PairScore : public ParticleInputs,
39  public base::Object {
40  public:
43  typedef const kernel::ParticlePair& PassArgument;
45  typedef PairModifier Modifier;
46  PairScore(std::string name = "PairScore %1%");
47  //! Compute the score and the derivative if needed.
48  /** \deprecated_at{2.1} Use the index-based evaluate instead. */
49  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
50  virtual double evaluate(const kernel::ParticlePair& vt, DerivativeAccumulator *da) const;
51 
52  //! Compute the score and the derivative if needed.
53  /** evaluate the score and the derivative if needed over vt
54 
55  @param m the model of vt
56  @param vt the index in m of an object of type ParticlePair
57  @param da a derivative accumulator that reweighting
58  computed derivatives. If nullptr, derivatives
59  will not be computed
60  */
61  virtual double evaluate_index(kernel::Model *m, const kernel::ParticleIndexPair& vt,
62  DerivativeAccumulator *da) const;
63 
64  //! Compute the score and the derivative if needed over a set.
65  /** evaluate the score and the derivative if needed over a set
66  of objects in o
67 
68  @param m the model of o
69  @param o objects of type ParticlePair, specified by index
70  @param da a derivative accumulator that reweighting
71  computed derivatives. If nullptr, derivatives
72  will not be computed
73  @param lower_bound index of first item in o to evaluate
74  @param upper_bound index of last item in o to evaluate
75 
76  @note Implementations
77  for these are provided by the IMP_PAIR_SCORE()
78  macro.
79  */
80  virtual double evaluate_indexes(kernel::Model *m, const kernel::ParticleIndexPairs &o,
82  unsigned int lower_bound,
83  unsigned int upper_bound) const;
84 
85  //! Compute the score and the derivative if needed.
86  /** Compute the score and the derivative if needed as in evaluate_index().
87  but may terminate the computation early if the score is higher than max.
88 
89  @return the score if score<= max or some arbitrary value > max otherwise.
90  */
91  virtual double evaluate_if_good_index(kernel::Model *m, const kernel::ParticleIndexPair& vt,
93  double max) const;
94 
95  /** Compute the score and the derivative if needed as in evaluate_index().
96  but may terminate the computation early if the total score is higher than max.
97 
98  @return the score if score<= max or some arbitrary value > max otherwise.
99 
100  Implementations
101  for these are provided by the IMP_PAIR_SCORE()
102  macro.
103  */
104  virtual double evaluate_if_good_indexes(kernel::Model *m,
106  DerivativeAccumulator *da, double max,
107  unsigned int lower_bound,
108  unsigned int upper_bound) const;
109  /** Decompose this pair score acting on the pair into a set of
110  restraints. The scoring function and derivatives should
111  be equal to the current score. The defualt implementation
112  just returns this object bound to the pair.*/
113  Restraints create_current_decomposition(kernel::Model *m,
114  const kernel::ParticleIndexPair& vt) const;
115 
116  protected:
117  /** Overide this to return your own decomposition.*/
118  virtual Restraints do_create_current_decomposition(kernel::Model *m,
119  const kernel::ParticleIndexPair& vt) const;
120 
122 };
123 
124 IMPKERNEL_END_NAMESPACE
125 
126 #endif /* IMPKERNEL_PAIR_SCORE_H */
Class for adding derivatives from restraints to the model.
Class for adding derivatives from restraints to the model.
IMP::kernel::PairScore PairScore
Basic types used by IMP.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Single variable function.
A class to store an fixed array of same-typed values.
Definition: Array.h:33
Abstract class for scoring object(s) of type ParticlePair.
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Classes to handle individual model particles.
A base class for modifiers of kernel::ParticlePairsTemp.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73