Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
- run: cargo publish --workspace --exclude py_feos --token ${{ secrets.CRATES_IO_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/release_core.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/release_derive.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/release_dft.yml

This file was deleted.

22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.0] - 2025-11-08
### Added
- Integrated the functionalities of [`feos-ad`](https://github.com/feos-org/feos-ad). [#289](https://github.com/feos-org/feos/pull/289)
- In Rust: Full access to arbitrary derivatives of properties and phase equilibria with respect to model parameters. See, e.g., [`feos-campd`](https://github.com/feos-org/feos-campd) for an application to molecular design.
- In Python: Specialized functions for the parallel evaluation of relevant properties (vapor pressure, liquid density, bubble/dew point pressure) including the gradients with respect to model parameters for parameter estimations or the inclusion in backpropagation frameworks.
- Implement pure-component multiparameter equations of state from CoolProp. [#301](https://github.com/feos-org/feos/pull/301)

### Changed
- :warning: Changed the format of parameter files. The contents of the old `model_record` field are now flattened into the `PureRecord`/`SegmentRecord`. [#233](https://github.com/feos-org/feos/pull/233)
- Generalized the implementation of association to allow for arbitrarily many association sites per molecule or group and full control over each interaction. [#233](https://github.com/feos-org/feos/pull/233) [#290](https://github.com/feos-org/feos/pull/290)
- Reimplemented the Python interface to avoid the necessity of having multiple classes with the same name.
- `feos.eos.State` and `feos.dft.State` (and analogous classes) are combined into `feos.State`. [#274](https://github.com/feos-org/feos/pull/274)
- All `feos.<model>.PureRecord` (and similar classes) are combined into `feos.PureRecord`. [#271](https://github.com/feos-org/feos/pull/271)
- All Python classes are exported at the package root. [#309](https://github.com/feos-org/feos/pull/309)
- Add initial density as optional argument to critical point algorithms. [#300](https://github.com/feos-org/feos/pull/300)

### Packaging
- Updated `quantity` dependency to 0.12.
- Updated `num-dual` dependency to 0.12.
- Updated `numpy`, `PyO3` and `pythonize` dependencies to 0.27.
- Updated `nalgebra` dependency to 0.34.

## [0.8.0] - 2024-12-28
### Fixed
- Fixed the handling of association records in combination with induced association in PC-SAFT [#264](https://github.com/feos-org/feos/pull/264)
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["crates/*", "py-feos"]
default-members = ["crates/feos"]

[workspace.package]
version = "0.8.0"
version = "0.9.0"
edition = "2024"
authors = [
"Gernot Bauer <bauer@itt.uni-stuttgart.de>",
Expand All @@ -22,7 +22,7 @@ keywords = [
categories = ["science"]

[workspace.dependencies]
quantity = "0.11"
quantity = "0.12"
num-dual = "0.12"
ndarray = "0.16"
nalgebra = "0.34"
Expand All @@ -44,10 +44,10 @@ approx = "0.5"
criterion = "0.7"
paste = "1.0"

feos-core = { version = "0.8", path = "crates/feos-core" }
feos-dft = { version = "0.8", path = "crates/feos-dft" }
feos-derive = { version = "0.6", path = "crates/feos-derive" }
feos = { version = "0.8", path = "crates/feos" }
feos-core = { version = "0.9", path = "crates/feos-core" }
feos-dft = { version = "0.9", path = "crates/feos-dft" }
feos-derive = { version = "0.9", path = "crates/feos-derive" }
feos = { version = "0.9", path = "crates/feos" }

[profile.release-lto]
inherits = "release"
Expand Down
54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
# FeOs - A Framework for Equations of State and Classical Density Functional Theory

[![crate](https://img.shields.io/crates/v/feos.svg)](https://crates.io/crates/feos)
[![documentation](https://docs.rs/feos/badge.svg)](https://docs.rs/feos)
[![documentation](https://img.shields.io/badge/docs-github--pages-blue)](https://feos-org.github.io/feos/)
[![repository](https://img.shields.io/pypi/v/feos)](https://pypi.org/project/feos/)
[![crate](https://img.shields.io/crates/v/feos?logo=rust)](https://crates.io/crates/feos)
[![documentation](https://img.shields.io/docsrs/feos?logo=rust)](https://docs.rs/feos)
[![repository](https://img.shields.io/pypi/v/feos?logo=python)](https://pypi.org/project/feos/)
[![documentation](https://img.shields.io/badge/docs-github--pages-blue?logo=python)](https://feos-org.github.io/feos/)
[![FeOs Publication](https://img.shields.io/badge/DOI-10.1021/acs.iecr.2c04561-passing)](https://pubs.acs.org/doi/10.1021/acs.iecr.2c04561)

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

```python
from feos.eos import EquationOfState, State
from feos.pcsaft import PcSaftParameters, PcSaftRecord
import feos
import si_units as si

# 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)
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 = PcSaftParameters.from_model_records([record])
eos = EquationOfState.pcsaft(parameters)
parameters = feos.Parameters.new_pure(record)
eos = feos.EquationOfState.pcsaft(parameters)

# Define thermodynamic conditions
critical_point = State.critical_point(eos)
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}, p={p}.')
print(f"Critical point for methanol: T={t/si.KELVIN:.1f} K, p={p/si.BAR:.1f} bar.")
```
```terminal
Critical point for methanol: T=531.5 K, p=10.7 MPa.
Critical point for methanol: T=531.5 K, p=106.5 bar.
```

## Models
Expand Down Expand Up @@ -55,6 +68,14 @@ Other public repositories that implement models within the `FeOs` framework, but
## Parameters
In addition to the source code for the Rust and Python packages, this repository contains JSON files with previously published [parameters](https://github.com/feos-org/feos/tree/main/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](https://github.com/feos-org/feos/tree/main/parameters) directory and for versions up to `0.8.0` in the [parameters_old](https://github.com/feos-org/feos/tree/main/parameters_old) directory.<br><br>
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](https://github.com/itt-ustutt/num-dual) to generically calculate exact partial derivatives from Helmholtz energy equations of state. The derivatives are used to calculate
Expand Down Expand Up @@ -107,10 +128,11 @@ See the *Building from source* section for information about building the wheel

### Building from source

To compile the code you need the Rust compiler and `maturin` (>=0.13,<0.14) installed.
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
```

Expand All @@ -119,7 +141,7 @@ which uses the `python` and `all_models` feature as specified in the `pyproject.
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"
maturin develop --release --features "pcsaft dft"
```

for the PC-SAFT equation of state and Helmholtz energy functional.
Expand All @@ -134,7 +156,7 @@ which will use the `python` and `all_models` features specified in the `pyprojec
Use the following command to build a wheel with specific features:

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

LTO increases compile times measurably but the resulting wheel is more performant and has a smaller size.
Expand All @@ -146,7 +168,7 @@ For a documentation of the Python API, Python examples, and a guide to the under

## Benchmarks

Check out the [benches](https://github.com/feos-org/feos/tree/main/feos-benchmarks) directory for information about provided Rust benchmarks and how to run them.
Check out the [benches](https://github.com/feos-org/feos/tree/main/crates/feos/benches) directory for information about provided Rust benchmarks and how to run them.

## Developers

Expand Down
3 changes: 3 additions & 0 deletions crates/feos-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

> [!IMPORTANT]
> This file contains changes up to `feos-core` v0.8.0. For newer versions, changes are documented for the entire project rather than individual crates [here](../../CHANGELOG.md).

## Unreleased

## [0.8.0] - 2024-12-28
Expand Down
12 changes: 1 addition & 11 deletions crates/feos-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,4 @@ The crate makes use of [generalized (hyper-) dual numbers](https://github.com/it
- **critical points**,
- and **phase equilibria**.

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. Mainly as a simple test case, a **cubic** equation of state is published as part of this crate. Implementations of more sophisticated models can be found in the [feos](https://github.com/feos-org/feos) repository.

For information on how to implement your own equation of state, check out the [documentation](https://feos-org.github.io/feos/rustguide/index.html).

## Installation

Add this to your `Cargo.toml`

```toml
[dependencies]
feos-core = "0.7"
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. Mainly as a simple test case, a **cubic** equation of state is published as part of this crate. Implementations of more sophisticated models can be found in the [feos](https://crates.io/crates/feos) crate.
9 changes: 2 additions & 7 deletions crates/feos-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,17 @@ pub use phase_equilibria::{PhaseEquilibrium, TemperatureOrPressure};
pub use state::{Contributions, DensityInitialization, State, StateBuilder, StateHD, StateVec};

/// Level of detail in the iteration output.
#[derive(Copy, Clone, PartialOrd, PartialEq, Eq)]
#[derive(Copy, Clone, PartialOrd, PartialEq, Eq, Default)]
pub enum Verbosity {
/// Do not print output.
#[default]
None,
/// Print information about the success of failure of the iteration.
Result,
/// Print a detailed outpur for every iteration.
Iter,
}

impl Default for Verbosity {
fn default() -> Self {
Self::None
}
}

/// Options for the various phase equilibria solvers.
///
/// If the values are [None], solver specific default
Expand Down
26 changes: 9 additions & 17 deletions crates/feos-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
[package]
name = "feos-derive"
version = "0.6.0"
authors = [
"Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"Philipp Rehner <prehner@ethz.ch>",
]
edition = "2021"
readme = "README.md"
description = "Macros for the EquationOfState and HelmholtzEnergyFunctional traits in FeOs"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/feos-org"
repository = "https://github.com/feos-org/feos"
keywords = [
"physics",
"thermodynamics",
"equations_of_state",
"phase_equilibria",
]
edition.workspace = true
version.workspace = true
authors.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Macros for the automatic implementation of traits in FeOs"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion crates/feos-derive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

## What it does

The `feos-derive` crate contains two macros that provide boilerplate for the implementation of the `EquationOfState` and the `HelmholtzEnergyFunctional` trait for the `EosVariant` and `FunctionalVariant` enums of the `feos` crate. With these macros, new equations of state and functionals can be added to the variants without any further implementations needed.
The `feos-derive` crate contains macros that provide boilerplate for the implementation of several traits from `feos-core` and `feos-dft` for the FFI conform enums in `feos`. With these macros, new equations of state and functionals can be added straightforwardly to the Python interface or other FFIs.


3 changes: 3 additions & 0 deletions crates/feos-dft/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

> [!IMPORTANT]
> This file contains changes up to `feos-dft` v0.8.0. For newer versions, changes are documented for the entire project rather than individual crates [here](../../CHANGELOG.md).

## [Unreleased]

## [0.8.0] - 2024-12-28
Expand Down
1 change: 0 additions & 1 deletion crates/feos-dft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repository.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Generic classical DFT implementations for the `feos` project."
exclude = ["/.github/*", "*.ipynb"]

[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", "./docs-header.html"]
Expand Down
9 changes: 0 additions & 9 deletions crates/feos-dft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,3 @@ The crate makes use of efficient numerical methods to calculate density profiles
- Automatic calculation of partial derivatives of Helmholtz energy densities (including temperature derivatives) using automatic differentiation with [generalized (hyper-) dual numbers](https://github.com/itt-ustutt/num-dual).
- Modeling of heterosegmented molecules, including branched molecules.
- Functionalities for calculating surface tensions, adsorption isotherms, pair correlation functions, and solvation free energies.

## Installation

Add this to your `Cargo.toml`

```toml
[dependencies]
feos-dft = "0.7"
```
1 change: 1 addition & 0 deletions crates/feos/README.md
1 change: 0 additions & 1 deletion crates/feos/src/pcsaft/eos/polar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ pub enum Multipole {
}

impl MeanSegmentNumbers {
#[expect(clippy::needless_range_loop)]
pub fn new(parameters: &PcSaftPars, polarity: Multipole) -> Self {
let (npoles, comp) = match polarity {
Multipole::Dipole => (parameters.ndipole, &parameters.dipole_comp),
Expand Down
6 changes: 1 addition & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,5 @@

# -- Options for HTML output -------------------------------------------------
html_theme = 'furo'
html_title = "FeOs"
html_static_path = ['_static']
html_css_files = [
'style.css',
]
html_title = f'FeOs v{feos.__version__}'

2 changes: 1 addition & 1 deletion license-apache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021-present feos-org and Contributors. https://github.com/feos-org/feos
Copyright (c) 2021-2025 feos-org and Contributors. https://github.com/feos-org/feos

Apache License
Version 2.0, January 2004
Expand Down
Loading