IMP logo
IMP Reference Guide  2.10.0
The Integrative Modeling Platform
SingletonScore.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/SingletonScore.h
7  * \brief Define SingletonScore.
8  *
9  * Copyright 2007-2018 IMP Inventors. All rights reserved.
10  */
11 
12 #ifndef IMPKERNEL_SINGLETON_SCORE_H
13 #define IMPKERNEL_SINGLETON_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 ParticleIndex.
25 /** SingletonScore will evaluate the score and derivatives
26  for passed object(s) of type ParticleIndex.
27 
28  Use in conjunction with various
29  restraints such as IMP::container::SingletonsRestraint or
30  IMP::core::SingletonRestraint. The restraints couple the score
31  functions with appropriate lists of object(s) of type ParticleIndex.
32 
33  Implementers should check out IMP_SINGLETON_SCORE().
34 
35  \see PredicateSingletonRestraint
36 */
37 class IMPKERNELEXPORT SingletonScore : public ParticleInputs,
38  public Object {
39  public:
40  typedef Particle* Argument;
42  typedef Particle* PassArgument;
45  SingletonScore(std::string name = "SingletonScore %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 Particle
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, ParticleIndex 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 Particle, 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_SINGLETON_SCORE() macro.
68  */
69  virtual double evaluate_indexes(Model *m, const ParticleIndexes &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, ParticleIndex 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_SINGLETON_SCORE()
91  macro.
92  */
93  virtual double evaluate_if_good_indexes(Model *m,
94  const ParticleIndexes &o,
95  DerivativeAccumulator *da, double max,
96  unsigned int lower_bound,
97  unsigned int upper_bound) const;
98 
99  //! Decompose this SingletonScore 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  ParticleIndex vt) const;
108 
109  protected:
110  //! Override this to return your own decomposition.
111  virtual Restraints do_create_current_decomposition(Model *m,
112  ParticleIndex vt) const;
113 
115 };
116 
117 IMPKERNEL_END_NAMESPACE
118 
119 #endif /* IMPKERNEL_SINGLETON_SCORE_H */
A base class for modifiers of ParticlesTemp.
Basic types used by IMP.
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.
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
Abstract class for scoring object(s) of type ParticleIndex.
Classes used in the construction of ModelObjects.
Various general useful macros for IMP.
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Class for adding derivatives from restraints to the model.