Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 4.08 KB

File metadata and controls

59 lines (47 loc) · 4.08 KB
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 2 column 337
---
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 (Python)

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.

Ground truth over guessing

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 all

When 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).

Where to look

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

The general shape of a calculation

Every task follows the same skeleton, regardless of model:

  1. Build one or more feos.PureRecords (parameters.md) — or load Parameters/ GcParameters straight from a file.
  2. Turn them into a feos.Parameters (or GcParameters) object.
  3. Construct a model: feos.EquationOfState.<model>(parameters, ...) for bulk thermodynamics, or feos.HelmholtzEnergyFunctional.<model>(parameters, fmt_version, ...) for classical DFT (models.md).
  4. Do the actual task: build a State and read properties, run a phase-equilibrium/ phase-diagram calculation, fit parameters against data, or run a DFT calculation — each with its own reference file under references/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.