OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
StatusFunction.hpp
1#ifndef OPTIMIZATION_STATUSFUNCTION_HPP
2#define OPTIMIZATION_STATUSFUNCTION_HPP
3
4#include <config.h>
5
6#include "brains/Stats.hpp"
7#include "io/DumpWriter.hpp"
8#include "io/StatWriter.hpp"
9
10namespace OpenMD {
12 public:
13 virtual ~StatusFunction() {}
14 virtual void writeStatus(int, int, const DynamicVector<RealType>&,
15 RealType) {}
16 };
17
18 //! No status
19 class NoStatus : public StatusFunction {
20 public:
21 virtual void writeStatus(int, int, const DynamicVector<RealType>&,
22 RealType) {};
23 };
24
26 public:
27 DumpStatusFunction(SimInfo* info) : StatusFunction(), info_(info) {
28 stats = new Stats(info_);
29 dumpWriter = new DumpWriter(info_);
30 Stats::StatsBitSet mask;
31 mask.set(Stats::TIME);
32 mask.set(Stats::POTENTIAL_ENERGY);
33 stats->setStatsMask(mask);
34 statWriter = new StatWriter(info_->getStatFileName(), stats);
35 }
36
37 virtual void writeStatus(int functionCount, int,
38 const DynamicVector<RealType>&, RealType) {
39 Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
40 curSnapshot->setTime(functionCount);
41 stats->collectStats();
42 statWriter->writeStat();
43
44 dumpWriter->writeDumpAndEor();
45 }
47 delete stats;
48 delete dumpWriter;
49 delete statWriter;
50 }
51
52 private:
53 SimInfo* info_ {nullptr};
54 Stats* stats;
55 DumpWriter* dumpWriter;
56 StatWriter* statWriter;
57 };
58} // namespace OpenMD
59
60#endif
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
SnapshotManager * getSnapshotManager()
Returns the snapshot manager.
Definition SimInfo.hpp:248
The Snapshot class is a repository storing dynamic data during a Simulation.
Definition Snapshot.hpp:147
Snapshot * getCurrentSnapshot()
Returns the pointer of current snapshot.
A configurable Statistics Writer.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.