IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
core/BallMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/BallMover.h
3  * \brief A modifier which variables within a ball.
4  *
5  * Copyright 2007-2015 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_BALL_MOVER_H
10 #define IMPCORE_BALL_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/base_types.h>
14 #include <IMP/exception.h>
15 #include "MonteCarloMover.h"
16 
17 IMPCORE_BEGIN_NAMESPACE
18 
19 //! Modify a set of continuous variables by perturbing them within a ball.
20 /** The variables are perturbed within a ball of the
21  given radius.
22  \see MonteCarlo
23  */
24 class IMPCOREEXPORT BallMover : public MonteCarloMover {
25  ParticleIndexes pis_;
26  FloatKeys keys_;
27  double radius_;
28  algebra::VectorKDs originals_;
29 
30  void initialize(ParticleIndexes pis, FloatKeys keys, double radius);
31 
32  public:
33  BallMover(Model *m, ParticleIndex pi, const FloatKeys &vars,
34  double radius);
35  //! Move the x,y,z coordinates
36  BallMover(Model *m, ParticleIndex pi, double radius);
37 
38 #ifndef IMP_DOXYGEN
39  /** The attributes are perturbed within a ball whose dimensionality is
40  given by the number of attributes and radius by the given value.
41  \param[in] sc The set of particles to perturb.
42  \param[in] vars The variables to use (normally the keys for x,y,z)
43  \param[in] radius The radius deviation to use.
44  */
45  BallMover(const ParticlesTemp &sc, const FloatKeys &vars,
46  Float radius);
47 
48  /** The x,y,z coordinates are perturbed within a ball.
49  \param[in] sc The set of particles to perturb.
50  \param[in] radius The radius deviation to use.
51  */
52  BallMover(const ParticlesTemp &sc, Float radius);
53 #endif
54 
55  void set_radius(Float radius) {
56  IMP_ALWAYS_CHECK(radius > 0, "The radius must be positive",
58  radius_ = radius;
59  }
60 
61  Float get_radius() const { return radius_; }
62 
63  protected:
66  virtual void do_reject() IMP_OVERRIDE;
68 };
69 
70 IMPCORE_END_NAMESPACE
71 
72 #endif /* IMPCORE_BALL_MOVER_H */
Basic types used by IMP.
#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()
Modify a set of continuous variables by perturbing them within a ball.
Exception definitions and assertions.
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()
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
#define IMP_ALWAYS_CHECK(condition, message, exception_name)
Throw an exception if a check fails.
Definition: check_macros.h:61
An exception for an invalid value being passed to IMP.
Definition: exception.h:137
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.