IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
SerialMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/SerialMover.h
3  * \brief A mover that applies other movers one at a time
4  *
5  * Copyright 2007-2023 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_SERIAL_MOVER_H
10 #define IMPCORE_SERIAL_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include "MonteCarlo.h"
14 #include "MonteCarloMover.h"
15 #include <cereal/access.hpp>
16 #include <cereal/types/base_class.hpp>
17 #include <cereal/types/polymorphic.hpp>
18 #include <cereal/types/vector.hpp>
19 
20 IMPCORE_BEGIN_NAMESPACE
21 
22 //! Applies a list of movers one at a time
23 /** Each time a move is requested, only the next mover in the list
24  is applied.
25  */
26 class IMPCOREEXPORT SerialMover : public MonteCarloMover {
27  int imov_;
28  MonteCarloMovers movers_;
29 
30  friend class cereal::access;
31 
32  template<class Archive> void serialize(Archive &ar) {
33  ar(cereal::base_class<MonteCarloMover>(this),
34  imov_, movers_);
35  }
37 
38  public:
39  /** Constructor.
40  \param[in] mvs list of movers to apply one after another
41  */
43 
44  SerialMover() {}
45 
46  const MonteCarloMovers& get_movers() const { return movers_; }
47 
48  protected:
49  virtual ModelObjectsTemp do_get_inputs() const override;
50  virtual MonteCarloMoverResult do_propose() override;
51  virtual void do_reject() override;
52  virtual void do_accept() override;
54 };
55 
56 IMPCORE_END_NAMESPACE
57 
58 #endif /* IMPCORE_SERIAL_MOVER_H */
Simple Monte Carlo optimizer.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual void do_accept()
Implement accept_proposed_move(); default implementation is empty.
virtual void do_reject()=0
Implement reset_proposed_move()
Return value of the MonteCarloMover::propose() function.
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()
Applies a list of movers one at a time.
Definition: SerialMover.h:26
virtual ModelObjectsTemp do_get_inputs() const =0