IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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
20IMPRMF_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*/
26class 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 */
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) override;
56 IMP_OBJECT_METHODS(SaveOptimizerState);
57};
58
59IMPRMF_END_NAMESPACE
60
61#endif /* IMPRMF_SAVE_OPTIMIZER_STATE_H */
Shared optimizer state.
Base class for "simulators", such as molecular dynamics.
Input/output of IMP::atom::Hierarchy information.
void update_always()
Force the state to perform its action now, ignoring the periodicity.
OptimizerState(Model *m, std::string name)
Constructor.
Class to handle individual particles of a Model object.
Definition Particle.h:45
A restraint is a term in an IMP ScoringFunction.
Definition Restraint.h:56
The standard decorator for manipulating molecular structures.
The base class for simulators.
Definition Simulator.h:36
The base class for geometry.
void set_simulator(atom::Simulator *sim)
Use the simulator to tag frames with current time.
virtual void do_update(unsigned int call_num) override
void update_always(std::string name)
Write a frame with a given name.
Handle read/write of geometry data from/to files.
IMP::Vector< IMP::WeakPointer< Geometry > > GeometriesTemp
IMP::Vector< IMP::Pointer< Geometry > > Geometries
void add_geometries(RMF::FileHandle file, const display::GeometriesTemp &r)
Add geometries to the file.
void add_particles(RMF::FileHandle fh, const ParticlesTemp &hs)
void add_restraints(RMF::FileHandle fh, const Restraints &hs)
void add_hierarchy(RMF::FileHandle fh, atom::Hierarchy hs)
IMP::Vector< IMP::Pointer< Restraint > > Restraints
Definition base_types.h:120
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
IMP::Vector< IMP::WeakPointer< Restraint > > RestraintsTemp
Definition base_types.h:120
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Manage read/write of particles from/to RMF files.
Manage read/write of Restraints from/to RMF files.
Smart pointer to Object-derived classes that does not refcount.
Definition WeakPointer.h:78