Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit 7fdb57a

Browse files
committed
Removed the check for multiple polar/associating groups in homo gc constructor
1 parent f46738e commit 7fdb57a

2 files changed

Lines changed: 8 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99
- `PcSaftFunctional` now always uses `Joback` as ideal gas model if parameters are available. [#25](https://github.com/feos-org/feos-pcsaft/pull/25)
1010

11+
### Changed
12+
- Building Pc-SAFT parameters from segments does not check anymore, whether multiple polar or associating groups are present. [#33](https://github.com/feos-org/feos-pcsaft/pull/33)
13+
1114
## [0.1.0] - 2022-01-12
1215
### Added
1316
- Initial release

src/parameters.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,40 +56,22 @@ impl FromSegments for PcSaftRecord {
5656
epsilon_k += s.m * s.epsilon_k * *n;
5757
});
5858

59-
// We do not allow more than a single segment for q, mu, kappa_ab, epsilon_k_ab
60-
let q: Vec<f64> = segments.iter().filter_map(|s| s.0.q).collect();
61-
let q = match q.len() {
62-
0 => None,
63-
1 => Some(q[0]),
64-
_ => panic!("More than one segment with quadrupole moment."),
65-
};
59+
let q = segments
60+
.iter()
61+
.filter_map(|(s, n)| s.q.map(|q| q * *n))
62+
.reduce(|a, b| a + b);
6663
let mu = segments
6764
.iter()
6865
.filter_map(|(s, n)| s.mu.map(|mu| mu * *n))
6966
.reduce(|a, b| a + b);
70-
// let mu = match mu.len() {
71-
// 0 => None,
72-
// 1 => Some(mu[0]),
73-
// _ => panic!("More than one segment with dipole moment."),
74-
// };
7567
let kappa_ab = segments
7668
.iter()
7769
.filter_map(|(s, n)| s.kappa_ab.map(|k| k * *n))
7870
.reduce(|a, b| a + b);
79-
// let kappa_ab = match kappa_ab.len() {
80-
// 0 => None,
81-
// 1 => Some(kappa_ab[0]),
82-
// _ => panic!("More than one segment with association site."),
83-
// };
8471
let epsilon_k_ab = segments
8572
.iter()
8673
.filter_map(|(s, n)| s.epsilon_k_ab.map(|e| e * *n))
8774
.reduce(|a, b| a + b);
88-
// let epsilon_k_ab = match epsilon_k_ab.len() {
89-
// 0 => None,
90-
// 1 => Some(epsilon_k_ab[0]),
91-
// _ => panic!("More than one segment with association site"),
92-
// };
9375
let na = segments
9476
.iter()
9577
.filter_map(|(s, n)| s.na.map(|na| na * *n))
@@ -98,6 +80,7 @@ impl FromSegments for PcSaftRecord {
9880
.iter()
9981
.filter_map(|(s, n)| s.nb.map(|nb| nb * *n))
10082
.reduce(|a, b| a + b);
83+
10184
Self {
10285
m,
10386
sigma: (sigma3 / m).cbrt(),

0 commit comments

Comments
 (0)