IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
SingletonScore.h
Go to the documentation of this file.
1 // Autogenerated by ../../../../tmp/nightly-build-6636/imp-2.5.0/tools/build/make_containers.py
2 // from ../../../../tmp/nightly-build-6636/imp-2.5.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-2015 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 "ParticleTuple.h"
18 #include "DerivativeAccumulator.h"
19 #include "internal/container_helpers.h"
20 #include <IMP/utility_macros.h>
21 #include "model_object_helpers.h"
22 
23 IMPKERNEL_BEGIN_NAMESPACE
24 
25 //! Abstract class for scoring object(s) of type ParticleIndex.
26 /** SingletonScore will evaluate the score and derivatives
27  for passed object(s) of type ParticleIndex.
28 
29  Use in conjunction with various
30  restraints such as IMP::container::SingletonsRestraint or
31  IMP::core::SingletonRestraint. The restraints couple the score
32  functions with appropriate lists of object(s) of type ParticleIndex.
33 
34  Implementers should check out IMP_SINGLETON_SCORE().
35 
36  \see PredicateSingletonRestraint
37 */
38 class IMPKERNELEXPORT SingletonScore : public ParticleInputs,
39  public Object {
40  public:
41  typedef Particle* Argument;
43  typedef Particle* PassArgument;
46  SingletonScore(std::string name = "SingletonScore %1%");
47 
48  //! Compute the score and the derivative if needed.
49  /** @param m the model of vt
50  @param vt the index in m of an object of type Particle
51  @param da a DerivativeAccumulator that weights
52  computed derivatives. If nullptr, derivatives
53  will not be computed.
54  */
55  virtual double evaluate_index(Model *m, ParticleIndex vt,
56  DerivativeAccumulator *da) const = 0;
57 
58  //! Compute the score and the derivative if needed over a set.
59  /** @param m the model of o
60  @param o objects of type Particle, specified by index
61  @param da a derivative accumulator that weights
62  computed derivatives. If nullptr, derivatives
63  will not be computed.
64  @param lower_bound index of first item in o to evaluate
65  @param upper_bound index of last item in o to evaluate
66 
67  @note Implementations for these are provided by
68  the IMP_SINGLETON_SCORE() macro.
69  */
70  virtual double evaluate_indexes(Model *m, const ParticleIndexes &o,
72  unsigned int lower_bound,
73  unsigned int upper_bound) const;
74 
75  //! Compute the score and the derivative if needed, only if "good".
76  /** This functions similarly to evaluate_index(),
77  but may terminate the computation early if the score is higher than max.
78 
79  @return the score if score<= max or some arbitrary value > max otherwise.
80  */
81  virtual double evaluate_if_good_index(Model *m, ParticleIndex vt,
83  double max) const;
84 
85  /** Compute the score and the derivative if needed over a set, only if "good".
86  This functions similarly to evaluate_indexes(), but may terminate
87  the computation early if the total score is higher than max.
88 
89  @return the score if score<= max or some arbitrary value > max otherwise.
90 
91  @note Implementations for these are provided by the IMP_SINGLETON_SCORE()
92  macro.
93  */
94  virtual double evaluate_if_good_indexes(Model *m,
95  const ParticleIndexes &o,
96  DerivativeAccumulator *da, double max,
97  unsigned int lower_bound,
98  unsigned int upper_bound) const;
99 
100  //! Decompose this pair score acting on the pair into a set of restraints.
101  /** The scoring function and derivatives should
102  be equal to the current score. The default implementation
103  just returns this object bound to the pair. */
104  Restraints create_current_decomposition(Model *m,
105  ParticleIndex vt) const;
106 
107  protected:
108  //! Overide this to return your own decomposition.
109  virtual Restraints do_create_current_decomposition(Model *m,
110  ParticleIndex vt) const;
111 
113 };
114 
115 IMPKERNEL_END_NAMESPACE
116 
117 #endif /* IMPKERNEL_SINGLETON_SCORE_H */
A base class for modifiers of ParticlesTemp.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Classes to handle individual model particles.
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.
Single variable function.
Various general useful macros for IMP.
Class to handle individual model particles.
Definition: Particle.h:37
Class for adding derivatives from restraints to the model.