Skip to content
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
Prev Previous commit
Next Next commit
started updates in feos
  • Loading branch information
g-bauer authored and prehner committed Jan 24, 2023
commit de867c37902c2fea5496dd076a33d73477f9d060
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ members = ["feos-core", "feos-dft", "feos-derive"]
crate-type = ["rlib", "cdylib"]

[dependencies]
quantity = "0.5"
num-dual = "0.5"
quantity = { git = "https://github.com/itt-ustutt/quantity" }
num-dual = { git = "https://github.com/itt-ustutt/num-dual", features = ["linalg"] }
feos-core = { version = "0.3", path = "feos-core" }
feos-dft = { version = "0.3", path = "feos-dft", optional = true }
feos-derive = { version = "0.1", path = "feos-derive" }
numpy = { version = "0.16", optional = true }
numpy = { version = "0.18", optional = true }
ndarray = { version = "0.15", features = ["approx"] }
petgraph = { version = "0.6", optional = true }
thiserror = "1.0"
Expand All @@ -40,7 +40,7 @@ indexmap = "1.8"
rayon = { version = "1.5", optional = true }

[dependencies.pyo3]
version = "0.16"
version = "0.18"
features = ["extension-module", "abi3", "abi3-py37"]
optional = true

Expand Down
1 change: 1 addition & 0 deletions src/association/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct PyAssociationRecord(pub AssociationRecord);

