IMP  2.4.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-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"
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 #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_, kernel::RestraintsTemp(1, obj)); }, {}, {});
38  IMP_LIST_ACTION(public, Particle, Particles, particle, particles,
40  { rmf::add_particles(fh_, kernel::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 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)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
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.
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)
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73