-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathrecord.rs
More file actions
58 lines (55 loc) · 1.66 KB
/
Copy pathrecord.rs
File metadata and controls
58 lines (55 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use crate::association::AssociationRecord;
use serde::{Deserialize, Serialize};
/// gc-PC-SAFT pure-component parameters.
#[derive(Serialize, Deserialize, Clone, Default)]
pub struct GcPcSaftRecord {
/// Segment shape factor
pub m: f64,
/// Segment diameter in units of Angstrom
pub sigma: f64,
/// Energetic parameter in units of Kelvin
pub epsilon_k: f64,
/// Dipole moment in units of Debye
#[serde(skip_serializing_if = "Option::is_none")]
pub mu: Option<f64>,
/// Association parameters
#[serde(flatten)]
#[serde(skip_serializing_if = "Option::is_none")]
pub association_record: Option<AssociationRecord>,
/// interaction range parameter for the dispersion functional
#[serde(skip_serializing_if = "Option::is_none")]
pub psi_dft: Option<f64>,
}
impl GcPcSaftRecord {
pub fn new(
m: f64,
sigma: f64,
epsilon_k: f64,
mu: Option<f64>,
association_record: Option<AssociationRecord>,
psi_dft: Option<f64>,
) -> Self {
Self {
m,
sigma,
epsilon_k,
mu,
association_record,
psi_dft,
}
}
}
impl std::fmt::Display for GcPcSaftRecord {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "GcPcSaftRecord(m={}", self.m)?;
write!(f, ", sigma={}", self.sigma)?;
write!(f, ", epsilon_k={}", self.epsilon_k)?;
if let Some(n) = &self.mu {
write!(f, ", mu={}", n)?;
}
if let Some(n) = &self.association_record {
write!(f, ", association_record={}", n)?;
}
write!(f, ")")
}
}