From 994cf85abfdc1d3b36c5a1f003a7ba051d849347 Mon Sep 17 00:00:00 2001 From: Philipp Rehner Date: Tue, 13 Dec 2022 14:19:37 +0100 Subject: [PATCH 1/3] enforce the limitations of the homo gc method for PC-SAFT more strictly --- src/pcsaft/parameters.rs | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/pcsaft/parameters.rs b/src/pcsaft/parameters.rs index ccdb2e72b..f7e2b980c 100644 --- a/src/pcsaft/parameters.rs +++ b/src/pcsaft/parameters.rs @@ -151,25 +151,15 @@ impl FromSegments for PcSaftRecord { impl FromSegments for PcSaftRecord { fn from_segments(segments: &[(Self, usize)]) -> Result { // We do not allow more than a single segment for q, mu, kappa_ab, epsilon_k_ab - let quadpole_comps = segments.iter().filter_map(|(s, _)| s.q).count(); - if quadpole_comps > 1 { - return Err(ParameterError::IncompatibleParameters(format!( - "{quadpole_comps} segments with quadrupole moment." - ))); - }; - let dipole_comps = segments.iter().filter_map(|(s, _)| s.mu).count(); - if dipole_comps > 1 { - return Err(ParameterError::IncompatibleParameters(format!( - "{dipole_comps} segment with dipole moment." - ))); - }; - let assoc_comps = segments + let quadpole_segments: usize = segments.iter().filter_map(|(s, n)| s.q.map(|_| n)).sum(); + let dipole_segments: usize = segments.iter().filter_map(|(s, n)| s.mu.map(|_| n)).sum(); + let assoc_segments: usize = segments .iter() - .filter_map(|(s, _)| s.association_record.as_ref()) - .count(); - if assoc_comps > 1 { + .filter_map(|(s, n)| s.association_record.map(|_| n)) + .sum(); + if quadpole_segments + dipole_segments + assoc_segments > 1 { return Err(ParameterError::IncompatibleParameters(format!( - "{assoc_comps} segments with association sites." + "Too many polar/associating segments (dipolar: {dipole_segments}, quadrupolar {quadpole_segments}, associating: {assoc_segments})." ))); } let segments: Vec<_> = segments From 946a52e02b1c7abf14c0d94b5e14d4c475ff1b8c Mon Sep 17 00:00:00 2001 From: Philipp Rehner Date: Tue, 13 Dec 2022 14:54:08 +0100 Subject: [PATCH 2/3] add changelog entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c03b4bb8..eb6112660 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- Added SAFT-VRQ Mie equation of state and Helmholtz energy functional for first order Feynman-Hibbs corrected Mie fluids. [#79](https://github.com/feos-org/feos/pull/79) +- Added SAFT-VRQ Mie equation of state and Helmholtz energy functional for first order Feynman-Hibbs corrected Mie fluids. [#79](https://github.com/feos-org/feos/pull/79) Thanks to @morteham. - Added `estimator` module to documentation. [#86](https://github.com/feos-org/feos/pull/86) ### Changed - Export `EosVariant` and `FunctionalVariant` directly in the crate root instead of their own modules. [#62](https://github.com/feos-org/feos/pull/62) - Changed constructors `VaporPressure::new` and `DataSet.vapor_pressure` (Python) to take a new optional argument `critical_temperature`. [#86](https://github.com/feos-org/feos/pull/86) +- The limitations of the homo gc method for PC-SAFT are enforced more strictly. [#88](https://github.com/feos-org/feos/pull/88) ## [0.3.0] - 2022-09-14 - Major restructuring of the entire `feos` project. All individual models are reunited in the `feos` crate. `feos-core` and `feos-dft` still live as individual crates within the `feos` workspace. From 5612038c13ff1b3e7ecae1bdb731507a723b7998 Mon Sep 17 00:00:00 2001 From: Philipp Rehner Date: Tue, 13 Dec 2022 14:55:17 +0100 Subject: [PATCH 3/3] forgot to save --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb6112660..24f824759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- Added SAFT-VRQ Mie equation of state and Helmholtz energy functional for first order Feynman-Hibbs corrected Mie fluids. [#79](https://github.com/feos-org/feos/pull/79) Thanks to @morteham. +- Added SAFT-VRQ Mie equation of state and Helmholtz energy functional for first order Feynman-Hibbs corrected Mie fluids. [#79](https://github.com/feos-org/feos/pull/79) - Added `estimator` module to documentation. [#86](https://github.com/feos-org/feos/pull/86) ### Changed