IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
RestraintsScoringFunction.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/RestraintsScoringFunction.h
3  * \brief A scoring function on a list of restraints
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_RESTRAINTS_SCORING_FUNCTION_H
10 #define IMPCORE_RESTRAINTS_SCORING_FUNCTION_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/ScoringFunction.h>
14 #include <IMP/Restraint.h>
15 #include <IMP/internal/RestraintsScoringFunction.h>
16 #include <cereal/access.hpp>
17 #include <cereal/types/base_class.hpp>
18 #include <cereal/types/polymorphic.hpp>
19 
20 IMPCORE_BEGIN_NAMESPACE
21 
22 //! Create a scoring function on a list of restraints.
24 #if defined(IMP_DOXYGEN) || defined(SWIG)
25  public ScoringFunction
26 #else
27  public IMP::internal::RestraintsScoringFunction
28 #endif
29 {
30  friend class cereal::access;
31 
32  template<class Archive> void serialize(Archive &ar) {
33  ar(cereal::base_class<IMP::internal::RestraintsScoringFunction>(this));
34  }
36 
37  public:
39  double weight = 1.0, double max = NO_MAX,
40  std::string name = "RestraintsScoringFunction%1%")
41  : IMP::internal::RestraintsScoringFunction(rs, weight, max, name) {}
43  std::string name)
44  : IMP::internal::RestraintsScoringFunction(rs, 1.0, NO_MAX, name) {}
45 
47 #if defined(SWIG)
48  void do_add_score_and_derivatives(
49  ScoreAccumulator sa, const ScoreStatesTemp &ss) override;
50 
51  void do_add_score_and_derivatives_moved(
52  ScoreAccumulator sa, const ParticleIndexes &moved_pis,
53  const ParticleIndexes &reset_pis,
54  const ScoreStatesTemp &ss) override;
55 
56  virtual Restraints create_restraints() const override;
57  virtual ModelObjectsTemp do_get_inputs() const override;
58 
59  // Expose methods to access the list of restraints from Python
60  Restraints get_restraints() const;
61  void set_restraints(const Restraints& d);
62  unsigned int get_number_of_restraints() const;
63  void clear_restraints();
64  Restraint *get_restraint(unsigned int i) const;
65  void erase_restraint(unsigned int i);
66  unsigned int add_restraint(Restraint *d);
67  void add_restraints(const Restraints& d);
68  unsigned int _python_index_restraint(Restraint *r, unsigned int start,
69  unsigned int stop);
70  IMP_LIST_PYTHON_IMPL(restraint, restraints, Restraints, Restraints)
71 
73 
74 #endif
75 };
76 
77 IMPCORE_END_NAMESPACE
78 
79 #endif /* IMPCORE_RESTRAINTS_SCORING_FUNCTION_H */
const double NO_MAX
Use this value when you want to turn off maximum for restraint evaluation.
RestraintsTemp get_restraints(const Subset &s, const ParticleStatesTable *pst, const DependencyGraph &dg, RestraintSet *rs)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Create a scoring function on a list of restraints.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
void add_restraint(RMF::FileHandle fh, Restraint *hs)
Provide a consistent interface for things that take Restraints as arguments.
Definition: Restraint.h:362
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
void add_restraints(RMF::FileHandle fh, const Restraints &hs)
Class for adding up scores during ScoringFunction evaluation.
Represents a scoring function on the model.
Represents a scoring function on the model.
Restraints create_restraints(RMF::FileConstHandle fh, Model *m)
Abstract base class for all restraints.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56