IMP  2.0.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-36540/imp-2.0.1/tools/build/container_templates/kernel
7  * by tools/maintenance/setup_containers.py.
8  *
9  * Copyright 2007-2013 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 "input_output_macros.h"
22 
23 IMPKERNEL_BEGIN_NAMESPACE
24 
25 //! Abstract score function
26 /** PairScores will evaluate the score and derivatives
27  for the passed particles. Use in conjunction with various
28  restraints such as IMP::core::PairsRestraint or
29  IMP::core::PairRestraint.
30 
31  Implementers should check out IMP_PAIR_SCORE().
32 */
33 class IMPKERNELEXPORT PairScore : public base::Object
34 {
35  public:
36  typedef ParticlePair Argument;
38  typedef const ParticlePair& PassArgument;
39  typedef const ParticleIndexPair& PassIndexArgument;
40  typedef PairModifier Modifier;
41  PairScore(std::string name="PairScore %1%");
42  //! Compute the score and the derivative if needed.
44  virtual double evaluate(const ParticlePair& vt,
45  DerivativeAccumulator *da) const;
46 
47  //! Compute the score and the derivative if needed.
48  virtual double evaluate_index(Model *m, const ParticleIndexPair& vt,
49  DerivativeAccumulator *da) const;
50 
51  /** Implementations
52  for these are provided by the IMP_PAIR_SCORE()
53  macro.
54  */
55  virtual double evaluate_indexes(Model *m,
56  const ParticleIndexPairs &o,
58  unsigned int lower_bound,
59  unsigned int upper_bound) const ;
60 
61  //! Compute the score and the derivative if needed.
62  virtual double evaluate_if_good_index(Model *m,
63  const ParticleIndexPair& vt,
65  double max) const;
66 
67  /** Implementations
68  for these are provided by the IMP_PAIR_SCORE()
69  macro.
70  */
71  virtual double evaluate_if_good_indexes(Model *m,
72  const ParticleIndexPairs &o,
74  double max,
75  unsigned int lower_bound,
76  unsigned int upper_bound)
77  const;
78  /** Decompose this pair score acting on the pair into a set of
79  restraints. The scoring function and derivatives should
80  be equal to the current score. The defualt implementation
81  just returns this object bound to the pair.*/
82  Restraints create_current_decomposition(Model *m,
83  const ParticleIndexPair& vt) const;
84 
86 
87 protected:
88  /** Overide this to return your own decomposition.*/
89  virtual Restraints do_create_current_decomposition
90  (Model *m, const ParticleIndexPair& vt)const;
91 
93 };
94 
95 IMPKERNEL_END_NAMESPACE
96 
97 #endif /* IMPKERNEL_PAIR_SCORE_H */