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