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

<EOL>if T <= a7:<EOL><INDENT>y = <NUM_LIT:0.><EOL><DEDENT>else:<EOL><INDENT>y = (T - a7)/(T + a6)<EOL><DEDENT>z = T/(T + a6)*(a7 + a6)/a7<EOL>if T <= a7:<EOL><INDENT>s = <NUM_LIT:0.><EOL><DEDENT>else:<EOL><INDENT>a72 = a7*a7<EOL>a62 = a6*a6<EOL>a7_a6 = a7/a6 <EOL>a7_a6_2 = a7_a6*a7_a6<EOL>a7_a6_4 = a7_a6_2*a7_a6_2<EOL>x1 = (a4*a72 - a5)/a62 <EOL>first = (a3 + ((a4*a72 - a5)/a62)*a7_a6_4)*a7_a6_2*log(z)<EOL>second = (a3 + a4)*log((T + a6)/(a6 + a7))<EOL>fourth = -(a3/a6*(a6 + a7) + a5*y**<NUM_LIT:6>/(<NUM_LIT>*a7*(a6 + a7)))*y<EOL>third = sum([(x1*(-a7_a6)**(<NUM_LIT:6>-i) - a4)*y**i/i for i in range(<NUM_LIT:1>, <NUM_LIT:8>)])<EOL>s = first + second + third + fourth<EOL><DEDENT>return R*(J + a0*log(T) + a1/(a2*a2)*(<NUM_LIT:1.> + a2/T)*exp(-a2/T) + s)<EOL>

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

    The difference in ideal-gas entropy with respect to 0 K is given by:

    .. math::
        \frac{S^\circ}{R} = J + a_0\ln T + \frac{a_1}{a_2^2}\left(1
        + \frac{a_2}{T}\right)x(a_2) + s(T)

        s(T) = \left[\left\{a_3 + \left(\frac{a_4 a_7^2 - a_5}{a_6^2}\right)
        \left(\frac{a_7}{a_6}\right)^4\right\}\left(\frac{a_7}{a_6}\right)^2
        \ln z + (a_3 + a_4)\ln\left(\frac{T+a_6}{a_6+a_7}\right)
        +\sum_{i=1}^7 \left\{\left(\frac{a_4 a_7^2 - a_5}{a_6^2}\right)\left(
        \frac{-a_7}{a_6}\right)^{6-i} - a_4\right\}\frac{y^i}{i}
        - \left\{\frac{a_3}{a_6}(a_6 + a_7) + \frac{a_5 y^6}{7a_7(a_6+a_7)}
        \right\}y\right]

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

        z = \frac{T}{T+a_6} \cdot \frac{a_7 + a_6}{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
    J : float, optional
        Integral offset

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

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

    Examples
    --------
    >>> TRCCp_integral_over_T(300, 4.0, 124000, 245, 50.539, -49.469,
    ... 220440000, 560, 78)
    213.80148972435018

    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 Rowlinson_Poling(T, Tc, omega, Cpgm):

Tr = T/Tc<EOL>Cplm = Cpgm+ R*(<NUM_LIT> + <NUM_LIT>/(<NUM_LIT:1.>-Tr) + omega*(<NUM_LIT><EOL>+ <NUM_LIT>*(<NUM_LIT:1>-Tr)**(<NUM_LIT:1>/<NUM_LIT>)/Tr + <NUM_LIT>/(<NUM_LIT:1.>-Tr)))<EOL>return Cplm<EOL>

r'''Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method.

    This equation is not terrible accurate.

    The heat capacity of a liquid is given by:

    .. math::
        \frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{1-T_r} +
        \omega\left[ 4.2775 + \frac{6.3(1-T_r)^{1/3}}{T_r} + \frac{0.4355}{1-T_r}\right]

    Parameters
    ----------
    T : float
        Temperature of fluid [K]
    Tc : float
        Critical temperature of fluid [K]
    omega : float
        Acentric factor for fluid, [-]
    Cpgm : float
        Constant-pressure gas heat capacity, [J/mol/K]

    Returns
    -------
    Cplm : float
        Liquid constant-pressure heat capacitiy, [J/mol/K]

    Notes
    -----
    Poling compared 212 substances, and found error at 298K larger than 10%
    for 18 of them, mostly associating. Of the other 194 compounds, AARD is 2.5%.

    Examples
    --------
    >>> Rowlinson_Poling(350.0, 435.5, 0.203, 91.21)
    143.80194441498296

    References
    ----------
    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.


def Rowlinson_Bondi(T, Tc, omega, Cpgm):

Tr = T/Tc<EOL>Cplm = Cpgm + R*(<NUM_LIT> + <NUM_LIT>/(<NUM_LIT:1.>-Tr) + <NUM_LIT>*omega*(<NUM_LIT><EOL>+ <NUM_LIT>*(<NUM_LIT:1>-Tr)**(<NUM_LIT:1>/<NUM_LIT>)/Tr + <NUM_LIT>/(<NUM_LIT:1.>-Tr)))<EOL>return Cplm<EOL>

r'''Calculate liquid constant-pressure heat capacitiy with the CSP method
    shown in [1]_.

    The heat capacity of a liquid is given by:

    .. math::
        \frac{Cp^L - Cp^{ig}}{R} = 1.45 + 0.45(1-T_r)^{-1} + 0.25\omega
        [17.11 + 25.2(1-T_r)^{1/3}T_r^{-1} + 1.742(1-T_r)^{-1}]

    Parameters
    ----------
    T : float
        Temperature of fluid [K]
    Tc : float
        Critical temperature of fluid [K]
    omega : float
        Acentric factor for fluid, [-]
    Cpgm : float
        Constant-pressure gas heat capacity, [J/mol/K]

    Returns
    -------
    Cplm : float
        Liquid constant-pressure heat capacitiy, [J/mol/K]

    Notes
    -----
    Less accurate than `Rowlinson_Poling`.

    Examples
    --------
    >>> Rowlinson_Bondi(T=373.28, Tc=535.55, omega=0.323, Cpgm=119.342)
    175.39760730048116

    References
    ----------
    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.
    .. [2] Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition.
       Berlin; New York:: Springer, 2010.
    .. [3] J.S. Rowlinson, Liquids and Liquid Mixtures, 2nd Ed.,
       Butterworth, London (1969).


a = similarity_variable<EOL>a11 = -<NUM_LIT><EOL>a12 = <NUM_LIT><EOL>a21 = <NUM_LIT><EOL>a22 = -<NUM_LIT><EOL>a31 = -<NUM_LIT><EOL>a32 = <NUM_LIT><EOL><INDENT>theta = <NUM_LIT><EOL>constant = <NUM_LIT:3>*R*(theta/T)**<NUM_LIT:2>*exp(theta/T)/(exp(theta/T)-<NUM_LIT:1>)**<NUM_LIT:2><EOL><DEDENT>constant = <NUM_LIT><EOL>Cp = (constant*(a11*a + a12*a**<NUM_LIT:2>) + (a21*a + a22*a**<NUM_LIT:2>)*T<EOL>+ (a31*a + a32*a**<NUM_LIT:2>)*T**<NUM_LIT:2>)<EOL>Cp = Cp*<NUM_LIT:1000> <EOL>return Cp<EOL>

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

    .. math::
        C_{p} = 24.5(a_{11}\alpha + a_{12}\alpha^2)+ (a_{21}\alpha
        + a_{22}\alpha^2)T +(a_{31}\alpha + a_{32}\alpha^2)T^2

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

    Returns
    -------
    Cpl : float
        Liquid constant-pressure heat capacitiy, [J/kg/K]

    Notes
    -----
    Many restrictions on its use.

    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!

    a11 = -0.3416; a12 = 2.2671; a21 = 0.1064; a22 = -0.3874l;
    a31 = -9.8231E-05; a32 = 4.182E-04

    Examples
    --------
    >>> Dadgostar_Shaw(355.6, 0.139)
    1802.5291501191516

    References
    ----------
    .. [1] Dadgostar, Nafiseh, and John M. Shaw. "A Predictive Correlation for
       the Constant-Pressure Specific Heat Capacity of Pure and Ill-Defined
       Liquid Hydrocarbons." Fluid Phase Equilibria 313 (January 15, 2012):
       211-226. doi:10.1016/j.fluid.2011.09.015.


a = similarity_variable<EOL>a2 = a*a<EOL>T2 = T*T<EOL>a11 = -<NUM_LIT><EOL>a12 = <NUM_LIT><EOL>a21 = <NUM_LIT><EOL>a22 = -<NUM_LIT><EOL>a31 = -<NUM_LIT><EOL>a32 = <NUM_LIT><EOL>constant = <NUM_LIT><EOL>H = T2*T/<NUM_LIT>*(a2*a32 + a*a31) + T2*<NUM_LIT:0.5>*(a2*a22 + a*a21) + T*constant*(a2*a12 + a*a11)<EOL>return H*<NUM_LIT><EOL>

r'''Calculate the integral of liquid 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
    --------
    Dadgostar_Shaw
    Dadgostar_Shaw_integral_over_T

    Examples
    --------
    >>> Dadgostar_Shaw_integral(300.0, 0.1333)
    238908.15142664989

    References
    ----------
    .. [1] Dadgostar, Nafiseh, and John M. Shaw. "A Predictive Correlation for
       the Constant-Pressure Specific Heat Capacity of Pure and Ill-Defined
       Liquid Hydrocarbons." Fluid Phase Equilibria 313 (January 15, 2012):
       211-226. doi:10.1016/j.fluid.2011.09.015.


a = similarity_variable<EOL>a2 = a*a<EOL>a11 = -<NUM_LIT><EOL>a12 = <NUM_LIT><EOL>a21 = <NUM_LIT><EOL>a22 = -<NUM_LIT><EOL>a31 = -<NUM_LIT><EOL>a32 = <NUM_LIT><EOL>constant = <NUM_LIT><EOL>S = T*T*<NUM_LIT:0.5>*(a2*a32 + a*a31) + T*(a2*a22 + a*a21) + a*constant*(a*a12 + a11)*log(T)<EOL>return S*<NUM_LIT><EOL>

r'''Calculate the integral of liquid 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
    --------
    Dadgostar_Shaw
    Dadgostar_Shaw_integral

    Examples
    --------
    >>> Dadgostar_Shaw_integral_over_T(300.0, 0.1333)
    1201.1409113147927

    References
    ----------
    .. [1] Dadgostar, Nafiseh, and John M. Shaw. "A Predictive Correlation for
       the Constant-Pressure Specific Heat Capacity of Pure and Ill-Defined
       Liquid Hydrocarbons." Fluid Phase Equilibria 313 (January 15, 2012):
       211-226. doi:10.1016/j.fluid.2011.09.015.


def Zabransky_quasi_polynomial(T, Tc, a1, a2, a3, a4, a5, a6):

Tr = T/Tc<EOL>return R*(a1*log(<NUM_LIT:1>-Tr) + a2/(<NUM_LIT:1>-Tr) + a3 + a4*Tr + a5*Tr**<NUM_LIT:2> + a6*Tr**<NUM_LIT:3>)<EOL>

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

    .. math::
        \frac{C}{R}=A_1\ln(1-T_r) + \frac{A_2}{1-T_r}
        + \sum_{j=0}^m A_{j+3} T_r^j

    Parameters
    ----------
    T : float
        Temperature [K]
    Tc : float
        Critical temperature of fluid, [K]
    a1-a6 : float
        Coefficients

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

    Notes
    -----
    Used only for isobaric heat capacities, not saturation heat capacities.
    Designed for reasonable extrapolation behavior caused by using the reduced
    critical temperature. Used by the authors of [1]_ when critical temperature
    was available for the fluid.
    Analytical integrals are available for this expression.

    Examples
    --------
    >>> Zabransky_quasi_polynomial(330, 591.79, -3.12743, 0.0857315, 13.7282, 1.28971, 6.42297, 4.10989)
    165.4728226923247

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


def Zabransky_quasi_polynomial_integral(T, Tc, a1, a2, a3, a4, a5, a6):

Tc2 = Tc*Tc<EOL>Tc3 = Tc2*Tc<EOL>term = T - Tc<EOL>return R*(T*(T*(T*(T*a6/(<NUM_LIT>*Tc3) + a5/(<NUM_LIT>*Tc2)) + a4/(<NUM_LIT>*Tc)) - a1 + a3) <EOL>+ T*a1*log(<NUM_LIT:1.> - T/Tc) - <NUM_LIT:0.5>*Tc*(a1 + a2)*log(term*term))<EOL>

r'''Calculates the integral of liquid heat capacity using the
    quasi-polynomial model developed in [1]_.

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

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

    Notes
    -----
    The analytical integral was derived with SymPy; it is a simple polynomial
    plus some logarithms.

    Examples
    --------
    >>> H2 = Zabransky_quasi_polynomial_integral(300, 591.79, -3.12743,
    ... 0.0857315, 13.7282, 1.28971, 6.42297, 4.10989)
    >>> H1 = Zabransky_quasi_polynomial_integral(200, 591.79, -3.12743,
    ... 0.0857315, 13.7282, 1.28971, 6.42297, 4.10989)
    >>> H2 - H1
    14662.026406892925

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6):

term = T - Tc<EOL>logT = log(T)<EOL>Tc2 = Tc*Tc<EOL>Tc3 = Tc2*Tc<EOL>return R*(a3*logT -a1*polylog2(T/Tc) - a2*(-logT + <NUM_LIT:0.5>*log(term*term))<EOL>+ T*(T*(T*a6/(<NUM_LIT>*Tc3) + a5/(<NUM_LIT>*Tc2)) + a4/Tc))<EOL>

r'''Calculates the integral of liquid heat capacity over T using the
    quasi-polynomial model  developed in [1]_.

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

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

    Notes
    -----
    The analytical integral was derived with Sympy. It requires the
    Polylog(2,x) function, which is unimplemented in SciPy. A very accurate
    numerical approximation was implemented as :obj:`thermo.utils.polylog2`.
    Relatively slow due to the use of that special function.

    Examples
    --------
    >>> S2 = Zabransky_quasi_polynomial_integral_over_T(300, 591.79, -3.12743,
    ... 0.0857315, 13.7282, 1.28971, 6.42297, 4.10989)
    >>> S1 = Zabransky_quasi_polynomial_integral_over_T(200, 591.79, -3.12743,
    ... 0.0857315, 13.7282, 1.28971, 6.42297, 4.10989)
    >>> S2 - S1
    59.16997291893654

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


T = T/<NUM_LIT><EOL>return R*(((a4*T + a3)*T + a2)*T + a1)<EOL>

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

    .. math::
        \frac{C}{R}=\sum_{j=0}^3 A_{j+1} \left(\frac{T}{100}\right)^j

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

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

    Notes
    -----
    Most often form used in [1]_.
    Analytical integrals are available for this expression.

    Examples
    --------
    >>> Zabransky_cubic(298.15, 20.9634, -10.1344, 2.8253, -0.256738)
    75.31462591538556

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


def Zabransky_cubic_integral(T, a1, a2, a3, a4):

T = T/<NUM_LIT><EOL>return <NUM_LIT:100>*R*T*(T*(T*(T*a4*<NUM_LIT> + a3/<NUM_LIT>) + a2*<NUM_LIT:0.5>) + a1)<EOL>

r'''Calculates the integral of liquid heat capacity using the model
    developed in [1]_.

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

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

    Notes
    -----
    The analytical integral was derived with Sympy; it is a simple polynomial.

    Examples
    --------
    >>> Zabransky_cubic_integral(298.15, 20.9634, -10.1344, 2.8253, -0.256738)
    31051.679845520586

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


def Zabransky_cubic_integral_over_T(T, a1, a2, a3, a4):

T = T/<NUM_LIT><EOL>return R*(T*(T*(T*a4/<NUM_LIT:3> + a3/<NUM_LIT:2>) + a2) + a1*log(T))<EOL>

r'''Calculates the integral of liquid heat capacity over T using the model
    developed in [1]_.

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

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

    Notes
    -----
    The analytical integral was derived with Sympy; it is a simple polynomial,
    plus a logarithm

    Examples
    --------
    >>> Zabransky_cubic_integral_over_T(298.15, 20.9634, -10.1344, 2.8253,
    ... -0.256738)
    24.73245695987246

    References
    ----------
    .. [1] Zabransky, M., V. Ruzicka Jr, V. Majer, and Eugene S. Domalski.
       Heat Capacity of Liquids: Critical Review and Recommended Values.
       2 Volume Set. Washington, D.C.: Amer Inst of Physics, 1996.


A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>theta = <NUM_LIT><EOL>C1 = <NUM_LIT><EOL>C2 = -<NUM_LIT><EOL>D1 = <NUM_LIT><EOL>D2 = -<NUM_LIT><EOL>Cp = (<NUM_LIT:3>*(A1*similarity_variable + A2*similarity_variable**<NUM_LIT:2>)*R*(theta/T<EOL>)**<NUM_LIT:2>*exp(theta/T)/(exp(theta/T)-<NUM_LIT:1>)**<NUM_LIT:2><EOL>+ (C1*similarity_variable + C2*similarity_variable**<NUM_LIT:2>)*T<EOL>+ (D1*similarity_variable + D2*similarity_variable**<NUM_LIT:2>)*T**<NUM_LIT:2>)<EOL>Cp = Cp*<NUM_LIT:1000> <EOL>return Cp<EOL>

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

    .. math::
        C_p = 3(A_1\alpha + A_2\alpha^2)R\left(\frac{\theta}{T}\right)^2
        \frac{\exp(\theta/T)}{[\exp(\theta/T)-1]^2}
        + (C_1\alpha + C_2\alpha^2)T + (D_1\alpha + D_2\alpha^2)T^2

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

    Returns
    -------
    Cps : float
        Solid constant-pressure heat capacitiy, [J/kg/K]

    Notes
    -----
    Many restrictions on its use. Trained on data with MW from 12.24 g/mol
    to 402.4 g/mol, C mass fractions from 61.3% to 95.2%,
    H mass fractions from 3.73% to 15.2%, N mass fractions from 0 to 15.4%,
    O mass fractions from 0 to 18.8%, and S mass fractions from 0 to 29.6%.
    Recommended for organic compounds with low mass fractions of hetero-atoms
    and especially when molar mass exceeds 200 g/mol. This model does not show
    and effects of phase transition but should not be used passed the triple
    point.

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

    A1 = 0.013183; A2 = 0.249381; theta = 151.8675; C1 = 0.026526;
    C2 = -0.024942; D1 = 0.000025; D2 = -0.000123.

    Examples
    --------
    >>> Lastovka_solid(300, 0.2139)
    1682.063629222013

    References
    ----------
    .. [1] Laštovka, Václav, Michal Fulem, Mildred Becerra, and John M. Shaw.
       "A Similarity Variable for Estimating the Heat Capacity of Solid Organic
       Compounds: Part II. Application: Heat Capacity Calculation for
       Ill-Defined Organic Solids." Fluid Phase Equilibria 268, no. 1-2
       (June 25, 2008): 134-41. doi:10.1016/j.fluid.2008.03.018.


A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>theta = <NUM_LIT><EOL>C1 = <NUM_LIT><EOL>C2 = -<NUM_LIT><EOL>D1 = <NUM_LIT><EOL>D2 = -<NUM_LIT><EOL>similarity_variable2 = similarity_variable*similarity_variable<EOL>return (T*T*T*(<NUM_LIT>*D1*similarity_variable/<NUM_LIT> <EOL>+ <NUM_LIT>*D2*similarity_variable2/<NUM_LIT>) + T*T*(<NUM_LIT>*C1*similarity_variable <EOL>+ <NUM_LIT>*C2*similarity_variable2)<EOL>+ (<NUM_LIT>*A1*R*similarity_variable*theta<EOL>+ <NUM_LIT>*A2*R*similarity_variable2*theta)/(exp(theta/T) - <NUM_LIT:1.>))<EOL>

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

    Uses a explicit form as derived with Sympy.

    Parameters
    ----------
    T : float
        Temperature of solid [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!

    See Also
    --------
    Lastovka_solid

    Examples
    --------
    >>> Lastovka_solid_integral(300, 0.2139)
    283246.1242170376

    References
    ----------
    .. [1] Laštovka, Václav, Michal Fulem, Mildred Becerra, and John M. Shaw.
       "A Similarity Variable for Estimating the Heat Capacity of Solid Organic
       Compounds: Part II. Application: Heat Capacity Calculation for
       Ill-Defined Organic Solids." Fluid Phase Equilibria 268, no. 1-2
       (June 25, 2008): 134-41. doi:10.1016/j.fluid.2008.03.018.


A1 = <NUM_LIT><EOL>A2 = <NUM_LIT><EOL>theta = <NUM_LIT><EOL>C1 = <NUM_LIT><EOL>C2 = -<NUM_LIT><EOL>D1 = <NUM_LIT><EOL>D2 = -<NUM_LIT><EOL>sim2 = similarity_variable*similarity_variable<EOL>exp_theta_T = exp(theta/T)<EOL>return (-<NUM_LIT>*R*similarity_variable*(A1 + A2*similarity_variable)*log(exp_theta_T - <NUM_LIT:1.>) <EOL>+ T**<NUM_LIT:2>*(<NUM_LIT>*D1*similarity_variable + <NUM_LIT>*D2*sim2)<EOL>+ T*(<NUM_LIT>*C1*similarity_variable + <NUM_LIT>*C2*sim2)<EOL>+ (<NUM_LIT>*A1*R*similarity_variable*theta <EOL>+ <NUM_LIT>*A2*R*sim2*theta)/(T*exp_theta_T - T) <EOL>+ (<NUM_LIT>*A1*R*similarity_variable*theta <EOL>+ <NUM_LIT>*A2*R*sim2*theta)/T)<EOL>

r'''Integrates over T solid constant-pressure heat capacitiy with the
    similarity variable concept and method as shown in [1]_.

    Uses a explicit form as derived with Sympy.

    Parameters
    ----------
    T : float
        Temperature of solid [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!

    See Also
    --------
    Lastovka_solid

    Examples
    --------
    >>> Lastovka_solid_integral_over_T(300, 0.2139)
    1947.553552666818

    References
    ----------
    .. [1] Laštovka, Václav, Michal Fulem, Mildred Becerra, and John M. Shaw.
       "A Similarity Variable for Estimating the Heat Capacity of Solid Organic
       Compounds: Part II. Application: Heat Capacity Calculation for
       Ill-Defined Organic Solids." Fluid Phase Equilibria 268, no. 1-2
       (June 25, 2008): 134-41. doi:10.1016/j.fluid.2008.03.018.


methods = []<EOL>Tmins, Tmaxs = [], []<EOL>if self.CASRN in TRC_gas_data.index:<EOL><INDENT>methods.append(TRCIG)<EOL>_, self.TRCIG_Tmin, self.TRCIG_Tmax, a0, a1, a2, a3, a4, a5, a6, a7, _, _, _ = _TRC_gas_data_values[TRC_gas_data.index.get_loc(self.CASRN)].tolist()<EOL>self.TRCIG_coefs = [a0, a1, a2, a3, a4, a5, a6, a7]<EOL>Tmins.append(self.TRCIG_Tmin); Tmaxs.append(self.TRCIG_Tmax)<EOL><DEDENT>if self.CASRN in Poling_data.index and not np.isnan(Poling_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>_, self.POLING_Tmin, self.POLING_Tmax, a0, a1, a2, a3, a4, Cpg, Cpl = _Poling_data_values[Poling_data.index.get_loc(self.CASRN)].tolist()<EOL>methods.append(POLING)<EOL>self.POLING_coefs = [a0, a1, a2, a3, a4]<EOL>Tmins.append(self.POLING_Tmin); Tmaxs.append(self.POLING_Tmax)<EOL><DEDENT>if self.CASRN in Poling_data.index and not np.isnan(Poling_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(POLING_CONST)<EOL>self.POLING_T = <NUM_LIT><EOL>self.POLING_constant = float(Poling_data.at[self.CASRN, '<STR_LIT>'])<EOL><DEDENT>if self.CASRN in CRC_standard_data.index and not np.isnan(CRC_standard_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(CRCSTD)<EOL>self.CRCSTD_T = <NUM_LIT><EOL>self.CRCSTD_constant = float(CRC_standard_data.at[self.CASRN, '<STR_LIT>'])<EOL><DEDENT>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)<EOL>self.CP_f = coolprop_fluids[self.CASRN]<EOL>Tmins.append(self.CP_f.Tt); Tmaxs.append(self.CP_f.Tc)<EOL><DEDENT>if self.MW and self.similarity_variable:<EOL><INDENT>methods.append(LASTOVKA_SHAW)<EOL><DEDENT>self.all_methods = set(methods)<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`,
        and :obj:`all_methods` 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 == TRCIG:<EOL><INDENT>Cp = TRCCp(T, *self.TRCIG_coefs)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>Cp = PropsSI('<STR_LIT>', '<STR_LIT:T>', T,'<STR_LIT:P>', <NUM_LIT>, self.CASRN)<EOL><DEDENT>elif method == POLING:<EOL><INDENT>Cp = R*(self.POLING_coefs[<NUM_LIT:0>] + self.POLING_coefs[<NUM_LIT:1>]*T<EOL>+ self.POLING_coefs[<NUM_LIT:2>]*T**<NUM_LIT:2> + self.POLING_coefs[<NUM_LIT:3>]*T**<NUM_LIT:3><EOL>+ self.POLING_coefs[<NUM_LIT:4>]*T**<NUM_LIT:4>)<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>Cp = self.POLING_constant<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>Cp = self.CRCSTD_constant<EOL><DEDENT>elif method == LASTOVKA_SHAW:<EOL><INDENT>Cp = Lastovka_Shaw(T, self.similarity_variable)<EOL>Cp = property_mass_to_molar(Cp, self.MW)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>Cp = self.interpolate(T, method)<EOL><DEDENT>return Cp<EOL>

r'''Method to calculate surface tension of a liquid at temperature `T`
        with a given method.

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

        Parameters
        ----------
        T : float
            Temperature at which to calculate heat capacity, [K]
        method : str
            Method name to use

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


def calculate_integral(self, T1, T2, method):

if method == TRCIG:<EOL><INDENT>H2 = TRCCp_integral(T2, *self.TRCIG_coefs)<EOL>H1 = TRCCp_integral(T1, *self.TRCIG_coefs)<EOL>return H2 - H1<EOL><DEDENT>elif method == POLING:<EOL><INDENT>A, B, C, D, E = self.POLING_coefs<EOL>H2 = (((((<NUM_LIT>*E)*T2 + <NUM_LIT>*D)*T2 + C/<NUM_LIT>)*T2 + <NUM_LIT:0.5>*B)*T2 + A)*T2<EOL>H1 = (((((<NUM_LIT>*E)*T1 + <NUM_LIT>*D)*T1 + C/<NUM_LIT>)*T1 + <NUM_LIT:0.5>*B)*T1 + A)*T1<EOL>return R*(H2 - H1)<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>return (T2 - T1)*self.POLING_constant<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return (T2 - T1)*self.CRCSTD_constant<EOL><DEDENT>elif method == LASTOVKA_SHAW:<EOL><INDENT>dH = (Lastovka_Shaw_integral(T2, self.similarity_variable)<EOL>- Lastovka_Shaw_integral(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dH, self.MW)<EOL><DEDENT>elif method in self.tabular_data or method == COOLPROP:<EOL><INDENT>return float(quad(self.calculate, T1, T2, args=(method))[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate the integral of a property with respect to
        temperature, using a specified method. Implements the analytical
        integrals of all available methods except for tabular data.

        Parameters
        ----------
        T1 : float
            Lower limit of integration, [K]
        T2 : float
            Upper limit of integration, [K]
        method : str
            Method for which to find the integral

        Returns
        -------
        integral : float
            Calculated integral of the property over the given range,
            [`units*K`]


def calculate_integral_over_T(self, T1, T2, method):

if method == TRCIG:<EOL><INDENT>S2 = TRCCp_integral_over_T(T2, *self.TRCIG_coefs)<EOL>S1 = TRCCp_integral_over_T(T1, *self.TRCIG_coefs)<EOL>return S2 - S1<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return self.CRCSTD_constant*log(T2/T1)<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>return self.POLING_constant*log(T2/T1)<EOL><DEDENT>elif method == POLING:<EOL><INDENT>A, B, C, D, E = self.POLING_coefs<EOL>S2 = ((((<NUM_LIT>*E)*T2 + D/<NUM_LIT>)*T2 + <NUM_LIT:0.5>*C)*T2 + B)*T2 <EOL>S1 = ((((<NUM_LIT>*E)*T1 + D/<NUM_LIT>)*T1 + <NUM_LIT:0.5>*C)*T1 + B)*T1<EOL>return R*(S2-S1 + A*log(T2/T1))<EOL><DEDENT>elif method == LASTOVKA_SHAW:<EOL><INDENT>dS = (Lastovka_Shaw_integral_over_T(T2, self.similarity_variable)<EOL>- Lastovka_Shaw_integral_over_T(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dS, self.MW)<EOL><DEDENT>elif method in self.tabular_data or method == COOLPROP:<EOL><INDENT>return float(quad(lambda T: self.calculate(T, method)/T, T1, T2)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate the integral of a property over temperature
        with respect to temperature, using a specified method. Implements the
        analytical integrals of all available methods except for tabular data.

        Parameters
        ----------
        T1 : float
            Lower limit of integration, [K]
        T2 : float
            Upper limit of integration, [K]
        method : str
            Method for which to find the integral

        Returns
        -------
        integral : float
            Calculated integral of the property over the given range,
            [`units`]


return Zabransky_quasi_polynomial(T, self.Tc, *self.coeffs)<EOL>

r'''Method to actually calculate heat capacity as a function of
        temperature.

        Parameters
        ----------
        T : float
            Temperature, [K]

        Returns
        -------
        Cp : float
            Liquid heat capacity as T, [J/mol/K]


return (Zabransky_quasi_polynomial_integral(T2, self.Tc, *self.coeffs)<EOL>- Zabransky_quasi_polynomial_integral(T1, self.Tc, *self.coeffs))<EOL>

r'''Method to compute the enthalpy integral of heat capacity from
         `T1` to `T2`.

        Parameters
        ----------
        T1 : float
            Initial temperature, [K]
        T2 : float
            Final temperature, [K]

        Returns
        -------
        dH : float
            Enthalpy difference between `T1` and `T2`, [J/mol]


def calculate_integral_over_T(self, T1, T2):

return (Zabransky_quasi_polynomial_integral_over_T(T2, self.Tc, *self.coeffs)<EOL>- Zabransky_quasi_polynomial_integral_over_T(T1, self.Tc, *self.coeffs))<EOL>

r'''Method to compute the entropy integral of heat capacity from
         `T1` to `T2`.

        Parameters
        ----------
        T1 : float
            Initial temperature, [K]
        T2 : float
            Final temperature, [K]

        Returns
        -------
        dS : float
            Entropy difference between `T1` and `T2`, [J/mol/K]


def add_coeffs(self, Tmin, Tmax, coeffs):

self.n += <NUM_LIT:1><EOL>if not self.Ts:<EOL><INDENT>self.Ts = [Tmin, Tmax]<EOL>self.coeff_sets = [coeffs]<EOL><DEDENT>else:<EOL><INDENT>for ind, T in enumerate(self.Ts):<EOL><INDENT>if Tmin < T:<EOL><INDENT>self.Ts.insert(ind, Tmin) <EOL>self.coeff_sets.insert(ind, coeffs)<EOL>return<EOL><DEDENT><DEDENT>self.Ts.append(Tmax)<EOL>self.coeff_sets.append(coeffs)<EOL><DEDENT>

Called internally during the parsing of the Zabransky database, to
        add coefficients as they are read one per line


<EOL>if self.n == <NUM_LIT:1>:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>for i in range(self.n):<EOL><INDENT>if T <= self.Ts[i+<NUM_LIT:1>]:<EOL><INDENT>return i<EOL><DEDENT><DEDENT>return self.n - <NUM_LIT:1><EOL>

Determines the index at which the coefficients for the current
        temperature are stored in `coeff_sets`.


return Zabransky_cubic(T, *self.coeff_sets[self._coeff_ind_from_T(T)])<EOL>


<EOL>if T2 < T1:<EOL><INDENT>flipped = True<EOL>T1, T2 = T2, T1<EOL><DEDENT>else:<EOL><INDENT>flipped = False<EOL><DEDENT>if self.n == <NUM_LIT:1>:<EOL><INDENT>dH = (Zabransky_cubic_integral(T2, *self.coeff_sets[<NUM_LIT:0>])<EOL>- Zabransky_cubic_integral(T1, *self.coeff_sets[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>ind_T1, ind_T2 = self._coeff_ind_from_T(T1), self._coeff_ind_from_T(T2)<EOL>if ind_T1 == ind_T2:<EOL><INDENT>dH = (Zabransky_cubic_integral(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral(T1, *self.coeff_sets[ind_T1]))<EOL><DEDENT>else:<EOL><INDENT>dH = (Zabransky_cubic_integral(self.Ts[ind_T1], *self.coeff_sets[ind_T1])<EOL>- Zabransky_cubic_integral(T1, *self.coeff_sets[ind_T1]))<EOL>for i in range(ind_T1, ind_T2):<EOL><INDENT>diff =(Zabransky_cubic_integral(self.Ts[i+<NUM_LIT:1>], *self.coeff_sets[i])<EOL>- Zabransky_cubic_integral(self.Ts[i], *self.coeff_sets[i]))<EOL>dH += diff<EOL><DEDENT>end = (Zabransky_cubic_integral(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral(self.Ts[ind_T2], *self.coeff_sets[ind_T2]))<EOL>dH += end<EOL><DEDENT><DEDENT>return -dH if flipped else dH<EOL>

r'''Method to compute the enthalpy integral of heat capacity from
        `T1` to `T2`. Analytically integrates across the piecewise spline
        as necessary.

        Parameters
        ----------
        T1 : float
            Initial temperature, [K]
        T2 : float
            Final temperature, [K]

        Returns
        -------
        dS : float
            Enthalpy difference between `T1` and `T2`, [J/mol/K]


<EOL>if T2 < T1:<EOL><INDENT>flipped = True<EOL>T1, T2 = T2, T1<EOL><DEDENT>else:<EOL><INDENT>flipped = False<EOL><DEDENT>if self.n == <NUM_LIT:1>:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[<NUM_LIT:0>])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>ind_T1, ind_T2 = self._coeff_ind_from_T(T1), self._coeff_ind_from_T(T2)<EOL>if ind_T1 == ind_T2:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[ind_T1]))<EOL><DEDENT>else:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(self.Ts[ind_T1], *self.coeff_sets[ind_T1])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[ind_T1]))<EOL>for i in range(ind_T1, ind_T2):<EOL><INDENT>diff =(Zabransky_cubic_integral_over_T(self.Ts[i+<NUM_LIT:1>], *self.coeff_sets[i])<EOL>- Zabransky_cubic_integral_over_T(self.Ts[i], *self.coeff_sets[i]))<EOL>dS += diff<EOL><DEDENT>end = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral_over_T(self.Ts[ind_T2], *self.coeff_sets[ind_T2]))<EOL>dS += end<EOL><DEDENT><DEDENT>return -dS if flipped else dS<EOL>

r'''Method to compute the entropy integral of heat capacity from
        `T1` to `T2`. Analytically integrates across the piecewise spline
        as necessary.

        Parameters
        ----------
        T1 : float
            Initial temperature, [K]
        T2 : float
            Final temperature, [K]

        Returns
        -------
        dS : float
            Entropy difference between `T1` and `T2`, [J/mol/K]


methods = []<EOL>Tmins, Tmaxs = [], []<EOL>if self.CASRN in zabransky_dict_const_s:<EOL><INDENT>methods.append(ZABRANSKY_SPLINE)<EOL>self.Zabransky_spline = zabransky_dict_const_s[self.CASRN]<EOL><DEDENT>if self.CASRN in zabransky_dict_const_p:<EOL><INDENT>methods.append(ZABRANSKY_QUASIPOLYNOMIAL)<EOL>self.Zabransky_quasipolynomial = zabransky_dict_const_p[self.CASRN]<EOL><DEDENT>if self.CASRN in zabransky_dict_iso_s:<EOL><INDENT>methods.append(ZABRANSKY_SPLINE_C)<EOL>self.Zabransky_spline_iso = zabransky_dict_iso_s[self.CASRN]<EOL><DEDENT>if self.CASRN in zabransky_dict_iso_p:<EOL><INDENT>methods.append(ZABRANSKY_QUASIPOLYNOMIAL_C)<EOL>self.Zabransky_quasipolynomial_iso = zabransky_dict_iso_p[self.CASRN]<EOL><DEDENT>if self.CASRN in Poling_data.index and not np.isnan(Poling_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(POLING_CONST)<EOL>self.POLING_T = <NUM_LIT><EOL>self.POLING_constant = float(Poling_data.at[self.CASRN, '<STR_LIT>'])<EOL><DEDENT>if self.CASRN in CRC_standard_data.index and not np.isnan(CRC_standard_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(CRCSTD)<EOL>self.CRCSTD_T = <NUM_LIT><EOL>self.CRCSTD_constant = float(CRC_standard_data.at[self.CASRN, '<STR_LIT>'])<EOL><DEDENT>if self.CASRN in zabransky_dict_sat_s:<EOL><INDENT>methods.append(ZABRANSKY_SPLINE_SAT)<EOL>self.Zabransky_spline_sat = zabransky_dict_sat_s[self.CASRN]<EOL><DEDENT>if self.CASRN in zabransky_dict_sat_p:<EOL><INDENT>methods.append(ZABRANSKY_QUASIPOLYNOMIAL_SAT)<EOL>self.Zabransky_quasipolynomial_sat = zabransky_dict_sat_p[self.CASRN]<EOL><DEDENT>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 self.Tc and self.omega:<EOL><INDENT>methods.extend([ROWLINSON_POLING, ROWLINSON_BONDI])<EOL><DEDENT>if has_CoolProp and self.CASRN in coolprop_dict:<EOL><INDENT>methods.append(COOLPROP)<EOL>self.CP_f = coolprop_fluids[self.CASRN]<EOL>Tmins.append(self.CP_f.Tt); Tmaxs.append(self.CP_f.Tc)<EOL><DEDENT>if self.MW and self.similarity_variable:<EOL><INDENT>methods.append(DADGOSTAR_SHAW)<EOL><DEDENT>self.all_methods = set(methods)<EOL>if Tmins and Tmaxs:<EOL><INDENT>self.Tmin, self.Tmax = min(Tmins), max(Tmaxs)<EOL><DEDENT>


if method == ZABRANSKY_SPLINE:<EOL><INDENT>return self.Zabransky_spline.calculate(T)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL:<EOL><INDENT>return self.Zabransky_quasipolynomial.calculate(T)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_C:<EOL><INDENT>return self.Zabransky_spline_iso.calculate(T)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_C:<EOL><INDENT>return self.Zabransky_quasipolynomial_iso.calculate(T)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_SAT:<EOL><INDENT>return self.Zabransky_spline_sat.calculate(T)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_SAT:<EOL><INDENT>return self.Zabransky_quasipolynomial_sat.calculate(T)<EOL><DEDENT>elif method == COOLPROP:<EOL><INDENT>return CoolProp_T_dependent_property(T, self.CASRN , '<STR_LIT>', '<STR_LIT:l>')<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>return self.POLING_constant<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return self.CRCSTD_constant<EOL><DEDENT>elif method == ROWLINSON_POLING:<EOL><INDENT>Cpgm = self.Cpgm(T) if hasattr(self.Cpgm, '<STR_LIT>') else self.Cpgm<EOL>return Rowlinson_Poling(T, self.Tc, self.omega, Cpgm)<EOL><DEDENT>elif method == ROWLINSON_BONDI:<EOL><INDENT>Cpgm = self.Cpgm(T) if hasattr(self.Cpgm, '<STR_LIT>') else self.Cpgm<EOL>return Rowlinson_Bondi(T, self.Tc, self.omega, Cpgm)<EOL><DEDENT>elif method == DADGOSTAR_SHAW:<EOL><INDENT>Cp = Dadgostar_Shaw(T, self.similarity_variable)<EOL>return property_mass_to_molar(Cp, self.MW)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>return self.interpolate(T, method)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate heat capacity of a liquid at temperature `T`
        with a given method.

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

        Parameters
        ----------
        T : float
            Temperature at which to calculate heat capacity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        Cp : float
            Heat capacity of the liquid at T, [J/mol/K]


if method == ZABRANSKY_SPLINE:<EOL><INDENT>return self.Zabransky_spline.calculate_integral(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_C:<EOL><INDENT>return self.Zabransky_spline_iso.calculate_integral(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_SAT:<EOL><INDENT>return self.Zabransky_spline_sat.calculate_integral(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL:<EOL><INDENT>return self.Zabransky_quasipolynomial.calculate_integral(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_C:<EOL><INDENT>return self.Zabransky_quasipolynomial_iso.calculate_integral(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_SAT:<EOL><INDENT>return self.Zabransky_quasipolynomial_sat.calculate_integral(T1, T2)<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>return (T2 - T1)*self.POLING_constant<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return (T2 - T1)*self.CRCSTD_constant<EOL><DEDENT>elif method == DADGOSTAR_SHAW:<EOL><INDENT>dH = (Dadgostar_Shaw_integral(T2, self.similarity_variable)<EOL>- Dadgostar_Shaw_integral(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dH, self.MW)<EOL><DEDENT>elif method in self.tabular_data or method == COOLPROP or method in [ROWLINSON_POLING, ROWLINSON_BONDI]:<EOL><INDENT>return float(quad(self.calculate, T1, T2, args=(method))[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate the integral of a property with respect to
        temperature, using a specified method.  Implements the
        analytical integrals of all available methods except for tabular data,
        the case of multiple coefficient sets needed to encompass the temperature
        range of any of the ZABRANSKY methods, and the CSP methods using the
        vapor phase properties.

        Parameters
        ----------
        T1 : float
            Lower limit of integration, [K]
        T2 : float
            Upper limit of integration, [K]
        method : str
            Method for which to find the integral

        Returns
        -------
        integral : float
            Calculated integral of the property over the given range,
            [`units*K`]


if method == ZABRANSKY_SPLINE:<EOL><INDENT>return self.Zabransky_spline.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_C:<EOL><INDENT>return self.Zabransky_spline_iso.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_SPLINE_SAT:<EOL><INDENT>return self.Zabransky_spline_sat.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL:<EOL><INDENT>return self.Zabransky_quasipolynomial.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_C:<EOL><INDENT>return self.Zabransky_quasipolynomial_iso.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == ZABRANSKY_QUASIPOLYNOMIAL_SAT:<EOL><INDENT>return self.Zabransky_quasipolynomial_sat.calculate_integral_over_T(T1, T2)<EOL><DEDENT>elif method == POLING_CONST:<EOL><INDENT>return self.POLING_constant*log(T2/T1)<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return self.CRCSTD_constant*log(T2/T1)<EOL><DEDENT>elif method == DADGOSTAR_SHAW:<EOL><INDENT>dS = (Dadgostar_Shaw_integral_over_T(T2, self.similarity_variable)<EOL>- Dadgostar_Shaw_integral_over_T(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dS, self.MW)<EOL><DEDENT>elif method in self.tabular_data or method == COOLPROP or method in [ROWLINSON_POLING, ROWLINSON_BONDI]:<EOL><INDENT>return float(quad(lambda T: self.calculate(T, method)/T, T1, T2)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate the integral of a property over temperature
        with respect to temperature, using a specified method.   Implements the
        analytical integrals of all available methods except for tabular data,
        the case of multiple coefficient sets needed to encompass the temperature
        range of any of the ZABRANSKY methods, and the CSP methods using the
        vapor phase properties.

        Parameters
        ----------
        T1 : float
            Lower limit of integration, [K]
        T2 : float
            Upper limit of integration, [K]
        method : str
            Method for which to find the integral

        Returns
        -------
        integral : float
            Calculated integral of the property over the given range,
            [`units`]


methods = []<EOL>Tmins, Tmaxs = [], []<EOL>if self.CASRN and self.CASRN in _PerryI and '<STR_LIT:c>' in _PerryI[self.CASRN]:<EOL><INDENT>self.PERRY151_Tmin = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>'] if _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>'] else <NUM_LIT:0><EOL>self.PERRY151_Tmax = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>'] if _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>'] else <NUM_LIT><EOL>self.PERRY151_const = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>']<EOL>self.PERRY151_lin = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>']<EOL>self.PERRY151_quad = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>']<EOL>self.PERRY151_quadinv = _PerryI[self.CASRN]['<STR_LIT:c>']['<STR_LIT>']<EOL>methods.append(PERRY151)<EOL>Tmins.append(self.PERRY151_Tmin); Tmaxs.append(self.PERRY151_Tmax)<EOL><DEDENT>if self.CASRN in CRC_standard_data.index and not np.isnan(CRC_standard_data.at[self.CASRN, '<STR_LIT>']):<EOL><INDENT>self.CRCSTD_Cp = float(CRC_standard_data.at[self.CASRN, '<STR_LIT>'])<EOL>methods.append(CRCSTD)<EOL><DEDENT>if self.MW and self.similarity_variable:<EOL><INDENT>methods.append(LASTOVKA_S)<EOL>Tmins.append(<NUM_LIT:1.0>); Tmaxs.append(<NUM_LIT>)<EOL><DEDENT>self.all_methods = set(methods)<EOL>if Tmins and Tmaxs:<EOL><INDENT>self.Tmin, self.Tmax = min(Tmins), max(Tmaxs)<EOL><DEDENT>


if method == PERRY151:<EOL><INDENT>Cp = (self.PERRY151_const + self.PERRY151_lin*T<EOL>+ self.PERRY151_quadinv/T**<NUM_LIT:2> + self.PERRY151_quad*T**<NUM_LIT:2>)*calorie<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>Cp = self.CRCSTD_Cp<EOL><DEDENT>elif method == LASTOVKA_S:<EOL><INDENT>Cp = Lastovka_solid(T, self.similarity_variable)<EOL>Cp = property_mass_to_molar(Cp, self.MW)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>Cp = self.interpolate(T, method)<EOL><DEDENT>return Cp<EOL>

r'''Method to calculate heat capacity of a solid at temperature `T`
        with a given method.

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

        Parameters
        ----------
        T : float
            Temperature at which to calculate heat capacity, [K]
        method : str
            Name of the method to use

        Returns
        -------
        Cp : float
            Heat capacity of the solid at T, [J/mol/K]


if method == PERRY151:<EOL><INDENT>H2 = (self.PERRY151_const*T2 + <NUM_LIT:0.5>*self.PERRY151_lin*T2**<NUM_LIT:2> <EOL>- self.PERRY151_quadinv/T2 + self.PERRY151_quad*T2**<NUM_LIT:3>/<NUM_LIT>)<EOL>H1 = (self.PERRY151_const*T1 + <NUM_LIT:0.5>*self.PERRY151_lin*T1**<NUM_LIT:2> <EOL>- self.PERRY151_quadinv/T1 + self.PERRY151_quad*T1**<NUM_LIT:3>/<NUM_LIT>)<EOL>return (H2-H1)*calorie<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>return (T2-T1)*self.CRCSTD_Cp<EOL><DEDENT>elif method == LASTOVKA_S:<EOL><INDENT>dH = (Lastovka_solid_integral(T2, self.similarity_variable)<EOL>- Lastovka_solid_integral(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dH, self.MW)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>return float(quad(self.calculate, T1, T2, args=(method))[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>


if method == PERRY151:<EOL><INDENT>S2 = (self.PERRY151_const*log(T2) + self.PERRY151_lin*T2 <EOL>- self.PERRY151_quadinv/(<NUM_LIT>*T2**<NUM_LIT:2>) + <NUM_LIT:0.5>*self.PERRY151_quad*T2**<NUM_LIT:2>)<EOL>S1 = (self.PERRY151_const*log(T1) + self.PERRY151_lin*T1<EOL>- self.PERRY151_quadinv/(<NUM_LIT>*T1**<NUM_LIT:2>) + <NUM_LIT:0.5>*self.PERRY151_quad*T1**<NUM_LIT:2>)<EOL>return (S2 - S1)*calorie<EOL><DEDENT>elif method == CRCSTD:<EOL><INDENT>S2 = self.CRCSTD_Cp*log(T2)<EOL>S1 = self.CRCSTD_Cp*log(T1)<EOL>return (S2 - S1)<EOL><DEDENT>elif method == LASTOVKA_S:<EOL><INDENT>dS = (Lastovka_solid_integral_over_T(T2, self.similarity_variable)<EOL>- Lastovka_solid_integral_over_T(T1, self.similarity_variable))<EOL>return property_mass_to_molar(dS, self.MW)<EOL><DEDENT>elif method in self.tabular_data:<EOL><INDENT>return float(quad(lambda T: self.calculate(T, method)/T, T1, T2)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>


methods = [SIMPLE]        <EOL>if len(self.CASs) > <NUM_LIT:1> and '<STR_LIT>' in self.CASs:<EOL><INDENT>wCASs = [i for i in self.CASs if i != '<STR_LIT>'] <EOL>if all([i in _Laliberte_Heat_Capacity_ParametersDict for i in wCASs]):<EOL><INDENT>methods.append(LALIBERTE)<EOL>self.wCASs = wCASs<EOL>self.index_w = self.CASs.index('<STR_LIT>')<EOL><DEDENT><DEDENT>self.all_methods = set(methods)<EOL>

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>Cplms = [i(T) for i in self.HeatCapacityLiquids]<EOL>return mixing_simple(zs, Cplms)<EOL><DEDENT>elif method == LALIBERTE:<EOL><INDENT>ws = list(ws) ; ws.pop(self.index_w)<EOL>Cpl = Laliberte_heat_capacity(T, ws, self.wCASs)<EOL>MW = mixing_simple(zs, self.MWs)<EOL>return property_mass_to_molar(Cpl, MW)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate heat capacity 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
        -------
        Cplm : float
            Molar heat capacity of the liquid mixture at the given conditions,
            [J/mol]


methods = [SIMPLE]        <EOL>self.all_methods = set(methods)<EOL>


if method == SIMPLE:<EOL><INDENT>Cpsms = [i(T) for i in self.HeatCapacitySolids]<EOL>return mixing_simple(zs, Cpsms)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate heat capacity of a solid 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
        -------
        Cpsm : float
            Molar heat capacity of the solid mixture at the given conditions, [J/mol]


if method == SIMPLE:<EOL><INDENT>Cpgms = [i(T) for i in self.HeatCapacityGases]<EOL>return mixing_simple(zs, Cpgms)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>

r'''Method to calculate heat capacity 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
        -------
        Cpgm : float
            Molar heat capacity of the gas mixture at the given conditions,
            [J/mol]


def Stockmayer(Tm=None, Tb=None, Tc=None, Zc=None, omega=None,<EOL>CASRN='<STR_LIT>', AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in MagalhaesLJ_data.index:<EOL><INDENT>methods.append(MAGALHAES)<EOL><DEDENT>if Tc and omega:<EOL><INDENT>methods.append(TEEGOTOSTEWARD2)<EOL><DEDENT>if Tc:<EOL><INDENT>methods.append(FLYNN)<EOL>methods.append(BSLC)<EOL>methods.append(TEEGOTOSTEWARD1)<EOL><DEDENT>if Tb:<EOL><INDENT>methods.append(BSLB)<EOL><DEDENT>if Tm:<EOL><INDENT>methods.append(BSLM)<EOL><DEDENT>if Tc and Zc:<EOL><INDENT>methods.append(STIELTHODOS)<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 == FLYNN:<EOL><INDENT>epsilon = epsilon_Flynn(Tc)<EOL><DEDENT>elif Method == BSLC:<EOL><INDENT>epsilon = epsilon_Bird_Stewart_Lightfoot_critical(Tc)<EOL><DEDENT>elif Method == BSLB:<EOL><INDENT>epsilon = epsilon_Bird_Stewart_Lightfoot_boiling(Tb)<EOL><DEDENT>elif Method == BSLM:<EOL><INDENT>epsilon = epsilon_Bird_Stewart_Lightfoot_melting(Tm)<EOL><DEDENT>elif Method == STIELTHODOS:<EOL><INDENT>epsilon = epsilon_Stiel_Thodos(Tc, Zc)<EOL><DEDENT>elif Method == TEEGOTOSTEWARD1:<EOL><INDENT>epsilon = epsilon_Tee_Gotoh_Steward_1(Tc)<EOL><DEDENT>elif Method == TEEGOTOSTEWARD2:<EOL><INDENT>epsilon = epsilon_Tee_Gotoh_Steward_2(Tc, omega)<EOL><DEDENT>elif Method == MAGALHAES:<EOL><INDENT>epsilon = float(MagalhaesLJ_data.at[CASRN, "<STR_LIT>"])<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>epsilon = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return epsilon<EOL>

r'''This function handles the retrieval or calculation a chemical's
    Stockmayer parameter. Values are available from one source with lookup
    based on CASRNs, or can be estimated from 7 CSP methods.
    Will automatically select a data source to use if no Method is provided;
    returns None if the data is not available.

    Prefered sources are 'Magalhães, Lito, Da Silva, and Silva (2013)' for
    common chemicals which had valies listed in that source, and the CSP method
    `Tee, Gotoh, and Stewart CSP with Tc, omega (1966)` for chemicals which
    don't.

    Examples
    --------
    >>> Stockmayer(CASRN='64-17-5')
    1291.41

    Parameters
    ----------
    Tm : float, optional
        Melting temperature of fluid [K]
    Tb : float, optional
        Boiling temperature of fluid [K]
    Tc : float, optional
        Critical temperature, [K]
    Zc : float, optional
        Critical compressibility, [-]
    omega : float, optional
        Acentric factor of compound, [-]
    CASRN : string, optional
        CASRN [-]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain epsilon with the given
        inputs

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

    Notes
    -----
    These values are somewhat rough, as they attempt to pigeonhole a chemical
    into L-J behavior.

    The tabulated data is from [2]_, for 322 chemicals.

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006
    .. [2] Magalhães, Ana L., Patrícia F. Lito, Francisco A. Da Silva, and
       Carlos M. Silva. "Simple and Accurate Correlations for Diffusion
       Coefficients of Solutes in Liquids and Supercritical Fluids over Wide
       Ranges of Temperature and Density." The Journal of Supercritical Fluids
       76 (April 2013): 94-114. doi:10.1016/j.supflu.2013.02.002.


def molecular_diameter(Tc=None, Pc=None, Vc=None, Zc=None, omega=None,<EOL>Vm=None, Vb=None, CASRN='<STR_LIT>', AvailableMethods=False, Method=None):

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in MagalhaesLJ_data.index:<EOL><INDENT>methods.append(MAGALHAES)<EOL><DEDENT>if Tc and Pc and omega:<EOL><INDENT>methods.append(TEEGOTOSTEWARD4)<EOL><DEDENT>if Tc and Pc:<EOL><INDENT>methods.append(SILVALIUMACEDO)<EOL>methods.append(BSLC2)<EOL>methods.append(TEEGOTOSTEWARD3)<EOL><DEDENT>if Vc and Zc:<EOL><INDENT>methods.append(STIELTHODOSMD)<EOL><DEDENT>if Vc:<EOL><INDENT>methods.append(FLYNN)<EOL>methods.append(BSLC1)<EOL><DEDENT>if Vb:<EOL><INDENT>methods.append(BSLB)<EOL><DEDENT>if Vm:<EOL><INDENT>methods.append(BSLM)<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 == FLYNN:<EOL><INDENT>sigma = sigma_Flynn(Vc)<EOL><DEDENT>elif Method == BSLC1:<EOL><INDENT>sigma = sigma_Bird_Stewart_Lightfoot_critical_1(Vc)<EOL><DEDENT>elif Method == BSLC2:<EOL><INDENT>sigma = sigma_Bird_Stewart_Lightfoot_critical_2(Tc, Pc)<EOL><DEDENT>elif Method == TEEGOTOSTEWARD3:<EOL><INDENT>sigma = sigma_Tee_Gotoh_Steward_1(Tc, Pc)<EOL><DEDENT>elif Method == SILVALIUMACEDO:<EOL><INDENT>sigma = sigma_Silva_Liu_Macedo(Tc, Pc)<EOL><DEDENT>elif Method == BSLB:<EOL><INDENT>sigma = sigma_Bird_Stewart_Lightfoot_boiling(Vb)<EOL><DEDENT>elif Method == BSLM:<EOL><INDENT>sigma = sigma_Bird_Stewart_Lightfoot_melting(Vm)<EOL><DEDENT>elif Method == STIELTHODOSMD:<EOL><INDENT>sigma = sigma_Stiel_Thodos(Vc, Zc)<EOL><DEDENT>elif Method == TEEGOTOSTEWARD4:<EOL><INDENT>sigma = sigma_Tee_Gotoh_Steward_2(Tc, Pc, omega)<EOL><DEDENT>elif Method == MAGALHAES:<EOL><INDENT>sigma = float(MagalhaesLJ_data.at[CASRN, "<STR_LIT>"])<EOL><DEDENT>elif Method == NONE:<EOL><INDENT>sigma = None<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return sigma<EOL>

r'''This function handles the retrieval or calculation a chemical's
    L-J molecular diameter. Values are available from one source with lookup
    based on CASRNs, or can be estimated from 9 CSP methods.
    Will automatically select a data source to use if no Method is provided;
    returns None if the data is not available.

    Prefered sources are 'Magalhães, Lito, Da Silva, and Silva (2013)' for
    common chemicals which had valies listed in that source, and the CSP method
    `Tee, Gotoh, and Stewart CSP with Tc, Pc, omega (1966)` for chemicals which
    don't.

    Examples
    --------
    >>> molecular_diameter(CASRN='64-17-5')
    4.23738

    Parameters
    ----------
    Tc : float, optional
        Critical temperature, [K]
    Pc : float, optional
        Critical pressure, [Pa]
    Vc : float, optional
        Critical volume, [m^3/mol]
    Zc : float, optional
        Critical compressibility, [-]
    omega : float, optional
        Acentric factor of compound, [-]
    Vm : float, optional
        Molar volume of liquid at the melting point of the fluid [K]
    Vb : float, optional
        Molar volume of liquid at the boiling point of the fluid [K]
    CASRN : string, optional
        CASRN [-]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain epsilon with the given
        inputs

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

    Notes
    -----
    These values are somewhat rough, as they attempt to pigeonhole a chemical
    into L-J behavior.

    The tabulated data is from [2]_, for 322 chemicals.

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006
    .. [2] Magalhães, Ana L., Patrícia F. Lito, Francisco A. Da Silva, and
       Carlos M. Silva. "Simple and Accurate Correlations for Diffusion
       Coefficients of Solutes in Liquids and Supercritical Fluids over Wide
       Ranges of Temperature and Density." The Journal of Supercritical Fluids
       76 (April 2013): 94-114. doi:10.1016/j.supflu.2013.02.002.


Vc = Vc*<NUM_LIT>  <EOL>sigma = <NUM_LIT>*(Vc**(<NUM_LIT:1>/<NUM_LIT>))**<NUM_LIT><EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical volume. CSP method by [1]_ as reported in [2]_.

    .. math::
        \sigma = 0.561(V_c^{1/3})^{5/4}

    Parameters
    ----------
    Vc : float
        Critical volume of fluid [m^3/mol]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Vc is originally in units of mL/mol.

    Examples
    --------
    >>> sigma_Flynn(0.000268)
    5.2506948422196285

    References
    ----------
    .. [1] Flynn, L.W., M.S. thesis, Northwestern Univ., Evanston, Ill. (1960).
    .. [2] Stiel, L. I., and George Thodos. "Lennard-Jones Force Constants
       Predicted from Critical Properties." Journal of Chemical & Engineering
       Data 7, no. 2 (April 1, 1962): 234-36. doi:10.1021/je60013a023


Pc = Pc/<NUM_LIT><EOL>sigma = <NUM_LIT>*(Tc/Pc)**(<NUM_LIT:1>/<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical temperature and pressure. CSP method by [1]_.

    .. math::
        \sigma = 2.44(T_c/P_c)^{1/3}

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    Pc : float
        Critical pressure of fluid [Pa]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Original units of critical pressure are atmospheres.

    Examples
    --------
    >>> sigma_Bird_Stewart_Lightfoot_critical_2(560.1, 4550000)
    5.658657684653222

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


Vc = Vc*<NUM_LIT>  <EOL>sigma = <NUM_LIT>*Vc**(<NUM_LIT:1>/<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical volume. CSP method by [1]_.

    .. math::
        \sigma = 0.841 V_c^{1/3}

    Parameters
    ----------
    Vc : float
        Critical volume of fluid [m^3/mol]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Original units of Vc are mL/mol.

    Examples
    --------
    >>> sigma_Bird_Stewart_Lightfoot_critical_1(0.000268)
    5.422184116631474

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


Vb = Vb*<NUM_LIT><EOL>sigma = <NUM_LIT>*Vb**(<NUM_LIT:1>/<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses molar volume of liquid at boiling. CSP method by [1]_.

    .. math::
        \sigma = 1.166V_{b,liq}^{1/3}

    Parameters
    ----------
    Vb : float
        Boiling molar volume of liquid [m^3/mol]

    Returns
    -------
    sigma : float
        Lennard-Jones collision integral, [Angstrom]

    Notes
    -----
    Original units of Vb are mL/mol.

    Examples
    --------
    >>> sigma_Bird_Stewart_Lightfoot_boiling(0.0001015)
    5.439018856944655

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


Vm = Vm*<NUM_LIT><EOL>sigma = <NUM_LIT>*Vm**(<NUM_LIT:1>/<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses molar volume of a liquid at its melting point. CSP method by [1]_.

    .. math::
        \sigma = 1.222 V_{m,sol}^{1/3}

    Parameters
    ----------
    Vm : float
        Melting molar volume of a liquid at its melting point [m^3/mol]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Original units of Vm are mL/mol.

    Examples
    --------
    >>> sigma_Bird_Stewart_Lightfoot_melting(8.8e-05)
    5.435407341351406

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


Vc = Vc*<NUM_LIT><EOL>sigma = <NUM_LIT>*Vc**(<NUM_LIT:1>/<NUM_LIT>)*Zc**(-<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical volume and compressibility. CSP method by [1]_.

    .. math::
        \sigma = 0.1866 V_c^{1/3} Z_c^{-6/5}

    Parameters
    ----------
    Vc : float
        Critical volume of fluid [m^3/mol]
    Zc : float
        Critical compressibility of fluid, [-]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Vc is originally in units of mL/mol.

    Examples
    --------
    Monofluorobenzene

    >>> sigma_Stiel_Thodos(0.000271, 0.265)
    5.94300853971033

    References
    ----------
    .. [1] Stiel, L. I., and George Thodos. "Lennard-Jones Force Constants
       Predicted from Critical Properties." Journal of Chemical & Engineering
       Data 7, no. 2 (April 1, 1962): 234-36. doi:10.1021/je60013a023


r'''Calculates Lennard-Jones molecular diameter.
    Uses critical temperature and pressure. CSP method by [1]_.

    .. math::
        \sigma = 2.3647 \left(\frac{T_c}{P_c}\right)^{1/3}

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    Pc : float
        Critical pressure of fluid [Pa]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Original units of Pc are atm. Further regressions with other parameters
    were performed in [1]_ but are not included here, except for
    `sigma_Tee_Gotoh_Steward_2`.

    Examples
    --------
    >>> sigma_Tee_Gotoh_Steward_1(560.1, 4550000)
    5.48402779790962

    References
    ----------
    .. [1] Tee, L. S., Sukehiro Gotoh, and W. E. Stewart. "Molecular
       Parameters for Normal Fluids. Lennard-Jones 12-6 Potential." Industrial
       & Engineering Chemistry Fundamentals 5, no. 3 (August 1, 1966): 356-63.
       doi:10.1021/i160019a011


def sigma_Tee_Gotoh_Steward_2(Tc, Pc, omega):

Pc = Pc/<NUM_LIT><EOL>sigma = (<NUM_LIT>-<NUM_LIT>*omega)*(Tc/Pc)**(<NUM_LIT:1>/<NUM_LIT>)<EOL>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical temperature, pressure, and acentric factor. CSP method by
    [1]_.

    .. math::
        \sigma = (2.3551 - 0.0874\omega)\left(\frac{T_c}{P_c}\right)^{1/3}

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    Pc : float
        Critical pressure of fluid [Pa]
    omega : float
        Acentric factor for fluid, [-]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Original units of Pc are atm. Further regressions with other parameters
    were performed in [1]_ but are not included here, except for
    `sigma_Tee_Gotoh_Steward_1`.

    Examples
    --------
    >>> sigma_Tee_Gotoh_Steward_2(560.1, 4550000, 0.245)
    5.412104867264477

    References
    ----------
    .. [1] Tee, L. S., Sukehiro Gotoh, and W. E. Stewart. "Molecular Parameters
       for Normal Fluids. Lennard-Jones 12-6 Potential." Industrial
       & Engineering Chemistry Fundamentals 5, no. 3 (August 1, 1966): 356-63.
       doi:10.1021/i160019a011


Pc = Pc/<NUM_LIT>  <EOL>term = <NUM_LIT> + <NUM_LIT>*(Tc/Pc) - <NUM_LIT> * (Tc/Pc)**<NUM_LIT:2><EOL>if term < <NUM_LIT:0>:<EOL><INDENT>sigma = None<EOL><DEDENT>else:<EOL><INDENT>sigma = (term)**(<NUM_LIT:1>/<NUM_LIT>)<EOL><DEDENT>return sigma<EOL>

r'''Calculates Lennard-Jones molecular diameter.
    Uses critical temperature and pressure. CSP method by [1]_.

    .. math::
        \sigma_{LJ}^3 = 0.17791 + 11.779 \left( \frac{T_c}{P_c}\right)
        - 0.049029\left( \frac{T_c}{P_c}\right)^2

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    Pc : float
        Critical pressure of fluid [Pa]

    Returns
    -------
    sigma : float
        Lennard-Jones molecular diameter, [Angstrom]

    Notes
    -----
    Pc is originally in bar. An excellent paper. None is
    returned if the polynomial returns a negative number, as in the case of
    1029.13 K and 3.83 bar.

    Examples
    --------
    >>> sigma_Silva_Liu_Macedo(560.1, 4550000)
    5.164483998730177

    References
    ----------
    .. [1] Silva, Carlos M., Hongqin Liu, and Eugenia A. Macedo. "Models for
       Self-Diffusion Coefficients of Dense Fluids, Including Hydrogen-Bonding
       Substances." Chemical Engineering Science 53, no. 13 (July 1, 1998):
       2423-29. doi:10.1016/S0009-2509(98)00037-2


epsilon_k = <NUM_LIT>*Tc**(<NUM_LIT:5>/<NUM_LIT>)<EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses critical temperature. CSP method by [1]_ as reported in [2]_.

    .. math::
        \epsilon/k = 1.77 T_c^{5/6}

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----

    Examples
    --------
    >>> epsilon_Flynn(560.1)
    345.2984087011443

    References
    ----------
    .. [1] Flynn, L.W., M.S. thesis, Northwestern Univ., Evanston, Ill. (1960).
    .. [2] Stiel, L. I., and George Thodos. "Lennard-Jones Force Constants
       Predicted from Critical Properties." Journal of Chemical & Engineering
       Data 7, no. 2 (April 1, 1962): 234-36. doi:10.1021/je60013a023


epsilon_k = <NUM_LIT>*Tc<EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses critical temperature. CSP method by [1]_.

    .. math::
        \epsilon/k = 0.77T_c

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----

    Examples
    --------
    >>> epsilon_Bird_Stewart_Lightfoot_critical(560.1)
    431.27700000000004

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


epsilon_k = <NUM_LIT>*Tb<EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses boiling temperature. CSP method by [1]_.

    .. math::
        \epsilon/k = 1.15 T_b

    Parameters
    ----------
    Tb : float
        Boiling temperature [K]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----

    Examples
    --------
    >>> epsilon_Bird_Stewart_Lightfoot_boiling(357.85)
    411.5275

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


epsilon_k = <NUM_LIT>*Tm<EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses melting temperature. CSP method by [1]_.

    .. math::
        \epsilon/k = 1.92T_m

    Parameters
    ----------
    Tm : float
        Melting temperature [K]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----

    Examples
    --------
    >>> epsilon_Bird_Stewart_Lightfoot_melting(231.15)
    443.808

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


epsilon_k = <NUM_LIT>*Tc*Zc**<NUM_LIT><EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses Critical temperature and critical compressibility. CSP method by [1]_.

    .. math::
        \epsilon/k = 65.3 T_c Z_c^{3.6}

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    Zc : float
        Critical compressibility of fluid, [-]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----

    Examples
    --------
    Fluorobenzene

    >>> epsilon_Stiel_Thodos(358.5, 0.265)
    196.3755830305783

    References
    ----------
    .. [1] Stiel, L. I., and George Thodos. "Lennard-Jones Force Constants
       Predicted from Critical Properties." Journal of Chemical & Engineering
       Data 7, no. 2 (April 1, 1962): 234-36. doi:10.1021/je60013a023


r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses Critical temperature. CSP method by [1]_.

    .. math::
        \epsilon/k = 0.7740T_c

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----
    Further regressions with other parameters were performed in [1]_ but are
    not included here, except for `epsilon_Tee_Gotoh_Steward_2`.

    Examples
    --------
    >>> epsilon_Tee_Gotoh_Steward_1(560.1)
    433.5174

    References
    ----------
    .. [1] Tee, L. S., Sukehiro Gotoh, and W. E. Stewart. "Molecular Parameters
       for Normal Fluids. Lennard-Jones 12-6 Potential." Industrial &
       Engineering Chemistry Fundamentals 5, no. 3 (August 1, 1966): 356-63.
       doi:10.1021/i160019a011


epsilon_k = (<NUM_LIT> + <NUM_LIT>*omega)*Tc<EOL>return epsilon_k<EOL>

r'''Calculates Lennard-Jones depth of potential-energy minimum.
    Uses critical temperature and acentric factor. CSP method by [1]_.

    .. math::
        \epsilon/k = (0.7915 + 0.1693 \omega)T_c

    Parameters
    ----------
    Tc : float
        Critical temperature of fluid [K]
    omega : float
        Acentric factor for fluid, [-]

    Returns
    -------
    epsilon_k : float
        Lennard-Jones depth of potential-energy minimum over k, [K]

    Notes
    -----
    Further regressions with other parameters were performed in [1]_ but are
    not included here, except for `epsilon_Tee_Gotoh_Steward_1`.

    Examples
    --------
    >>> epsilon_Tee_Gotoh_Steward_2(560.1, 0.245)
    466.55125785

    References
    ----------
    .. [1] Tee, L. S., Sukehiro Gotoh, and W. E. Stewart. "Molecular Parameters
       for Normal Fluids. Lennard-Jones 12-6 Potential." Industrial &
       Engineering Chemistry Fundamentals 5, no. 3 (August 1, 1966): 356-63.
       doi:10.1021/i160019a011


def collision_integral_Neufeld_Janzen_Aziz(Tstar, l=<NUM_LIT:1>, s=<NUM_LIT:1>):

if (l, s) not in Neufeld_collision:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>A, B, C, D, E, F, G, H, R, S, W, P = Neufeld_collision[(l, s)]<EOL>omega = A/Tstar**B + C/exp(D*Tstar) + E/exp(F*Tstar)<EOL>if (l, s) in [(<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, <NUM_LIT:2>), (<NUM_LIT:3>, <NUM_LIT:3>)]:<EOL><INDENT>omega += G/exp(H*Tstar)<EOL><DEDENT>if (l, s) not in [(<NUM_LIT:1>, <NUM_LIT:1>), (<NUM_LIT:1>, <NUM_LIT:2>)]:<EOL><INDENT>omega += R*Tstar**B*sin(S*Tstar**W-P)<EOL><DEDENT>return omega<EOL>

r'''Calculates Lennard-Jones collision integral for any of 16 values of
    (l,j) for the wide range of 0.3 < Tstar < 100. Values are accurate to
    0.1 % of actual values, but the calculation of actual values is
    computationally intensive and so these simplifications are used, developed
    in [1]_.

    .. math::
        \Omega_D = \frac{A}{T^{*B}} + \frac{C}{\exp(DT^*)} +
        \frac{E}{\exp(FT^{*})} + \frac{G}{\exp(HT^*)} + RT^{*B}\sin(ST^{*W}-P)

    Parameters
    ----------
    Tstar : float
        Reduced temperature of the fluid [-]
    l : int
        term
    s : int
        term

    Returns
    -------
    Omega : float
        Collision integral of A and B

    Notes
    -----
    Acceptable pairs of (l,s) are (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
    (1, 6), (1, 7), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 3), (3, 4),
    (3, 5), and (4, 4).

    .. math::
        T^* = \frac{k_b T}{\epsilon}

    Results are very similar to those of the more modern formulation,
    `collision_integral_Kim_Monroe`.

    Calculations begin to yield overflow errors in some values of (l, 2) after
    Tstar = 75, beginning with (1, 7). Also susceptible are (1, 5) and (1, 6).

    Examples
    --------
    >>> collision_integral_Neufeld_Janzen_Aziz(100, 1, 1)
    0.516717697672334

    References
    ----------
    .. [1] Neufeld, Philip D., A. R. Janzen, and R. A. Aziz. "Empirical
       Equations to Calculate 16 of the Transport Collision Integrals
       Omega(l, S)* for the Lennard-Jones (12-6) Potential." The Journal of
       Chemical Physics 57, no. 3 (August 1, 1972): 1100-1102.
       doi:10.1063/1.1678363


def collision_integral_Kim_Monroe(Tstar, l=<NUM_LIT:1>, s=<NUM_LIT:1>):

if (l, s) not in As_collision:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>omega = As_collision[(l, s)]<EOL>for ki in range(<NUM_LIT:6>):<EOL><INDENT>Bs = Bs_collision[(l, s)]<EOL>Cs = Cs_collision[(l, s)]<EOL>omega += Bs[ki]/Tstar**(ki+<NUM_LIT:1>) + Cs[ki]*log(Tstar)**(ki+<NUM_LIT:1>)<EOL><DEDENT>return omega<EOL>

r'''Calculates Lennard-Jones collision integral for any of 16 values of
    (l,j) for the wide range of 0.3 < Tstar < 400. Values are accurate to
    0.007 % of actual values, but the calculation of actual values is
    computationally intensive and so these simplifications are used, developed
    in [1]_.

    .. math::
        \Omega^{(l,s)*} = A^{(l,s)} + \sum_{k=1}^6 \left[ \frac{B_k^{(l,s)}}
        {(T^*)^k} + C_k^{(l,s)} (\ln T^*)^k \right]

    Parameters
    ----------
    Tstar : float
        Reduced temperature of the fluid [-]
    l : int
        term
    s : int
        term

    Returns
    -------
    Omega : float
        Collision integral of A and B

    Notes
    -----
    Acceptable pairs of (l,s) are (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
    (1, 6), (1, 7), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (3, 3), (3, 4),
    (3, 5), and (4, 4).

    .. math::
        T^* = \frac{k_b T}{\epsilon}

    Examples
    --------
    >>> collision_integral_Kim_Monroe(400, 1, 1)
    0.4141818082392228

    References
    ----------
    .. [1] Kim, Sun Ung, and Charles W. Monroe. "High-Accuracy Calculations of
       Sixteen Collision Integrals for Lennard-Jones (12-6) Gases and Their
       Interpolation to Parameterize Neon, Argon, and Krypton." Journal of
       Computational Physics 273 (September 15, 2014): 358-73.
       doi:10.1016/j.jcp.2014.05.018.


def Tstar(T, epsilon_k=None, epsilon=None):

if epsilon_k:<EOL><INDENT>_Tstar = T/(epsilon_k)<EOL><DEDENT>elif epsilon:<EOL><INDENT>_Tstar = k*T/epsilon<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return _Tstar<EOL>

r'''This function calculates the parameter `Tstar` as needed in performing
    collision integral calculations.

    .. math::
        T^* = \frac{kT}{\epsilon}

    Examples
    --------
    >>> Tstar(T=318.2, epsilon_k=308.43)
    1.0316765554582887

    Parameters
    ----------
    epsilon_k : float, optional
        Lennard-Jones depth of potential-energy minimum over k, [K]
    epsilon : float, optional
        Lennard-Jones depth of potential-energy minimum [J]

    Returns
    -------
    Tstar : float
        Dimentionless temperature for calculating collision integral, [-]

    Notes
    -----
    Tabulated values are normally listed as epsilon/k. k is the Boltzman
    constant, with units of J/K.

    References
    ----------
    .. [1] Bird, R. Byron, Warren E. Stewart, and Edwin N. Lightfoot.
       Transport Phenomena, Revised 2nd Edition. New York:
       John Wiley & Sons, Inc., 2006


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

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in GWP_data.index:<EOL><INDENT>methods.append(IPCC100)<EOL>if not pd.isnull(GWP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(IPCC100SAR)<EOL><DEDENT>methods.append(IPCC20)<EOL>methods.append(IPCC500)<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 == IPCC100:<EOL><INDENT>return float(GWP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == IPCC100SAR:<EOL><INDENT>return float(GWP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == IPCC20:<EOL><INDENT>return float(GWP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == IPCC500:<EOL><INDENT>return float(GWP_data.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 of a chemical's Global Warming
    Potential, relative to CO2. Lookup is based on CASRNs. Will automatically
    select a data source to use if no Method is provided; returns None if the
    data is not available.

    Returns the GWP for the 100yr outlook by default.

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

    Returns
    -------
    GWP : float
        Global warming potential, [(impact/mass chemical)/(impact/mass CO2)]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain GWP with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are IPCC (2007) 100yr',
        'IPCC (2007) 100yr-SAR', 'IPCC (2007) 20yr', and 'IPCC (2007) 500yr'.
        All valid values are also held in the list GWP_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the GWP for the desired chemical, and will return methods
        instead of the GWP

    Notes
    -----
    All data is from [1]_, the official source. Several chemicals are available
    in [1]_ are not included here as they do not have a CAS.
    Methods are 'IPCC (2007) 100yr', 'IPCC (2007) 100yr-SAR',
    'IPCC (2007) 20yr', and 'IPCC (2007) 500yr'.

    Examples
    --------
    Methane, 100-yr outlook

    >>> GWP(CASRN='74-82-8')
    25.0

    References
    ----------
    .. [1] IPCC. "2.10.2 Direct Global Warming Potentials - AR4 WGI Chapter 2:
       Changes in Atmospheric Constituents and in Radiative Forcing." 2007.
       https://www.ipcc.ch/publications_and_data/ar4/wg1/en/ch2s2-10-2.html.


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

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in ODP_data.index:<EOL><INDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP2MAX)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP1MAX)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP2LOG)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP1LOG)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP2MIN)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP1MIN)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP2STR)<EOL><DEDENT>if not pd.isnull(ODP_data.at[CASRN, '<STR_LIT>']):<EOL><INDENT>methods.append(ODP1STR)<EOL><DEDENT><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 == ODP2MAX:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP1MAX:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP2MIN:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP1MIN:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP2LOG:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP1LOG:<EOL><INDENT>return float(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP2STR:<EOL><INDENT>return str(ODP_data.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == ODP1STR:<EOL><INDENT>return str(ODP_data.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 of a chemical's Ozone Depletion
    Potential, relative to CFC-11 (trichlorofluoromethane). Lookup is based on
    CASRNs. Will automatically select a data source to use if no Method is
    provided; returns None if the data is not available.

    Returns the ODP of a chemical according to [2]_ when a method is not
    specified. If a range is provided in [2]_, the highest value is returned.

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

    Returns
    -------
    ODP : float or str
        Ozone Depletion potential, [(impact/mass chemical)/(impact/mass CFC-11)];
        if method selected has `string` in it, this will be returned as a
        string regardless of if a range is given or a number
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain ODP with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'ODP2 Max', 'ODP2 Min',
        'ODP2 string', 'ODP2 logarithmic average', and methods for older values
        are 'ODP1 Max', 'ODP1 Min', 'ODP1 string', and 'ODP1 logarithmic average'.
        All valid values are also held in the list ODP_methods.
    Method : string, optional
        A string for the method name to use, as defined by constants in
        ODP_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the ODP for the desired chemical, and will return methods
        instead of the ODP

    Notes
    -----
    Values are tabulated only for a small number of halogenated hydrocarbons,
    responsible for the largest impact. The original values of ODP as defined
    in the Montreal Protocol are also available, as methods with the `ODP1`
    prefix.

    All values are somewhat emperical, as actual reaction rates of chemicals
    with ozone depend on temperature which depends on latitude, longitude,
    time of day, weather, and the concentrations of other pollutants.

    All data is from [1]_. Several mixtures listed in [1]_ are not included
    here as they are not pure species.
    Methods for values in [2]_ are 'ODP2 Max', 'ODP2 Min', 'ODP2 string',
    'ODP2 logarithmic average',  and methods for older values are 'ODP1 Max',
    'ODP1 Min', 'ODP1 string', and 'ODP1 logarithmic average'.

    Examples
    --------
    Dichlorotetrafluoroethane, according to [2]_.

    >>> ODP(CASRN='76-14-2')
    0.58

    References
    ----------
    .. [1] US EPA, OAR. "Ozone-Depleting Substances." Accessed April 26, 2016.
       https://www.epa.gov/ozone-layer-protection/ozone-depleting-substances.
    .. [2] WMO (World Meteorological Organization), 2011: Scientific Assessment
       of Ozone Depletion: 2010. Global Ozone Research and Monitoring
       Project-Report No. 52, Geneva, Switzerland, 516 p.
       https://www.wmo.int/pages/prog/arep/gaw/ozone_2010/documents/Ozone-Assessment-2010-complete.pdf


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

def list_methods():<EOL><INDENT>methods = []<EOL>if CASRN in CRClogPDict.index:<EOL><INDENT>methods.append(CRC)<EOL><DEDENT>if CASRN in SyrresDict2.index:<EOL><INDENT>methods.append(SYRRES)<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 == CRC:<EOL><INDENT>return float(CRClogPDict.at[CASRN, '<STR_LIT>'])<EOL><DEDENT>elif Method == SYRRES:<EOL><INDENT>return float(SyrresDict2.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 of a chemical's octanol-water
    partition coefficient. Lookup is based on CASRNs. Will automatically
    select a data source to use if no Method is provided; returns None if the
    data is not available.

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

    Returns
    -------
    logP : float
        Octanol-water partition coefficient, [-]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain logP with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        The method name to use. Accepted methods are 'SYRRES', or 'CRC',
        All valid values are also held in the list logP_methods.
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the logP for the desired chemical, and will return methods
        instead of the logP

    Notes
    -----
    .. math::
        \log P_{ oct/wat} = \log\left(\frac{\left[{solute}
        \right]_{ octanol}^{un-ionized}}{\left[{solute}
        \right]_{ water}^{ un-ionized}}\right)

    Examples
    --------
    >>> logP('67-56-1')
    -0.74

    References
    ----------
    .. [1] Syrres. 2006. KOWWIN Data, SrcKowData2.zip.
       http://esc.syrres.com/interkow/Download/SrcKowData2.zip
    .. [2] Haynes, W.M., Thomas J. Bruno, and David R. Lide. CRC Handbook of
       Chemistry and Physics, 95E. Boca Raton, FL: CRC press, 2014.


def legal_status(CASRN, Method=None, AvailableMethods=False, CASi=None):

load_law_data()<EOL>if not CASi:<EOL><INDENT>CASi = CAS2int(CASRN)<EOL><DEDENT>methods = [COMBINED, DSL, TSCA, EINECS, NLP, SPIN]<EOL>if AvailableMethods:<EOL><INDENT>return methods<EOL><DEDENT>if not Method:<EOL><INDENT>Method = methods[<NUM_LIT:0>]<EOL><DEDENT>if Method == DSL:<EOL><INDENT>if CASi in DSL_data.index:<EOL><INDENT>status = CAN_DSL_flags[DSL_data.at[CASi, '<STR_LIT>']]<EOL><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == TSCA:<EOL><INDENT>if CASi in TSCA_data.index:<EOL><INDENT>data = TSCA_data.loc[CASi].to_dict()<EOL>if any(data.values()):<EOL><INDENT>status = sorted([TSCA_flags[i] for i in data.keys() if data[i]])<EOL><DEDENT>else:<EOL><INDENT>status = LISTED<EOL><DEDENT><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == EINECS:<EOL><INDENT>if CASi in EINECS_data.index:<EOL><INDENT>status = LISTED<EOL><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == NLP:<EOL><INDENT>if CASi in NLP_data.index:<EOL><INDENT>status = LISTED<EOL><DEDENT>else:<EOL><INDENT>status = UNLISTED<EOL><DEDENT><DEDENT>elif Method == SPIN:<EOL><INDENT>if CASi in SPIN_data.index:<EOL><INDENT>status = LISTED<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] = legal_status(CASRN, Method=method, CASi=CASi)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return status<EOL>

r'''Looks up the legal status of a chemical 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
        Legal status information [-]
    methods : list, only returned if AvailableMethods == True
        List of methods which can be used to obtain legal status with the
        given inputs

    Other Parameters
    ----------------
    Method : string, optional
        A string for the method name to use, as defined by constants in
        legal_status_methods
    AvailableMethods : bool, optional
        If True, function will determine which methods can be used to obtain
        the legal status for the desired chemical, and will return methods
        instead of the status
    CASi : int, optional
        CASRN as an integer, used internally [-]

    Notes
    -----

    Supported methods are:

        * **DSL**: Canada Domestic Substance List, [1]_. As extracted on Feb 11, 2015
          from a html list. This list is updated continuously, so this version
          will always be somewhat old. Strictly speaking, there are multiple
          lists but they are all bundled together here. A chemical may be
          'Listed', or be on the 'Non-Domestic Substances List (NDSL)',
          or be on the list of substances with 'Significant New Activity (SNAc)',
          or be on the DSL but with a 'Ministerial Condition pertaining to this
          substance', or have been removed from the DSL, or have had a
          Ministerial prohibition for the substance.
        * **TSCA**: USA EPA Toxic Substances Control Act Chemical Inventory, [2]_.
          This list is as extracted on 2016-01. It is believed this list is
          updated on a periodic basis (> 6 month). A chemical may simply be
          'Listed', or may have certain flags attached to it. All these flags
          are described in the dict TSCA_flags.
        * **EINECS**: European INventory of Existing Commercial chemical
          Substances, [3]_. As extracted from a spreadsheet dynamically
          generated at [1]_. This list was obtained March 2015; a more recent
          revision already exists.
        * **NLP**: No Longer Polymers, a list of chemicals with special
          regulatory exemptions in EINECS. Also described at [3]_.
        * **SPIN**: Substances Prepared in Nordic Countries. Also a boolean
          data type. Retrieved 2015-03 from [4]_.

    Other methods which could be added are:

        * Australia: AICS Australian Inventory of Chemical Substances
        * China: Inventory of Existing Chemical Substances Produced or Imported
          in China (IECSC)
        * Europe: REACH List of Registered Substances
        * India: List of Hazardous Chemicals
        * Japan: ENCS: Inventory of existing and new chemical substances
        * Korea: Existing Chemicals Inventory (KECI)
        * Mexico: INSQ National Inventory of Chemical Substances in Mexico
        * New Zealand:  Inventory of Chemicals (NZIoC)
        * Philippines: PICCS Philippines Inventory of Chemicals and Chemical
          Substances

    Examples
    --------
    >>> pprint(legal_status('64-17-5'))
    {'DSL': 'LISTED',
     'EINECS': 'LISTED',
     'NLP': 'UNLISTED',
     'SPIN': 'LISTED',
     'TSCA': 'LISTED'}

    References
    ----------
    .. [1] Government of Canada.. "Substances Lists" Feb 11, 2015.
       https://www.ec.gc.ca/subsnouvelles-newsubs/default.asp?n=47F768FE-1.
    .. [2] US EPA. "TSCA Chemical Substance Inventory." Accessed April 2016.
       https://www.epa.gov/tsca-inventory.
    .. [3] ECHA. "EC Inventory". Accessed March 2015.
       http://echa.europa.eu/information-on-chemicals/ec-inventory.
    .. [4] SPIN. "SPIN Substances in Products In Nordic Countries." Accessed
       March 2015. http://195.215.202.233/DotNetNuke/default.aspx.