def Nicola_original(T, M, Tc, omega, Hfus):

Tr = T/Tc<EOL>Hfus = Hfus*<NUM_LIT:1000><EOL>return -<NUM_LIT> - <NUM_LIT>*Tr + <NUM_LIT>*Hfus + <NUM_LIT>*omega + (<NUM_LIT:1.>/M)**<NUM_LIT><EOL>

r'''Estimates the thermal conductivity of a liquid as a function of
    temperature using the CSP method of Nicola [1]_. A  simpler but long
    method claiming high-accuracy and using only statistically significant
    variable following analalysis.

    Requires temperature, molecular weight, critical temperature, acentric
    factor and the heat of vaporization.

    .. math::
        \frac{\lambda}{1 \text{Wm/K}}=-0.5694-0.1436T_r+5.4893\times10^{-10}
        \frac{\Delta_{fus}H}{\text{kmol/J}}+0.0508\omega +
        \left(\frac{1 \text{kg/kmol}}{MW}\right)^{0.0622}

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    M : float
        Molecular weight of the fluid [g/mol]
    Tc : float
        Critical temperature of the fluid [K]
    omega : float
        Acentric factor of the fluid [-]
    Hfus : float
        Heat of fusion of the fluid [J/mol]

    Returns
    -------
    kl : float
        Estimated liquid thermal conductivity [W/m/k]

    Notes
    -----
    A weird statistical correlation. Recent and yet to be reviewed.
    This correlation has been superceded by the author's later work.
    Hfus is internally converted to be in J/kmol.

    Examples
    --------
    >>> Nicola_original(300, 142.3, 611.7, 0.49, 201853)
    0.2305018632230984

    References
    ----------
    .. [1] Nicola, Giovanni Di, Eleonora Ciarrocchi, Mariano Pierantozzi, and
        Roman Stryjek. "A New Equation for the Thermal Conductivity of Organic
        Compounds." Journal of Thermal Analysis and Calorimetry 116, no. 1
        (April 1, 2014): 135-40. doi:10.1007/s10973-013-3422-7


Tr = T/Tc<EOL>Pc = Pc/<NUM_LIT><EOL>return <NUM_LIT>*(-<NUM_LIT>*Tr + <NUM_LIT>*Pc + <NUM_LIT>*omega + (<NUM_LIT:1.>/M)**<NUM_LIT>)<EOL>

r'''Estimates the thermal conductivity of a liquid as a function of
    temperature using the CSP method of [1]_. A statistically derived
    equation using any correlated terms.

    Requires temperature, molecular weight, critical temperature and pressure,
    and acentric factor.

    .. math::
        \frac{\lambda}{0.5147 W/m/K} = -0.2537T_r+\frac{0.0017Pc}{\text{bar}}
        +0.1501 \omega + \left(\frac{1}{MW}\right)^{-0.2999}

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    M : float
        Molecular weight of the fluid [g/mol]
    Tc : float
        Critical temperature of the fluid [K]
    Pc : float
        Critical pressure of the fluid [Pa]
    omega : float
        Acentric factor of the fluid [-]

    Returns
    -------
    kl : float
        Estimated liquid thermal conductivity [W/m/k]

    Notes
    -----
    A statistical correlation. A revision of an original correlation.

    Examples
    --------
    >>> Nicola(300, 142.3, 611.7, 2110000.0, 0.49)
    0.10863821554584034

    References
    ----------
    .. [1] Di Nicola, Giovanni, Eleonora Ciarrocchi, Gianluca Coccia, and
       Mariano Pierantozzi. "Correlations of Thermal Conductivity for
       Liquid Refrigerants at Atmospheric Pressure or near Saturation."
       International Journal of Refrigeration. 2014.
       doi:10.1016/j.ijrefrig.2014.06.003


A = [-<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>B = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>]<EOL>C = [-<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>D = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>]<EOL>X, Y = M, T<EOL>a = A[<NUM_LIT:0>] + B[<NUM_LIT:0>]*X + C[<NUM_LIT:0>]*X**<NUM_LIT:2> + D[<NUM_LIT:0>]*X**<NUM_LIT:3><EOL>b = A[<NUM_LIT:1>] + B[<NUM_LIT:1>]*X + C[<NUM_LIT:1>]*X**<NUM_LIT:2> + D[<NUM_LIT:1>]*X**<NUM_LIT:3><EOL>c = A[<NUM_LIT:2>] + B[<NUM_LIT:2>]*X + C[<NUM_LIT:2>]*X**<NUM_LIT:2> + D[<NUM_LIT:2>]*X**<NUM_LIT:3><EOL>d = A[<NUM_LIT:3>] + B[<NUM_LIT:3>]*X + C[<NUM_LIT:3>]*X**<NUM_LIT:2> + D[<NUM_LIT:3>]*X**<NUM_LIT:3><EOL>return a + b*Y + c*Y**<NUM_LIT:2> + d*Y**<NUM_LIT:3><EOL>

r'''Estimates the thermal conductivity of parafin liquid hydrocarbons.
    Fits their data well, and is useful as only MW is required.
    X is the Molecular weight, and Y the temperature.

    .. math::
        K = a + bY + CY^2 + dY^3

        a = A_1 + B_1 X + C_1 X^2 + D_1 X^3

        b = A_2 + B_2 X + C_2 X^2 + D_2 X^3

        c = A_3 + B_3 X + C_3 X^2 + D_3 X^3

        d = A_4 + B_4 X + C_4 X^2 + D_4 X^3

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    M : float
        Molecular weight of the fluid [g/mol]

    Returns
    -------
    kl : float
        Estimated liquid thermal conductivity [W/m/k]

    Notes
    -----
    The accuracy of this equation has not been reviewed.

    Examples
    --------
    Data point from [1]_.

    >>> Bahadori_liquid(273.15, 170)
    0.14274278108272603

    References
    ----------
    .. [1] Bahadori, Alireza, and Saeid Mokhatab. "Estimating Thermal
       Conductivity of Hydrocarbons." Chemical Engineering 115, no. 13
       (December 2008): 52-54


def Mersmann_Kind_thermal_conductivity_liquid(T, MW, Tc, Vc, atoms):

na = sum(atoms.values())<EOL>lambda_star = <NUM_LIT:2>/<NUM_LIT>*(na + <NUM_LIT>*(<NUM_LIT:1.> - T/Tc)**<NUM_LIT:0.5>)<EOL>Vc = Vc*<NUM_LIT:1000> <EOL>N_A2 = N_A*<NUM_LIT:1000> <EOL>kl = lambda_star*(k*Tc)**<NUM_LIT>*N_A2**(<NUM_LIT:7>/<NUM_LIT>)*Vc**(-<NUM_LIT:2>/<NUM_LIT>)/Tc*MW**-<NUM_LIT:0.5><EOL>return kl<EOL>

r'''Estimates the thermal conductivity of organic liquid substances
    according to the method of [1]_.

    .. math::
        \lambda^* = \frac{\lambda\cdot V_c^{2/3}\cdot T_c\cdot \text{MW}^{0.5}}
        {(k\cdot T_c)^{1.5}\cdot N_A^{7/6}}

        \lambda^* = \frac{2}{3}\left(n_a + 40\sqrt{1-T_r}\right)

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    M : float
        Molecular weight of the fluid [g/mol]
    Tc : float
        Critical temperature of the fluid [K]
    Vc : float
        Critical volume of the fluid [m^3/mol]
    atoms : dict
        Dictionary of atoms and their counts, [-]

    Returns
    -------
    kl : float
        Estimated liquid thermal conductivity [W/m/k]

    Notes
    -----
    In the equation, all quantities must be in SI units but N_A is in a kmol
    basis and Vc is in units of (m^3/kmol); this is converted internally.

    Examples
    --------
    Dodecane at 400 K:

    >>> Mersmann_Kind_thermal_conductivity_liquid(400, 170.33484, 658.0,
    ... 0.000754, {'C': 12, 'H': 26})
    0.08952713798442789

    References
    ----------
    .. [1] Mersmann, Alfons, and Matthias Kind. "Prediction of Mechanical and
       Thermal Properties of Pure Liquids, of Critical Data, and of Vapor
       Pressure." Industrial & Engineering Chemistry Research, January 31,
       2017. https://doi.org/10.1021/acs.iecr.6b04323.


Tr = T/Tc<EOL>Pr = P/Pc<EOL>return kl*(<NUM_LIT> + <NUM_LIT>*Pr*Tr**<NUM_LIT> + <NUM_LIT>*Tr**<NUM_LIT>*(Pr/(<NUM_LIT> + Pr)))<EOL>

r'''Adjustes for pressure the thermal conductivity of a liquid using an
    emperical formula based on [1]_, but as given in [2]_.

    .. math::
        k = k^* \left[ 0.98 + 0.0079 P_r T_r^{1.4} + 0.63 T_r^{1.2}
        \left( \frac{P_r}{30 + P_r}\right)\right]

    Parameters
    ----------
    T : float
        Temperature of fluid [K]
    P : float
        Pressure of fluid [Pa]
    Tc: float
        Critical point of fluid [K]
    Pc : float
        Critical pressure of the fluid [Pa]
    kl : float
        Thermal conductivity of liquid at 1 atm or saturation, [W/m/K]

    Returns
    -------
    kl_dense : float
        Thermal conductivity of liquid at P, [W/m/K]

    Notes
    -----
    This equation is entrely dimensionless; all dimensions cancel.
    The original source has not been reviewed.

    This is DIPPR Procedure 9G: Method for the Thermal Conductivity of Pure
    Nonhydrocarbon Liquids at High Pressures

    Examples
    --------
    From [2]_, for butyl acetate.

    >>> DIPPR9G(515.05, 3.92E7, 579.15, 3.212E6, 7.085E-2)
    0.0864419738671184

    References
    ----------
    .. [1] Missenard, F. A., Thermal Conductivity of Organic Liquids of a
       Series or a Group of Liquids , Rev. Gen.Thermodyn., 101 649 (1970).
    .. [2] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.


Tr = T/Tc<EOL>Pr = P/Pc<EOL>Q = float(Qfunc_Missenard(Pr, Tr))<EOL>return kl*(<NUM_LIT:1.> + Q*Pr**<NUM_LIT>)<EOL>

r'''Adjustes for pressure the thermal conductivity of a liquid using an
    emperical formula based on [1]_, but as given in [2]_.

    .. math::
        \frac{k}{k^*} = 1 + Q P_r^{0.7}

    Parameters
    ----------
    T : float
        Temperature of fluid [K]
    P : float
        Pressure of fluid [Pa]
    Tc: float
        Critical point of fluid [K]
    Pc : float
        Critical pressure of the fluid [Pa]
    kl : float
        Thermal conductivity of liquid at 1 atm or saturation, [W/m/K]

    Returns
    -------
    kl_dense : float
        Thermal conductivity of liquid at P, [W/m/K]

    Notes
    -----
    This equation is entirely dimensionless; all dimensions cancel.
    An interpolation routine is used here from tabulated values of Q.
    The original source has not been reviewed.

    Examples
    --------
    Example from [2]_, toluene; matches.

    >>> Missenard(304., 6330E5, 591.8, 41E5, 0.129)
    0.2198375777069657

    References
    ----------
    .. [1] Missenard, F. A., Thermal Conductivity of Organic Liquids of a
       Series or a Group of Liquids , Rev. Gen.Thermodyn., 101 649 (1970).
    .. [2] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.


if not none_and_length_check([ks, ws]):  <EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return sum(ws[i]/ks[i]**<NUM_LIT:2> for i in range(len(ws)))**(-<NUM_LIT:0.5>)<EOL>

r'''Calculates thermal conductivity of a liquid mixture according to
    mixing rules in [1]_ and also in [2]_.

    .. math::
        \lambda_m = \left( \sum_i w_i \lambda_i^{-2}\right)^{-1/2}

    Parameters
    ----------
    ws : float
        Mass fractions of components
    ks : float
        Liquid thermal conductivites of all components, [W/m/K]

    Returns
    -------
    kl : float
        Thermal conductivity of liquid mixture, [W/m/K]

    Notes
    -----
    This equation is entirely dimensionless; all dimensions cancel.
    The example is from [2]_; all results agree.
    The original source has not been reviewed.

    DIPPR Procedure 9H: Method for the Thermal Conductivity of Nonaqueous Liquid Mixtures

    Average deviations of 3%. for 118 nonaqueous systems with 817 data points.
    Max deviation 20%. According to DIPPR.

    Examples
    --------
    >>> DIPPR9H([0.258, 0.742], [0.1692, 0.1528])
    0.15657104706719646

    References
    ----------
    .. [1] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E. The
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.
    .. [2] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.


if not none_and_length_check([ks, ws], <NUM_LIT:2>):  <EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return ws[<NUM_LIT:0>]*ks[<NUM_LIT:0>] + ws[<NUM_LIT:1>]*ks[<NUM_LIT:1>] - <NUM_LIT>*ws[<NUM_LIT:0>]*ws[<NUM_LIT:1>]*(ks[<NUM_LIT:1>] - ks[<NUM_LIT:0>])<EOL>

r'''Calculates thermal conductivity of a binary liquid mixture according to
    mixing rules in [2]_ as found in [1]_.

    .. math::
        \lambda_m = w_1 \lambda_1 + w_2\lambda_2
        - 0.72 w_1 w_2(\lambda_2-\lambda_1)

    Parameters
    ----------
    ws : float
        Mass fractions of components
    ks : float
        Liquid thermal conductivites of all components, [W/m/K]

    Returns
    -------
    kl : float
        Thermal conductivity of liquid mixture, [W/m/K]

    Notes
    -----
    This equation is entirely dimensionless; all dimensions cancel.
    The original source has not been reviewed.
    Only useful for binary mixtures.

    Examples
    --------
    >>> Filippov([0.258, 0.742], [0.1692, 0.1528])
    0.15929167628799998

    References
    ----------
    .. [1] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E. The
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.
    .. [2] Filippov, L. P.: Vest. Mosk. Univ., Ser. Fiz. Mat. Estestv. Nauk,
       (8I0E): 67-69A955); Chem. Abstr., 50: 8276 A956).
       Filippov, L. P., and N. S. Novoselova: Vestn. Mosk. Univ., Ser. F
       iz. Mat. Estestv.Nauk, CI0B): 37-40A955); Chem. Abstr., 49: 11366 A955).


