IMP  2.0.1
The Integrative Modeling Platform
Mover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/Mover.h
3  * \brief Backwards compatibility.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_MOVER_H
10 #define IMPCORE_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include "MonteCarloMover.h"
14 #include <IMP/Model.h>
15 #include <IMP/Particle.h>
16 
17 IMPCORE_BEGIN_NAMESPACE
18 
19 #if defined(IMP_DOXYGEN) || IMP_HAS_DEPRECATED
20 
21 //! A base class for classes which perturb particles.
22 /** Mover objects are designed primarily to be used with
23  the Monte Carlo optimizer. You probably want to use MoverBase
24  if you are implementing a Mover.
25  \see MonteCarlo
26  */
27 class IMPCOREEXPORT Mover: public MonteCarloMover
28 {
29 public:
30  Mover(Model *m, std::string name): MonteCarloMover(m, name) {}
31 
32  virtual ParticlesTemp propose_move(Float size)=0;
33 
34  //! Roll back any changes made to the Particles
35  virtual void reset_move()=0;
36 
37  //! Return the set of particles over which moves can be proposed
38  virtual ParticlesTemp get_output_particles() const=0;
39 
40  protected:
41  virtual ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE {
42  return get_as<ModelObjectsTemp>(get_output_particles());
43  }
44  virtual MonteCarloMoverResult do_propose() IMP_OVERRIDE {
45  return MonteCarloMoverResult(get_indexes(propose_move(1.0)), 1.0);
46  }
47  virtual void do_reject() IMP_OVERRIDE {
48  reset_move();
49  }
50 };
51 
52 typedef MonteCarloMovers Movers;
53 typedef MonteCarloMoversTemp MoversTemp;
54 #endif
55 
56 IMPCORE_END_NAMESPACE
57 
58 #endif /* IMPCORE_MOVER_H */