Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
FileReader.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#include "core/Cell.hpp"
12#include "core/Trajectory.hpp"
13
15
16#include <cstdint>
17#include <expected>
18#include <string>
19#include <vector>
20
21// The correlation::readers namespace encapsulates all functionality related to
22// reading structure and trajectory files. It delegates to specialized readers.
23namespace correlation::readers {
24
49
61correlation::core::Cell readStructure(const std::string &filename, FileType type,
62 const ProgressCallback &progress_callback = nullptr);
63
74correlation::core::Trajectory readTrajectory(const std::string &filename, FileType type,
75 const ProgressCallback &progress_callback = nullptr);
76
87correlation::core::Trajectory readTrajectory(const std::vector<std::string> &filenames,
89 const ProgressCallback &progress_callback = nullptr);
90
99[[nodiscard]] std::expected<correlation::core::Cell, std::string>
100readStructureExpected(const std::string &filename, FileType type = FileType::Unknown,
101 const ProgressCallback &progress_callback = nullptr);
102
111[[nodiscard]] std::expected<correlation::core::Trajectory, std::string>
112readTrajectoryExpected(const std::string &filename, FileType type = FileType::Unknown,
113 const ProgressCallback &progress_callback = nullptr);
114
123[[nodiscard]] std::expected<correlation::core::Trajectory, std::string>
124readTrajectoryExpected(const std::vector<std::string> &filenames, FileType type = FileType::Unknown,
125 const ProgressCallback &progress_callback = nullptr);
126
134FileType determineFileType(const std::string &filename);
135
136} // namespace correlation::readers
Abstract base class for all file format readers.
Simulation cell structure with periodic boundary conditions.
Trajectory data structure for time-series atomistic simulations.
Represents the simulation cell (periodic box).
Definition Cell.hpp:30
This class stores a series of snapshots of a system.
Definition Trajectory.hpp:32
Definition TrajectoryLoader.hpp:24
FileType
A type-safe enum to specify the format of a structure or trajectory file.
Definition FileReader.hpp:29
@ Nequip
NequIP Extended XYZ format (.nequip).
Definition FileReader.hpp:46
@ Xdatcar
VASP XDATCAR trajectory format.
Definition FileReader.hpp:39
@ Mace
MACE Extended XYZ format (.mace, .extxyz).
Definition FileReader.hpp:43
@ Cell
CASTEP .cell physical structure format.
Definition FileReader.hpp:31
@ Outmol
DMol3 .outmol format.
Definition FileReader.hpp:37
@ Arc
Accelrys .arc trajectory format.
Definition FileReader.hpp:34
@ Gap
GAP Extended XYZ format (.gap, .quip).
Definition FileReader.hpp:45
@ CastepMd
CASTEP molecular dynamics .md trajectory format.
Definition FileReader.hpp:36
@ Chgnet
CHGNet Extended XYZ format (.chgnet).
Definition FileReader.hpp:44
@ Unknown
Unrecognized or unsupported file format.
Definition FileReader.hpp:47
@ Cif
Crystallographic Information File (.cif).
Definition FileReader.hpp:32
@ Vasp
VASP POSCAR/CONTCAR single-structure format.
Definition FileReader.hpp:38
@ Xyz
Extended XYZ .xyz format.
Definition FileReader.hpp:42
@ Pdb
PDB .pdb format.
Definition FileReader.hpp:41
@ LammpsDump
LAMMPS atomic dump trajectory format.
Definition FileReader.hpp:35
@ Gromacs
GROMACS .gro format.
Definition FileReader.hpp:40
@ Car
Accelrys .car file format.
Definition FileReader.hpp:30
@ OnetepDat
ONETEP input/output .dat format.
Definition FileReader.hpp:33
FileType determineFileType(const std::string &filename)
Determines the FileType from a given filename extension.
Definition FileReader.cpp:79
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.
Definition FileReader.cpp:299
correlation::core::Trajectory readTrajectory(const std::string &filename, FileType type, const ProgressCallback &progress_callback=nullptr)
Reads a trajectory from a file.
Definition FileReader.cpp:247
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.
Definition FileReader.cpp:287
correlation::core::Cell readStructure(const std::string &filename, FileType type, const ProgressCallback &progress_callback=nullptr)
Reads an atomic structure from a file.
Definition FileReader.cpp:229
std::function< void(float, const std::string &)> ProgressCallback
Progress report callback function type. Invoked with normalized progress in [0.0, 1....
Definition IStructureReader.hpp:22