crunchflow.input.databases.thermo.ThermoDatabase

class crunchflow.input.databases.thermo.ThermoDatabase

In-memory representation of a CrunchFlow-style thermodynamic database.

This single file contains both the data container and the lightweight parser/writer methods (mirroring the pattern used by input/inputfile.py).

classmethod from_file(path: str) ThermoDatabase

Read a database from a file and return the populated instance.

read(path: str) None

Populate this instance from a thermodynamic database file. Overwrites any existing contents.

Notes on expected structure (typical CrunchFlow database):
  • Temperature line (e.g., “temperature points: 0 25 60 …”)

  • Debye–Hückel arrays (adh, bdh, bdt) on the same grid

  • Sections terminated by keywords:

    End of primary End of secondary End of gases End of minerals

    Surface complexes bracketed by:

    Begin surface complexation End of surface complexation

write(path: str) None

Write the current database to a file in a straightforward, readable format. This prioritizes clarity and round-trippability for files parsed by this module.

clear() None

Clear all contents, resetting to an empty state.