a
    7b#6                     @   s`   d dl mZ d dlT d dlZd dlmZmZ d dlm	Z	 ddl
mZ ejZG dd	 d	ejZdS )
    )print_function)*N)platformexit)path   )thermoc                       s   e Zd ZdZ fddZd!ddZdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Z  ZS )"	saftvrmiez"
    Interface to SAFT-VR Mie
    c                    sF  t t|   t| j| dd| _t| j| dd| _t| j| dd| _t| j| dd| _	t| j| dd| _
t| j| dd| _t| j| d	d
| _t| j| d	d| _t| j| d	d| _t| j| d	d| _t| j| d	d| _t| j| d	d| _t| j| d	d| _t| j| d	d| _dS )z=
        Initialize cubic specific function pointers
        Zsaftvrmie_interfaceZmodel_control_hsmodel_control_a1model_control_a2model_control_a3model_control_chainZ
eoslibinitZinit_saftvrmieZsaftvrmie_containersZget_saftvrmie_pure_fluid_paramZset_saftvrmie_pure_fluid_paramZget_saftvrmie_eps_kijZset_saftvrmie_eps_kijZget_saftvrmie_sigma_lijZset_saftvrmie_sigma_lijZget_saftvrmie_lr_gammaijZset_saftvrmie_lr_gammaijN)superr	   __init__getattrtpZget_export_names_enable_hss_enable_a1s_enable_a2s_enable_a3s_enable_chains_eoslibinit_init_saftvrmie s_get_saftvrmie_pure_fluid_param s_set_saftvrmie_pure_fluid_params_get_eps_kijs_set_eps_kijs_get_sigma_lijs_set_sigma_lijs_get_lr_gammaijs_set_lr_gammaij)self	__class__ _/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/pyctp/saftvrmie.pyr      sV    












zsaftvrmie.__init__Defaultc                 C   s   |    t|d}tt|}t|d}tt|}ttttg| j_d| j_| |||| tt|	dt|	d| _
dS )zInitialize SAFT-VR Mie model in thermopack

        Args:
            comps (str): Comma separated list of component names
            parameter_reference (str, optional): Which parameters to use?. Defaults to "Default".
        asciiN ,)activatec_char_pencode
c_len_typelenr   argtypesrestypemaxsplitZnc)r    compsZparameter_referenceZcomp_string_cZcomp_string_lenZref_string_cZref_string_lenr#   r#   r$   initC   s"    zsaftvrmie.initc                 C   s@   |    t|rdnd}ttg| j_d| j_| t| dS )zModel control. Enable/disable hard-sphere term.

        Args:
            active (bool): Enable/disable hard-sphere dispersion term
        r   r   N)r)   c_intPOINTERr   r.   r/   byrefr    activeZactive_cr#   r#   r$   model_control_hard_sphere]   s
    z#saftvrmie.model_control_hard_spherec                 C   s@   |    t|rdnd}ttg| j_d| j_| t| dS )zModel control. Enable/disable first dispersion term.

        Args:
            active (bool): Enable/disable first dispersion term
        r   r   N)r)   r4   r5   r   r.   r/   r6   r7   r#   r#   r$   r
   i   s
    zsaftvrmie.model_control_a1c                 C   s@   |    t|rdnd}ttg| j_d| j_| t| dS )zModel control. Enable/disable second dispersion term.

        Args:
            active (bool): Enable/disable second dispersion term
        r   r   N)r)   r4   r5   r   r.   r/   r6   r7   r#   r#   r$   r   u   s
    zsaftvrmie.model_control_a2c                 C   s@   |    t|rdnd}ttg| j_d| j_| t| dS )zModel control. Enable/disable third dispersion term.

        Args:
            active (bool): Enable/disable third dispersion term
        r   r   N)r)   r4   r5   r   r.   r/   r6   r7   r#   r#   r$   r      s
    zsaftvrmie.model_control_a3c                 C   s@   |    t|rdnd}ttg| j_d| j_| t| dS )zvModel control. Enable/disable chain term.

        Args:
            active (bool): Enable/disable chain term
        r   r   N)r)   r4   r5   r   r.   r/   r6   r7   r#   r#   r$   r      s
    zsaftvrmie.model_control_chainc                 C   sb   |    t|}t|}td}ttttttg| j_d| j_| t|t|t| |jS )zGet binary well depth interaction parameter

        Args:
            c1 (int): Component one
            c2 (int): Component two

        Returns:
            kij (float): Well depth interaction parameter
                N)	r)   r4   c_doubler5   r   r.   r/   r6   value)r    c1c2c1_cc2_ckij_cr#   r#   r$   get_eps_kij   s    

