Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::readers::XYZReader Class Reference

Reads structure data from Extended XYZ format files. More...

#include <XYZReader.hpp>

Inheritance diagram for correlation::readers::XYZReader:
Collaboration diagram for correlation::readers::XYZReader:

Classes

struct  CommentData
 Intermediate storage for parsed Extended XYZ comment line metadata and column layout. More...

Public Member Functions

std::string getName () const override
 Returns the display name of the format.
std::vector< std::string > getExtensions () const override
 Returns a list of supported file extensions.
bool isTrajectory () const override
 Returns true if this reader supports trajectory files.
correlation::core::Cell readStructure (const std::string &filename, std::function< void(float, const std::string &)> progress_callback=nullptr) override
 Reads an atomic structure from a file.
correlation::core::Trajectory readTrajectory (const std::string &filename, std::function< void(float, const std::string &)> progress_callback=nullptr) override
 Reads a trajectory from a file.
Public Member Functions inherited from correlation::readers::BaseReader
 BaseReader ()=default
 ~BaseReader () override=default
 BaseReader (const BaseReader &)=delete
BaseReader & operator= (const BaseReader &)=delete
 BaseReader (BaseReader &&)=delete
BaseReader & operator= (BaseReader &&)=delete
virtual correlation::core::Trajectory readTrajectory (const std::vector< std::string > &filenames, ProgressCallback progress_callback=nullptr)
 Reads a trajectory concatenated across multiple files.
Public Member Functions inherited from correlation::readers::IStructureReader
 IStructureReader ()=default
virtual ~IStructureReader ()=default
 IStructureReader (const IStructureReader &)=delete
IStructureReader & operator= (const IStructureReader &)=delete
 IStructureReader (IStructureReader &&)=delete
IStructureReader & operator= (IStructureReader &&)=delete
Public Member Functions inherited from correlation::readers::ITrajectoryReader
 ITrajectoryReader ()=default
virtual ~ITrajectoryReader ()=default
 ITrajectoryReader (const ITrajectoryReader &)=delete
ITrajectoryReader & operator= (const ITrajectoryReader &)=delete
 ITrajectoryReader (ITrajectoryReader &&)=delete
ITrajectoryReader & operator= (ITrajectoryReader &&)=delete

Static Private Member Functions

static void parseLattice (const std::string &comment, CommentData &data)
static void parseEnergy (const std::string &comment, CommentData &data)
static void parseProperties (const std::string &comment, CommentData &data)
static void parsePropertiesParts (const std::vector< std::string > &parts, CommentData &data)
static CommentData parseCommentLine (const std::string &comment)
 Parses an Extended XYZ comment line for properties, lattice and energy.
static correlation::core::Cell parseXYZFrame (const char *data, size_t size)
static void parseAtomLine (const std::string &line, const CommentData &comm_data, std::vector< std::string_view > &tokens, correlation::core::Cell &cell)

Detailed Description

Reads structure data from Extended XYZ format files.

Supports the standard XYZ format (atom count, comment line, coordinate lines) as well as the Extended XYZ convention where lattice vectors are encoded in the comment line via Lattice="...".

Only structural data (species, positions, lattice) is parsed. Custom per-atom properties and arbitrary key-value metadata are ignored.

Member Function Documentation

◆ getExtensions()

std::vector< std::string > correlation::readers::XYZReader::getExtensions ( ) const
inlineoverridevirtual

Returns a list of supported file extensions.

Returns
A vector of strings containing extensions (e.g. {".cif", ".ext"}).

Implements correlation::readers::BaseReader.

◆ getName()

std::string correlation::readers::XYZReader::getName ( ) const
inlineoverridevirtual

Returns the display name of the format.

Returns
A string representing the format name (e.g. "LAMMPS Dump", "CIF").

Implements correlation::readers::BaseReader.

◆ isTrajectory()

bool correlation::readers::XYZReader::isTrajectory ( ) const
inlineoverridevirtual

Returns true if this reader supports trajectory files.

Returns
True if the format can store multiple time steps.

Implements correlation::readers::BaseReader.

◆ parseAtomLine()

void correlation::readers::XYZReader::parseAtomLine ( const std::string & line,
const CommentData & comm_data,
std::vector< std::string_view > & tokens,
correlation::core::Cell & cell )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseCommentLine()

XYZReader::CommentData correlation::readers::XYZReader::parseCommentLine ( const std::string & comment)
staticprivate

Parses an Extended XYZ comment line for properties, lattice and energy.

Parameters
commentThe comment line string.
Returns
CommentData struct containing parsed info.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseEnergy()

void correlation::readers::XYZReader::parseEnergy ( const std::string & comment,
CommentData & data )
staticprivate
Here is the caller graph for this function:

◆ parseLattice()

void correlation::readers::XYZReader::parseLattice ( const std::string & comment,
CommentData & data )
staticprivate
Here is the caller graph for this function:

◆ parseProperties()

void correlation::readers::XYZReader::parseProperties ( const std::string & comment,
CommentData & data )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parsePropertiesParts()

void correlation::readers::XYZReader::parsePropertiesParts ( const std::vector< std::string > & parts,
CommentData & data )
staticprivate
Here is the caller graph for this function:

◆ parseXYZFrame()

correlation::core::Cell correlation::readers::XYZReader::parseXYZFrame ( const char * data,
size_t size )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStructure()

correlation::core::Cell correlation::readers::XYZReader::readStructure ( const std::string & filename,
std::function< void(float, const std::string &)> progress_callback = nullptr )
overridevirtual

Reads an atomic structure from a file.

Parameters
[in]filenamePath to the file to be read.
[in]progress_callbackOptional callback to report progress [0.0, 1.0].
Returns
A Cell object containing the loaded structure.

Implements correlation::readers::BaseReader.

Here is the call graph for this function:

◆ readTrajectory()

correlation::core::Trajectory correlation::readers::XYZReader::readTrajectory ( const std::string & filename,
std::function< void(float, const std::string &)> progress_callback = nullptr )
overridevirtual

Reads a trajectory from a file.

Parameters
[in]filenamePath to the file to be read.
[in]progress_callbackOptional callback to report progress [0.0, 1.0].
Returns
A Trajectory object containing all loaded frames.

Implements correlation::readers::BaseReader.

Here is the call graph for this function:
Here is the caller graph for this function:

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