11use super :: parameters:: PyPcSaftParameters ;
2+ use crate :: eos:: polar:: DQVariants ;
23use crate :: eos:: { PcSaft , PcSaftOptions } ;
34use feos_core:: python:: { PyContributions , PyVerbosity } ;
45use feos_core:: utils:: {
@@ -14,6 +15,16 @@ use quantity::si::*;
1415use std:: collections:: HashMap ;
1516use std:: rc:: Rc ;
1617
18+ impl From < & str > for DQVariants {
19+ fn from ( str : & str ) -> Self {
20+ match str {
21+ "dq35" => Self :: DQ35 ,
22+ "dq44" => Self :: DQ44 ,
23+ _ => panic ! ( "dq_variant must be either \" dq35\" or \" dq44\" " ) ,
24+ }
25+ }
26+ }
27+
1728/// Initialize PC-SAFT equation of state.
1829///
1930/// Parameters
@@ -26,16 +37,16 @@ use std::rc::Rc;
2637/// Maximum number of iterations for cross association. Defaults to 50.
2738/// tol_cross_assoc : float
2839/// Tolerance for convergence of cross association. Defaults to 1e-10.
40+ /// dq_variant : {'dq35', 'dq44'}, optional
41+ /// Combination rule used in the dipole/quadrupole term. Defaults to 'dq35'
2942///
3043/// Returns
3144/// -------
3245/// PcSaft
3346/// The PC-SAFT equation of state that can be used to compute thermodynamic
3447/// states.
3548#[ pyclass( name = "PcSaft" , unsendable) ]
36- #[ pyo3(
37- text_signature = "(parameters, max_eta, max_iter_cross_assoc, tol_cross_assoc, joback_parameters)"
38- ) ]
49+ #[ pyo3( text_signature = "(parameters, max_eta, max_iter_cross_assoc, tol_cross_assoc, dq_variant)" ) ]
3950#[ derive( Clone ) ]
4051pub struct PyPcSaft ( pub Rc < PcSaft > ) ;
4152
@@ -45,18 +56,21 @@ impl PyPcSaft {
4556 #[ args(
4657 max_eta = "0.5" ,
4758 max_iter_cross_assoc = "50" ,
48- tol_cross_assoc = "1e-10"
59+ tol_cross_assoc = "1e-10" ,
60+ dq_variant = "\" dq35\" "
4961 ) ]
5062 fn new (
5163 parameters : PyPcSaftParameters ,
5264 max_eta : f64 ,
5365 max_iter_cross_assoc : usize ,
5466 tol_cross_assoc : f64 ,
67+ dq_variant : & str ,
5568 ) -> Self {
5669 let options = PcSaftOptions {
5770 max_eta,
5871 max_iter_cross_assoc,
5972 tol_cross_assoc,
73+ dq_variant : dq_variant. into ( ) ,
6074 } ;
6175 Self ( Rc :: new ( PcSaft :: with_options ( parameters. 0 , options) ) )
6276 }
0 commit comments