---
name: feos-python
description: Helps write Python code against the feos thermodynamics package (pip install feos) — an equation-of-state and classical DFT toolkit (PC-SAFT, ePC-SAFT, GC-PC-SAFT, PETS, UV-theory, SAFT-VR-Mie, SAFT-VR-Q-Mie, Peng-Robinson, multiparameter/reference EOS). Use this whenever the user is working with the `feos` Python package: building an EquationOfState or HelmholtzEnergyFunctional, defining or loading PureRecord/Parameters, working with si_units/SIObject dimensioned quantities, computing State properties, phase equilibria (bubble/dew/flash/critical points), phase diagrams, parameter fitting/regression against experimental data, or DFT calculations (surface tension, adsorption, pores, pair correlation). Trigger even if the user doesn't say "feos" explicitly but mentions PC-SAFT, SAFT equations of state, or thermodynamic property/phase-equilibrium calculations in Python that look like they involve this package.
---
feos is a Rust thermodynamics/classical-DFT library exposed to Python via PyO3
(pip install feos). This skill is a lookup reference for the Python API, split into
files loaded on demand — don't try to hold the whole API in context at once, jump to the
file that matches the task.
The Python-facing API is generated from Rust and evolves; IDE stub files
(feos.pyi) can lag behind the installed version. If something in these reference files
doesn't match what you observe, or you need to check a detail not covered here, the
installed package is always the authoritative source — introspect it directly:
import feos, inspect
inspect.signature(feos.EquationOfState.pcsaft) # exact call signature
help(feos.EquationOfState.pcsaft) # full docstring, if present
[x for x in dir(feos) if not x.startswith('_')] # what's available at allWhen a parameter object's exact required fields are unclear, the fastest way to find out
is to try building it with too few/wrong fields — the error message names the missing
field (see references/models.md for why this works and how it was used to build that
file).
| Task | Read |
|---|---|
| Dimensioned quantities: creating, converting, NumPy arrays | references/units.md |
Defining/loading substance parameters (Identifier, PureRecord, Parameters, group contribution, association sites) |
references/parameters.md |
| Which model to use, its constructor options, and its parameter field names (PC-SAFT, ePC-SAFT, GC-PC-SAFT, PETS, UV-theory, SAFT-VR-Mie, SAFT-VR-Q-Mie, Peng-Robinson, multiparameter, ideal-gas correlations) | references/models.md |
Building a State, reading off properties (pressure, enthalpy, fugacity, ...), Contributions, StateVec |
references/tasks/state_and_properties.md |
| Vapor pressure, bubble/dew points, flash calculations, critical points, Txy/pxy phase diagrams | references/tasks/phase_equilibria.md |
Fitting/regressing model parameters against experimental data (incl. analytic-gradient fitting for PC-SAFT via EquationOfStateAD) |
references/tasks/parameter_fitting.md |
| Classical DFT: surface tension, interfacial profiles, pores/adsorption, pair correlation | references/tasks/dft.md |
Every task follows the same skeleton, regardless of model:
- Build one or more
feos.PureRecords (parameters.md) — or loadParameters/GcParametersstraight from a file. - Turn them into a
feos.Parameters(orGcParameters) object. - Construct a model:
feos.EquationOfState.<model>(parameters, ...)for bulk thermodynamics, orfeos.HelmholtzEnergyFunctional.<model>(parameters, fmt_version, ...)for classical DFT (models.md). - Do the actual task: build a
Stateand read properties, run a phase-equilibrium/ phase-diagram calculation, fit parameters against data, or run a DFT calculation — each with its own reference file underreferences/tasks/.
All physical inputs/outputs are si_units.SIObjects, not plain floats — read
references/units.md first if this is unfamiliar; every other reference file assumes it.