IMP  2.1.0
The Integrative Modeling Platform
SaveOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file IMP/rmf/SaveOptimizerState.h
3  * \brief Handle read/write of kernel::Model data from/to files.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPRMF_SAVE_OPTIMIZER_STATE_H
10 #define IMPRMF_SAVE_OPTIMIZER_STATE_H
11 
12 #include <IMP/rmf/rmf_config.h>
13 #include "atom_io.h"
14 #include "restraint_io.h"
15 #include "particle_io.h"
16 #include "geometry_io.h"
18 #include <IMP/atom/Simulator.h>
19 
20 IMPRMF_BEGIN_NAMESPACE
21 
22 /** Periodically call the save_frame() method to save the everything
23  associated with the RMF file to file.
24 */
25 class IMPRMFEXPORT SaveOptimizerState : public kernel::OptimizerState {
26  RMF::FileHandle fh_;
28 
29  public:
30  SaveOptimizerState(kernel::Model *m, RMF::FileHandle fh);
31  /** \deprecated_at{2.1} Use one that takes a model. */
32  IMPRMF_DEPRECATED_FUNCTION_DECL(2.1)
33  SaveOptimizerState(RMF::FileHandle fh);
34 #ifndef IMP_DOXYGEN
35  IMP_LIST_ACTION(public, Hierarchy, Hierarchies, hierarchy, hierarchies,
37  { rmf::add_hierarchy(fh_, atom::Hierarchy(obj)); }, {}, {});
38  IMP_LIST_ACTION(public, Restraint, estraints, restraint, restraints,
41  {}, {});
42  IMP_LIST_ACTION(public, Particle, Particles, particle, particles,
44  { rmf::add_particles(fh_, kernel::ParticlesTemp(1, obj)); },
45  {}, {});
46  IMP_LIST_ACTION(
47  public, Geometry, Geometries, geometry, geometries, display::Geometry *,
49  { rmf::add_geometries(fh_, display::GeometriesTemp(1, obj)); }, {}, {});
50 #endif
51  //! Use the simulator to tag frames with current time
52  /** \note This may change to a more general mechanism at some point
53  in the future.
54  */
55  void set_simulator(atom::Simulator *sim);
56  //! Write a frame with a given name
57  void update_always(std::string name);
58  // to prevent it from being hidden
60  virtual void do_update(unsigned int call_num) IMP_OVERRIDE;
62 };
63 
64 IMPRMF_END_NAMESPACE
65 
66 #endif /* IMPRMF_SAVE_OPTIMIZER_STATE_H */
The base class for simulators.
Definition: Simulator.h:34
Handle read/write of kernel::Model data from/to files.
virtual void do_update(unsigned int)
The base class for geometry.
void add_restraints(RMF::FileHandle fh, const kernel::Restraints &hs)
Shared optimizer state that is invoked upon commitment of new coordinates.
Handle read/write of kernel::Model data from/to files.
IMP::base::Vector< IMP::base::Pointer< Geometry > > Geometries
Handle read/write of kernel::Model data from/to files.
void add_hierarchy(RMF::FileHandle fh, atom::Hierarchy hs)
The standard decorator for manipulating molecular structures.
void add_particles(RMF::FileHandle fh, const kernel::ParticlesTemp &hs)
A restraint is a term in an IMP ScoringFunction.
Shared optimizer state.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Simple molecular dynamics optimizer.
Class to handle individual model particles.
Handle read/write of kernel::Model data from/to files.
void add_geometries(RMF::FileHandle file, const display::GeometriesTemp &r)
Class for storing model, its restraints, constraints, and particles.