IMP  2.0.1
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-2013 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 {
22  ParticleIndexes pis_;
23  FloatKeys keys_;
24  Float stddev_;
25  algebra::VectorKDs originals_;
26 
27  void initialize(ParticleIndexes pis,
28  FloatKeys keys,
29  double radius);
30 public:
32  const FloatKeys &vars, double stddev);
33  //! Move the x,y,z coordinates
34  NormalMover(Model *m, ParticleIndex pi, double stddev);
35 #ifndef IMP_DOXYGEN
36  /** \param[in] sc The set of particles to perturb.
37  \param[in] vars The variables to use (normally the keys for x,y,z)
38  \param[in] sigma The standard deviation to use.
39  */
40  NormalMover(const ParticlesTemp &sc,
41  const FloatKeys &vars,
42  Float sigma);
43 
44  NormalMover(const ParticlesTemp &sc,
45  Float radius);
46 #endif
47 
48  void set_sigma(Float sigma) {
49  IMP_USAGE_CHECK(sigma > 0, "Sigma must be positive");
50  stddev_=sigma;
51  }
52 
53  Float get_sigma() const {
54  return stddev_;
55  }
56 
57 protected:
58  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
59  virtual MonteCarloMoverResult do_propose() IMP_OVERRIDE;
60  virtual void do_reject() IMP_OVERRIDE;
62 };
63 
64 IMPCORE_END_NAMESPACE
65 
66 #endif /* IMPCORE_NORMAL_MOVER_H */