Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Release v0.2.0
  • Loading branch information
prehner committed Apr 7, 2022
commit 409de331076584a62402344a54b2cd991ade0069
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.0] - 2022-03-09
### Packaging
- Updated `pyo3` and `numpy` dependencies to 0.16.
- Updated `quantity` dependency to 0.5.
- Updated `num-dual` dependency to 0.5.
- Updated `feos-core` dependency to 0.2.
- Updated `ang` dependency to 0.6.

## [0.1.3] - 2022-02-17
### Fixed
- The pore volume for `Pore3D` is now also accesible from Python. [#16](https://github.com/feos-org/feos-dft/pull/16)
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ exclude = ["/.github/*", "*.ipynb"]
rustdoc-args = [ "--html-in-header", "./docs-header.html" ]

[dependencies]
quantity = { version = "0.4", features = ["linalg"] }
feos-core = "0.1"
num-dual = "0.4"
quantity = { version = "0.5", features = ["linalg"] }
feos-core = { path = "../feos-core" }
num-dual = "0.5"
ndarray = { version = "0.15", features = ["serde", "rayon"] }
ndarray-stats = "0.5"
rustdct = "0.7"
rustfft = "6.0"
log = "0.4"
ang = "0.5"
ang = "0.6"
num-traits = "0.2"
libc = "0.2"
gauss-quad = "0.1"
petgraph = "0.6"
numpy = { version = "0.15", optional = true }
pyo3 = { version = "0.15", optional = true }
numpy = { version = "0.16", optional = true }
pyo3 = { version = "0.16", optional = true }

[features]
default = []
python = ["pyo3", "numpy", "feos-core/python"]
python = ["pyo3", "numpy", "feos-core/python"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Add this to your `Cargo.toml`

```toml
[dependencies]
feos-dft = "0.1"
feos-dft = "0.2"
```

## Test building python wheel
Expand Down
2 changes: 1 addition & 1 deletion build_wheel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ crate-type = ["cdylib"]

[dependencies]
feos-dft = { path = "..", features = ["python"] }
pyo3 = { version = "0.15", features = ["extension-module", "abi3", "abi3-py36"] }
pyo3 = { version = "0.16", features = ["extension-module", "abi3", "abi3-py37"] }

22 changes: 11 additions & 11 deletions src/adsorption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use super::functional::{HelmholtzEnergyFunctional, DFT};
use super::solver::DFTSolver;
use feos_core::{
Contributions, EosError, EosResult, EosUnit, EquationOfState, StateBuilder, VLEOptions,
Contributions, EosError, EosResult, EosUnit, EquationOfState, SolverOptions, StateBuilder,
};
use ndarray::{arr1, Array1, Dimension, Ix1, Ix3};
use quantity::{QuantityArray1, QuantityArray2, QuantityScalar};
Expand Down Expand Up @@ -179,7 +179,7 @@ where
pore,
molefracs,
solver,
VLEOptions::default(),
SolverOptions::default(),
);
if let Ok(equilibrium) = equilibrium {
let pressure = pressure.equilibrium(&equilibrium)?;
Expand Down Expand Up @@ -259,9 +259,9 @@ where
.pressure(pressure.get(0))
.moles(&moles)
.build()?;
if functional.components() > 1 && !bulk.is_stable(VLEOptions::default())? {
if functional.components() > 1 && !bulk.is_stable(SolverOptions::default())? {
bulk = bulk
.tp_flash(None, VLEOptions::default(), None)?
.tp_flash(None, SolverOptions::default(), None)?
.vapor()
.clone();
}
Expand All @@ -273,9 +273,9 @@ where
.pressure(pressure.get(i))
.moles(&moles)
.build()?;
if functional.components() > 1 && !bulk.is_stable(VLEOptions::default())? {
if functional.components() > 1 && !bulk.is_stable(SolverOptions::default())? {
bulk = bulk
.tp_flash(None, VLEOptions::default(), None)?
.tp_flash(None, SolverOptions::default(), None)?
.vapor()
.clone();
}
Expand All @@ -299,7 +299,7 @@ where
pore: &S,
molefracs: Option<&Array1<f64>>,
solver: Option<&DFTSolver>,
options: VLEOptions,
options: SolverOptions,
) -> EosResult<Adsorption<U, D, F>> {
let moles =
functional.validate_moles(molefracs.map(|x| x * U::reference_moles()).as_ref())?;
Expand Down Expand Up @@ -395,11 +395,11 @@ where
QuantityArray1::from_shape_fn(self.profiles.len(), |i| match &self.profiles[i] {
Ok(p) => {
if p.profile.bulk.eos.components() > 1
&& !p.profile.bulk.is_stable(VLEOptions::default()).unwrap()
&& !p.profile.bulk.is_stable(SolverOptions::default()).unwrap()
{
p.profile
.bulk
.tp_flash(None, VLEOptions::default(), None)
.tp_flash(None, SolverOptions::default(), None)
.unwrap()
.vapor()
.pressure(Contributions::Total)
Expand All @@ -415,11 +415,11 @@ where
QuantityArray1::from_shape_fn(self.profiles.len(), |i| match &self.profiles[i] {
Ok(p) => {
if p.profile.bulk.eos.components() > 1
&& !p.profile.bulk.is_stable(VLEOptions::default()).unwrap()
&& !p.profile.bulk.is_stable(SolverOptions::default()).unwrap()
{
p.profile
.bulk
.tp_flash(None, VLEOptions::default(), None)
.tp_flash(None, SolverOptions::default(), None)
.unwrap()
.vapor()
.molar_gibbs_energy(Contributions::Total)
Expand Down
4 changes: 2 additions & 2 deletions src/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ impl<T: HelmholtzEnergyFunctional> DFT<T> {
D::Larger: Dimension<Smaller = D>,
{
// Calculate residual Helmholtz energy density and functional derivative
let t = temperature.to_reduced(U::reference_temperature()).unwrap();
let rho = density.to_reduced(U::reference_density()).unwrap();
let t = temperature.to_reduced(U::reference_temperature())?;
let rho = density.to_reduced(U::reference_density())?;
let (mut f, dfdrho) = self.functional_derivative(t, &rho, convolver)?;

// calculate the grand potential density
Expand Down
4 changes: 2 additions & 2 deletions src/python/adsorption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ macro_rules! impl_adsorption_isotherm {
solver: Option<PyDFTSolver>,
max_iter: Option<usize>,
tol: Option<f64>,
verbosity: Option<PyVerbosity>,
verbosity: Option<Verbosity>,
) -> PyResult<Self> {
Ok(Self(Adsorption::phase_equilibrium(
&functional.0,
Expand All @@ -229,7 +229,7 @@ macro_rules! impl_adsorption_isotherm {
&pore.0,
molefracs.map(|x| x.to_owned_array()).as_ref(),
solver.map(|s| s.0).as_ref(),
(max_iter, tol, verbosity.map(|v| v.0)).into(),
(max_iter, tol, verbosity).into(),
)?))
}

Expand Down
1 change: 0 additions & 1 deletion src/python/fundamental_measure_theory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::functional::DFT;
use crate::fundamental_measure_theory::{FMTFunctional, FMTVersion};
use crate::solvation::*;
use crate::*;
use feos_core::python::{PyContributions, PyVerbosity};
use feos_core::*;
use numpy::*;
use pyo3::exceptions::PyValueError;
Expand Down
2 changes: 1 addition & 1 deletion src/python/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pyo3::prelude::*;
use pyo3::wrap_pymodule;
use quantity::python::PyInit_quantity;
use quantity::python::__PYO3_PYMODULE_DEF_QUANTITY;

mod adsorption;
mod fundamental_measure_theory;
Expand Down
18 changes: 9 additions & 9 deletions src/python/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ macro_rules! impl_profile {
/// Returns
/// -------
/// SIArray
#[args(contributions = "PyContributions::Total()")]
#[args(contributions = "Contributions::Total")]
#[pyo3(text_signature = "($self, contributions)")]
fn entropy_density(
&mut self,
contributions: PyContributions,
contributions: Contributions,
) -> PyResult<$si_arr> {
Ok($si_arr::from(
self.0.profile.entropy_density(contributions.0)?,
self.0.profile.entropy_density(contributions)?,
))
}

Expand All @@ -139,14 +139,14 @@ macro_rules! impl_profile {
/// Returns
/// -------
/// SINumber
#[args(contributions = "PyContributions::Total()")]
#[args(contributions = "Contributions::Total")]
#[pyo3(text_signature = "($self, contributions)")]
fn entropy(
&mut self,
contributions: PyContributions,
contributions: Contributions,
) -> PyResult<PySINumber> {
Ok(PySINumber::from(
self.0.profile.entropy(contributions.0)?,
self.0.profile.entropy(contributions)?,
))
}

Expand All @@ -161,14 +161,14 @@ macro_rules! impl_profile {
/// Returns
/// -------
/// SINumber
#[args(contributions = "PyContributions::Total()")]
#[args(contributions = "Contributions::Total")]
#[pyo3(text_signature = "($self, contributions)")]
fn internal_energy(
&mut self,
contributions: PyContributions,
contributions: Contributions,
) -> PyResult<PySINumber> {
Ok(PySINumber::from(
self.0.profile.internal_energy(contributions.0)?,
self.0.profile.internal_energy(contributions)?,
))
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/python/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ impl PyDFTSolver {
fn _repr_markdown_(&self) -> String {
self.0._repr_markdown_()
}
}

#[pyproto]
impl pyo3::class::basic::PyObjectProtocol for PyDFTSolver {
fn __repr__(&self) -> PyResult<String> {
Ok(self.0.to_string())
}
Expand Down