Base Handler
Base file-handler abstraction for ReaxKit.
This module defines the abstract FileHandler class, which provides the
common interface and lifecycle used by all ReaxKit file handlers
(e.g., XmoloutHandler, Fort7Handler, SummaryHandler).
The base class standardizes how ReaxFF output files are:
- loaded from disk
- parsed lazily into structured tabular data
- exposed via a uniform DataFrame-based API
- accompanied by lightweight metadata
All ReaxKit analysis functions rely on FileHandler subclasses to provide
a consistent, predictable view of parsed ReaxFF files.
BaseHandler
Bases: ABC
Abstract base class for ReaxKit file handlers.
This class defines the minimal public interface that all ReaxKit file handlers must implement. Subclasses are responsible for parsing a specific ReaxFF file format and exposing its contents as structured pandas DataFrames.
Parsed Data
Main table
A pandas.DataFrame returned by dataframe(), whose columns
depend on the specific file type.
Metadata
A dictionary of lightweight metadata returned by metadata(),
typically including global or per-file attributes.
Notes
- Parsing is performed lazily and cached after the first access.
- Subclasses must implement the private
_parse()method.
__init__(file_path)
Initialize a file handler with a file path.
Works on
ReaxFF output files on disk
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str or Path
|
Path to the file to be parsed. |
required |
Returns:
| Type | Description |
|---|---|
None
|
Initializes the handler without parsing the file. |
dataframe()
Return the parsed file contents as a pandas DataFrame.
Works on
FileHandler — ReaxFF output file
Returns:
| Type | Description |
|---|---|
DataFrame
|
Structured table representing the parsed file contents. |
Examples:
>>> h = SomeHandler("file")
>>> df = h.dataframe()
metadata()
Return parsed metadata associated with the file.
Works on
FileHandler — ReaxFF output file
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of metadata values extracted during parsing. |
Examples:
>>> h = SomeHandler("file")
>>> meta = h.metadata()
parse()
Parse the file contents into structured data.
Works on
FileHandler — ReaxFF output file
Returns:
| Type | Description |
|---|---|
None
|
Parses the file and caches the resulting DataFrame and metadata. |
Examples:
>>> h = SomeHandler("file")
>>> h.parse()