IMP  2.0.1
The Integrative Modeling Platform
LognormalRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/LognormalRestraint.h
3  * \brief A lognormal restraint that uses the ISPA model to model NOE-derived
4  * distance fit.
5  *
6  * Copyright 2007-2013 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPISD_LOGNORMAL_RESTRAINT_H
11 #define IMPISD_LOGNORMAL_RESTRAINT_H
12 
13 #include <IMP/restraint_macros.h>
14 #include <IMP/isd/isd_config.h>
15 #include <IMP/Particle.h>
16 #include <IMP/isd/ISDRestraint.h>
17 
18 IMPISD_BEGIN_NAMESPACE
19 
20 //! Normal probability distribution as a restraint
21 class IMPISDEXPORT LognormalRestraint : public ISDRestraint
22 {
23 private:
24  Pointer<Particle> px_;
25  double x_;
26  Pointer<Particle> pmu_;
27  double mu_;
28  Pointer<Particle> psigma_;
29  double sigma_;
30  bool isx_, ismu_, issigma_; // true if it's a particle
31  double chi_;
32 
33 private:
34  void set_chi(double chi) { chi_ = chi; }
35  void check_particles();
36 
37 public:
38  //! Gaussian restraint
39  /** The restraint is a 3-particle restraint, linking together the mean,
40  * observed value and variance, which can all be either Nuisances or doubles.
41  * If F is the identity function, this is a gaussian (e.g. harmonic)
42  * restraint.
43  */
45  LognormalRestraint(double x, Particle *mu, Particle *sigma);
46  LognormalRestraint(Particle *x, double mu, Particle *sigma);
47  LognormalRestraint(Particle *x, Particle *mu, double sigma);
48  LognormalRestraint(double x, double mu, Particle *sigma);
49  LognormalRestraint(Particle *x, double mu, double sigma);
50  LognormalRestraint(double x, Particle *mu, double sigma);
51 
52  /* call for probability */
53  double get_probability() const
54  {
55  return exp(-unprotected_evaluate(nullptr));
56  }
57 
58  double get_chi() const
59  {return chi_; }
60 
61 
63 
64 };
65 
66 IMPISD_END_NAMESPACE
67 
68 #endif /* IMPISD_LOGNORMAL_RESTRAINT_H */