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

Namespaces

namespace  detail

Classes

class  AbinitReader
 Handles parsing of ABINIT input/output files containing acell, rprim, and atomic positions. More...
class  ArcReader
 Reads an ARC file and returns a vector of correlation::core::Cell objects. More...
class  BaseReader
 Base class for all file readers. More...
class  CarReader
 Reads a Materials Studio .car file and returns a correlation::core::Cell object. More...
class  CastepMdReader
 Reads a sequence of frames from a CASTEP .md trajectory file. More...
class  CellReader
 Reads a CASTEP .cell physical structure format. More...
class  ChgnetReader
 Reads atomic structures and trajectories from CHGNet Extended XYZ outputs. More...
class  CifReader
 Reads a Crystallographic Information File (.cif). More...
struct  ReaderExtensionQuery
 Parameters for querying a reader by extension and optional filename for content sniffing. More...
class  IReaderRegistry
 Abstract interface defining lookup capabilities for file reader discovery and instantiation. More...
class  IStructureReader
 Segregated contract for file format parsers that read individual snapshot structures. More...
class  ITrajectoryReader
 Segregated contract for file format parsers that read multi-frame simulation trajectories. More...
class  CP2KReader
 Handles parsing of CP2K restart and input files. More...
class  DftbReader
 Handles parsing of DFTB+ GenFormat (.gen) and HSD input geometry structures. More...
class  GapReader
 Reads atomic structures and trajectories from GAP / QUIP Extended XYZ outputs. More...
class  GpawReader
 Handles parsing of GPAW text log and output files containing unit cells and coordinates. More...
class  GromacsReader
 Handles parsing of GROMACS (.gro) structure files. More...
class  LammpsDumpReader
 Reads one or more frames from a LAMMPS custom dump file. More...
class  MaceReader
 Reads atomic structures and trajectories from MACE Extended XYZ outputs. More...
class  NequipReader
 Reads atomic structures and trajectories from NequIP Extended XYZ outputs. More...
class  OnetepDatReader
 Reads a ONETEP .dat structure format. More...
class  OrcaReader
 Handles parsing of ORCA output and log files for structures and geometry optimization trajectories. More...
class  OutmolReader
 Reads a DMol3 .outmol output format. More...
class  PdbReader
 Handles parsing of PDB (.pdb) structure files. More...
class  QEReader
 Handles parsing of Quantum ESPRESSO output and input files. More...
class  ReaderFactory
 Registry for all file readers, enabling automatic discovery. More...
class  VaspReader
 Reads VASP POSCAR and CONTCAR structure files. More...
class  XdatcarReader
 Reads VASP XDATCAR trajectory files with memory-mapped lazy loading. More...
class  XYZReader
 Reads structure data from Extended XYZ format files. More...

Typedefs

using ProgressCallback = std::function<void(float, const std::string &)>
 Progress report callback function type. Invoked with normalized progress in [0.0, 1.0] and a status message.

Enumerations

enum class  FileType : std::uint8_t {
  Car , Cell , Cif , OnetepDat ,
  Arc , LammpsDump , CastepMd , Outmol ,
  Vasp , Xdatcar , Gromacs , Pdb ,
  Xyz , Mace , Chgnet , Gap ,
  Nequip , Unknown
}
 A type-safe enum to specify the format of a structure or trajectory file. More...

Functions

correlation::core::Cell readStructure (const std::string &filename, FileType type, const ProgressCallback &progress_callback=nullptr)
 Reads an atomic structure from a file.
correlation::core::Trajectory readTrajectory (const std::string &filename, FileType type, const ProgressCallback &progress_callback=nullptr)
 Reads a trajectory from a file.
correlation::core::Trajectory readTrajectory (const std::vector< std::string > &filenames, FileType type=FileType::Unknown, const ProgressCallback &progress_callback=nullptr)
 Reads a trajectory concatenated across multiple files.
std::expected< correlation::core::Cell, std::string > readStructureExpected (const std::string &filename, FileType type=FileType::Unknown, const ProgressCallback &progress_callback=nullptr)
 Reads a structure from the given file, returning Cell or diagnostic error string.
std::expected< correlation::core::Trajectory, std::string > readTrajectoryExpected (const std::string &filename, FileType type=FileType::Unknown, const ProgressCallback &progress_callback=nullptr)
 Reads a trajectory from the given file, returning Trajectory or diagnostic error string.
std::expected< correlation::core::Trajectory, std::string > readTrajectoryExpected (const std::vector< std::string > &filenames, FileType type=FileType::Unknown, const ProgressCallback &progress_callback=nullptr)
 Reads a trajectory from multiple files, returning Trajectory or diagnostic error string.
FileType determineFileType (const std::string &filename)
 Determines the FileType from a given filename extension.
bool naturalLess (std::string_view str_a, std::string_view str_b) noexcept
 Performs natural alphanumeric comparison of two strings.
void naturalSort (std::vector< std::string > &paths)
 Sorts a container of file paths in natural alphanumeric order.
std::vector< std::string > expandWildcards (const std::string &pattern)
 Expands wildcard patterns (*, ?) in a path and sorts naturally.

Variables

const bool REGISTERED = ReaderFactory::registerTypeSafe<ArcReader>("ArcReader")

Typedef Documentation

◆ ProgressCallback

typedef std::function< void(float, const std::string &)> correlation::readers::ProgressCallback = std::function<void(float, const std::string &)>

Progress report callback function type. Invoked with normalized progress in [0.0, 1.0] and a status message.

Enumeration Type Documentation

◆ FileType

enum class correlation::readers::FileType : std::uint8_t
strong

A type-safe enum to specify the format of a structure or trajectory file.

Enumerator
Car 

Accelrys .car file format.

Cell 

CASTEP .cell physical structure format.

