-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathpython.rs
More file actions
47 lines (39 loc) · 1.07 KB
/
python.rs
File metadata and controls
47 lines (39 loc) · 1.07 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
use super::AssociationRecord;
use feos_core::impl_json_handling;
use feos_core::parameter::ParameterError;
use pyo3::prelude::*;
/// Pure component association parameters
#[pyclass(
name = "AssociationRecord",
text_signature = "(kappa_ab, epsilon_k_ab, na=None, nb=None)"
)]
#[derive(Clone)]
pub struct PyAssociationRecord(pub AssociationRecord);
#[pymethods]
impl PyAssociationRecord {
#[pyo3(signature = (kappa_ab, epsilon_k_ab, na=None, nb=None))]
#[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))
}
#[getter]
fn get_kappa_ab(&self) -> f64 {
self.0.kappa_ab
}
#[getter]
fn get_epsilon_k_ab(&self) -> f64 {
self.0.epsilon_k_ab
}
#[getter]
fn get_na(&self) -> Option<f64> {
self.0.na
}
#[getter]
fn get_nb(&self) -> Option<f64> {
self.0.nb
}
fn __repr__(&self) -> PyResult<String> {
Ok(self.0.to_string())
}
}
impl_json_handling!(PyAssociationRecord);