1#ifndef RPG_TRAJECTORY_WRITER_TPP
2#define RPG_TRAJECTORY_WRITER_TPP
10#include "TrajectoryWriter.h"
12#include <rpg/System.h>
13#include <rpg/fts/simulator/Simulator.h>
14#include <util/misc/FileMaster.h>
16#include <util/misc/ioUtil.h>
34 isInitialized_(false),
35 simulatorPtr_(&simulator),
36 systemPtr_(&(simulator.system()))
46 isInitialized_ =
true;
59 isInitialized_ =
true;
78 filename_ = outputFileName();
79 system().fileMaster().openOutputFile(filename_ , outputFile_);
80 writeHeader(outputFile_);
86 out <<
"i = " << iStep <<
"\n";
87 bool writeHeader =
false;
88 bool isSymmetric =
false;
89 Domain<D> const & domain = system().domain();
93 writeHeader, isSymmetric);
102 int nMonomer = system().mixture().nMonomer();
103 FieldIo<D> const & fieldIo = system().domain().fieldIo();
117 if (isAtInterval(iStep)) {
118 writeFrame(outputFile_, iStep);
128 { outputFile_.close(); }
void writeFieldHeader(std::ostream &out, int nMonomer, UnitCell< D > const &unitCell, bool isSymmetric=true) const
Write header for field file (fortran pscf format)
Base template for UnitCell<D> classes, D=1, 2 or 3.
Abstract base for periodic output and/or analysis actions.
virtual void readParameters(std::istream &in)
Read parameters from archive.
Spatial domain and spatial discretization for a periodic structure.
UnitCell< D > & unitCell()
Get UnitCell by reference.
FieldIo< D > & fieldIo()
Get associated FieldIo object.
File input/output operations and format conversions for fields.
void writeFieldsRGrid(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true, bool writeMeshSize=true) const
Write array of RField objects (fields on r-space grid) to a stream.
Field theoretic simulator (base class).
Main class for calculations that represent one system.
void writeHeader(std::ofstream &out)
Write data that should appear once, at beginning of the file.
virtual void save(Serializable::OArchive &ar)
Save state to archive.
void setClassName(const char *className)
Set class name string.
virtual void readParameters(std::istream &in)
Read interval and output file name.
virtual void setup()
Clear nSample counter.
TrajectoryWriter(Simulator< D > &simulator, System< D > &system)
Constructor.
void writeFrame(std::ofstream &out, long iStep)
Write data that should appear in every frame.
virtual void output()
Close trajectory file after run.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
Loading (input) archive for binary istream.
Saving / output archive for binary ostream.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from archive, without adding Begin and End lines.
bool hasSymmetry(AT const &in, Basis< D > const &basis, IntVec< D > const &dftDimensions, double epsilon=1.0e-8, bool verbose=true)
Check if a k-grid field has the declared space group symmetry.
PSCF package top-level namespace.
Utility classes for scientific computation.