IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
UniformPrior.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/UniformPrior.h
3  * \brief A restraint on a scale parameter.
4  *
5  * Copyright 2007-2023 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPISD_UNIFORM_PRIOR_H
10 #define IMPISD_UNIFORM_PRIOR_H
11 
12 #include <IMP/isd/isd_config.h>
13 #include <IMP/SingletonScore.h>
14 #include <IMP/Restraint.h>
15 #include <cereal/access.hpp>
16 #include <cereal/types/base_class.hpp>
17 
18 IMPISD_BEGIN_NAMESPACE
19 
20 //! Uniform distribution with harmonic boundaries
21 
22 class IMPISDEXPORT UniformPrior : public Restraint
23 {
24  ParticleIndex pi_;
25  double upperb_;
26  double lowerb_;
27  double k_;
28 
29  friend class cereal::access;
30  template<class Archive> void serialize(Archive &ar) {
31  ar(cereal::base_class<Restraint>(this), pi_, upperb_, lowerb_, k_);
32  }
34 
35 public:
36  //! Create the restraint.
37  UniformPrior(IMP::Model* m, Particle *p, double k, double upperb,
38  double lowerb, std::string name="UniformPrior%1%");
39 
40  UniformPrior() {}
41 
42  virtual double
44  const override;
45  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
47 
48  /* call for probability */
49  virtual double get_probability() const
50  {
51  return exp(-unprotected_evaluate(nullptr));
52  }
53 
54  //! \return Information for writing to RMF files
55  RestraintInfo *get_static_info() const override;
56 
57  //! \return Information for writing to RMF files
58  RestraintInfo *get_dynamic_info() const override;
59 
60 };
61 
62 IMPISD_END_NAMESPACE
63 
64 #endif /* IMPISD_UNIFORM_PRIOR_H */
virtual RestraintInfo * get_static_info() const
Definition: Restraint.h:178
virtual RestraintInfo * get_dynamic_info() const
Definition: Restraint.h:190
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Uniform distribution with harmonic boundaries.
Definition: UniformPrior.h:22
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
Define SingletonScore.
Report key:value information on restraints.
Definition: RestraintInfo.h:47
Class to handle individual particles of a Model object.
Definition: Particle.h:43
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56