Skip to content

Commit a167f8f

Browse files
authored
Migrate FeOs to new quantity crate (#257)
1 parent 124098c commit a167f8f

File tree

121 files changed

+1086
-2414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1086
-2414
lines changed

.github/workflows/wheels.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,19 @@ jobs:
6161
path: dist
6262
windows:
6363
runs-on: windows-latest
64-
strategy:
65-
matrix:
66-
target: [x64, x86]
6764
steps:
6865
- uses: actions/checkout@v4
6966
- uses: actions/setup-python@v5
7067
with:
7168
python-version: 3.9
72-
architecture: ${{ matrix.target }}
69+
architecture: x64
7370
- name: Build wheels
7471
uses: PyO3/maturin-action@v1
7572
with:
76-
target: ${{ matrix.target }}
73+
target: x64
7774
args: --release --out dist
7875
- name: Upload wheels
7976
uses: actions/upload-artifact@v4
8077
with:
81-
name: wheel-${{ matrix.target }}
78+
name: wheel-windows-x86_64
8279
path: dist

Cargo.toml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
[package]
22
name = "feos"
33
version = "0.7.0"
4-
authors = ["Gernot Bauer <bauer@itt.uni-stuttgart.de>", "Philipp Rehner <prehner@ethz.ch>"]
4+
authors = [
5+
"Gernot Bauer <bauer@itt.uni-stuttgart.de>",
6+
"Philipp Rehner <prehner@ethz.ch>",
7+
]
58
edition = "2021"
69
readme = "README.md"
710
license = "MIT OR Apache-2.0"
811
description = "FeOs - A framework for equations of state and classical density functional theory."
912
homepage = "https://github.com/feos-org"
1013
repository = "https://github.com/feos-org/feos"
11-
keywords = ["physics", "thermodynamics", "equations_of_state", "phase_equilibria"]
14+
keywords = [
15+
"physics",
16+
"thermodynamics",
17+
"equations_of_state",
18+
"phase_equilibria",
19+
]
1220
categories = ["science"]
1321

1422
[package.metadata.docs.rs]
1523
features = ["all_models", "rayon"]
16-
rustdoc-args = [ "--html-in-header", "./docs-header.html" ]
24+
rustdoc-args = ["--html-in-header", "./docs-header.html"]
1725

1826
[workspace]
1927
members = ["feos-core", "feos-dft", "feos-derive"]
@@ -22,13 +30,13 @@ members = ["feos-core", "feos-dft", "feos-derive"]
2230
crate-type = ["rlib", "cdylib"]
2331

2432
[dependencies]
25-
quantity = { version = "0.8", optional = true }
26-
num-dual = "0.9"
33+
quantity = "0.9"
34+
num-dual = "0.10"
2735
feos-core = { version = "0.7", path = "feos-core" }
2836
feos-dft = { version = "0.7", path = "feos-dft", optional = true }
2937
feos-derive = { version = "0.5", path = "feos-derive" }
30-
numpy = { version = "0.21", optional = true }
31-
ndarray = { version = "0.15", features = ["approx"] }
38+
numpy = { version = "0.22", optional = true }
39+
ndarray = { version = "0.16", features = ["approx"] }
3240
petgraph = { version = "0.6", optional = true }
3341
thiserror = "1.0"
3442
conv = "0.3"
@@ -42,7 +50,7 @@ itertools = "0.13"
4250
typenum = "1.16"
4351

4452
[dependencies.pyo3]
45-
version = "0.21"
53+
version = "0.22"
4654
features = ["extension-module", "abi3", "abi3-py37"]
4755
optional = true
4856

@@ -74,8 +82,25 @@ pets = []
7482
saftvrqmie = []
7583
saftvrmie = []
7684
rayon = ["dep:rayon", "ndarray/rayon", "feos-core/rayon", "feos-dft?/rayon"]
77-
python = ["pyo3", "numpy", "quantity/python", "feos-core/python", "feos-dft?/python", "rayon"]
78-
all_models = ["dft", "estimator", "pcsaft", "epcsaft", "gc_pcsaft", "uvtheory", "pets", "saftvrqmie", "saftvrmie"]
85+
python = [
86+
"pyo3",
87+
"numpy",
88+
"quantity/python_numpy",
89+
"feos-core/python",
90+
"feos-dft?/python",
91+
"rayon",
92+
]
93+
all_models = [
94+
"dft",
95+
"estimator",
96+
"pcsaft",
97+
"epcsaft",
98+
"gc_pcsaft",
99+
"uvtheory",
100+
"pets",
101+
"saftvrqmie",
102+
"saftvrmie",
103+
]
79104

80105
[[bench]]
81106
name = "state_properties"

benches/contributions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use criterion::{criterion_group, criterion_main, Criterion};
99
use feos::pcsaft::{PcSaft, PcSaftParameters};
1010
use feos_core::parameter::{IdentifierOption, Parameter};
11-
use feos_core::si::*;
11+
use quantity::*;
1212
use feos_core::{DensityInitialization, Derivative, Residual, State};
1313
use ndarray::arr1;
1414
use std::sync::Arc;

benches/dft_pore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use feos::gc_pcsaft::{GcPcSaftFunctional, GcPcSaftFunctionalParameters};
55
use feos::hard_sphere::{FMTFunctional, FMTVersion};
66
use feos::pcsaft::{PcSaftFunctional, PcSaftParameters};
77
use feos_core::parameter::{IdentifierOption, Parameter, ParameterHetero};
8-
use feos_core::si::{ANGSTROM, KELVIN, NAV};
98
use feos_core::{PhaseEquilibrium, State, StateBuilder};
109
use feos_dft::adsorption::{ExternalPotential, Pore1D, PoreSpecification};
1110
use feos_dft::{DFTSolver, Geometry};
1211
use ndarray::arr1;
12+
use quantity::{ANGSTROM, KELVIN, NAV};
1313
use std::sync::Arc;
1414
use typenum::P3;
1515

benches/dual_numbers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! creation.
66
use criterion::{criterion_group, criterion_main, Criterion};
77
use feos::pcsaft::{PcSaft, PcSaftParameters};
8-
use feos_core::si::*;
8+
use quantity::*;
99
use feos_core::{
1010
parameter::{IdentifierOption, Parameter},
1111
Derivative, Residual, State, StateHD,

benches/dual_numbers_saftvrmie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
use criterion::{criterion_group, criterion_main, Criterion};
77
use feos::hard_sphere::HardSphereProperties;
88
use feos::saftvrmie::{test_utils::test_parameters, SaftVRMie, SaftVRMieParameters};
9-
use feos_core::si::*;
109
use feos_core::{Derivative, Residual, State, StateHD};
1110
use ndarray::{Array, ScalarOperand};
1211
use num_dual::DualNum;
12+
use quantity::*;
1313
use std::sync::Arc;
1414

1515
/// Helper function to create a state for given parameters.

benches/state_creation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(clippy::type_complexity)]
22
use criterion::{criterion_group, criterion_main, Criterion};
33
use feos::pcsaft::{PcSaft, PcSaftParameters};
4-
use feos_core::si::*;
4+
use quantity::*;
55
use feos_core::{
66
parameter::{IdentifierOption, Parameter},
77
Contributions, DensityInitialization, PhaseEquilibrium, Residual, State, TemperatureOrPressure,

benches/state_properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(clippy::type_complexity)]
22
use criterion::{criterion_group, criterion_main, Criterion};
33
use feos::pcsaft::{PcSaft, PcSaftParameters};
4-
use feos_core::si::*;
4+
use quantity::*;
55
use feos_core::{
66
parameter::{IdentifierOption, Parameter},
77
Contributions, Residual, State,

feos-core/Cargo.toml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
[package]
22
name = "feos-core"
33
version = "0.7.0"
4-
authors = ["Gernot Bauer <bauer@itt.uni-stuttgart.de>",
5-
"Philipp Rehner <prehner@ethz.ch"]
4+
authors = [
5+
"Gernot Bauer <bauer@itt.uni-stuttgart.de>",
6+
"Philipp Rehner <prehner@ethz.ch",
7+
]
68
edition = "2021"
79
rust-version = "1.80"
810
license = "MIT OR Apache-2.0"
911
description = "Core traits and functionalities for the `feos` project."
1012
homepage = "https://github.com/feos-org"
1113
readme = "README.md"
1214
repository = "https://github.com/feos-org/feos"
13-
keywords = ["physics", "thermodynamics", "equations_of_state", "phase_equilibria"]
15+
keywords = [
16+
"physics",
17+
"thermodynamics",
18+
"equations_of_state",
19+
"phase_equilibria",
20+
]
1421
categories = ["science"]
1522
workspace = ".."
1623

1724
[package.metadata.docs.rs]
18-
rustdoc-args = [ "--html-in-header", "./docs-header.html" ]
19-
features = [ "rayon" ]
25+
rustdoc-args = ["--html-in-header", "./docs-header.html"]
26+
features = ["rayon"]
2027

2128
[dependencies]
22-
quantity = { version = "0.8", optional = true }
23-
num-dual = { version = "0.9", features = ["linalg"] }
24-
ndarray = { version = "0.15", features = ["serde", "approx-0_5"] }
25-
nalgebra = "0.32"
29+
quantity = { version = "0.9", features = ["approx", "ndarray"] }
30+
num-dual = { version = "0.10", features = ["linalg"] }
31+
ndarray = { version = "0.16", features = ["serde", "approx"] }
32+
nalgebra = "0.33"
2633
num-traits = "0.2"
2734
thiserror = "1.0"
2835
serde = { version = "1.0", features = ["derive"] }
2936
serde_json = "1.0"
3037
indexmap = "2.0"
3138
conv = "0.3"
32-
numpy = { version = "0.21", optional = true }
33-
pyo3 = { version = "0.21", optional = true }
39+
numpy = { version = "0.22", optional = true }
40+
pyo3 = { version = "0.22", features = ["multiple-pymethods"], optional = true }
3441
rayon = { version = "1.5", optional = true }
3542
typenum = "1.16"
3643
approx = "0.5"
3744
regex = "1.9"
38-
ang = "0.6"
3945

4046
[features]
4147
default = []

feos-core/src/cubic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//! [this wikipedia article](https://en.wikipedia.org/wiki/Cubic_equations_of_state#Peng%E2%80%93Robinson_equation_of_state).
77
use crate::equation_of_state::{Components, Residual};
88
use crate::parameter::{Identifier, Parameter, ParameterError, PureRecord};
9-
use crate::si::{MolarWeight, GRAM, MOL};
109
use crate::state::StateHD;
1110
use ndarray::{Array1, Array2, ScalarOperand};
1211
use num_dual::DualNum;
12+
use quantity::{MolarWeight, GRAM, MOL};
1313
use serde::{Deserialize, Serialize};
1414
use std::f64::consts::SQRT_2;
1515
use std::fmt;
@@ -223,10 +223,10 @@ impl Residual for PengRobinson {
223223
#[cfg(test)]
224224
mod tests {
225225
use super::*;
226-
use crate::si::{KELVIN, PASCAL};
227226
use crate::state::{Contributions, State};
228227
use crate::{EosResult, SolverOptions, Verbosity};
229228
use approx::*;
229+
use quantity::{KELVIN, PASCAL};
230230
use std::sync::Arc;
231231

232232
fn pure_record_vec() -> Vec<PureRecord<PengRobinsonRecord>> {

0 commit comments

Comments
 (0)