Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure feos-core #226

Merged
merged 20 commits into from
Feb 26, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v2
with:
Expand All @@ -22,7 +22,7 @@ jobs:
run: |
pip install sphinx nbsphinx ipython pygments sphinx_inline_tabs sphinx_design sphinx_copybutton myst_parser furo
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Build documentation
run: sphinx-build docs/ public/ -b html
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: documentation
path: public
Expand Down
44 changes: 31 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
Expand All @@ -39,27 +39,45 @@ jobs:
profile: minimal
default: true
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
macos_universal2:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build wheels - universal2
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
args: --profile release-lto --universal2 --out dist
args: --release --target universal2-apple-darwin --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
Expand All @@ -71,12 +89,12 @@ jobs:
profile: minimal
default: true
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
Expand Down Expand Up @@ -105,7 +123,7 @@ jobs:
name: Release crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Release crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_derive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Release crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_dft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Release crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
crate: [feos-core, feos-dft]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: cargo build --release -p ${{ matrix.crate }}
- name: Run tests
Expand All @@ -31,7 +31,7 @@ jobs:
model: [pcsaft, gc_pcsaft, pets, uvtheory, saftvrqmie]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --features ${{ matrix.model }}
- name: Run tests
Expand All @@ -45,7 +45,7 @@ jobs:
model: [pcsaft, gc_pcsaft]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --features "${{ matrix.model }} dft"
- name: Run tests
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
args: --release --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
Expand All @@ -38,19 +38,19 @@ jobs:
profile: minimal
default: true
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
macos_universal2:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
Expand All @@ -62,11 +62,11 @@ jobs:
profile: minimal
default: true
- name: Build wheels - universal2
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
args: --release --universal2 --out dist
args: --release --target universal2-apple-darwin --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
Expand All @@ -76,7 +76,7 @@ jobs:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: 3.9
Expand All @@ -88,12 +88,12 @@ jobs:
profile: minimal
default: true
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Updated model implementations to account for the removal of trait objects for Helmholtz energy contributions and the de Broglie in `feos-core`. [#226](https://github.com/feos-org/feos/pull/226)
- Changed Helmholtz energy functions in `PcSaft` contributions so that the temperature-dependent diameter is re-used across different contributions. [#226](https://github.com/feos-org/feos/pull/226)
- Renamed structs in `uvtheory` module in accordance with names in other models (`UV...` to `UVTheory...`). [#226](https://github.com/feos-org/feos/pull/226)
- Restructured `uvtheory` module: added modules for BH and WCA. [#226](https://github.com/feos-org/feos/pull/226)
- Updated github action versions for CI/CD. [#226](https://github.com/feos-org/feos/pull/226)
- Added `codegen-units = 1` to `release-lto` profile. [#226](https://github.com/feos-org/feos/pull/226)

### Removed
- Removed `VirialOrder` from `uvtheory` module. Orders are now variants of the existing `Perturbation` enum. [#226](https://github.com/feos-org/feos/pull/226)

## [0.6.1] - 2024-01-11
- Python only: Release the changes introduced in `feos-core` 0.6.1.

Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ criterion = "0.5"
[profile.release-lto]
inherits = "release"
lto = true
codegen-units = 1
prehner marked this conversation as resolved.
Show resolved Hide resolved


[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion benches/contributions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn pcsaft(c: &mut Criterion) {
let name1 = comp1.identifier.name.as_deref().unwrap();
let name2 = comp2.identifier.name.as_deref().unwrap();
let mix = format!("{name1}_{name2}");
group.bench_function(mix, |b| b.iter(|| eos.evaluate_residual(&state_hd)));
group.bench_function(mix, |b| b.iter(|| eos.residual_helmholtz_energy(&state_hd)));
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions benches/dual_numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use feos::pcsaft::{PcSaft, PcSaftParameters};
use feos_core::si::*;
use feos_core::{
parameter::{IdentifierOption, Parameter},
Derivative, HelmholtzEnergy, HelmholtzEnergyDual, Residual, State, StateHD,
Derivative, Residual, State, StateHD,
};
use ndarray::{arr1, Array};
use ndarray::{arr1, Array, ScalarOperand};
use num_dual::DualNum;
use std::sync::Arc;
use typenum::P3;
Expand All @@ -29,11 +29,8 @@ fn state_pcsaft(parameters: PcSaftParameters) -> State<PcSaft> {
}

/// Residual Helmholtz energy given an equation of state and a StateHD.
fn a_res<D: DualNum<f64> + Copy, E: Residual>(inp: (&Arc<E>, &StateHD<D>)) -> D
where
(dyn HelmholtzEnergy + 'static): HelmholtzEnergyDual<D>,
{
inp.0.evaluate_residual(inp.1)
fn a_res<D: DualNum<f64> + Copy + ScalarOperand, E: Residual>(inp: (&Arc<E>, &StateHD<D>)) -> D {
inp.0.residual_helmholtz_energy(inp.1)
}

/// Benchmark for evaluation of the Helmholtz energy for different dual number types.
Expand Down
10 changes: 5 additions & 5 deletions docs/api/uvtheory.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# `feos.uvtheory`

Utilities to build `UVParameters`.
Utilities to build `UVTheoryParameters`.

## Example

```python
from feos.uvtheory import UVParameters
from feos.uvtheory import UVTheoryParameters

parameters = UVParameters.from_json(['methane', 'ethane'], 'parameters.json')
parameters = UVTheoryParameters.from_json(['methane', 'ethane'], 'parameters.json')
```

## Data types
Expand All @@ -23,6 +23,6 @@ parameters = UVParameters.from_json(['methane', 'ethane'], 'parameters.json')
PureRecord
BinaryRecord
Perturbation
UVRecord
UVParameters
UVTheoryRecord
UVTheoryParameters
```
Loading
Loading