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
The FeOs
package provides Rust implementations of different equation of state and Helmholtz energy functional models and corresponding Python bindings.
from feos.eos import EquationOfState, State
from feos.pcsaft import PcSaftParameters, PcSaftRecord
# PC-SAFT parameters for methanol (Gross and Sadowski 2002)
record = PcSaftRecord(1.5255, 3.23, 188.9, kappa_ab=0.035176, epsilon_k_ab=2899.5, na=1, nb=1)
# Build an equation of state
parameters = PcSaftParameters.from_model_records([record])
eos = EquationOfState.pcsaft(parameters)
# Define thermodynamic conditions
critical_point = State.critical_point(eos)
# Compute properties
p = critical_point.pressure()
t = critical_point.temperature
print(f'Critical point for methanol: T={t}, p={p}.')
Critical point for methanol: T=531.5 K, p=10.7 MPa.
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 | ✓ |
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.
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
(>=0.13,<0.14) installed.
To install the package directly into the active environment (virtualenv or conda), use
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 "python 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 "python ..."
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
- Prof. Joachim Gross, Institute of Thermodynamics and Thermal Process Engineering (ITT), University of Stuttgart
- Prof. André Bardow, Energy and Process Systems Engineering (EPSE), ETH Zurich
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file feos-0.7.0-cp37-abi3-win_amd64.whl
.
File metadata
- Download URL: feos-0.7.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27db5ded30dd1bc293a09e32d9aadae838ead8015d4e1988c7c28e7357b01d98 |
|
MD5 | 49eb13252a935169ef0fed0acdadec15 |
|
BLAKE2b-256 | 6a72e582628abb5149689a7bafd9f39a1b0b4b8d3d09685e62af68d57e0a0aa8 |
File details
Details for the file feos-0.7.0-cp37-abi3-win32.whl
.
File metadata
- Download URL: feos-0.7.0-cp37-abi3-win32.whl
- Upload date:
- Size: 15.7 MB
- Tags: CPython 3.7+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd9467cb24414dd76c9430e4e1199aceee4d006e76dab28133cb4f79d287adf6 |
|
MD5 | b23aeae3887ed96d2b102802e85b2b1a |
|
BLAKE2b-256 | 13d81034cb402bb37b81374dea83ccb02d3e158f7195eb5fb0bab06bd9ea8239 |
File details
Details for the file feos-0.7.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: feos-0.7.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.9 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5498ef22f17f8541e9841a50c3d1862715b7fdf2f0342362182db62cee4562f5 |
|
MD5 | c20ac7416f760e76bcd8ac252dae0a10 |
|
BLAKE2b-256 | f1df521dfb08b955dc89377b763b749ec3b229d3b862a8ecbd04401bec417bd8 |
File details
Details for the file feos-0.7.0-cp37-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: feos-0.7.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 11.4 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe3bc2b3e46057c62319362f277a7b114112d4e1a143f450833fb4aaaa03d506 |
|
MD5 | fcf2077c0037eb00c3a67a420d9c31dc |
|
BLAKE2b-256 | 2a7caeade5653d218e92c5d68fef62de98bd181071a4c09b08702906b96dc8ff |
File details
Details for the file feos-0.7.0-cp37-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: feos-0.7.0-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 16.1 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e95b69fc0e6d3275ecd3469e9db0683e678f7acaba8dc57cda4dd68f64e12b48 |
|
MD5 | fb7fab7156819a10defbc87f4f77ae1a |
|
BLAKE2b-256 | 76efd6d1e798f7a759d9f19fd2b437129e09eb2332f6a9e72f53ebe7cce71c7c |