Skip to content

Fort7 Handler

ReaxFF connectivity (fort.7) file handler.

This module provides a handler for parsing ReaxFF fort.7 files, which store per-iteration atom connectivity, bond-order information, and system-wide totals.

Typical use cases include:

  • extracting per-atom bond-order features
  • computing coordination statistics
  • building molecule- and structure-level descriptors

Fort7Handler

Bases: BaseHandler

Parser for ReaxFF connectivity output files (fort.7).

This class parses ReaxFF fort.7 files and exposes both iteration-level summaries and per-iteration atom connectivity tables as structured tabular data.

Parsed Data

Summary table One row per iteration, returned by dataframe(), with columns: ["iter", "num_of_atoms", "num_of_bonds", "total_BO", "total_LP", "total_BO_uncorrected", "total_charge"]

Per-frame atom tables Stored in self._frames, one table per iteration, where each frame is a pandas.DataFrame with columns: ["atom_num", "atom_type_num", "atom_cnn1..nb", "molecule_num", "BO1..nb", "sum_BOs", "num_LPs", "partial_charge", ...]

Here, ``nb`` denotes the number of bonded neighbors in that frame,
leading to variable-length connectivity and bond-order columns.

Metadata Returned by metadata(), containing: ["n_frames", "n_records", "simulation_name"]

Notes
  • Duplicate iterations are resolved by keeping the last occurrence.
  • Connectivity and bond-order columns are inferred from the header.
  • Extra, file-dependent columns are preserved as unknown* fields.

__init__(file_path='fort.7')

Initialize a handler for a ReaxFF fort.7 connectivity file.

Works on

Fort7Handler — fort.7

Parameters:

Name Type Description Default
file_path str or Path

Path to the fort.7 file to be parsed.

'fort.7'

Returns:

Type Description
None

Initializes the handler without parsing the file.

frame(i)

Return a single frame as an atom-level connectivity table.

Works on

Fort7Handler — fort.7

Parameters:

Name Type Description Default
i int

Frame index to retrieve.

required

Returns:

Type Description
DataFrame

Atom-level table for the selected frame, including connectivity and bond-order columns.

Examples:

>>> h = Fort7Handler("fort.7")
>>> df = h.frame(0)

iter_frames(step=1)

Iterate over atom-level frames with optional subsampling.

Works on

Fort7Handler — fort.7

Parameters:

Name Type Description Default
step int

Step size for subsampling frames (default: 1).

1

Yields:

Type Description
DataFrame

Atom-level connectivity table for each yielded frame.

Examples:

>>> h = Fort7Handler("fort.7")
>>> for frame in h.iter_frames(step=10):
...     print(len(frame))

n_atoms(frame=0)

Return the number of atoms in a given frame.

Works on

Fort7Handler — fort.7

Parameters:

Name Type Description Default
frame int

Frame index to query.

0

Returns:

Type Description
int

Number of atoms in the selected frame.

n_frames()

Return the number of frames parsed from the fort.7 file.

Works on

Fort7Handler — fort.7

Returns:

Type Description
int

Number of parsed frames (iterations).