IMP  2.0.1
The Integrative Modeling Platform
RigidBodyMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/RigidBodyMover.h
3  * \brief A mover that transform a rigid body
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_RIGID_BODY_MOVER_H
10 #define IMPCORE_RIGID_BODY_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include "MonteCarlo.h"
14 #include "MonteCarloMover.h"
15 #include <IMP/algebra/Vector3D.h>
17 #include <IMP/SingletonContainer.h>
18 #include <IMP/core/rigid_bodies.h>
19 IMPCORE_BEGIN_NAMESPACE
20 
21 //! Modify the transformation of a rigid body
22 /** The transformation of a rigid body is moved in a ball of given
23  size. The probability distribution is uniform over the ball.
24  \see MonteCarlo
25  */
26 class IMPCOREEXPORT RigidBodyMover : public MonteCarloMover
27 {
28  algebra::Transformation3D last_transformation_;
29  Float max_translation_;
30  Float max_angle_;
31  ParticleIndex pi_;
32 public:
34  Float max_translation,
35  Float max_rotation);
36 
37 #ifndef IMP_DOXYGEN
38  /** The rigid body is rotated and translated to move
39  \param[in] d the rigid body decorator
40  \param[in] max_translation maximum translation during a step
41  \param[in] max_rotation maximum rotation angle in radians
42  */
43  RigidBodyMover(RigidBody d,Float max_translation,
44  Float max_rotation);
45 #endif
46 
47  void set_maximum_translation(Float mt) {
48  IMP_USAGE_CHECK(mt > 0, "Max translation must be positive");
49  max_translation_=mt;
50  }
51 
52  void set_maximum_rotation(Float mr) {
53  IMP_USAGE_CHECK(mr > 0, "Max rotation must be positive");
54  max_angle_=mr;
55  }
56 
57  Float get_maximum_translation() const {
58  return max_translation_;
59  }
60 
61  Float get_maximum_rotation() const {
62  return max_angle_;
63  }
64 
65 protected:
66  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
67  virtual MonteCarloMoverResult do_propose() IMP_OVERRIDE;
68  virtual void do_reject() IMP_OVERRIDE;
70 };
71 
72 IMPCORE_END_NAMESPACE
73 
74 #endif /* IMPCORE_RIGID_BODY_MOVER_H */