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