IMP logo
IMP Reference Guide  2.5.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 Model data from/to files.
4  *
5  * Copyright 2007-2015 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"
17 #include <IMP/OptimizerState.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 OptimizerState {
26  RMF::FileHandle fh_;
28 
29  public:
30  SaveOptimizerState(Model *m, RMF::FileHandle fh);
31 #ifndef IMP_DOXYGEN
32  IMP_LIST_ACTION(public, Hierarchy, Hierarchies, hierarchy, hierarchies,
34  { rmf::add_hierarchy(fh_, atom::Hierarchy(obj)); }, {}, {});
35  IMP_LIST_ACTION(public, Restraint, estraints, restraint, restraints,
37  { rmf::add_restraints(fh_, RestraintsTemp(1, obj)); }, {}, {});
38  IMP_LIST_ACTION(public, Particle, Particles, particle, particles,
40  { rmf::add_particles(fh_, ParticlesTemp(1, obj)); }, {}, {});
41  IMP_LIST_ACTION(public, Geometry, Geometries, geometry, geometries,
43  { rmf::add_geometries(fh_, display::GeometriesTemp(1, obj)); }, {}, {});
44 #endif
45  //! Use the simulator to tag frames with current time
46  /** \note This may change to a more general mechanism at some point
47  in the future.
48  */
49  void set_simulator(atom::Simulator *sim);
50  //! Write a frame with a given name
51  void update_always(std::string name);
52  // to prevent it from being hidden
54  virtual void do_update(unsigned int call_num) IMP_OVERRIDE;
56 };
57 
58 IMPRMF_END_NAMESPACE
59 
60 #endif /* IMPRMF_SAVE_OPTIMIZER_STATE_H */
The base class for simulators.
Definition: Simulator.h:34
Handle read/write of Model data from/to files.
void add_particles(RMF::FileHandle fh, const ParticlesTemp &hs)
The base class for geometry.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Handle read/write of Model data from/to files.
virtual void do_update(unsigned int)
IMP::Vector< IMP::WeakPointer< Restraint > > RestraintsTemp
Definition: base_types.h:80
Handle read/write of Model data from/to files.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
void add_hierarchy(RMF::FileHandle fh, atom::Hierarchy hs)
The standard decorator for manipulating molecular structures.
void add_restraints(RMF::FileHandle fh, const Restraints &hs)
Simple molecular dynamics optimizer.
Handle read/write of Model data from/to files.
IMP::Vector< IMP::Pointer< Geometry > > Geometries
Shared optimizer state that is invoked upon commitment of new coordinates.
Class to handle individual model particles.
Definition: Particle.h:37
Shared optimizer state.
void add_geometries(RMF::FileHandle file, const display::GeometriesTemp &r)
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:52