zsaftvrmie.get_eps_kijc                 C   s`   |    t|}t|}t|}ttttttg| j_d| j_| t|t|t| dS )zSet binary well depth interaction parameter

        Args:
            c1 (int): Component one
            c2 (int): Component two
            kij (float): Well depth interaction parameter
        N)r)   r4   r;   r5   r   r.   r/   r6   )r    r=   r>   Zkijr?   r@   rA   r#   r#   r$   set_eps_kij   s    
zsaftvrmie.set_eps_kijc                 C   sb   |    t|}t|}td}ttttttg| j_d| j_| t|t|t| |jS )a  Get the interaction parameter lij for the sigma combining rule (controlling non-additivity)

        Args:
            c1 (int): Component one
            c2 (int): Component two

        Returns:
            lij (float): Sigma interaction parameter
        r:   N)	r)   r4   r;   r5   r   r.   r/   r6   r<   )r    r=   r>   r?   r@   lij_cr#   r#   r$   get_sigma_lij   s    

zsaftvrmie.get_sigma_lijc                 C   s`   |    t|}t|}t|}ttttttg| j_d| j_| t|t|t| dS )zSet the interaction parameter lij for the sigma combining rule (controlling non-additivity)

        Args:
            c1 (int): Component one
            c2 (int): Component two
            lij (float): Sigma interaction parameter
        N)r)   r4   r;   r5   r   r.   r/   r6   )r    r=   r>   Zlijr?   r@   rD   r#   r#   r$   set_sigma_lij   s    
zsaftvrmie.set_sigma_lijc                 C   sb   |    t|}t|}td}ttttttg| j_d| j_| t|t|t| |jS )zGet the interaction parameter gammaij for the lambda_r combining rule

        Args:
            c1 (int): Component one
            c2 (int): Component two

        Returns:
            gammaij (float): Repulsive exponent interaction parameter
        r:   N)	r)   r4   r;   r5   r   r.   r/   r6   r<   )r    r=   r>   r?   r@   	gammaij_cr#   r#   r$   get_lr_gammaij   s    

zsaftvrmie.get_lr_gammaijc                 C   s`   |    t|}t|}t|}ttttttg| j_d| j_| t|t|t| dS )zSet the interaction parameter gammaij for the lambda_r combining rule

        Args:
            c1 (int): Component one
            c2 (int): Component two
            gammaij (float): Repulsive exponent interaction parameter
        N)r)   r4   r;   r5   r   r.   r/   r6   )r    r=   r>   Zgammaijr?   r@   rG   r#   r#   r$   set_lr_gammaij  s    
zsaftvrmie.set_lr_gammaijc              	   C   s   |    t|}td}td}td}td}td}ttttttttttttg| j_d| j_| t|t|t|t|t|t| |j|j|j|j|jfS )a  Set pure fluid parameters

        Args:
            ic (int): Component index
        Returns;
            m (float): Mean number of segments.
            sigma (float): Temperature-independent segment diameter [m].
            eps_div_k (float): Well depth divided by Boltzmann's const. [K].
            lambda_a (float): Attractive exponent of the Mie potential
            lambda_r (float): Repulsive exponent of the Mie potential
        r:   N)	r)   r4   r;   r5   r   r.   r/   r6   r<   )r    icic_cm_csigma_ceps_c
lambda_a_c
lambda_r_cr#   r#   r$   get_pure_fluid_param&  s.    
zsaftvrmie.get_pure_fluid_paramc              	   C   s   |    t|}t|}t|}	t|}
t|}t|}ttttttttttttg| j_d| j_| t|t|t|	t|
t|t| dS )a  Set pure fluid parameters

        Args:
            ic (int): Component index
            m (float): Mean number of segments.
            sigma (float): Temperature-independent segment diameter [m].
            eps_div_k (float): Well depth divided by Boltzmann's const. [K].
            lambda_a (float): Attractive exponent of the Mie potential
            lambda_r (float): Repulsive exponent of the Mie potential
        N)r)   r4   r;   r5   r   r.   r/   r6   )r    rJ   msigmaZ	eps_div_kZlambda_aZlambda_rrK   rL   rM   rN   rO   rP   r#   r#   r$   set_pure_fluid_paramK  s,    
zsaftvrmie.set_pure_fluid_param)r%   )__name__
__module____qualname____doc__r   r3   r9   r
   r   r   r   rB   rC   rE   rF   rH   rI   rQ   rT   __classcell__r#   r#   r!   r$   r	      s    -
%r	   )
__future__r   ctypesZnumpynpsysr   r   osr    r   r,   Z
thermopackr	   r#   r#   r#   r$   <module>   s   