MW = MW/<NUM_LIT><EOL>return (<NUM_LIT:1.> + <NUM_LIT:9>/<NUM_LIT>/(Cvm/R))*mu*Cvm/MW<EOL>

r'''Estimates the thermal conductivity of a gas as a function of
    temperature using the CSP method of Eucken [1]_.

    .. math::
        \frac{\lambda M}{\eta C_v} = 1 + \frac{9/4}{C_v/R}

    Parameters
    ----------
    MW : float
        Molecular weight of the gas [g/mol]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]
    mu : float
        Gas viscosity [Pa*S]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    Temperature dependence is introduced via heat capacity and viscosity.
    A theoretical equation. No original author located.
    MW internally converted to kg/g-mol.

    Examples
    --------
    2-methylbutane at low pressure, 373.15 K. Mathes calculation in [1]_.

    >>> Eucken(MW=72.151, Cvm=135.9, mu=8.77E-6)
    0.018792644287722975

    References
    ----------
    .. [1] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


MW = MW/<NUM_LIT><EOL>return (<NUM_LIT> + <NUM_LIT>/(Cvm/R))*mu*Cvm/MW<EOL>

r'''Estimates the thermal conductivity of a gas as a function of
    temperature using the Modified CSP method of Eucken [1]_.

    .. math::
        \frac{\lambda M}{\eta C_v} = 1.32 + \frac{1.77}{C_v/R}

    Parameters
    ----------
    MW : float
        Molecular weight of the gas [g/mol]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]
    mu : float
        Gas viscosity [Pa*S]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    Temperature dependence is introduced via heat capacity and viscosity.
    A theoretical equation. No original author located.
    MW internally converted to kg/g-mol.

    Examples
    --------
    2-methylbutane at low pressure, 373.15 K. Mathes calculation in [1]_.

    >>> Eucken_modified(MW=72.151, Cvm=135.9, mu=8.77E-6)
    0.023593536999201956

    References
    ----------
    .. [1] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


def DIPPR9B(T, MW, Cvm, mu, Tc=None, chemtype=None):

Cvm = Cvm*<NUM_LIT>  <EOL>if not chemtype:<EOL><INDENT>chemtype = '<STR_LIT>'<EOL><DEDENT>if chemtype == '<STR_LIT>':<EOL><INDENT>return <NUM_LIT>*mu*Cvm/MW<EOL><DEDENT>elif chemtype == '<STR_LIT>':<EOL><INDENT>Tr = T/Tc<EOL>return mu/MW*(<NUM_LIT>*Cvm + <NUM_LIT> - <NUM_LIT>/Tr)<EOL><DEDENT>elif chemtype == '<STR_LIT>':<EOL><INDENT>return mu/MW*(<NUM_LIT>*Cvm + <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Calculates the thermal conductivity of a gas using one of several
    emperical equations developed in [1]_, [2]_, and presented in [3]_.

    For monoatomic gases:

    .. math::
        k = 2.5 \frac{\eta C_v}{MW}

    For linear molecules:

    .. math::
        k = \frac{\eta}{MW} \left( 1.30 C_v + 14644.00 - \frac{2928.80}{T_r}\right)

    For nonlinear molecules:

    .. math::
        k = \frac{\eta}{MW}(1.15C_v + 16903.36)

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    Tc : float
        Critical temperature of the fluid [K]
    MW : float
        Molwcular weight of fluid [g/mol]
    Cvm : float
        Molar heat capacity at constant volume of fluid, [J/mol/K]
    mu : float
        Viscosity of gas, [Pa*S]

    Returns
    -------
    k_g : float
        Thermal conductivity of gas, [W/m/k]

    Notes
    -----
    Tested with DIPPR values.
    Cvm is internally converted to J/kmol/K.

    Examples
    --------
    CO:

    >>> DIPPR9B(200., 28.01, 20.826, 1.277E-5, 132.92, chemtype='linear')
    0.01813208676438415

    References
    ----------
    .. [1] Bromley, LeRoy A., Berkeley. University of California, and U.S.
       Atomic Energy Commission. Thermal Conductivity of Gases at Moderate
       Pressures. UCRL;1852. Berkeley, CA: University of California Radiation
       Laboratory, 1952.
    .. [2] Stiel, Leonard I., and George Thodos. "The Thermal Conductivity of
       Nonpolar Substances in the Dense Gaseous and Liquid Regions." AIChE
       Journal 10, no. 1 (January 1, 1964): 26-30. doi:10.1002/aic.690100114
    .. [3] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.


MW = MW/<NUM_LIT><EOL>alpha = Cvm/R - <NUM_LIT><EOL>beta = <NUM_LIT> - <NUM_LIT>*omega + <NUM_LIT>*omega**<NUM_LIT:2><EOL>Z = <NUM_LIT:2> + <NUM_LIT>*(T/Tc)**<NUM_LIT:2><EOL>psi = <NUM_LIT:1> + alpha*((<NUM_LIT> + <NUM_LIT>*alpha - <NUM_LIT>*beta + <NUM_LIT>*Z)<EOL>/(<NUM_LIT> + beta*Z + <NUM_LIT>*alpha*beta))<EOL>return <NUM_LIT>*psi/(Cvm/R)/MW*mu*Cvm<EOL>

r'''Estimates the thermal conductivity of a gas as a function of
    temperature using the CSP method of Chung [1]_.

    .. math::
        \frac{\lambda M}{\eta C_v} = \frac{3.75 \Psi}{C_v/R}

        \Psi = 1 + \alpha \left\{[0.215+0.28288\alpha-1.061\beta+0.26665Z]/
        [0.6366+\beta Z + 1.061 \alpha \beta]\right\}

        \alpha = \frac{C_v}{R}-1.5

        \beta = 0.7862-0.7109\omega + 1.3168\omega^2

        Z=2+10.5T_r^2

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]
    Tc : float
        Critical temperature of the gas [K]
    omega : float
        Acentric factor of the gas [-]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]
    mu : float
        Gas viscosity [Pa*S]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    MW internally converted to kg/g-mol.

    Examples
    --------
    2-methylbutane at low pressure, 373.15 K. Mathes calculation in [2]_.

    >>> Chung(T=373.15, MW=72.151, Tc=460.4, omega=0.227, Cvm=135.9, mu=8.77E-6)
    0.023015653729496946

    References
    ----------
    .. [1] Chung, Ting Horng, Lloyd L. Lee, and Kenneth E. Starling.
       "Applications of Kinetic Gas Theories and Multiparameter Correlation for
       Prediction of Dilute Gas Viscosity and Thermal Conductivity."
       Industrial & Engineering Chemistry Fundamentals 23, no. 1
       (February 1, 1984): 8-13. doi:10.1021/i100013a002
    .. [2] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


def eli_hanley(T, MW, Tc, Vc, Zc, omega, Cvm):

Cs = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <EOL><NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>Tr = T/Tc<EOL>if Tr > <NUM_LIT:2>: Tr = <NUM_LIT:2><EOL>theta = <NUM_LIT:1> + (omega - <NUM_LIT>)*(<NUM_LIT> - <NUM_LIT>*log(Tr) - <NUM_LIT>/Tr)<EOL>psi = (<NUM_LIT:1> + (omega-<NUM_LIT>)*(<NUM_LIT> - <NUM_LIT>*log(Tr)))*<NUM_LIT>/Zc<EOL>f = Tc/<NUM_LIT>*theta<EOL>h = Vc/<NUM_LIT>*psi<EOL>T0 = T/f<EOL>eta0 = <NUM_LIT>*sum([Ci*T0**((i+<NUM_LIT:1.> - <NUM_LIT>)/<NUM_LIT>) for i, Ci in enumerate(Cs)])<EOL>k0 = <NUM_LIT>*eta0<EOL>H = (<NUM_LIT>/MW)**<NUM_LIT:0.5>*f**<NUM_LIT:0.5>*h**(-<NUM_LIT:2>/<NUM_LIT>)<EOL>etas = eta0*H*MW/<NUM_LIT><EOL>ks = k0*H<EOL>return ks + etas/(MW/<NUM_LIT>)*<NUM_LIT>*(Cvm - <NUM_LIT>*R)<EOL>

r'''Estimates the thermal conductivity of a gas as a function of
    temperature using the reference fluid method of Eli and Hanley [1]_ as
    shown in [2]_.

    .. math::
        \lambda = \lambda^* + \frac{\eta^*}{MW}(1.32)\left(C_v - \frac{3R}{2}\right)

        Tr = \text{min}(Tr, 2)

        \theta = 1 + (\omega-0.011)\left(0.56553 - 0.86276\ln Tr - \frac{0.69852}{Tr}\right)

        \psi = [1 + (\omega - 0.011)(0.38560 - 1.1617\ln Tr)]\frac{0.288}{Z_c}

        f = \frac{T_c}{190.4}\theta

        h = \frac{V_c}{9.92E-5}\psi

        T_0 = T/f

        \eta_0^*(T_0)= \sum_{n=1}^9 C_n T_0^{(n-4)/3}

        \theta_0 = 1944 \eta_0

        \lambda^* = \lambda_0 H

        \eta^* = \eta^*_0 H \frac{MW}{16.04}

        H = \left(\frac{16.04}{MW}\right)^{0.5}f^{0.5}/h^{2/3}

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]
    Tc : float
        Critical temperature of the gas [K]
    Vc : float
        Critical volume of the gas [m^3/mol]
    Zc : float
        Critical compressibility of the gas []
    omega : float
        Acentric factor of the gas [-]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    Reference fluid is Methane.
    MW internally converted to kg/g-mol.

    Examples
    --------
    2-methylbutane at low pressure, 373.15 K. Mathes calculation in [2]_.

    >>> eli_hanley(T=373.15, MW=72.151, Tc=460.4, Vc=3.06E-4, Zc=0.267,
    ... omega=0.227, Cvm=135.9)
    0.02247951789135337

    References
    ----------
    .. [1] Ely, James F., and H. J. M. Hanley. "Prediction of Transport
       Properties. 2. Thermal Conductivity of Pure Fluids and Mixtures."
       Industrial & Engineering Chemistry Fundamentals 22, no. 1 (February 1,
       1983): 90-97. doi:10.1021/i100009a016.
    .. [2] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


def Gharagheizi_gas(T, MW, Tb, Pc, omega):

Pc = Pc/<NUM_LIT><EOL>B = T + (<NUM_LIT>*omega + <NUM_LIT>*T - <NUM_LIT>*T*(<NUM_LIT>*omega + <NUM_LIT>)/Tb + <NUM_LIT>)/(<NUM_LIT:2>*omega + T - T*(<NUM_LIT:2>*omega+<NUM_LIT>)/Tb + <NUM_LIT>) - T*(<NUM_LIT:2>*omega+<NUM_LIT>)/Tb<EOL>A = (<NUM_LIT:2>*omega + T - T*(<NUM_LIT:2>*omega + <NUM_LIT>)/Tb + <NUM_LIT>)/(<NUM_LIT:0.1>*MW*Pc*T) * (<NUM_LIT>*omega + <NUM_LIT:0.1>*Pc + <NUM_LIT>*B + <NUM_LIT>)**<NUM_LIT:2><EOL>return <NUM_LIT> + <NUM_LIT>*T - <NUM_LIT>*MW + <NUM_LIT>*A<EOL>

r'''Estimates the thermal conductivity of a gas as a function of
    temperature using the CSP method of Gharagheizi [1]_. A  convoluted
    method claiming high-accuracy and using only statistically significant
    variable following analalysis.

    Requires temperature, molecular weight, boiling temperature and critical
    pressure and acentric factor.

    .. math::
        k = 7.9505\times 10^{-4} + 3.989\times 10^{-5} T
        -5.419\times 10^-5 M + 3.989\times 10^{-5} A

       A = \frac{\left(2\omega + T - \frac{(2\omega + 3.2825)T}{T_b} + 3.2825\right)}{0.1MP_cT}
        \times (3.9752\omega + 0.1 P_c + 1.9876B + 6.5243)^2

    Parameters
    ----------
    T : float
        Temperature of the fluid [K]
    MW: float
        Molecular weight of the fluid [g/mol]
    Tb : float
        Boiling temperature of the fluid [K]
    Pc : float
        Critical pressure of the fluid [Pa]
    omega : float
        Acentric factor of the fluid [-]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    Pressure is internally converted into 10*kPa but author used correlation with
    kPa; overall, errors have been corrected in the presentation of the formula.

    This equation was derived with 15927 points and 1574 compounds.
    Example value from [1]_ is the first point in the supportinf info, for CH4.

    Examples
    --------
    >>> Gharagheizi_gas(580., 16.04246, 111.66, 4599000.0, 0.0115478000)
    0.09594861261873211

    References
    ----------
    .. [1] Gharagheizi, Farhad, Poorandokht Ilani-Kashkouli, Mehdi Sattari,
       Amir H. Mohammadi, Deresh Ramjugernath, and Dominique Richon.
       "Development of a General Model for Determination of Thermal
       Conductivity of Liquid Chemical Compounds at Atmospheric Pressure."
       AIChE Journal 59, no. 5 (May 1, 2013): 1702-8. doi:10.1002/aic.13938


A = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>]<EOL>B = [-<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>C = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>]<EOL>D = [-<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>X, Y = T, MW<EOL>a = A[<NUM_LIT:0>] + B[<NUM_LIT:0>]*X + C[<NUM_LIT:0>]*X**<NUM_LIT:2> + D[<NUM_LIT:0>]*X**<NUM_LIT:3><EOL>b = A[<NUM_LIT:1>] + B[<NUM_LIT:1>]*X + C[<NUM_LIT:1>]*X**<NUM_LIT:2> + D[<NUM_LIT:1>]*X**<NUM_LIT:3><EOL>c = A[<NUM_LIT:2>] + B[<NUM_LIT:2>]*X + C[<NUM_LIT:2>]*X**<NUM_LIT:2> + D[<NUM_LIT:2>]*X**<NUM_LIT:3><EOL>d = A[<NUM_LIT:3>] + B[<NUM_LIT:3>]*X + C[<NUM_LIT:3>]*X**<NUM_LIT:2> + D[<NUM_LIT:3>]*X**<NUM_LIT:3><EOL>return a + b*Y + c*Y**<NUM_LIT:2> + d*Y**<NUM_LIT:3><EOL>

r'''Estimates the thermal conductivity of hydrocarbons gases at low P.
    Fits their data well, and is useful as only MW is required.
    Y is the Molecular weight, and X the temperature.

    .. math::
        K = a + bY + CY^2 + dY^3

        a = A_1 + B_1 X + C_1 X^2 + D_1 X^3

        b = A_2 + B_2 X + C_2 X^2 + D_2 X^3

        c = A_3 + B_3 X + C_3 X^2 + D_3 X^3

        d = A_4 + B_4 X + C_4 X^2 + D_4 X^3

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]

    Returns
    -------
    kg : float
        Estimated gas thermal conductivity [W/m/k]

    Notes
    -----
    The accuracy of this equation has not been reviewed.

    Examples
    --------
    >>> Bahadori_gas(40+273.15, 20) # Point from article
    0.031968165337873326

    References
    ----------
    .. [1] Bahadori, Alireza, and Saeid Mokhatab. "Estimating Thermal
       Conductivity of Hydrocarbons." Chemical Engineering 115, no. 13
       (December 2008): 52-54


def stiel_thodos_dense(T, MW, Tc, Pc, Vc, Zc, Vm, kg):

gamma = <NUM_LIT>*(Tc*MW**<NUM_LIT>/(Pc/<NUM_LIT>)**<NUM_LIT:4>)**(<NUM_LIT:1>/<NUM_LIT>)<EOL>rhor = Vc/Vm<EOL>if rhor < <NUM_LIT:0.5>:<EOL><INDENT>term = <NUM_LIT>*(exp(<NUM_LIT>*rhor) - <NUM_LIT:1.>)<EOL><DEDENT>elif rhor < <NUM_LIT:2>:<EOL><INDENT>term = <NUM_LIT>*(exp(<NUM_LIT>*rhor) - <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>term = <NUM_LIT>*(exp(<NUM_LIT>*rhor) + <NUM_LIT>)<EOL><DEDENT>diff = term/Zc**<NUM_LIT:5>/gamma<EOL>kg = kg + diff<EOL>return kg<EOL>

r'''Estimates the thermal conductivity of a gas at high pressure as a
    function of temperature using difference method of Stiel and Thodos [1]_
    as shown in [2]_.

    if \rho_r < 0.5:

    .. math::
        (\lambda-\lambda^\circ)\Gamma Z_c^5=1.22\times 10^{-2} [\exp(0.535 \rho_r)-1]

    if 0.5 < \rho_r < 2.0:

    .. math::
        (\lambda-\lambda^\circ)\Gamma Z_c^5=1.22\times 10^{-2} [\exp(0.535 \rho_r)-1]

    if 2 < \rho_r < 2.8:

    .. math::
        (\lambda-\lambda^\circ)\Gamma Z_c^5=1.22\times 10^{-2} [\exp(0.535 \rho_r)-1]

        \Gamma = 210 \left(\frac{T_cMW^3}{P_c^4}\right)^{1/6}

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]
    Tc : float
        Critical temperature of the gas [K]
    Pc : float
        Critical pressure of the gas [Pa]
    Vc : float
        Critical volume of the gas [m^3/mol]
    Zc : float
        Critical compressibility of the gas [-]
    Vm : float
        Molar volume of the gas at T and P [m^3/mol]
    kg : float
        Low-pressure gas thermal conductivity [W/m/k]

    Returns
    -------
    kg : float
        Estimated dense gas thermal conductivity [W/m/k]

    Notes
    -----
    Pc is internally converted to bar.

    Examples
    --------
    >>> stiel_thodos_dense(T=378.15, MW=44.013, Tc=309.6, Pc=72.4E5,
    ... Vc=97.4E-6, Zc=0.274, Vm=144E-6, kg=2.34E-2)
    0.041245574404863684

    References
    ----------
    .. [1] Stiel, Leonard I., and George Thodos. "The Thermal Conductivity of
       Nonpolar Substances in the Dense Gaseous and Liquid Regions." AIChE
       Journal 10, no. 1 (January 1, 1964): 26-30. doi:10.1002/aic.690100114.
    .. [2] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


def eli_hanley_dense(T, MW, Tc, Vc, Zc, omega, Cvm, Vm):

Cs = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>,<EOL><NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>,<EOL><NUM_LIT>]<EOL>Tr = T/Tc<EOL>if Tr > <NUM_LIT:2>:<EOL><INDENT>Tr = <NUM_LIT:2><EOL><DEDENT>Vr = Vm/Vc<EOL>if Vr > <NUM_LIT:2>:<EOL><INDENT>Vr = <NUM_LIT:2><EOL><DEDENT>theta = <NUM_LIT:1> + (omega - <NUM_LIT>)*(<NUM_LIT> - <NUM_LIT>*log(Tr) + (<NUM_LIT> - <NUM_LIT>/Tr)*(Vr-<NUM_LIT:0.5>))<EOL>psi = (<NUM_LIT:1> + (omega-<NUM_LIT>)*(<NUM_LIT>*(Vr-<NUM_LIT>) - <NUM_LIT>*(Vr-<NUM_LIT>)*log(Tr)))*<NUM_LIT>/Zc<EOL>f = Tc/<NUM_LIT>*theta<EOL>h = Vc/<NUM_LIT>*psi<EOL>T0 = T/f<EOL>rho0 = <NUM_LIT>/(Vm*<NUM_LIT>)*h  <EOL>eta0 = <NUM_LIT>*sum([Cs[i]*T0**((i+<NUM_LIT:1>-<NUM_LIT:4>)/<NUM_LIT>) for i in range(len(Cs))])<EOL>k1 = <NUM_LIT>*eta0<EOL>b1 = -<NUM_LIT><EOL>b2 = <NUM_LIT><EOL>b3 = <NUM_LIT><EOL>b4 = <NUM_LIT><EOL>k2 = (b1 + b2*(b3 - log(T0/b4))**<NUM_LIT:2>)/<NUM_LIT>*rho0<EOL>a1 = -<NUM_LIT><EOL>a2 = <NUM_LIT><EOL>a3 = <NUM_LIT><EOL>a4 = -<NUM_LIT><EOL>a5 = <NUM_LIT><EOL>a6 = <NUM_LIT><EOL>a7 = -<NUM_LIT><EOL>k3 = exp(a1 + a2/T0)*(exp((a3 + a4/T0**<NUM_LIT>)*rho0**<NUM_LIT:0.1> + (rho0/<NUM_LIT> - <NUM_LIT:1>)*rho0**<NUM_LIT:0.5>*(a5 + a6/T0 + a7/T0**<NUM_LIT:2>)) - <NUM_LIT:1>)/<NUM_LIT><EOL>if T/Tc > <NUM_LIT:2>:<EOL><INDENT>dtheta = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>dtheta = (omega - <NUM_LIT>)*(-<NUM_LIT>/T + (Vr-<NUM_LIT:0.5>)*<NUM_LIT>*Tc/T**<NUM_LIT:2>)<EOL><DEDENT>dfdT = Tc/<NUM_LIT>*dtheta<EOL>X = ((<NUM_LIT:1> - T/f*dfdT)*<NUM_LIT>/Zc)**<NUM_LIT><EOL>H = (<NUM_LIT>/MW)**<NUM_LIT:0.5>*f**<NUM_LIT:0.5>/h**(<NUM_LIT:2>/<NUM_LIT>)<EOL>ks = (k1*X + k2 + k3)*H<EOL>theta = <NUM_LIT:1> + (omega - <NUM_LIT>)*(<NUM_LIT> - <NUM_LIT>*log(Tr) - <NUM_LIT>/Tr)<EOL>psi = (<NUM_LIT:1> + (omega-<NUM_LIT>)*(<NUM_LIT> - <NUM_LIT>*log(Tr)))*<NUM_LIT>/Zc<EOL>f = Tc/<NUM_LIT>*theta<EOL>h = Vc/<NUM_LIT>*psi<EOL>T0 = T/f<EOL>eta0 = <NUM_LIT>*sum([Cs[i]*T0**((i+<NUM_LIT:1>-<NUM_LIT:4>)/<NUM_LIT>) for i in range(len(Cs))])<EOL>H = (<NUM_LIT>/MW)**<NUM_LIT:0.5>*f**<NUM_LIT:0.5>/h**(<NUM_LIT:2>/<NUM_LIT>)<EOL>etas = eta0*H*MW/<NUM_LIT><EOL>k = ks + etas/(MW/<NUM_LIT>)*<NUM_LIT>*(Cvm-<NUM_LIT:3>*R/<NUM_LIT>)<EOL>return k<EOL>

r'''Estimates the thermal conductivity of a gas at high pressure as a
    function of temperature using the reference fluid method of Eli and
    Hanley [1]_ as shown in [2]_.

    .. math::
        Tr = min(Tr, 2)

        Vr = min(Vr, 2)

        f = \frac{T_c}{190.4}\theta

        h = \frac{V_c}{9.92E-5}\psi

        T_0 = T/f

        \rho_0 = \frac{16.04}{V}h

        \theta = 1 + (\omega-0.011)\left(0.09057 - 0.86276\ln Tr + \left(
        0.31664 - \frac{0.46568}{Tr}\right) (V_r - 0.5)\right)

        \psi = [1 + (\omega - 0.011)(0.39490(V_r - 1.02355) - 0.93281(V_r -
        0.75464)\ln T_r]\frac{0.288}{Z_c}

        \lambda_1 = 1944 \eta_0

        \lambda_2 = \left\{b_1 + b_2\left[b_3 - \ln \left(\frac{T_0}{b_4}
        \right)\right]^2\right\}\rho_0

        \lambda_3 = \exp\left(a_1 + \frac{a_2}{T_0}\right)\left\{\exp[(a_3 +
        \frac{a_4}{T_0^{1.5}})\rho_0^{0.1} + (\frac{\rho_0}{0.1617} - 1)
        \rho_0^{0.5}(a_5 + \frac{a_6}{T_0} + \frac{a_7}{T_0^2})] - 1\right\}

        \lambda^{**} = [\lambda_1 + \lambda_2 + \lambda_3]H

        H = \left(\frac{16.04}{MW}\right)^{0.5}f^{0.5}/h^{2/3}

        X = \left\{\left[1 - \frac{T}{f}\left(\frac{df}{dT}\right)_v \right]
        \frac{0.288}{Z_c}\right\}^{1.5}

        \left(\frac{df}{dT}\right)_v = \frac{T_c}{190.4}\left(\frac{d\theta}
        {d T}\right)_v

        \left(\frac{d\theta}{d T}\right)_v = (\omega-0.011)\left[
        \frac{-0.86276}{T} + (V_r-0.5)\frac{0.46568T_c}{T^2}\right]

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]
    Tc : float
        Critical temperature of the gas [K]
    Vc : float
        Critical volume of the gas [m^3/mol]
    Zc : float
        Critical compressibility of the gas []
    omega : float
        Acentric factor of the gas [-]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]
    Vm : float
        Volume of the gas at T and P [m^3/mol]

    Returns
    -------
    kg : float
        Estimated dense gas thermal conductivity [W/m/k]

    Notes
    -----
    Reference fluid is Methane.
    MW internally converted to kg/g-mol.

    Examples
    --------
    >>> eli_hanley_dense(T=473., MW=42.081, Tc=364.9, Vc=1.81E-4, Zc=0.274,
    ... omega=0.144, Cvm=82.70, Vm=1.721E-4)
    0.06038475936515042

    References
    ----------
    .. [1] Ely, James F., and H. J. M. Hanley. "Prediction of Transport
       Properties. 2. Thermal Conductivity of Pure Fluids and Mixtures."
       Industrial & Engineering Chemistry Fundamentals 22, no. 1 (February 1,
       1983): 90-97. doi:10.1021/i100009a016.
    .. [2] Reid, Robert C.; Prausnitz, John M.; Poling, Bruce E.
       Properties of Gases and Liquids. McGraw-Hill Companies, 1987.


def chung_dense(T, MW, Tc, Vc, omega, Cvm, Vm, mu, dipole, association=<NUM_LIT:0>):

ais = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>]<EOL>bis = [<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>]<EOL>cis = [-<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, -<NUM_LIT>]<EOL>dis = [<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>]<EOL>Tr = T/Tc<EOL>mur = <NUM_LIT>*dipole/(Vc*<NUM_LIT>*Tc)**<NUM_LIT:0.5><EOL>alpha = Cvm/R - <NUM_LIT><EOL>beta = <NUM_LIT> - <NUM_LIT>*omega + <NUM_LIT>*omega**<NUM_LIT:2><EOL>Z = <NUM_LIT:2> + <NUM_LIT>*(T/Tc)**<NUM_LIT:2><EOL>psi = <NUM_LIT:1> + alpha*((<NUM_LIT> + <NUM_LIT>*alpha - <NUM_LIT>*beta + <NUM_LIT>*Z)/(<NUM_LIT> + beta*Z + <NUM_LIT>*alpha*beta))<EOL>y = Vc/(<NUM_LIT:6>*Vm)<EOL>B1, B2, B3, B4, B5, B6, B7 = [ais[i] + bis[i]*omega + cis[i]*mur**<NUM_LIT:4> + dis[i]*association for i in range(<NUM_LIT:7>)]<EOL>G1 = (<NUM_LIT:1> - <NUM_LIT:0.5>*y)/(<NUM_LIT:1.> - y)**<NUM_LIT:3><EOL>G2 = (B1/y*(<NUM_LIT:1> - exp(-B4*y)) + B2*G1*exp(B5*y) + B3*G1)/(B1*B4 + B2 + B3)<EOL>q = <NUM_LIT>*(Tc/(MW/<NUM_LIT>))**<NUM_LIT:0.5>/(Vc*<NUM_LIT>)**(<NUM_LIT:2>/<NUM_LIT>)<EOL>return <NUM_LIT>*mu*psi/(MW/<NUM_LIT>)*(G2**-<NUM_LIT:1> + B6*y) + q*B7*y**<NUM_LIT:2>*Tr**<NUM_LIT:0.5>*G2<EOL>

r'''Estimates the thermal conductivity of a gas at high pressure as a
    function of temperature using the reference fluid method of
    Chung [1]_ as shown in [2]_.

    .. math::
        \lambda = \frac{31.2 \eta^\circ \Psi}{M'}(G_2^{-1} + B_6 y)+qB_7y^2T_r^{1/2}G_2

        \Psi = 1 + \alpha \left\{[0.215+0.28288\alpha-1.061\beta+0.26665Z]/
        [0.6366+\beta Z + 1.061 \alpha \beta]\right\}

        \alpha = \frac{C_v}{R}-1.5

        \beta = 0.7862-0.7109\omega + 1.3168\omega^2

        Z=2+10.5T_r^2

        q = 3.586\times 10^{-3} (T_c/M')^{1/2}/V_c^{2/3}

        y = \frac{V_c}{6V}

        G_1 = \frac{1-0.5y}{(1-y)^3}

        G_2 = \frac{(B_1/y)[1-\exp(-B_4y)]+ B_2G_1\exp(B_5y) + B_3G_1}
        {B_1B_4 + B_2 + B_3}

        B_i = a_i + b_i \omega + c_i \mu_r^4 + d_i \kappa

    Parameters
    ----------
    T : float
        Temperature of the gas [K]
    MW : float
        Molecular weight of the gas [g/mol]
    Tc : float
        Critical temperature of the gas [K]
    Vc : float
        Critical volume of the gas [m^3/mol]
    omega : float
        Acentric factor of the gas [-]
    Cvm : float
        Molar contant volume heat capacity of the gas [J/mol/K]
    Vm : float
        Molar volume of the gas at T and P [m^3/mol]
    mu : float
        Low-pressure gas viscosity [Pa*S]
    dipole : float
        Dipole moment [debye]
    association : float, optional
        Association factor [-]

    Returns
    -------
    kg : float
        Estimated dense gas thermal conductivity [W/m/k]

    Notes
    -----
    MW internally converted to kg/g-mol.
    Vm internally converted to mL/mol.
    [1]_ is not the latest form as presented in [1]_.
    Association factor is assumed 0. Relates to the polarity of the gas.

    Coefficients as follows:
    ais = [2.4166E+0, -5.0924E-1, 6.6107E+0, 1.4543E+1, 7.9274E-1, -5.8634E+0, 9.1089E+1]

    bis = [7.4824E-1, -1.5094E+0, 5.6207E+0, -8.9139E+0, 8.2019E-1, 1.2801E+1, 1.2811E+2]

    cis = [-9.1858E-1, -4.9991E+1, 6.4760E+1, -5.6379E+0, -6.9369E-1, 9.5893E+0, -5.4217E+1]

    dis = [1.2172E+2, 6.9983E+1, 2.7039E+1, 7.4344E+1, 6.3173E+0, 6.5529E+1, 5.2381E+2]

    Examples
    --------
    >>> chung_dense(T=473., MW=42.081, Tc=364.9, Vc=184.6E-6, omega=0.142,
    ... Cvm=82.67, Vm=172.1E-6, mu=134E-7, dipole=0.4)
    0.06160570379787278

    References
    ----------
    .. [1] Chung, Ting Horng, Mohammad Ajlan, Lloyd L. Lee, and Kenneth E.
       Starling. "Generalized Multiparameter Correlation for Nonpolar and Polar
       Fluid Transport Properties." Industrial & Engineering Chemistry Research
       27, no. 4 (April 1, 1988): 671-79. doi:10.1021/ie00076a024.
    .. [2] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.


def Lindsay_Bromley(T, ys, ks, mus, Tbs, MWs):

if not none_and_length_check([ys, ks, mus, Tbs, MWs]):<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>cmps = range(len(ys))<EOL>Ss = [<NUM_LIT>*Tb for Tb in Tbs]<EOL>Sij = [[(Si*Sj)**<NUM_LIT:0.5> for Sj in Ss] for Si in Ss]<EOL>Aij = [[<NUM_LIT>*(<NUM_LIT:1.> + (mus[i]/mus[j]*(MWs[j]/MWs[i])**<NUM_LIT><EOL>*(T+Ss[i])/(T+Ss[j]))**<NUM_LIT:0.5> )**<NUM_LIT:2> *(T+Sij[i][j])/(T+Ss[i])<EOL>for j in cmps] for i in cmps]<EOL>return sum([ys[i]*ks[i]/sum(ys[j]*Aij[i][j] for j in cmps) for i in cmps])<EOL>

r'''Calculates thermal conductivity of a gas mixture according to
    mixing rules in [1]_ and also in [2]_.

    .. math::
        k = \sum \frac{y_i k_i}{\sum y_i A_{ij}}

        A_{ij} = \frac{1}{4} \left\{ 1 + \left[\frac{\eta_i}{\eta_j}
        \left(\frac{MW_j}{MW_i}\right)^{0.75} \left( \frac{T+S_i}{T+S_j}\right)
        \right]^{0.5} \right\}^2 \left( \frac{T+S_{ij}}{T+S_i}\right)

        S_{ij} = S_{ji} = (S_i S_j)^{0.5}

    Parameters
    ----------
    T : float
        Temperature of gas [K]
    ys : float
        Mole fractions of gas components
    ks : float
        Liquid thermal conductivites of all components, [W/m/K]
    mus : float
        Gas viscosities of all components, [Pa*S]
    Tbs : float
        Boiling points of all components, [K]
    MWs : float
        Molecular weights of all components, [g/mol]

    Returns
    -------
    kg : float
        Thermal conductivity of gas mixture, [W/m/K]

    Notes
    -----
    This equation is entirely dimensionless; all dimensions cancel.
    The example is from [2]_; all results agree.
    The original source has not been reviewed.

    DIPPR Procedure 9D: Method for the Thermal Conductivity of Gas Mixtures

    Average deviations of 4-5% for 77 binary mixtures reviewed in [2]_, from
    1342 points; also six ternary mixtures (70  points); max deviation observed
    was 40%. (DIPPR)

    TODO: Finish documenting this.

    Examples
    --------
    >>> Lindsay_Bromley(323.15, [0.23, 0.77], [1.939E-2, 1.231E-2], [1.002E-5, 1.015E-5], [248.31, 248.93], [46.07, 50.49])
    0.01390264417969313

    References
    ----------
    .. [1] Lindsay, Alexander L., and LeRoy A. Bromley. "Thermal Conductivity
       of Gas Mixtures." Industrial & Engineering Chemistry 42, no. 8
       (August 1, 1950): 1508-11. doi:10.1021/ie50488a017.
    .. [2] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.


methods, methods_P = [], []<EOL>Tmins, Tmaxs = [], []<EOL>if self.CASRN in _VDISaturationDict:<EOL><INDENT>methods.append(VDI_TABULAR)<EOL>Ts, props = VDI_tabular_data(self.CASRN, '<STR_LIT>')<EOL>self.VDI_Tmin = Ts[<NUM_LIT:0>]<EOL>self.VDI_Tmax = Ts[-<NUM_LIT:1>]<EOL>self.tabular_data[VDI_TABULAR] = (Ts, props)<EOL>Tmins.append(self.VDI_Tmin); Tmaxs.append(self.VDI_Tmax)<EOL><DEDENT>if has_CoolProp and self.CASRN in coolprop_dict:<EOL><INDENT>methods.append(COOLPROP); methods_P.append(COOLPROP)<EOL>self.CP_f = coolprop_fluids[self.CASRN]<EOL>Tmins.append(self.CP_f.Tmin); Tmaxs.append(self.CP_f.Tc)<EOL><DEDENT>if self.MW:<EOL><INDENT>methods.extend([BAHADORI_L, LAKSHMI_PRASAD])<EOL><DEDENT>if self.CASRN in Perrys2_315.index:<EOL><INDENT>methods.append(DIPPR_PERRY_8E)<EOL>_, C1, C2, C3, C4, C5, self.Perrys2_315_Tmin, self.Perrys2_315_Tmax = _Perrys2_315_values[Perrys2_315.index.get_loc(self.CASRN)].tolist()<EOL>self.Perrys2_315_coeffs = [C1, C2, C3, C4, C5]<EOL>Tmins.append(self.Perrys2_315_Tmin); Tmaxs.append(self.Perrys2_315_Tmax)<EOL><DEDENT>if self.CASRN in VDI_PPDS_9.index:<EOL><INDENT>_,  A, B, C, D, E = _VDI_PPDS_9_values[VDI_PPDS_9.index.get_loc(self.CASRN)].tolist()<EOL>self.VDI_PPDS_coeffs = [A, B, C, D, E]<EOL>self.VDI_PPDS_coeffs.reverse()<EOL>methods.append(VDI_PPDS)<EOL><DEDENT>if all([self.MW, self.Tm]):<EOL><INDENT>methods.append(SHEFFY_JOHNSON)<EOL>Tmins.append(<NUM_LIT:0>); Tmaxs.append(self.Tm + <NUM_LIT>)<EOL><DEDENT>if all([self.Tb, self.Pc, self.omega]):<EOL><INDENT>methods.append(GHARAGHEIZI_L)<EOL>Tmins.append(self.Tb); Tmaxs.append(self.Tc)<EOL><DEDENT>if all([self.Tc, self.Pc, self.omega]):<EOL><INDENT>methods.append(NICOLA)<EOL><DEDENT>if all([self.Tb, self.Tc]):<EOL><INDENT>methods.append(SATO_RIEDEL)<EOL><DEDENT>if all([self.Hfus, self.Tc, self.omega]):<EOL><INDENT>methods.append(NICOLA_ORIGINAL)<EOL><DEDENT>if all([self.Tc, self.Pc]):<EOL><INDENT>methods_P.extend([DIPPR_9G, MISSENARD])<EOL><DEDENT>self.all_methods = set(methods)<EOL>self.all_methods_P = set(methods_P)<EOL>if Tmins and Tmaxs:<EOL><INDENT>self.Tmin, self.Tmax = min(Tmins), max(Tmaxs)<EOL><DEDENT>

r'''Method which picks out coefficients for the specified chemical
        from the various dictionaries and DataFrames storing it. All data is
        stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
        :obj:`all_methods` and obj:`all_methods_P` as a set of methods for
        which the data exists for.

        Called on initialization only. See the source code for the variables at
        which the coefficients are stored. The coefficients can safely be
        altered once the class is initialized. This method can be called again
        to reset the parameters.


if method == SHEFFY_JOHNSON:<EOL><INDENT>kl = Sheffy_Johnson(T, self.MW, self.Tm)<EOL><DEDENT>elif method == SATO_RIEDEL:<EOL><INDENT>kl = Sato_Riedel(T, self.MW, self.Tb, self.Tc)<EOL><DEDENT>elif method == GHARAGHEIZI_L:<EOL><INDENT>kl = Gharagheizi_liquid(T, self.MW, self.Tb, self.Pc, self.omega)<EOL><DEDENT>elif method == NICOLA:<EOL><INDENT>kl = Nicola(T, self.MW, self.Tc, self.Pc, self.omega)<EOL><DEDENT>elif method == NICOLA_ORIGINAL:<EOL><INDENT>kl = Nicola_original(T, self.MW, self.Tc, self.omega, self.Hfus)<EOL><DEDENT>elif method == LAKSHMI_PRASAD:<EOL><INDENT>kl = Lakshmi_Prasad(T, self.MW)<EOL><DEDENT>elif method == BAHADORI_L:<EOL><INDENT>kl = Bahadori_liquid(T, self.MW)<EOL><DEDENT>elif method == DIPPR_PERRY_8E:<EOL><INDENT>kl = EQ100(T, *self.Perrys2_315_coeffs)<EOL><DEDENT>elif method == VDI_PPDS:<EOL><INDENT>kl = horner(self.VDI_PPDS_coeffs, T)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>kl = CoolProp_T_dependent_property(T, self.CASRN, '<STR_LIT:L>', '<STR_LIT:l>')<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>kl = self.interpolate(T, method)<EOL><DEDENT>return kl<EOL>

r'''Method to calculate low-pressure liquid thermal conductivity at
        tempearture `T` with a given method.

        This method has no exception handling; see `T_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature of the liquid, [K]
        method : str
            Name of the method to use

        Returns
        -------
        kl : float
            Thermal conductivity of the liquid at T and a low pressure, [W/m/K]


if method == DIPPR_9G:<EOL><INDENT>kl = self.T_dependent_property(T)<EOL>kl = DIPPR9G(T, P, self.Tc, self.Pc, kl)<EOL><DEDENT>elif method == MISSENARD:<EOL><INDENT>kl = self.T_dependent_property(T)<EOL>kl = Missenard(T, P, self.Tc, self.Pc, kl)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>kl = PropsSI('<STR_LIT:L>', '<STR_LIT:T>', T, '<STR_LIT:P>', P, self.CASRN)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>kl = self.interpolate_P(T, P, method)<EOL><DEDENT>return kl<EOL>

r'''Method to calculate pressure-dependent liquid thermal conductivity
        at temperature `T` and pressure `P` with a given method.

        This method has no exception handling; see `TP_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to calculate liquid thermal conductivity, [K]
        P : float
            Pressure at which to calculate liquid thermal conductivity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        kl : float
            Thermal conductivity of the liquid at T and P, [W/m/K]


methods = [DIPPR_9H, SIMPLE]        <EOL>if len(self.CASs) == <NUM_LIT:2>:<EOL><INDENT>methods.append(FILIPPOV)<EOL><DEDENT>if '<STR_LIT>' in self.CASs and len(self.CASs)><NUM_LIT:1>:<EOL><INDENT>wCASs = [i for i in self.CASs if i != '<STR_LIT>']<EOL>if all([i in Magomedovk_thermal_cond.index for i in wCASs]):<EOL><INDENT>methods.append(MAGOMEDOV)<EOL>self.wCASs = wCASs<EOL>self.index_w = self.CASs.index('<STR_LIT>')<EOL><DEDENT><DEDENT>self.all_methods = set(methods)<EOL>Tmins = [i.Tmin for i in self.ThermalConductivityLiquids if i.Tmin]<EOL>Tmaxs = [i.Tmax for i in self.ThermalConductivityLiquids if i.Tmax]<EOL>if Tmins:<EOL><INDENT>self.Tmin = max(Tmins)<EOL><DEDENT>if Tmaxs:<EOL><INDENT>self.Tmax = max(Tmaxs)<EOL><DEDENT>

r'''Method to initialize the object by precomputing any values which
        may be used repeatedly and by retrieving mixture-specific variables.
        All data are stored as attributes. This method also sets :obj:`Tmin`,
        :obj:`Tmax`, and :obj:`all_methods` as a set of methods which should
        work to calculate the property.

        Called on initialization only. See the source code for the variables at
        which the coefficients are stored. The coefficients can safely be
        altered once the class is initialized. This method can be called again
        to reset the parameters.


def calculate(self, T, P, zs, ws, method):

if method == SIMPLE:<EOL><INDENT>ks = [i(T, P) for i in self.ThermalConductivityLiquids]<EOL>return mixing_simple(zs, ks)<EOL><DEDENT>elif method == DIPPR_9H:<EOL><INDENT>ks = [i(T, P) for i in self.ThermalConductivityLiquids]<EOL>return DIPPR9H(ws, ks)<EOL><DEDENT>elif method == FILIPPOV:<EOL><INDENT>ks = [i(T, P) for i in self.ThermalConductivityLiquids]<EOL>return Filippov(ws, ks)<EOL><DEDENT>elif method == MAGOMEDOV:<EOL><INDENT>k_w = self.ThermalConductivityLiquids[self.index_w](T, P)<EOL>ws = list(ws) ; ws.pop(self.index_w)<EOL>return thermal_conductivity_Magomedov(T, P, ws, self.wCASs, k_w)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate thermal conductivity of a liquid mixture at
        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
        `ws` with a given method.

        This method has no exception handling; see `mixture_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to calculate the property, [K]
        P : float
            Pressure at which to calculate the property, [Pa]
        zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        method : str
            Name of the method to use

        Returns
        -------
        k : float
            Thermal conductivity of the liquid mixture, [W/m/K]


methods, methods_P = [], []<EOL>Tmins, Tmaxs = [], []<EOL>if self.CASRN in _VDISaturationDict:<EOL><INDENT>methods.append(VDI_TABULAR)<EOL>Ts, props = VDI_tabular_data(self.CASRN, '<STR_LIT>')<EOL>self.VDI_Tmin = Ts[<NUM_LIT:0>]<EOL>self.VDI_Tmax = Ts[-<NUM_LIT:1>]<EOL>self.tabular_data[VDI_TABULAR] = (Ts, props)<EOL>Tmins.append(self.VDI_Tmin); Tmaxs.append(self.VDI_Tmax)<EOL><DEDENT>if has_CoolProp and self.CASRN in coolprop_dict:<EOL><INDENT>methods.append(COOLPROP); methods_P.append(COOLPROP)<EOL>self.CP_f = coolprop_fluids[self.CASRN]<EOL>Tmins.append(self.CP_f.Tmin); Tmaxs.append(self.CP_f.Tc)<EOL><DEDENT>if self.CASRN in Perrys2_314.index:<EOL><INDENT>methods.append(DIPPR_PERRY_8E)<EOL>_, C1, C2, C3, C4, self.Perrys2_314_Tmin, self.Perrys2_314_Tmax = _Perrys2_314_values[Perrys2_314.index.get_loc(self.CASRN)].tolist()<EOL>self.Perrys2_314_coeffs = [C1, C2, C3, C4]<EOL>Tmins.append(self.Perrys2_314_Tmin); Tmaxs.append(self.Perrys2_314_Tmax)<EOL><DEDENT>if self.CASRN in VDI_PPDS_10.index:<EOL><INDENT>_,  A, B, C, D, E = _VDI_PPDS_10_values[VDI_PPDS_10.index.get_loc(self.CASRN)].tolist()<EOL>self.VDI_PPDS_coeffs = [A, B, C, D, E]<EOL>self.VDI_PPDS_coeffs.reverse()<EOL>methods.append(VDI_PPDS)<EOL><DEDENT>if all((self.MW, self.Tb, self.Pc, self.omega)):<EOL><INDENT>methods.append(GHARAGHEIZI_G)<EOL>Tmaxs.append(<NUM_LIT>)<EOL><DEDENT>if all((self.Cvgm, self.mug, self.MW, self.Tc)):<EOL><INDENT>methods.append(DIPPR_9B)<EOL>Tmins.append(<NUM_LIT>); Tmaxs.append(<NUM_LIT>)  <EOL><DEDENT>if all((self.Cvgm, self.mug, self.MW, self.Tc, self.omega)):<EOL><INDENT>methods.append(CHUNG)<EOL>Tmins.append(<NUM_LIT>); Tmaxs.append(<NUM_LIT>)  <EOL><DEDENT>if all((self.Cvgm, self.MW, self.Tc, self.Vc, self.Zc, self.omega)):<EOL><INDENT>methods.append(ELI_HANLEY)<EOL>Tmaxs.append(<NUM_LIT>)  <EOL><DEDENT>if all((self.Cvgm, self.mug, self.MW)):<EOL><INDENT>methods.append(EUCKEN_MOD)<EOL>methods.append(EUCKEN)<EOL>Tmins.append(<NUM_LIT>); Tmaxs.append(<NUM_LIT>)  <EOL><DEDENT>if self.MW:<EOL><INDENT>methods.append(BAHADORI_G)<EOL><DEDENT>if all([self.MW, self.Tc, self.Vc, self.Zc, self.omega]):<EOL><INDENT>methods_P.append(ELI_HANLEY_DENSE)<EOL><DEDENT>if all([self.MW, self.Tc, self.Vc, self.omega, self.dipole]):<EOL><INDENT>methods_P.append(CHUNG_DENSE)<EOL><DEDENT>if all([self.MW, self.Tc, self.Pc, self.Vc, self.Zc]):<EOL><INDENT>methods_P.append(STIEL_THODOS_DENSE)<EOL><DEDENT>self.all_methods = set(methods)<EOL>self.all_methods_P = set(methods_P)<EOL>if Tmins and Tmaxs:<EOL><INDENT>self.Tmin, self.Tmax = min(Tmins), max(Tmaxs)<EOL><DEDENT>


if method == GHARAGHEIZI_G:<EOL><INDENT>kg = Gharagheizi_gas(T, self.MW, self.Tb, self.Pc, self.omega)<EOL><DEDENT>elif method == DIPPR_9B:<EOL><INDENT>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>mug = self.mug(T) if hasattr(self.mug, '<STR_LIT>') else self.mug<EOL>kg = DIPPR9B(T, self.MW, Cvgm, mug, self.Tc)<EOL><DEDENT>elif method == CHUNG:<EOL><INDENT>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>mug = self.mug(T) if hasattr(self.mug, '<STR_LIT>') else self.mug<EOL>kg = Chung(T, self.MW, self.Tc, self.omega, Cvgm, mug)<EOL><DEDENT>elif method == ELI_HANLEY:<EOL><INDENT>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>kg = eli_hanley(T, self.MW, self.Tc, self.Vc, self.Zc, self.omega, Cvgm)<EOL><DEDENT>elif method == EUCKEN_MOD:<EOL><INDENT>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>mug = self.mug(T) if hasattr(self.mug, '<STR_LIT>') else self.mug<EOL>kg = Eucken_modified(self.MW, Cvgm, mug)<EOL><DEDENT>elif method == EUCKEN:<EOL><INDENT>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>mug = self.mug(T) if hasattr(self.mug, '<STR_LIT>') else self.mug<EOL>kg = Eucken(self.MW, Cvgm, mug)<EOL><DEDENT>elif method == DIPPR_PERRY_8E:<EOL><INDENT>kg = EQ102(T, *self.Perrys2_314_coeffs)<EOL><DEDENT>elif method == VDI_PPDS:<EOL><INDENT>kg = horner(self.VDI_PPDS_coeffs, T)<EOL><DEDENT>elif method == BAHADORI_G:<EOL><INDENT>kg = Bahadori_gas(T, self.MW)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>kg = CoolProp_T_dependent_property(T, self.CASRN, '<STR_LIT:L>', '<STR_LIT:g>')<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>kg = self.interpolate(T, method)<EOL><DEDENT>return kg<EOL>

r'''Method to calculate low-pressure gas thermal conductivity at
        tempearture `T` with a given method.

        This method has no exception handling; see `T_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature of the gas, [K]
        method : str
            Name of the method to use

        Returns
        -------
        kg : float
            Thermal conductivity of the gas at T and a low pressure, [W/m/K]


if method == ELI_HANLEY_DENSE:<EOL><INDENT>Vmg = self.Vmg(T, P) if hasattr(self.Vmg, '<STR_LIT>') else self.Vmg<EOL>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>kg = eli_hanley_dense(T, self.MW, self.Tc, self.Vc, self.Zc, self.omega, Cvgm, Vmg)<EOL><DEDENT>elif method == CHUNG_DENSE:<EOL><INDENT>Vmg = self.Vmg(T, P) if hasattr(self.Vmg, '<STR_LIT>') else self.Vmg<EOL>Cvgm = self.Cvgm(T) if hasattr(self.Cvgm, '<STR_LIT>') else self.Cvgm<EOL>mug = self.mug(T, P) if hasattr(self.mug, '<STR_LIT>') else self.mug<EOL>kg = chung_dense(T, self.MW, self.Tc, self.Vc, self.omega, Cvgm, Vmg, mug, self.dipole)<EOL><DEDENT>elif method == STIEL_THODOS_DENSE:<EOL><INDENT>kg = self.T_dependent_property(T)<EOL>Vmg = self.Vmg(T, P) if hasattr(self.Vmg, '<STR_LIT>') else self.Vmg<EOL>kg = stiel_thodos_dense(T, self.MW, self.Tc, self.Pc, self.Vc, self.Zc, Vmg, kg)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>kg = PropsSI('<STR_LIT:L>', '<STR_LIT:T>', T, '<STR_LIT:P>', P, self.CASRN)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>kg = self.interpolate_P(T, P, method)<EOL><DEDENT>return kg<EOL>

r'''Method to calculate pressure-dependent gas thermal conductivity
        at temperature `T` and pressure `P` with a given method.

        This method has no exception handling; see `TP_dependent_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to calculate gas thermal conductivity, [K]
        P : float
            Pressure at which to calculate gas thermal conductivity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        kg : float
            Thermal conductivity of the gas at T and P, [W/m/K]


methods = []        <EOL>methods.append(SIMPLE)<EOL>if none_and_length_check((self.Tbs, self.MWs)):<EOL><INDENT>methods.append(LINDSAY_BROMLEY)<EOL><DEDENT>self.all_methods = set(methods)<EOL>Tmins = [i.Tmin for i in self.ThermalConductivityGases if i.Tmin]<EOL>Tmaxs = [i.Tmax for i in self.ThermalConductivityGases if i.Tmax]<EOL>if Tmins:<EOL><INDENT>self.Tmin = max(Tmins)<EOL><DEDENT>if Tmaxs:<EOL><INDENT>self.Tmax = max(Tmaxs)<EOL><DEDENT>


if method == SIMPLE:<EOL><INDENT>ks = [i(T, P) for i in self.ThermalConductivityGases]<EOL>return mixing_simple(zs, ks)<EOL><DEDENT>elif method == LINDSAY_BROMLEY:<EOL><INDENT>ks = [i(T, P) for i in self.ThermalConductivityGases]<EOL>mus = [i(T, P) for i in self.ViscosityGases]<EOL>return Lindsay_Bromley(T=T, ys=zs, ks=ks, mus=mus, Tbs=self.Tbs, MWs=self.MWs)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate thermal conductivity of a gas mixture at
        temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
        `ws` with a given method.

        This method has no exception handling; see `mixture_property`
        for that.

        Parameters
        ----------
        T : float
            Temperature at which to calculate the property, [K]
        P : float
            Pressure at which to calculate the property, [Pa]
        zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        method : str
            Name of the method to use

        Returns
        -------
        kg : float
            Thermal conductivity of gas mixture, [W/m/K]


def ppmv_to_mgm3(ppmv, MW, T=<NUM_LIT>, P=<NUM_LIT>):

parts = ppmv*<NUM_LIT><EOL>n = parts*P/(R*T)<EOL>mgm3 = MW*n*<NUM_LIT:1000>  <EOL>return mgm3<EOL>

r'''Converts a concentration in ppmv to units of mg/m^3. Used in
    industrial toxicology.

    .. math::
        \frac{mg}{m^3} = \frac{ppmv\cdot P}{RT}\cdot \frac{MW}{1000}

    Parameters
    ----------
    ppmv : float
        Concentratoin of a component in a gas mixure [parts per million,
        volumetric]
    MW : float
        Molecular weight of the trace gas [g/mol]
    T : float, optional
        Temperature of the gas at which the ppmv is reported
    P : float, optional
        Pressure of the gas at which the ppmv is reported

    Returns
    -------
    mgm3 : float
        Concentration of a substance in an ideal gas mixture [mg/m^3]

    Notes
    -----
    The term P/(RT)/1000 converts to 0.040874 at STP. Its inverse is reported
    as 24.45 in [1]_.

    Examples
    --------
    >>> ppmv_to_mgm3(1, 40)
    1.6349623351068687

    References
    ----------
    .. [1] ACGIH. Industrial Ventilation: A Manual of Recommended Practice,
       23rd Edition. American Conference of Governmental and Industrial
       Hygenists, 2004.


def mgm3_to_ppmv(mgm3, MW, T=<NUM_LIT>, P=<NUM_LIT>):

n = mgm3/MW/<NUM_LIT><EOL>parts = n*R*T/P<EOL>ppm = parts/<NUM_LIT><EOL>return ppm<EOL>

r'''Converts a concentration in  mg/m^3 to units of ppmv. Used in
    industrial toxicology.

    .. math::
        ppmv = \frac{1000RT}{MW\cdot P} \cdot \frac{mg}{m^3}

    Parameters
    ----------
    mgm3 : float
        Concentration of a substance in an ideal gas mixture [mg/m^3]
    MW : float
        Molecular weight of the trace gas [g/mol]
    T : float, optional
        Temperature of the gas at which the ppmv is reported
    P : float, optional
        Pressure of the gas at which the ppmv is reported

    Returns
    -------
    ppmv : float
        Concentration of a component in a gas mixure [parts per million,
        volumetric]

    Notes
    -----
    The term P/(RT)/1000 converts to 0.040874 at STP. Its inverse is reported
    as 24.45 in [1]_.

    Examples
    --------
    >>> mgm3_to_ppmv(1.635, 40)
    1.0000230371625833

    References
    ----------
    .. [1] ACGIH. Industrial Ventilation: A Manual of Recommended Practice,
       23rd Edition. American Conference of Governmental and Industrial
       Hygenists, 2004.


def TWA(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in _OntarioExposureLimits and (_OntarioExposureLimits[CASRN]["<STR_LIT>"] or _OntarioExposureLimits[CASRN]["<STR_LIT>"]):<EOL><INDENT>methods.append(ONTARIO)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == ONTARIO:<EOL><INDENT>if _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_TWA = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT>elif _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_TWA = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT><DEDENT>elif Method == NONE:<EOL><INDENT>_TWA = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _TWA<EOL>

This function handles the retrieval of Time-Weighted Average limits on worker
    exposure to dangerous chemicals.

    This API is considered experimental, and is expected to be removed in a
    future release in favor of a more complete object-oriented interface.

    >>> TWA('98-00-0')
    (10.0, 'ppm')
    >>> TWA('1303-00-0')
    (5.0742430905659505e-05, 'ppm')
    >>> TWA('7782-42-5', AvailableMethods=True)
    ['Ontario Limits', 'None']


def STEL(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in _OntarioExposureLimits and (_OntarioExposureLimits[CASRN]["<STR_LIT>"] or _OntarioExposureLimits[CASRN]["<STR_LIT>"]):<EOL><INDENT>methods.append(ONTARIO)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == ONTARIO:<EOL><INDENT>if _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_STEL = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT>elif _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_STEL = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT><DEDENT>elif Method == NONE:<EOL><INDENT>_STEL = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _STEL<EOL>

This function handles the retrieval of Short-term Exposure Limit on
    worker exposure to dangerous chemicals.

    This API is considered experimental, and is expected to be removed in a
    future release in favor of a more complete object-oriented interface.

    >>> STEL('67-64-1')
    (750.0, 'ppm')
    >>> STEL('7664-38-2')
    (0.7489774978301237, 'ppm')
    >>> STEL('55720-99-5')
    (2.0, 'mg/m^3')
    >>> STEL('86290-81-5', AvailableMethods=True)
    ['Ontario Limits', 'None']


def Ceiling(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in _OntarioExposureLimits and (_OntarioExposureLimits[CASRN]["<STR_LIT>"] or _OntarioExposureLimits[CASRN]["<STR_LIT>"]):<EOL><INDENT>methods.append(ONTARIO)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == ONTARIO:<EOL><INDENT>if _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_Ceiling = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT>elif _OntarioExposureLimits[CASRN]["<STR_LIT>"]:<EOL><INDENT>_Ceiling = (_OntarioExposureLimits[CASRN]["<STR_LIT>"], '<STR_LIT>')<EOL><DEDENT><DEDENT>elif Method == NONE:<EOL><INDENT>_Ceiling = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _Ceiling<EOL>

This function handles the retrieval of Ceiling limits on worker
    exposure to dangerous chemicals.

    This API is considered experimental, and is expected to be removed in a
    future release in favor of a more complete object-oriented interface.

    >>> Ceiling('75-07-0')
    (25.0, 'ppm')
    >>> Ceiling('1395-21-7')
    (6e-05, 'mg/m^3')
    >>> Ceiling('7572-29-4', AvailableMethods=True)
    ['Ontario Limits', 'None']


def Skin(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in _OntarioExposureLimits:<EOL><INDENT>methods.append(ONTARIO)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == ONTARIO:<EOL><INDENT>_Skin = (_OntarioExposureLimits[CASRN]["<STR_LIT>"])<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>_Skin = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _Skin<EOL>

This function handles the retrieval of whether or not a chemical can
    be absorbed through the skin, relevant to chemical safety calculations.

    This API is considered experimental, and is expected to be removed in a
    future release in favor of a more complete object-oriented interface.

    >>> Skin('108-94-1')
    True
    >>> Skin('1395-21-7')
    False
    >>> Skin('7572-29-4', AvailableMethods=True)
    ['Ontario Limits', 'None']


def Carcinogen(CASRN, AvailableMethods=False, Method=None):

methods = [COMBINED, IARC, NTP]<EOL>if AvailableMethods:<EOL><INDENT>return methods<EOL><DEDENT>if not Method:<EOL><INDENT>Method = methods[<NUM_LIT:0>]<EOL><DEDENT>if Method == IARC:<EOL><INDENT>if CASRN in IARC_data.index:<EOL><INDENT>status = IARC_codes[IARC_data.at[CASRN, '<STR_LIT>']]<EOL><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == NTP:<EOL><INDENT>if CASRN in NTP_data.index:<EOL><INDENT>status = NTP_codes[NTP_data.at[CASRN, '<STR_LIT>']]<EOL><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == COMBINED:<EOL><INDENT>status = {}<EOL>for method in methods[<NUM_LIT:1>:]:<EOL><INDENT>status[method] = Carcinogen(CASRN, Method=method)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return status<EOL>

r'''Looks up if a chemical is listed as a carcinogen or not according to
    either a specifc method or with all methods.

    Returns either the status as a string for a specified method, or the
    status of the chemical in all available data sources, in the format
    {source: status}.

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    status : str or dict
        Carcinogen status information [-]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain carcinogen status with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        Carcinogen_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        if a chemical is listed as carcinogenic, and will return methods
        instead of the status

    Notes
    -----
    Supported methods are:

        * **IARC**: International Agency for Research on Cancer, [1]_. As
          extracted with a last update of  February 22, 2016. Has listing
          information of 843 chemicals with CAS numbers. Chemicals without
          CAS numbers not included here. If two listings for the same CAS
          were available, that closest to the CAS number was used. If two
          listings were available published at different times, the latest
          value was used. All else equal, the most pessimistic value was used.
        * **NTP**: National Toxicology Program, [2]_. Has data on 226
          chemicals.

    Examples
    --------
    >>> Carcinogen('61-82-5')
    {'National Toxicology Program 13th Report on Carcinogens': 'Reasonably Anticipated', 'International Agency for Research on Cancer': 'Not classifiable as to its carcinogenicity to humans (3)'}

    References
    ----------
    .. [1] International Agency for Research on Cancer. Agents Classified by
       the IARC Monographs, Volumes 1-115. Lyon, France: IARC; 2016 Available
       from: http://monographs.iarc.fr/ENG/Classification/
    .. [2] NTP (National Toxicology Program). 2014. Report on Carcinogens,
       Thirteenth Edition. Research Triangle Park, NC: U.S. Department of
       Health and Human Services, Public Health Service.
       http://ntp.niehs.nih.gov/pubhealth/roc/roc13/


def Tflash(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in IEC_2010.index and not np.isnan(IEC_2010.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(IEC)<EOL><DEDENT>if CASRN in NFPA_2008.index and not np.isnan(NFPA_2008.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(NFPA)<EOL><DEDENT>if CASRN in DIPPR_SERAT.index:<EOL><INDENT>methods.append(SERAT)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == IEC:<EOL><INDENT>return float(IEC_2010.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == NFPA:<EOL><INDENT>return float(NFPA_2008.at[CASRN, "<STR_LIT>"])<EOL><DEDENT>elif Method == SERAT:<EOL><INDENT>return float(DIPPR_SERAT.at[CASRN, "<STR_LIT>"])<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''This function handles the retrieval or calculation of a chemical's
    flash point. Lookup is based on CASRNs. No predictive methods are currently
    implemented. Will automatically select a data source to use if no Method
    is provided; returns None if the data is not available.

    Prefered source is 'IEC 60079-20-1 (2010)' [1]_, with the secondary source
    'NFPA 497 (2008)' [2]_ having very similar data. A third source
    'Serat DIPPR (2017)' [3]_ provides third hand experimental but evaluated
    data from the DIPPR database, version unspecified, for 870 compounds.

    Examples
    --------
    >>> Tflash(CASRN='64-17-5')
    285.15

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    Tflash : float
        Flash point of the chemical, [K]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain Tflash with the given
        inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        Tflash_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        Tflash for the desired chemical, and will return methods instead of
        Tflash

    Notes
    -----
    The predicted values from the DIPPR databank are also available in the
    supporting material in [3]_, but are not included.

    References
    ----------
    .. [1] IEC. "IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
       Material characteristics for gas and vapour classification - Test
       methods and data." https://webstore.iec.ch/publication/635. See also
       https://law.resource.org/pub/in/bis/S05/is.iec.60079.20.1.2010.pdf
    .. [2] National Fire Protection Association. NFPA 497: Recommended
       Practice for the Classification of Flammable Liquids, Gases, or Vapors
       and of Hazardous. NFPA, 2008.
    .. [3] Serat, Fatima Zohra, Ali Mustapha Benkouider, Ahmed Yahiaoui, and
       Farid Bagui. "Nonlinear Group Contribution Model for the Prediction of
       Flash Points Using Normal Boiling Points." Fluid Phase Equilibria 449
       (October 15, 2017): 52-59. doi:10.1016/j.fluid.2017.06.008.


def Tautoignition(CASRN, AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in IEC_2010.index and not np.isnan(IEC_2010.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(IEC)<EOL><DEDENT>if CASRN in NFPA_2008.index and not np.isnan(NFPA_2008.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(NFPA)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == IEC:<EOL><INDENT>return float(IEC_2010.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == NFPA:<EOL><INDENT>return float(NFPA_2008.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''This function handles the retrieval or calculation of a chemical's
    autoifnition temperature. Lookup is based on CASRNs. No predictive methods
    are currently implemented. Will automatically select a data source to use
    if no Method is provided; returns None if the data is not available.

    Prefered source is 'IEC 60079-20-1 (2010)' [1]_, with the secondary source
    'NFPA 497 (2008)' [2]_ having very similar data.

    Examples
    --------
    >>> Tautoignition(CASRN='71-43-2')
    771.15

    Parameters
    ----------
    CASRN : string
        CASRN [-]

    Returns
    -------
    Tautoignition : float
        Autoignition point of the chemical, [K]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain Tautoignition with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        Tautoignition_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        Tautoignition for the desired chemical, and will return methods
        instead of Tautoignition

    Notes
    -----

    References
    ----------
    .. [1] IEC. “IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
       Material characteristics for gas and vapour classification - Test
       methods and data.” https://webstore.iec.ch/publication/635. See also
       https://law.resource.org/pub/in/bis/S05/is.iec.60079.20.1.2010.pdf
    .. [2] National Fire Protection Association. NFPA 497: Recommended
       Practice for the Classification of Flammable Liquids, Gases, or Vapors
       and of Hazardous. NFPA, 2008.


def LFL(Hc=None, atoms={}, CASRN='<STR_LIT>', AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in IEC_2010.index and not np.isnan(IEC_2010.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(IEC)<EOL><DEDENT>if CASRN in NFPA_2008.index and not np.isnan(NFPA_2008.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(NFPA)<EOL><DEDENT>if Hc:<EOL><INDENT>methods.append(SUZUKI)<EOL><DEDENT>if atoms:<EOL><INDENT>methods.append(CROWLLOUVAR)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == IEC:<EOL><INDENT>return float(IEC_2010.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == NFPA:<EOL><INDENT>return float(NFPA_2008.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == SUZUKI:<EOL><INDENT>return Suzuki_LFL(Hc=Hc)<EOL><DEDENT>elif Method == CROWLLOUVAR:<EOL><INDENT>return Crowl_Louvar_LFL(atoms=atoms)<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''This function handles the retrieval or calculation of a chemical's
    Lower Flammability Limit. Lookup is based on CASRNs. Two predictive methods
    are currently implemented. Will automatically select a data source to use
    if no Method is provided; returns None if the data is not available.

    Prefered source is 'IEC 60079-20-1 (2010)' [1]_, with the secondary source
    'NFPA 497 (2008)' [2]_ having very similar data. If the heat of combustion
    is provided, the estimation method `Suzuki_LFL` can be used. If the atoms
    of the molecule are available, the method `Crowl_Louvar_LFL` can be used.

    Examples
    --------
    >>> LFL(CASRN='71-43-2')
    0.012

    Parameters
    ----------
    Hc : float, optional
        Heat of combustion of gas [J/mol]
    atoms : dict, optional
        Dictionary of atoms and atom counts
    CASRN : string, optional
        CASRN [-]

    Returns
    -------
    LFL : float
        Lower flammability limit of the gas in an atmosphere at STP, [mole fraction]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain LFL with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        LFL_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the Lower Flammability Limit for the desired chemical, and will return
        methods instead of Lower Flammability Limit.

    Notes
    -----

    References
    ----------
    .. [1] IEC. “IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
       Material characteristics for gas and vapour classification - Test
       methods and data.” https://webstore.iec.ch/publication/635. See also
       https://law.resource.org/pub/in/bis/S05/is.iec.60079.20.1.2010.pdf
    .. [2] National Fire Protection Association. NFPA 497: Recommended
       Practice for the Classification of Flammable Liquids, Gases, or Vapors
       and of Hazardous. NFPA, 2008.


def UFL(Hc=None, atoms={}, CASRN='<STR_LIT>', AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in IEC_2010.index and not np.isnan(IEC_2010.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(IEC)<EOL><DEDENT>if CASRN in NFPA_2008.index and not np.isnan(NFPA_2008.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(NFPA)<EOL><DEDENT>if Hc:<EOL><INDENT>methods.append(SUZUKI)<EOL><DEDENT>if atoms:<EOL><INDENT>methods.append(CROWLLOUVAR)<EOL><DEDENT>methods.append(NONE)<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL><DEDENT>if Method == IEC:<EOL><INDENT>return float(IEC_2010.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == NFPA:<EOL><INDENT>return float(NFPA_2008.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == SUZUKI:<EOL><INDENT>return Suzuki_UFL(Hc=Hc)<EOL><DEDENT>elif Method == CROWLLOUVAR:<EOL><INDENT>return Crowl_Louvar_UFL(atoms=atoms)<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''This function handles the retrieval or calculation of a chemical's
    Upper Flammability Limit. Lookup is based on CASRNs. Two predictive methods
    are currently implemented. Will automatically select a data source to use
    if no Method is provided; returns None if the data is not available.

    Prefered source is 'IEC 60079-20-1 (2010)' [1]_, with the secondary source
    'NFPA 497 (2008)' [2]_ having very similar data. If the heat of combustion
    is provided, the estimation method `Suzuki_UFL` can be used. If the atoms
    of the molecule are available, the method `Crowl_Louvar_UFL` can be used.

    Examples
    --------
    >>> UFL(CASRN='71-43-2')
    0.086

    Parameters
    ----------
    Hc : float, optional
        Heat of combustion of gas [J/mol]
    atoms : dict, optional
        Dictionary of atoms and atom counts
    CASRN : string, optional
        CASRN [-]

    Returns
    -------
    UFL : float
        Upper flammability limit of the gas in an atmosphere at STP, [mole fraction]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain UFL with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        UFL_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the Upper Flammability Limit for the desired chemical, and will return
        methods instead of Upper Flammability Limit.

    Notes
    -----

    References
    ----------
    .. [1] IEC. “IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
       Material characteristics for gas and vapour classification - Test
       methods and data.” https://webstore.iec.ch/publication/635. See also
       https://law.resource.org/pub/in/bis/S05/is.iec.60079.20.1.2010.pdf
    .. [2] National Fire Protection Association. NFPA 497: Recommended
       Practice for the Classification of Flammable Liquids, Gases, or Vapors
       and of Hazardous. NFPA, 2008.


return <NUM_LIT:1.>/sum([yi/FLi for yi, FLi in zip(ys, FLs)])<EOL>

Crowl, Daniel A., and Joseph F. Louvar. Chemical Process Safety:
Fundamentals with Applications. 2E. Upper Saddle River, N.J:
Prentice Hall, 2001.

>>> fire_mixing(ys=normalize([0.0024, 0.0061, 0.0015]), FLs=[.012, .053, .031])
0.02751172136637643
>>> fire_mixing(ys=normalize([0.0024, 0.0061, 0.0015]), FLs=[.075, .15, .32])
0.12927551844869378


def LFL_mixture(ys=None, LFLs=None, CASRNs=None, AvailableMethods=False,<EOL>Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRNs:<EOL><INDENT>CASRNs2 = list(CASRNs)<EOL>LFLs2 = list(LFLs)<EOL>for i in inerts:<EOL><INDENT>if i in CASRNs2:<EOL><INDENT>ind = CASRNs.index(i)<EOL>CASRNs2.remove(i)<EOL>LFLs2.remove(LFLs[ind])<EOL><DEDENT><DEDENT>if none_and_length_check([LFLs2]):<EOL><INDENT>methods.append('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if none_and_length_check([LFLs]):<EOL><INDENT>methods.append('<STR_LIT>')<EOL><DEDENT><DEDENT>methods.append('<STR_LIT:None>')<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL>


def UFL_mixture(ys=None, UFLs=None, CASRNs=None, AvailableMethods=False,<EOL>Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRNs:<EOL><INDENT>CASRNs2 = list(CASRNs)<EOL>UFLs2 = list(UFLs)<EOL>for i in inerts:<EOL><INDENT>if i in CASRNs2:<EOL><INDENT>ind = CASRNs.index(i)<EOL>CASRNs2.remove(i)<EOL>UFLs2.remove(UFLs[ind])<EOL><DEDENT><DEDENT>if none_and_length_check([UFLs2]):<EOL><INDENT>methods.append('<STR_LIT>')<EOL><DEDENT><DEDENT>if none_and_length_check([UFLs, ys]):<EOL><INDENT>methods.append('<STR_LIT>')<EOL><DEDENT>methods.append('<STR_LIT:None>')<EOL>return methods<EOL><DEDENT>if AvailableMethods:<EOL><INDENT>return list_methods()<EOL><DEDENT>if not Method:<EOL><INDENT>Method = list_methods()[<NUM_LIT:0>]<EOL>


Hc = Hc/<NUM_LIT><EOL>LFL = -<NUM_LIT>/Hc + <NUM_LIT>*Hc + <NUM_LIT>*Hc*Hc + <NUM_LIT><EOL>return LFL/<NUM_LIT><EOL>

r'''Calculates lower flammability limit, using the Suzuki [1]_ correlation.
    Uses heat of combustion only.

    The lower flammability limit of a gas is air is:

    .. math::
        \text{LFL} = \frac{-3.42}{\Delta H_c^{\circ}} + 0.569
        \Delta H_c^{\circ} + 0.0538\Delta H_c^{\circ 2} + 1.80

    Parameters
    ----------
    Hc : float
        Heat of combustion of gas [J/mol]

    Returns
    -------
    LFL : float
        Lower flammability limit, mole fraction [-]

    Notes
    -----
    Fit performed with 112 compounds, r^2 was 0.977.
    LFL in percent volume in air. Hc is at standard conditions, in MJ/mol.
    11 compounds left out as they were outliers.
    Equation does not apply for molecules with halogen atoms, only hydrocarbons
    with oxygen or nitrogen or sulfur.
    No sample calculation provided with the article. However, the equation is
    straightforward.

    Limits of equations's validity are -6135596 J where it predicts a
    LFL of 0, and -48322129 J where it predicts a LFL of 1.

    Examples
    --------
    Pentane, 1.5 % LFL in literature

    >>> Suzuki_LFL(-3536600)
    0.014276107095811815

    References
    ----------
    .. [1] Suzuki, Takahiro. "Note: Empirical Relationship between Lower
       Flammability Limits and Standard Enthalpies of Combustion of Organic
       Compounds." Fire and Materials 18, no. 5 (September 1, 1994): 333-36.
       doi:10.1002/fam.810180509.


Hc = Hc/<NUM_LIT><EOL>UFL = <NUM_LIT>*Hc + <NUM_LIT>*Hc*Hc + <NUM_LIT><EOL>return UFL/<NUM_LIT><EOL>

r'''Calculates upper flammability limit, using the Suzuki [1]_ correlation.
    Uses heat of combustion only.

    The upper flammability limit of a gas is air is:

    .. math::
        \text{UFL} = 6.3\Delta H_c^\circ + 0.567\Delta H_c^{\circ 2} + 23.5

    Parameters
    ----------
    Hc : float
        Heat of combustion of gas [J/mol]

    Returns
    -------
    UFL : float
        Upper flammability limit, mole fraction

    Notes
    -----
    UFL in percent volume in air according to original equation.
    Hc is at standard conditions in the equation, in units of MJ/mol.
    AAPD = 1.2% for 95 compounds used in fit.
    Somewhat better results than the High and Danner method.
    4.9% < UFL < 23.0%
    -890.3 kJ/mol < dHc < -6380 kJ/mol
    r^2 = 0.989
    Sample calculations provided for all chemicals, both this method and
    High and Danner. Examples are from the article.

    Predicts a UFL of 1 at 7320190 J and a UFL of 0 at -5554160 J.

    Examples
    --------
    Pentane, literature 7.8% UFL

    >>> Suzuki_UFL(-3536600)
    0.0831119493052

    References
    ----------
    .. [1] Suzuki, Takahiro, and Kozo Koide. "Short Communication: Correlation
       between Upper Flammability Limits and Thermochemical Properties of
       Organic Compounds." Fire and Materials 18, no. 6 (November 1, 1994):
       393-97. doi:10.1002/fam.810180608.


nC, nH, nO = <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0><EOL>if '<STR_LIT:C>' in atoms and atoms['<STR_LIT:C>']:<EOL><INDENT>nC = atoms['<STR_LIT:C>']<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>if '<STR_LIT:H>' in atoms:<EOL><INDENT>nH = atoms['<STR_LIT:H>']<EOL><DEDENT>if '<STR_LIT:O>' in atoms:<EOL><INDENT>nO = atoms['<STR_LIT:O>']<EOL><DEDENT>return <NUM_LIT>/(<NUM_LIT>*nC + <NUM_LIT>*nH - <NUM_LIT>*nO + <NUM_LIT:1.>)<EOL>

r'''Calculates lower flammability limit, using the Crowl-Louvar [1]_
    correlation. Uses molecular formula only.

    The lower flammability limit of a gas is air is:

    .. math::
        C_mH_xO_y + zO_2 \to mCO_2 + \frac{x}{2}H_2O

        \text{LFL} = \frac{0.55}{4.76m + 1.19x - 2.38y + 1}

    Parameters
    ----------
    atoms : dict
        Dictionary of atoms and atom counts

    Returns
    -------
    LFL : float
        Lower flammability limit, mole fraction

    Notes
    -----
    Coefficient of 0.55 taken from [2]_

    Examples
    --------
    Hexane, example from [1]_, lit. 1.2 %

    >>> Crowl_Louvar_LFL({'H': 14, 'C': 6})
    0.011899610558199915

    References
    ----------
    .. [1] Crowl, Daniel A., and Joseph F. Louvar. Chemical Process Safety:
       Fundamentals with Applications. 2E. Upper Saddle River, N.J:
       Prentice Hall, 2001.
    .. [2] Jones, G. W. "Inflammation Limits and Their Practical Application
       in Hazardous Industrial Operations." Chemical Reviews 22, no. 1
       (February 1, 1938): 1-26. doi:10.1021/cr60071a001


r'''Calculates upper flammability limit, using the Crowl-Louvar [1]_
    correlation. Uses molecular formula only.

    The upper flammability limit of a gas is air is:

    .. math::
        C_mH_xO_y + zO_2 \to mCO_2 + \frac{x}{2}H_2O

        \text{UFL} = \frac{3.5}{4.76m + 1.19x - 2.38y + 1}

    Parameters
    ----------
    atoms : dict
        Dictionary of atoms and atom counts

    Returns
    -------
    UFL : float
        Upper flammability limit, mole fraction

    Notes
    -----
    Coefficient of 3.5 taken from [2]_

    Examples
    --------
    Hexane, example from [1]_, lit. 7.5 %

    >>> Crowl_Louvar_UFL({'H': 14, 'C': 6})
    0.07572479446127219

    References
    ----------
    .. [1] Crowl, Daniel A., and Joseph F. Louvar. Chemical Process Safety:
       Fundamentals with Applications. 2E. Upper Saddle River, N.J:
       Prentice Hall, 2001.
    .. [2] Jones, G. W. "Inflammation Limits and Their Practical Application
       in Hazardous Industrial Operations." Chemical Reviews 22, no. 1
       (February 1, 1938): 1-26. doi:10.1021/cr60071a001


def Lastovka_Shaw(T, similarity_variable, cyclic_aliphatic=False):

a = similarity_variable<EOL>if cyclic_aliphatic:<EOL><INDENT>A1 = -<NUM_LIT><EOL>A2 = <NUM_LIT><EOL>first = A1 + A2*a<EOL><DEDENT>else:<EOL><INDENT>A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>A3 = <NUM_LIT> <EOL>A4 = <NUM_LIT><EOL>first = A2 + (A1-A2)/(<NUM_LIT:1.> + exp((a - A3)/A4))<EOL><DEDENT>B11 = <NUM_LIT><EOL>B12 = <NUM_LIT><EOL>C11 = <NUM_LIT><EOL>C12 = <NUM_LIT><EOL>B21 = <NUM_LIT><EOL>B22 = <NUM_LIT><EOL>C21 = <NUM_LIT><EOL>C22 = <NUM_LIT><EOL>Cp = first + (B11 + B12*a)*((C11+C12*a)/T)**<NUM_LIT:2>*exp(-(C11 + C12*a)/T)/(<NUM_LIT:1.>-exp(-(C11+C12*a)/T))**<NUM_LIT:2><EOL>Cp += (B21 + B22*a)*((C21+C22*a)/T)**<NUM_LIT:2>*exp(-(C21 + C22*a)/T)/(<NUM_LIT:1.>-exp(-(C21+C22*a)/T))**<NUM_LIT:2><EOL>return Cp*<NUM_LIT><EOL>

r'''Calculate ideal-gas constant-pressure heat capacitiy with the similarity
    variable concept and method as shown in [1]_.

    .. math::
        C_p^0 = \left(A_2 + \frac{A_1 - A_2}{1 + \exp(\frac{\alpha-A_3}{A_4})}\right)
        + (B_{11} + B_{12}\alpha)\left(-\frac{(C_{11} + C_{12}\alpha)}{T}\right)^2
        \frac{\exp(-(C_{11} + C_{12}\alpha)/T)}{[1-\exp(-(C_{11}+C_{12}\alpha)/T)]^2}\\
        + (B_{21} + B_{22}\alpha)\left(-\frac{(C_{21} + C_{22}\alpha)}{T}\right)^2
        \frac{\exp(-(C_{21} + C_{22}\alpha)/T)}{[1-\exp(-(C_{21}+C_{22}\alpha)/T)]^2}

    Parameters
    ----------
    T : float
        Temperature of gas [K]
    similarity_variable : float
        similarity variable as defined in [1]_, [mol/g]

    Returns
    -------
    Cpg : float
        Gas constant-pressure heat capacitiy, [J/kg/K]

    Notes
    -----
    Original model is in terms of J/g/K. Note that the model is for predicting
    mass heat capacity, not molar heat capacity like most other methods!

    A1 = 0.58, A2 = 1.25, A3 = 0.17338003, A4 = 0.014, B11 = 0.73917383,
    B12 = 8.88308889, C11 = 1188.28051, C12 = 1813.04613, B21 = 0.0483019,
    B22 = 4.35656721, C21 = 2897.01927, C22 = 5987.80407.

    Examples
    --------
    >>> Lastovka_Shaw(1000.0, 0.1333)
    2467.113309084757

    References
    ----------
    .. [1] Lastovka, Vaclav, and John M. Shaw. "Predictive Correlations for
       Ideal Gas Heat Capacities of Pure Hydrocarbons and Petroleum Fractions."
       Fluid Phase Equilibria 356 (October 25, 2013): 338-370.
       doi:10.1016/j.fluid.2013.07.023.


def Lastovka_Shaw_integral(T, similarity_variable, cyclic_aliphatic=False):

a = similarity_variable<EOL>if cyclic_aliphatic:<EOL><INDENT>A1 = -<NUM_LIT><EOL>A2 = <NUM_LIT><EOL>first = A1 + A2*a<EOL><DEDENT>else:<EOL><INDENT>A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>A3 = <NUM_LIT> <EOL>A4 = <NUM_LIT><EOL>first = A2 + (A1-A2)/(<NUM_LIT:1.>+exp((a-A3)/A4)) <EOL><DEDENT>B11 = <NUM_LIT><EOL>B12 = <NUM_LIT><EOL>C11 = <NUM_LIT><EOL>C12 = <NUM_LIT><EOL>B21 = <NUM_LIT><EOL>B22 = <NUM_LIT><EOL>C21 = <NUM_LIT><EOL>C22 = <NUM_LIT><EOL>return <NUM_LIT>*(T*first - (B11 + B12*a)*(-C11 - C12*a)**<NUM_LIT:2>/(-C11 - C12*a + (C11 <EOL>+ C12*a)*exp((-C11 - C12*a)/T)) - (B21 + B22*a)*(-C21 - C22*a)**<NUM_LIT:2>/(-C21 <EOL>- C22*a + (C21 + C22*a)*exp((-C21 - C22*a)/T)))<EOL>

r'''Calculate the integral of ideal-gas constant-pressure heat capacitiy
    with the similarity variable concept and method as shown in [1]_.

    Parameters
    ----------
    T : float
        Temperature of gas [K]
    similarity_variable : float
        similarity variable as defined in [1]_, [mol/g]

    Returns
    -------
    H : float
        Difference in enthalpy from 0 K, [J/kg]

    Notes
    -----
    Original model is in terms of J/g/K. Note that the model is for predicting
    mass heat capacity, not molar heat capacity like most other methods!
    Integral was computed with SymPy.

    See Also
    --------
    Lastovka_Shaw
    Lastovka_Shaw_integral_over_T

    Examples
    --------
    >>> Lastovka_Shaw_integral(300.0, 0.1333)
    5283095.816018478

    References
    ----------
    .. [1] Lastovka, Vaclav, and John M. Shaw. "Predictive Correlations for
       Ideal Gas Heat Capacities of Pure Hydrocarbons and Petroleum Fractions."
       Fluid Phase Equilibria 356 (October 25, 2013): 338-370.
       doi:10.1016/j.fluid.2013.07.023.


def Lastovka_Shaw_integral_over_T(T, similarity_variable, cyclic_aliphatic=False):

from cmath import log, exp<EOL>a = similarity_variable<EOL>if cyclic_aliphatic:<EOL><INDENT>A1 = -<NUM_LIT><EOL>A2 = <NUM_LIT><EOL>first = A1 + A2*a<EOL><DEDENT>else:<EOL><INDENT>A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>A3 = <NUM_LIT> <EOL>A4 = <NUM_LIT><EOL>first = A2 + (A1-A2)/(<NUM_LIT:1.> + exp((a - A3)/A4))<EOL><DEDENT>a2 = a*a<EOL>B11 = <NUM_LIT><EOL>B12 = <NUM_LIT><EOL>C11 = <NUM_LIT><EOL>C12 = <NUM_LIT><EOL>B21 = <NUM_LIT><EOL>B22 = <NUM_LIT><EOL>C21 = <NUM_LIT><EOL>C22 = <NUM_LIT><EOL>S = (first*log(T) + (-B11 - B12*a)*log(exp((-C11 - C12*a)/T) - <NUM_LIT:1.>) <EOL>+ (-B11*C11 - B11*C12*a - B12*C11*a - B12*C12*a2)/(T*exp((-C11<EOL>- C12*a)/T) - T) - (B11*C11 + B11*C12*a + B12*C11*a + B12*C12*a2)/T)<EOL>S += ((-B21 - B22*a)*log(exp((-C21 - C22*a)/T) - <NUM_LIT:1.>) + (-B21*C21 - B21*C22*a<EOL>- B22*C21*a - B22*C22*a2)/(T*exp((-C21 - C22*a)/T) - T) - (B21*C21<EOL>+ B21*C22*a + B22*C21*a + B22*C22*a**<NUM_LIT:2>)/T)<EOL>return S.real*<NUM_LIT><EOL>

r'''Calculate the integral over temperature of ideal-gas constant-pressure
    heat capacitiy with the similarity variable concept and method as shown in
    [1]_.

    Parameters
    ----------
    T : float
        Temperature of gas [K]
    similarity_variable : float
        similarity variable as defined in [1]_, [mol/g]

    Returns
    -------
    S : float
        Difference in entropy from 0 K, [J/kg/K]

    Notes
    -----
    Original model is in terms of J/g/K. Note that the model is for predicting
    mass heat capacity, not molar heat capacity like most other methods!
    Integral was computed with SymPy.

    See Also
    --------
    Lastovka_Shaw
    Lastovka_Shaw_integral

    Examples
    --------
    >>> Lastovka_Shaw_integral_over_T(300.0, 0.1333)
    3609.791928945323

    References
    ----------
    .. [1] Lastovka, Vaclav, and John M. Shaw. "Predictive Correlations for
       Ideal Gas Heat Capacities of Pure Hydrocarbons and Petroleum Fractions."
       Fluid Phase Equilibria 356 (October 25, 2013): 338-370.
       doi:10.1016/j.fluid.2013.07.023.


if T <= a7:<EOL><INDENT>y = <NUM_LIT:0.><EOL><DEDENT>else:<EOL><INDENT>y = (T - a7)/(T + a6)<EOL><DEDENT>Cp = R*(a0 + (a1/T**<NUM_LIT:2>)*exp(-a2/T) + a3*y**<NUM_LIT:2> + (a4 - a5/(T-a7)**<NUM_LIT:2> )*y**<NUM_LIT>)<EOL>return Cp<EOL>

r'''Calculates ideal gas heat capacity using the model developed in [1]_.

    The ideal gas heat capacity is given by:

    .. math::
        C_p = R\left(a_0 + (a_1/T^2) \exp(-a_2/T) + a_3 y^2
        + (a_4 - a_5/(T-a_7)^2 )y^j \right)

        y = \frac{T-a_7}{T+a_6} \text{ for } T > a_7 \text{ otherwise } 0

    Parameters
    ----------
    T : float
        Temperature [K]
    a1-a7 : float
        Coefficients

    Returns
    -------
    Cp : float
        Ideal gas heat capacity , [J/mol/K]

    Notes
    -----
    j is set to 8. Analytical integrals are available for this expression.

    Examples
    --------
    >>> TRCCp(300, 4.0, 7.65E5, 720., 3.565, -0.052, -1.55E6, 52., 201.)
    42.06525682312236

    References
    ----------
    .. [1] Kabo, G. J., and G. N. Roganov. Thermodynamics of Organic Compounds
       in the Gas State, Volume II: V. 2. College Station, Tex: CRC Press, 1994.


def TRCCp_integral(T, a0, a1, a2, a3, a4, a5, a6, a7, I=<NUM_LIT:0>):

if T <= a7:<EOL><INDENT>y = <NUM_LIT:0.><EOL><DEDENT>else:<EOL><INDENT>y = (T - a7)/(T + a6)<EOL><DEDENT>y2 = y*y<EOL>y4 = y2*y2<EOL>if T <= a7:<EOL><INDENT>h = <NUM_LIT:0.0><EOL><DEDENT>else:<EOL><INDENT>first = a6 + a7<EOL>second = (<NUM_LIT>*a3 + <NUM_LIT>*a4)*log(<NUM_LIT:1.> - y)<EOL>third = (a3*(<NUM_LIT:1.> + <NUM_LIT:1.>/(<NUM_LIT:1.> - y)) + a4*(<NUM_LIT> + <NUM_LIT:1.>/(<NUM_LIT:1.> - y)))*y<EOL>fourth = a4*(<NUM_LIT>*y2 + <NUM_LIT>/<NUM_LIT>*y*y2 + y4 + <NUM_LIT>*y4*y + <NUM_LIT:1>/<NUM_LIT>*y4*y2)<EOL>fifth = <NUM_LIT:1>/<NUM_LIT>*(a4 - a5/((a6 + a7)**<NUM_LIT:2>))*y4*y2*y<EOL>h = first*(second + third + fourth + fifth)<EOL><DEDENT>return (a0 + a1*exp(-a2/T)/(a2*T) + I/T + h/T)*R*T<EOL>

r'''Integrates ideal gas heat capacity using the model developed in [1]_.
    Best used as a delta only.

    The difference in enthalpy with respect to 0 K is given by:

    .. math::
        \frac{H(T) - H^{ref}}{RT} = a_0 + a_1x(a_2)/(a_2T) + I/T + h(T)/T

        h(T) = (a_5 + a_7)\left[(2a_3 + 8a_4)\ln(1-y)+ \left\{a_3\left(1 +
        \frac{1}{1-y}\right) + a_4\left(7 + \frac{1}{1-y}\right)\right\}y
        + a_4\left\{3y^2 + (5/3)y^3 + y^4 + (3/5)y^5 + (1/3)y^6\right\}
        + (1/7)\left\{a_4 - \frac{a_5}{(a_6+a_7)^2}\right\}y^7\right]

        h(T) = 0 \text{ for } T \le a_7

        y = \frac{T-a_7}{T+a_6} \text{ for } T > a_7 \text{ otherwise } 0

    Parameters
    ----------
    T : float
        Temperature [K]
    a1-a7 : float
        Coefficients
    I : float, optional
        Integral offset

    Returns
    -------
    H-H(0) : float
        Difference in enthalpy from 0 K , [J/mol]

    Notes
    -----
    Analytical integral as provided in [1]_ and verified with numerical
    integration.

    Examples
    --------
    >>> TRCCp_integral(298.15, 4.0, 7.65E5, 720., 3.565, -0.052, -1.55E6, 52.,
    ... 201., 1.2)
    10802.532600592816

    References
    ----------
    .. [1] Kabo, G. J., and G. N. Roganov. Thermodynamics of Organic Compounds
       in the Gas State, Volume II: V. 2. College Station, Tex: CRC Press, 1994.