Skip to main content

FeOs - A framework for equations of state and classical density functional theory.

Project description

FeOs - A Framework for Equations of State and Classical Density Functional Theory

crate documentation repository documentation FeOs Publication

The FeOs package provides Rust implementations of different equation of state and Helmholtz energy functional models and corresponding Python bindings.

import feos
import si_units as si

# PC-SAFT parameters for methanol (Gross and Sadowski 2002)
record = feos.PureRecord(
    feos.Identifier(name="methanol"),
    molarweight=32.04,
    m=1.5255,
    sigma=3.23,
    epsilon_k=188.9,
    association_sites=[{
      "kappa_ab": 0.035176,
      "epsilon_k_ab": 2899.5,
      "na": 1,
      "nb": 1,
    }]
)

# Build an equation of state
parameters = feos.Parameters.new_pure(record)
eos = feos.EquationOfState.pcsaft(parameters)

# Define thermodynamic conditions
critical_point = feos.State.critical_point(eos)

# Compute properties
p = critical_point.pressure()
t = critical_point.temperature
print(f"Critical point for methanol: T={t/si.KELVIN:.1f} K, p={p/si.BAR:.1f} bar.")
Critical point for methanol: T=531.5 K, p=106.5 bar.

Models

The following models are currently published as part of the FeOs framework

name description eos dft
pcsaft perturbed-chain (polar) statistical associating fluid theory
epcsaft electrolyte PC-SAFT
gc-pcsaft (heterosegmented) group contribution PC-SAFT
pets perturbed truncated and shifted Lennard-Jones mixtures
uvtheory equation of state for Mie fluids and mixtures
saftvrqmie equation of state for quantum fluids and mixtures
saftvrmie statistical associating fluid theory for variable range interactions of Mie form
multiparameter Multiparameter Helmholtz energy equations of state for common pure components

The list is being expanded continuously. Currently under development are implementations of Helmholtz energy functionals for the UV theory and for SAFT-VR Mie.

Other public repositories that implement models within the FeOs framework, but are currently not part of the feos Python package, are

name description eos dft
feos-fused-chains heterosegmented fused-sphere chain functional

Parameters

In addition to the source code for the Rust and Python packages, this repository contains JSON files with previously published parameters for the different models including group contribution methods. The parameter files can be read directly from Rust or Python.

[!WARNING] The format for parameter files changed between releases 0.8.0 and 0.9.0. You find parameters for new versions in the parameters directory and for versions up to 0.8.0 in the parameters_old directory.

If you maintain your own parameter files, there are two adjustments you need to make when upgrading to feos 0.9.0:

  • Flatten the contents of the model_record field directly into the pure or segment record.
  • Move association parameters into a list called association_sites.

The structure of the JSON files and the PureRecord and SegmentRecord classes in Python is identical.

Properties and phase equilibria

The crate makes use of generalized (hyper-) dual numbers to generically calculate exact partial derivatives from Helmholtz energy equations of state. The derivatives are used to calculate

  • equilibrium properties (pressure, heat capacity, fugacity, and many more),
  • transport properties (viscosity, thermal conductivity, diffusion coefficients) using the entropy scaling approach
  • critical points and phase equilibria for pure components and mixtures.

In addition to that, utilities are provided to assist in the handling of parameters for both molecular equations of state and (homosegmented) group contribution methods and for the generation of phase diagrams for pure components and binary mixtures.

Classical density functional theory

FeOs uses efficient numerical methods to calculate density profiles in inhomogeneous systems. Highlights include:

  • Fast calculation of convolution integrals in cartesian (1D, 2D and 3D), polar, cylindrical, and spherical coordinate systems using FFT and related algorithms.
  • Automatic calculation of partial derivatives of Helmholtz energy densities (including temperature derivatives) using automatic differentiation with generalized (hyper-) dual numbers.
  • Modeling of heterosegmented molecules, including branched molecules.
  • Functionalities for calculating surface tensions, adsorption isotherms, pair correlation functions, and solvation free energies.

Cargo features

Without additional features activated, the command

cargo test --release

will only build and test the core functionalities of the crate. To run unit and integration tests for specific models, run

cargo test --release --features pcsaft

to test, e.g., the implementation of PC-SAFT or

cargo test --release --features all_models

to run tests on all implemented models.

Python package

FeOs uses the PyO3 framework to provide Python bindings. The Python package can be installed via pip and runs on Windows, Linux and macOS:

pip install feos

If there is no compiled package for your system available from PyPI and you have a Rust compiler installed, you can instead build the python package from source using

pip install git+https://github.com/feos-org/feos

This command builds the package without link-time optimization (LTO) that can be used to increase the performance further. See the Building from source section for information about building the wheel including LTO.

