IMP logo
IMP Reference Guide  2.16.0
The Integrative Modeling Platform
LogNormalMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/LogNormalMover.h
3  * \brief A modifier that perturbs a point with a log-normal distribution.
4  *
5  * Copyright 2007-2021 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_LOGNORMAL_MOVER_H
10 #define IMPCORE_LOGNORMAL_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include "MonteCarloMover.h"
14 
15 IMPCORE_BEGIN_NAMESPACE
16 
17 //! Modify a set of continuous variables using a log-normal distribution.
18 /** \see MonteCarlo
19  \see NormalMover
20  \note While technically a log-normal distribution only applies to
21  positively bounded variables, a log-normal perturbation has a
22  multiplicative effect that can be applied to negative variables
23  as well.
24  */
25 class IMPCOREEXPORT LogNormalMover : public MonteCarloMover {
26  ParticleIndexes pis_;
27  FloatKeys keys_;
28  Float stddev_;
29  algebra::VectorKDs originals_;
30 
31  void initialize(ParticleIndexes pis, FloatKeys keys, double radius);
32 
33  public:
34  LogNormalMover(Model *m, ParticleIndex pi, const FloatKeys &vars,
35  double stddev);
36  //! Move the x,y,z coordinates
37  LogNormalMover(Model *m, ParticleIndex pi, double stddev);
38 #ifndef IMP_DOXYGEN
39  /** \param[in] sc The set of particles to perturb.
40  \param[in] vars The variables to use (normally the keys for x,y,z)
41  \param[in] sigma The standard deviation to use.
42  */
43  LogNormalMover(const ParticlesTemp &sc, const FloatKeys &vars,
44  Float sigma);
45 
46  LogNormalMover(const ParticlesTemp &sc, Float radius);
47 #endif
48 
49  void set_sigma(Float sigma) {
50  IMP_USAGE_CHECK(sigma > 0, "Sigma must be positive");
51  stddev_ = sigma;
52  }
53 
54  Float get_sigma() const { return stddev_; }
55 
56  protected:
59  virtual void do_reject() IMP_OVERRIDE;
61 };
62 
63 IMPCORE_END_NAMESPACE
64 
65 #endif /* IMPCORE_LOGNORMAL_MOVER_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual void do_reject()=0
Implement reset_proposed_move()
Return value of the MonteCarloMover::propose() function.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:73
A base class for classes which perturb particles.
The base class for movers for Monte Carlo optimization.
virtual MonteCarloMoverResult do_propose()=0
Implement propose_move()
Modify a set of continuous variables using a log-normal distribution.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.