Cif 

Crystallographic Information File (.cif).

OnetepDat 

ONETEP input/output .dat format.

Arc 

Accelrys .arc trajectory format.

LammpsDump 

LAMMPS atomic dump trajectory format.

CastepMd 

CASTEP molecular dynamics .md trajectory format.

Outmol 

DMol3 .outmol format.

Vasp 

VASP POSCAR/CONTCAR single-structure format.

Xdatcar 

VASP XDATCAR trajectory format.

Gromacs 

GROMACS .gro format.

Pdb 

PDB .pdb format.

Xyz 

Extended XYZ .xyz format.

Mace 

MACE Extended XYZ format (.mace, .extxyz).

Chgnet 

CHGNet Extended XYZ format (.chgnet).

Gap 

GAP Extended XYZ format (.gap, .quip).

Nequip 

NequIP Extended XYZ format (.nequip).

Unknown 

Unrecognized or unsupported file format.

Function Documentation

◆ determineFileType()

FileType correlation::readers::determineFileType ( const std::string & filename)

Determines the FileType from a given filename extension.

Parameters
[in]filenameThe full path of the file.
Returns
The corresponding FileType enum value.
Exceptions
std::runtime_errorif the file has no extension or an unsupported one.
Here is the caller graph for this function:

◆ expandWildcards()

std::vector< std::string > correlation::readers::expandWildcards ( const std::string & pattern)
inline

Expands wildcard patterns (*, ?) in a path and sorts naturally.

Parameters
patternFile path or glob pattern.
Returns
Sorted vector of matching file paths.
Exceptions
std::runtime_errorIf a wildcard pattern matches no files or globbing fails.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ naturalLess()

bool correlation::readers::naturalLess ( std::string_view str_a,
std::string_view str_b )
inlinenoexcept

Performs natural alphanumeric comparison of two strings.

Ensures that numeric components are compared by value (e.g., "dump.2" < "dump.10"). Satisfies Strict Weak Ordering.

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

◆ naturalSort()

void correlation::readers::naturalSort ( std::vector< std::string > & paths)
inline

Sorts a container of file paths in natural alphanumeric order.

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

◆ readStructure()

correlation::core::Cell correlation::readers::readStructure ( const std::string & filename,
FileType type,
const ProgressCallback & progress_callback = nullptr )

Reads an atomic structure from a file.

Parameters
[in]filenameThe path to the structure file.
[in]typeThe format of the file.
[in]progress_callbackOptional callback invoked with progress (0.0–1.0) and a status message.
Returns
A correlation::core::Cell object containing the parsed atomic structure.
Exceptions
std::runtime_errorif the file cannot be opened or is malformed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStructureExpected()

std::expected< correlation::core::Cell, std::string > correlation::readers::readStructureExpected ( const std::string & filename,
FileType type = FileType::Unknown,
const ProgressCallback & progress_callback = nullptr )
nodiscard

Reads a structure from the given file, returning Cell or diagnostic error string.

Parameters
[in]filenamePath to the file containing the structure.
[in]typeFile format type used to decode the file.
[in]progress_callbackOptional callback invoked during reading.
Returns
Expected containing the parsed Cell on success, or diagnostic string on failure.
Here is the call graph for this function:

◆ readTrajectory() [1/2]

correlation::core::Trajectory correlation::readers::readTrajectory ( const std::string & filename,
FileType type,
const ProgressCallback & progress_callback = nullptr )

Reads a trajectory from a file.

Parameters
[in]filenameThe path to the trajectory file.
[in]typeThe format of the file.
[in]progress_callbackOptional callback invoked with progress (0.0–1.0) and a status message.
Returns
A correlation::core::Trajectory object.
Exceptions
std::runtime_errorif the file cannot be opened or is malformed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readTrajectory() [2/2]

correlation::core::Trajectory correlation::readers::readTrajectory ( const std::vector< std::string > & filenames,
FileType type = FileType::Unknown,
const ProgressCallback & progress_callback = nullptr )

Reads a trajectory concatenated across multiple files.

Parameters
[in]filenamesVector of paths to trajectory files.
[in]typeThe format of the files.
[in]progress_callbackOptional callback invoked with progress (0.0–1.0) and status message.
Returns
A correlation::core::Trajectory object.
Exceptions
std::runtime_errorif files cannot be opened or are malformed.
Here is the call graph for this function:

◆ readTrajectoryExpected() [1/2]

std::expected< correlation::core::Trajectory, std::string > correlation::readers::readTrajectoryExpected ( const std::string & filename,
FileType type = FileType::Unknown,
const ProgressCallback & progress_callback = nullptr )
nodiscard

Reads a trajectory from the given file, returning Trajectory or diagnostic error string.

Parameters
[in]filenamePath to the file containing the trajectory.
[in]typeFile format type used to decode the file.
[in]progress_callbackOptional callback invoked during reading.
Returns
Expected containing the parsed Trajectory on success, or diagnostic string on failure.
Here is the call graph for this function:

◆ readTrajectoryExpected() [2/2]

std::expected< correlation::core::Trajectory, std::string > correlation::readers::readTrajectoryExpected ( const std::vector< std::string > & filenames,
FileType type = FileType::Unknown,
const ProgressCallback & progress_callback = nullptr )
nodiscard

Reads a trajectory from multiple files, returning Trajectory or diagnostic error string.

Parameters
[in]filenamesPaths to the files containing the trajectory.
[in]typeFile format type used to decode the files.
[in]progress_callbackOptional callback invoked during reading.
Returns
Expected containing the parsed Trajectory on success, or diagnostic string on failure.
Here is the call graph for this function:

Variable Documentation

◆ REGISTERED

const bool correlation::readers::REGISTERED = ReaderFactory::registerTypeSafe<ArcReader>("ArcReader")