LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
loos::XTCWriter Class Reference

Class for writing Gromacs XTC trajectories. More...

#include <xtcwriter.hpp>

Inheritance diagram for loos::XTCWriter:
Inheritance graph
[legend]
Collaboration diagram for loos::XTCWriter:
Collaboration graph
[legend]

Public Member Functions

 XTCWriter (const std::string &fname, const bool append=false)
 
 XTCWriter (const std::string &fname, const double dt, const uint steps_per_frame, const bool append=false)
 
 XTCWriter (const std::string &fname, const double dt, const uint steps_per_frame, const float precision, const bool append=false)
 
double timePerStep () const
 Get the time per step.
 
void timePerStep (const double dt)
 Set the time per step.
 
uint stepsPerFrame () const
 How many steps per frame written.
 
void stepsPerFrame (const uint s)
 Set how many steps pass per frame written.
 
uint currentStep () const
 What the current output step is.
 
void currentStep (const uint s)
 Sets the current output step.
 
void writeFrame (const AtomicGroup &model)
 Write a frame to the trajectory.
 
void writeFrame (const AtomicGroup &model, const uint step, const double time)
 Write a frame to the trajectory with explicit step and time metadata.
 
uint framesWritten () const
 Total frames in output file.
 
- Public Member Functions inherited from loos::TrajectoryWriter
 TrajectoryWriter (const std::string &fname, const bool append=false)
 Write a trajectory to a file, optionally appending.
 
 TrajectoryWriter (std::iostream *s, const bool append=false)
 Write a trajectory to a stream.
 
virtual void setComments (const std::vector< std::string > &comments)
 Set comments in metadata (not all formats support)
 
virtual void setComments (const std::string &s)
 Set comment in metadata (not all formats support)
 
virtual bool hasFrameStep () const
 Can format write step on a per-frame basis?
 
virtual bool hasFrameTime () const
 Can format write time on a per-frame basis?
 
virtual bool hasComments () const
 Does format support comments in metadata?
 
bool isAppending () const
 Returns true if appending to an existing trajectory.
 

Static Public Member Functions

static pTrajectoryWriter create (const std::string &s, const bool append=false)
 Class factory function.
 

Additional Inherited Members

- Protected Attributes inherited from loos::TrajectoryWriter
std::iostream * stream_
 
std::string _filename
 
bool appending_
 
bool delete_
 

Detailed Description

Class for writing Gromacs XTC trajectories.

This code borrows heavily from the xdrfile-1.1b library provided by Gromacs. By default, the writer will assume that the frames are evenly spaced and will use the dt and steps_per_frame variables to determine the step and timepoint for each frame. For non-uniform frame intervals, explicitly pass a step and time to writeFrame(). Note that this will NOT modify the internal counters, so you should use on form of writeFrame() or the other and not mix them. If you must, use currentStep() to update the internal step counter (and possibly timePerStep()).

Member Function Documentation

◆ framesWritten()

uint loos::XTCWriter::framesWritten ( ) const
inlinevirtual

Total frames in output file.

For files being appended too, this includes the frames already written...

Implements loos::TrajectoryWriter.

◆ writeFrame() [1/2]

void loos::XTCWriter::writeFrame ( const AtomicGroup & model)
virtual

Write a frame to the trajectory.

Implements loos::TrajectoryWriter.

◆ writeFrame() [2/2]

void loos::XTCWriter::writeFrame ( const AtomicGroup & model,
const uint step,
const double time )
virtual

Write a frame to the trajectory with explicit step and time metadata.

Reimplemented from loos::TrajectoryWriter.


The documentation for this class was generated from the following files: