a
    7b                     @   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                       sT   e Zd ZdZ fddZdddZdd Zd	d
 ZdddZdd Z	dd Z
  ZS )ljs_bhz
    Interface to LJS-BH
    c                    s   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| _d	S )
z=
        Initialize cubic specific function pointers
        Z
lj_splinedZljs_bh_model_controlZ
eoslibinitZinit_ljsZljs_bh_get_pure_paramsZljs_bh_set_pure_paramsZcalc_ai_reduced_ljs_exZ ljs_bh_get_bh_diameter_div_sigmaN)superr	   __init__getattrtpZget_export_names_ljs_bh_model_controls_eoslibinit_init_ljs_bhs_ljs_bh_get_pure_paramss_ljs_bh_set_pure_paramss_calc_ai_reduced_ljs_ex"s_ljs_bh_get_bh_diameter_div_sigma)self	__class__ \/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/pyctp/ljs_bh.pyr      s    zljs_bh.__init__Defaultc                 C   sr   |    d}t|d}tt|}t|d}tt|}ttttg| j_d| j_| |||| d| _dS )zInitialize Lennard-Jomes splined model based on Barker-Henderson perturbation theory

        Args:
            parameter_reference (str, optional): Which parameters to use?. Defaults to "Default".
        ZBHasciiNr   )	activatec_char_pencode
c_len_typelenr   argtypesrestypeZnc)r   Zparameter_referencemodelZmodel_string_cZmodel_string_lenZref_string_cZref_string_lenr   r   r   init,   s$    zljs_bh.initc                 C   sT   |    td}td}ttttg| j_d| j_| t|t| |j|jfS )zGet particle size and well depth

        Returns:
            sigma (float): Particle diameter (m)
            eps_depth_divk (float): Well depth divided by Boltzmann constant (K)
                N)r   c_doublePOINTERr   r    r!   byrefvalue)r   sigma_ceps_depth_divk_cr   r   r   get_sigma_epsH   s    
zljs_bh.get_sigma_epsc                 C   sL   |    t|}t|}ttttg| j_d| j_| t|t| dS )zSet particle size and well depth

        Args:
            sigma (float): Particle diameter (m)
            eps_depth_divk (float): Well depth divided by Boltzmann constant (K)
        N)r   r%   r&   r   r    r!   r'   )r   sigmaZeps_depth_divkr)   r*   r   r   r   set_sigma_eps[   s    
zljs_bh.set_sigma_epsFTc              	   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  Model control. Enable/disable model terms.

        Args:
            use_Lafitte_a3 (bool): Enable/disable use of Lafitte model for a3 dispersion term. Defaults to False.
            enable_chi_correction (bool): Enable/disable use of chi correction for a2 dispersion term. Defaults to True.
            enable_hs (bool): Enable/disable hard-sphere term. Defaults to True.
            enable_a1 (bool): Enable/disable use of a1 dispersion term. Defaults to True.
            enable_a2 (bool): Enable/disable use of a2 dispersion term. Defaults to True.
            enable_a3 (bool): Enable/disable use of a3 dispersion term. Defaults to True.
        N)r   c_intr&   r   r    r!   r'   )r   Zuse_Lafitte_a3Zenable_chi_correctionZ	enable_hsZ	enable_a1Z	enable_a2Z	enable_a3Zuse_Lafitte_a3_cZenable_chi_correction_cZenable_hs_cZenable_a1_cZenable_a2_cZenable_a3_cr   r   r   model_controlq   s,    
zljs_bh.model_controlc                 C   s   t |}t |}t d}t d}t d}tt tt tt tt tt g| j_d| j_| t|t|t|t|t| |j|j|jfS )ak  Get perturbation terms.

        Args:
            T_star (float): Reduced temperature.
            rho_star (float): Reduced density.

        Returns:
            a1 (float): a1 dispersion term divided by epsilon.
            a2 (float): a2 dispersion term divided by epsilon squared.
            a3 (float): a3 dispersion term divided by epsilon cube.
        r$   N)r%   r&   r   r    r!   r'   r(   )r   T_starZrho_starZT_cZ
rho_star_cZa1_cZa2_cZa3_cr   r   r   
get_pert_a   s&    
zljs_bh.get_pert_ac                 C   sF   t |}t d}tt tt g| j_d| j_| t|t| |jS )zGet Barker-Henderson diameter.

        Args:
            T_star (float): Reduced temperature (-).

        Returns:
            d_bh (float): Barker-Henderson diameter divided by sigma (-).
        r$   N)r%   r&   r   r    r!   r'   r(   )r   r0   ZT_star_cZd_bh_cr   r   r   get_bh_diameter_div_sigma   s    	
z ljs_bh.get_bh_diameter_div_sigma)r   )FTTTTT)__name__
__module____qualname____doc__r   r#   r+   r-   r/   r1   r2   __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   