#[pymethods]
impl PyAssociationRecord {
#[pyo3(signature = (kappa_ab, epsilon_k_ab, na=None, nb=None))]
Comment thread
prehner marked this conversation as resolved.
#[new]
fn new(kappa_ab: f64, epsilon_k_ab: f64, na: Option<f64>, nb: Option<f64>) -> Self {
Self(AssociationRecord::new(kappa_ab, epsilon_k_ab, na, nb))
Expand Down
7 changes: 4 additions & 3 deletions src/gc_pcsaft/python/micelles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ macro_rules! impl_micelle_profile {
/// pressure: SINumber
/// Pressure.
///
#[pyo3(text_signature = "(delta_n_surfactant, pressure)")]
fn update_specification(&self, delta_n_surfactant: f64, pressure: PySINumber) -> Self {
Self(self.0.update_specification(MicelleSpecification::Size {
delta_n_surfactant,
Expand All @@ -124,8 +123,10 @@ macro_rules! impl_micelle_profile {
/// -------
/// MicelleProfile
///
#[pyo3(text_signature = "(solver1=None, solver2=None, debug=False)")]
#[args(solver1 = "None", solver2 = "None", debug = "false")]
#[pyo3(
signature = (solver1=None, solver2=None, debug=false),
text_signature = "(solver1=None, solver2=None, debug=False)"
)]
fn solve_micelle(
slf: &PyCell<Self>,
solver1: Option<PyDFTSolver>,
Expand Down
2 changes: 1 addition & 1 deletion src/gc_pcsaft/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl PyGcPcSaftEosParameters {
#[cfg(feature = "dft")]
#[pyclass(name = "GcPcSaftFunctionalParameters")]
#[pyo3(
text_signature = "(pure_records, segmentbinary_records=None, substances=None, search_option='Name')"
text_signature = "(pure_records, segmentbinary_records=None, substances=None, search_option=IdentifierOption.Name)"
Comment thread
prehner marked this conversation as resolved.
)]
#[derive(Clone)]
pub struct PyGcPcSaftFunctionalParameters(pub Arc<GcPcSaftFunctionalParameters>);
Expand Down
35 changes: 11 additions & 24 deletions src/python/dft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,10 @@ impl PyFunctionalVariant {
/// -------
/// HelmholtzEnergyFunctional
#[cfg(feature = "pcsaft")]
#[args(
fmt_version = "FMTVersion::WhiteBear",
max_eta = "0.5",
max_iter_cross_assoc = "50",
tol_cross_assoc = "1e-10",
dq_variant = "DQVariants::DQ35"
)]
#[staticmethod]
#[pyo3(
text_signature = "(parameters, fmt_version, max_eta, max_iter_cross_assoc, tol_cross_assoc, dq_variant)"
signature = (parameters, fmt_version=FMTVersion::WhiteBear, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10, dq_variant=DQVariants::DQ35),
text_signature = "(parameters, fmt_version=FMTVersion.WhiteBear, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10, dq_variant=DQVariants.DQ35)"
Comment thread
prehner marked this conversation as resolved.
)]
fn pcsaft(
parameters: PyPcSaftParameters,
Expand Down Expand Up @@ -114,15 +108,10 @@ impl PyFunctionalVariant {
/// -------
/// HelmholtzEnergyFunctional
#[cfg(feature = "gc_pcsaft")]
#[args(
fmt_version = "FMTVersion::WhiteBear",
max_eta = "0.5",
max_iter_cross_assoc = "50",
tol_cross_assoc = "1e-10"
)]
#[staticmethod]
#[pyo3(
text_signature = "(parameters, fmt_version, max_eta, max_iter_cross_assoc, tol_cross_assoc)"
signature = (parameters, fmt_version=FMTVersion::WhiteBear, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10),
text_signature = "(parameters, fmt_version=FMTVersion.WhiteBear, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10)"
)]
fn gc_pcsaft(
parameters: PyGcPcSaftFunctionalParameters,
Expand Down Expand Up @@ -157,9 +146,11 @@ impl PyFunctionalVariant {
/// -------
/// HelmholtzEnergyFunctional
#[cfg(feature = "pets")]
#[args(fmt_version = "FMTVersion::WhiteBear", max_eta = "0.5")]
#[staticmethod]
#[pyo3(text_signature = "(parameters, fmt_version, max_eta)")]
#[pyo3(
signature = (parameters, fmt_version=FMTVersion::WhiteBear, max_eta=0.5),
text_signature = "(parameters, fmt_version=FMTVersion.WhiteBear, max_eta=0.5)"
)]
fn pets(parameters: PyPetsParameters, fmt_version: FMTVersion, max_eta: f64) -> Self {
let options = PetsOptions { max_eta };
Self(Arc::new(
Expand All @@ -180,7 +171,6 @@ impl PyFunctionalVariant {
/// -------
/// HelmholtzEnergyFunctional
#[staticmethod]
#[pyo3(text_signature = "(sigma, version)")]
fn fmt(sigma: &PyArray1<f64>, fmt_version: FMTVersion) -> Self {
Self(Arc::new(
FMTFunctional::new(&sigma.to_owned_array(), fmt_version).into(),
Expand Down Expand Up @@ -208,13 +198,10 @@ impl PyFunctionalVariant {
/// HelmholtzEnergyFunctional
#[cfg(feature = "saftvrqmie")]
#[staticmethod]
#[args(
fmt_version = "FMTVersion::WhiteBear",
max_eta = "0.5",
fh_order = "FeynmanHibbsOrder::FH1",
inc_nonadd_term = "true"
#[pyo3(
signature = (parameters, fmt_version=FMTVersion::WhiteBear, max_eta=0.5, fh_order=FeynmanHibbsOrder::FH1, inc_nonadd_term=true),
text_signature = "(parameters, fmt_version=FMTVersion.WhiteBear, max_eta=0.5, fh_order=FeynmanHibbsOrder.FH1, inc_nonadd_term=True)"
)]
#[pyo3(text_signature = "(parameters, fmt_version, max_eta, fh_order, inc_nonadd_term)")]
fn saftvrqmie(
parameters: PySaftVRQMieParameters,
fmt_version: FMTVersion,
Expand Down
33 changes: 12 additions & 21 deletions src/python/eos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,11 @@ impl PyEosVariant {
/// The gc-PC-SAFT equation of state that can be used to compute thermodynamic
/// states.
#[cfg(feature = "gc_pcsaft")]
#[args(
max_eta = "0.5",
max_iter_cross_assoc = "50",
tol_cross_assoc = "1e-10"
)]
#[staticmethod]
#[pyo3(text_signature = "(parameters, max_eta, max_iter_cross_assoc, tol_cross_assoc)")]
#[pyo3(
signature = (parameters, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10),
text_signature = "(parameters, max_eta=0.5, max_iter_cross_assoc=50, tol_cross_assoc=1e-10)"
)]
pub fn gc_pcsaft(
parameters: PyGcPcSaftEosParameters,
max_eta: f64,
Expand Down Expand Up @@ -154,7 +152,6 @@ impl PyEosVariant {
/// The PR equation of state that can be used to compute thermodynamic
/// states.
#[staticmethod]
#[pyo3(text_signature = "(parameters)")]
pub fn peng_robinson(parameters: PyPengRobinsonParameters) -> Self {
Self(Arc::new(EosVariant::PengRobinson(PengRobinson::new(
parameters.0,
Expand All @@ -173,7 +170,6 @@ impl PyEosVariant {
/// -------
/// EquationOfState
#[staticmethod]
#[pyo3(text_signature = "(obj)")]
fn python(obj: Py<PyAny>) -> PyResult<Self> {
Ok(Self(Arc::new(EosVariant::Python(PyEoSObj::new(obj)?))))
}
Expand All @@ -193,9 +189,8 @@ impl PyEosVariant {
/// The PeTS equation of state that can be used to compute thermodynamic
/// states.
#[cfg(feature = "pets")]
#[args(max_eta = "0.5")]
#[staticmethod]
#[pyo3(text_signature = "(parameters, max_eta)")]
#[pyo3(signature = (parameters, max_eta=0.5), text_signature = "(parameters, max_eta=0.5)")]
fn pets(parameters: PyPetsParameters, max_eta: f64) -> Self {
let options = PetsOptions { max_eta };
Self(Arc::new(EosVariant::Pets(Pets::with_options(
Expand Down Expand Up @@ -224,13 +219,11 @@ impl PyEosVariant {
/// The UV-Theory equation of state that can be used to compute thermodynamic
/// states.
#[cfg(feature = "uvtheory")]
#[args(
max_eta = "0.5",
perturbation = "Perturbation::WeeksChandlerAndersen",
virial_order = "VirialOrder::Second"
)]
#[staticmethod]
#[pyo3(text_signature = "(parameters, max_eta, perturbation, virial_order)")]
#[pyo3(
signature = (parameters, max_eta=0.5, perturbation=Perturbation::WeeksChandlerAndersen, virial_order=VirialOrder::Second),
text_signature = "(parameters, max_eta=0.5, perturbation=Perturbation.WeeksChandlerAndersen, virial_order=VirialOrder.Second)"
)]
fn uvtheory(
parameters: PyUVParameters,
max_eta: f64,
Expand Down Expand Up @@ -268,12 +261,10 @@ impl PyEosVariant {
/// states.
#[cfg(feature = "saftvrqmie")]
#[staticmethod]
#[args(
max_eta = "0.5",
fh_order = "FeynmanHibbsOrder::FH1",
inc_nonadd_term = "true"
#[pyo3(
signature = (parameters, max_eta=0.5, fh_order=FeynmanHibbsOrder::FH1, inc_nonadd_term=true),
text_signature = "(parameters, max_eta=0.5, fh_order=FeynmanHibbsOrder.FH1, inc_nonadd_term=True)"
)]
#[pyo3(text_signature = "(parameters, max_eta, fh_order, inc_nonadd_term)")]
fn saftvrqmie(
parameters: PySaftVRQMieParameters,
max_eta: f64,
Expand Down