IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
NormalMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/NormalMover.h
3  * \brief A modifier which perturbs a point with a normal distribution.
4  *
5  * Copyright 2007-2015 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_NORMAL_MOVER_H
10 #define IMPCORE_NORMAL_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 normal distribution.
18 /** \see MonteCarlo
19  */
20 class IMPCOREEXPORT NormalMover : public MonteCarloMover {
21  ParticleIndexes pis_;
22  FloatKeys keys_;
23  Float stddev_;
24  algebra::VectorKDs originals_;
25 
26  void initialize(ParticleIndexes pis, FloatKeys keys, double radius);
27 
28  public:
29  NormalMover(Model *m, ParticleIndex pi, const FloatKeys &vars,
30  double stddev);
31  //! Move the x,y,z coordinates
32  NormalMover(Model *m, ParticleIndex pi, double stddev);
33 #ifndef IMP_DOXYGEN
34  /** \param[in] sc The set of particles to perturb.
35  \param[in] vars The variables to use (normally the keys for x,y,z)
36  \param[in] sigma The standard deviation to use.
37  */
38  NormalMover(const ParticlesTemp &sc, const FloatKeys &vars,
39  Float sigma);
40 
41  NormalMover(const ParticlesTemp &sc, Float radius);
42 #endif
43 
44  void set_sigma(Float sigma) {
45  IMP_USAGE_CHECK(sigma > 0, "Sigma must be positive");
46  stddev_ = sigma;
47  }
48 
49  Float get_sigma() const { return stddev_; }
50 
51  protected:
54  virtual void do_reject() IMP_OVERRIDE;
56 };
57 
58 IMPCORE_END_NAMESPACE
59 
60 #endif /* IMPCORE_NORMAL_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()
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
A base class for classes which perturb particles.
The base class for movers for MC optimization.
virtual MonteCarloMoverResult do_propose()=0
Implement propose_move()
Modify a set of continuous variables using a normal distribution.
Definition: NormalMover.h:20
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.