IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
SaveOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file IMP/rmf/SaveOptimizerState.h
3  * \brief Dump the state of all associated objects into the RMF file.
4  *
5  * Copyright 2007-2020 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 dump the state of all associated objects into the RMF file.
23 /** This is done by calling the save_frame() function. Convenience methods
24  are provided to add hierarchies, restraints, particles, and geometries.
25 */
26 class IMPRMFEXPORT SaveOptimizerState : public OptimizerState {
27  RMF::FileHandle fh_;
29 
30  public:
31  SaveOptimizerState(Model *m, RMF::FileHandle fh);
32 #ifndef IMP_DOXYGEN
33  IMP_LIST_ACTION(public, Hierarchy, Hierarchies, hierarchy, hierarchies,
35  { rmf::add_hierarchy(fh_, atom::Hierarchy(obj)); }, {}, {});
36  IMP_LIST_ACTION(public, Restraint, estraints, restraint, restraints,
38  { rmf::add_restraints(fh_, RestraintsTemp(1, obj)); }, {}, {});
39  IMP_LIST_ACTION(public, Particle, Particles, particle, particles,
41  { rmf::add_particles(fh_, ParticlesTemp(1, obj)); }, {}, {});
42  IMP_LIST_ACTION(public, Geometry, Geometries, geometry, geometries,
44  { rmf::add_geometries(fh_, display::GeometriesTemp(1, obj)); }, {}, {});
45 #endif
46  //! Use the simulator to tag frames with current time
47  /** \note This may change to a more general mechanism at some point
48  in the future.
49  */
50  void set_simulator(atom::Simulator *sim);
51  //! Write a frame with a given name
52  void update_always(std::string name);
53  // to prevent it from being hidden
55  virtual void do_update(unsigned int call_num) IMP_OVERRIDE;
57 };
58 
59 IMPRMF_END_NAMESPACE
60 
61 #endif /* IMPRMF_SAVE_OPTIMIZER_STATE_H */
The base class for simulators.
Definition: Simulator.h:34
Handle read/write of geometry 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
Input/output of IMP::atom::Hierarchy information.
virtual void do_update(unsigned int)
IMP::Vector< IMP::WeakPointer< Restraint > > RestraintsTemp
Definition: base_types.h:84
Manage read/write of Restraints from/to RMF 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.
Manage read/write of particles from/to RMF files.
IMP::Vector< IMP::Pointer< Geometry > > Geometries
Periodically dump the state of all associated objects into the RMF file.
Shared optimizer state that is invoked upon commitment of new coordinates.
Class to handle individual particles of a Model object.
Definition: Particle.h:41
void update_always()
Force the state to perform its action now, ignoring the periodicity.
Shared optimizer state.
void add_geometries(RMF::FileHandle file, const display::GeometriesTemp &r)
Add geometries to the file.
#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:54