IMP logo
IMP Reference Guide  2.20.1
The Integrative Modeling Platform
SurfaceMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/SurfaceMover.h
3  * \brief A mover that transforms a Surface.
4  *
5  * Copyright 2007-2023 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_SURFACE_MOVER_H
10 #define IMPCORE_SURFACE_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/core/Surface.h>
14 #include <IMP/core/MonteCarlo.h>
16 #include <IMP/Particle.h>
17 #include <IMP/Object.h>
18 #include <IMP/Model.h>
19 #include <cereal/access.hpp>
20 #include <cereal/types/base_class.hpp>
21 #include <cereal/types/polymorphic.hpp>
22 
23 
24 IMPCORE_BEGIN_NAMESPACE
25 
26 //! Modify a surface orientation.
27 /** The Surface is transformed via translation, rotation, and/or
28  reflection.
29 
30  If combined with a `LateralSurfaceConstraint`, then only
31  the normal component of the translation is kept.
32 
33  \see Surface
34  \see LateralSurfaceConstraint
35  \see MonteCarlo
36 */
37 class IMPCOREEXPORT SurfaceMover : public MonteCarloMover {
38  private:
39  algebra::Transformation3D last_transform_;
40  Float max_translation_;
41  Float max_angle_;
42  Float reflect_prob_;
43  ParticleIndex pi_;
44 
45  void initialize(ParticleIndex pi, double max_translation,
46  double max_rotation, double reflect_probability);
47 
48  friend class cereal::access;
49  template<class Archive> void serialize(Archive &ar) {
50  ar(cereal::base_class<MonteCarloMover>(this), last_transform_,
51  max_translation_, max_angle_, reflect_prob_, pi_);
52  }
54 
55  public:
56  SurfaceMover(Model *m, ParticleIndex pi, Float max_translation,
57  Float max_rotation, Float reflect_probability);
58 
59  SurfaceMover(Surface s, Float max_translation, Float max_rotation,
60  Float reflect_probability);
61 
62  SurfaceMover() {}
63 
64  //! Set the maximum translation in angstroms.
65  void set_maximum_translation(Float mt);
66 
67  //! Set the maximum rotation in radians.
68  void set_maximum_rotation(Float mr);
69 
70  //! Set the frequency of reflection moves.
71  void set_reflect_probability(Float rp);
72 
73  //! Get the maximum translation.
74  Float get_maximum_translation() const { return max_translation_; }
75 
76  //! Get the maximum rotation.
77  Float get_maximum_rotation() const { return max_angle_; }
78 
79  //! Get the frequency of reflection moves.
80  Float get_reflect_probability() const { return reflect_prob_; }
81 
82  //! Get the surface being moved.
83  Surface get_surface() const { return Surface(get_model(), pi_); }
84 
85  protected:
86  virtual ModelObjectsTemp do_get_inputs() const override;
87  virtual MonteCarloMoverResult do_propose() override;
88  virtual void do_reject() override;
90 };
91 
92 IMPCORE_END_NAMESPACE
93 
94 #endif /* IMPCORE_SURFACE_MOVER_H */
Simple 3D transformation class.
Simple Monte Carlo optimizer.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Storage of a model, its restraints, constraints and particles.
virtual void do_reject()=0
Implement reset_proposed_move()
Return value of the MonteCarloMover::propose() function.
Float get_maximum_rotation() const
Get the maximum rotation.
Definition: SurfaceMover.h:77
Modify a surface orientation.
Definition: SurfaceMover.h:37
Surface get_surface() const
Get the surface being moved.
Definition: SurfaceMover.h:83
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Simple surface decorator.
A base class for classes which perturb particles.
The base class for movers for Monte Carlo optimization.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
virtual MonteCarloMoverResult do_propose()=0
Implement propose_move()
A decorator for a particle that represents a surface, its coordinates, and orientation.
Definition: Surface.h:35
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Float get_reflect_probability() const
Get the frequency of reflection moves.
Definition: SurfaceMover.h:80
Float get_maximum_translation() const
Get the maximum translation.
Definition: SurfaceMover.h:74
A shared base class to help in debugging and things.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
virtual ModelObjectsTemp do_get_inputs() const =0