Building from source

To compile the code you need the Rust compiler and maturin installed. To install the package directly into the active environment (virtualenv or conda), use

cd py-feos
maturin develop --release

which uses the python and all_models feature as specified in the pyproject.toml file.

Alternatively, you can specify the models or features that you want to include in the python package explicitly, e.g.

maturin develop --release --features "pcsaft dft"

for the PC-SAFT equation of state and Helmholtz energy functional.

To build wheels including link-time optimization (LTO), use

maturin build --profile="release-lto"

which will use the python and all_models features specified in the pyproject.toml file. Use the following command to build a wheel with specific features:

maturin build --profile="release-lto" --features "pcsaft ..."

LTO increases compile times measurably but the resulting wheel is more performant and has a smaller size. For development however, we recommend using the --release flag.

Documentation

For a documentation of the Python API, Python examples, and a guide to the underlying Rust framework check out the documentation.

Benchmarks

Check out the benches directory for information about provided Rust benchmarks and how to run them.

Developers

This software is currently maintained by members of the groups of

Contributing

FeOs grew from the need to maintain a common codebase used within the scientific work done in our groups. We share the code publicly as a platform to publish our own research but also encourage other researchers and developers to contribute their own models or implementations of existing equations of state.

If you want to contribute to FeOs, there are several ways to go: improving the documentation and helping with language issues, testing the code on your systems to find bugs, adding new models or algorithms, or providing feature requests. Feel free to message us if you have questions or open an issue to discuss improvements.

Cite us

If you find FeOs useful for your own scientific studies, consider citing our publication accompanying this library.

@article{rehner2023feos,
  author = {Rehner, Philipp and Bauer, Gernot and Gross, Joachim},
  title = {FeOs: An Open-Source Framework for Equations of State and Classical Density Functional Theory},
  journal = {Industrial \& Engineering Chemistry Research},
  volume = {62},
  number = {12},
  pages = {5347-5357},
  year = {2023},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

feos-0.9.5-cp310-abi3-win_amd64.whl (19.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

feos-0.9.5-cp310-abi3-win32.whl (18.7 MB view details)

Uploaded CPython 3.10+Windows x86

feos-0.9.5-cp310-abi3-manylinux_2_35_x86_64.whl (18.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ x86-64

feos-0.9.5-cp310-abi3-macosx_11_0_arm64.whl (14.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

feos-0.9.5-cp310-abi3-macosx_10_12_x86_64.whl (17.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file feos-0.9.5-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: feos-0.9.5-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 19.1 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for feos-0.9.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a507c9c08b6a032b98745694bf989ca0d49c36e04d727fb96f3c791b134cb4d6
MD5 6ae3748e1b7dbcfbee343f68526ea21d
BLAKE2b-256 90013c5ae9b9e26447b8c9700fec087cc5332ee0b6902349d91466917fe603ca

See more details on using hashes here.

File details

Details for the file feos-0.9.5-cp310-abi3-win32.whl.

File metadata

  • Download URL: feos-0.9.5-cp310-abi3-win32.whl
  • Upload date:
  • Size: 18.7 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for feos-0.9.5-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 ac54961e093d173916f4d76b5b448ba318131ac851bdb49bcada787870fef8fe
MD5 c029f868266f54168ee1d093ff9e2d7c
BLAKE2b-256 78bc2f1316fc0be85dcc1150750a62d61556706b02fbd53e6e172bf5c4453380

See more details on using hashes here.

File details

Details for the file feos-0.9.5-cp310-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for feos-0.9.5-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 799dd18878601115ad33b688bbce02835660ccdeabf76fd2d6b6721832df04c9
MD5 6205acb002448df55a29a0819a20a653
BLAKE2b-256 594fc716cc42698e7d5784a6b92791c76fe51b598d40ed6b4d60760c7191470a

See more details on using hashes here.

File details

Details for the file feos-0.9.5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: feos-0.9.5-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 14.3 MB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for feos-0.9.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67385f6f59b379f5a0622f8537f854e2352785041f078ed713a882a992c71698
MD5 53777cc28bd7d844dfc8700c23342702
BLAKE2b-256 108c86ca8e747cb6d3c25c799384a0aadd91a33e9fc9121e8363ad21e59cd14a

See more details on using hashes here.

File details

Details for the file feos-0.9.5-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for feos-0.9.5-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ad0fe61d3e91d9425969d276a4d4f3cd8c19052b4b583d8f18b0eb537ac038ff
MD5 ad20e00c69d93e5f159ec4f7e3c41915
BLAKE2b-256 4d8b3dcfe005dd3a0f3af513a97efd88a4114de2c1ab6e982ce4f8cde6642888

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page