signature:
def SMK ( T , Tc , omega ) :
    r'''Calculates enthalpy of vaporization at arbitrary temperatures using a
 the work of [ 1 ] _ ; requires a chemical ' s critical temperature and
 acentric factor .
 The enthalpy of vaporization is given by :
 . . math : :
 \ frac { \ Delta H _ { vap } } { RT _ c } =
 \ left ( \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R1 ) } + \ left (
 \ frac { \ omega - \ omega ^ { ( R1 ) } } { \ omega ^ { ( R2 ) } - \ omega ^ { ( R1 ) } } \ right )
 \ left [ \ left ( \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R2 ) } - \ left (
 \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R1 ) } \ right ]
 \ left ( \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R1 ) }
 = 6.537 \ tau ^ { 1/3 } - 2.467 \ tau ^ { 5/6 } - 77.251 \ tau ^ { 1.208 } +
 59.634 \ tau + 36.009 \ tau ^ 2 - 14.606 \ tau ^ 3
 \ left ( \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R2 ) } - \ left (
 \ frac { \ Delta H _ { vap } } { RT _ c } \ right ) ^ { ( R1 ) } = - 0.133 \ tau ^ { 1/3 } - 28.215
 \ tau ^ { 5/6 } - 82.958 \ tau ^ { 1.208 } + 99.00 \ tau + 19.105 \ tau ^ 2 - 2.796 \ tau ^ 3
 \ tau = 1 - T / T _ c
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 omega : float
 Acentric factor [ - ]
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 The original article has been reviewed and found to have coefficients with
 slightly more precision . Additionally , the form of the equation is slightly
 different , but numerically equivalent .
 The refence fluids are :
 : math : ` \ omega _ 0 ` = benzene = 0.212
 : math : ` \ omega _ 1 ` = carbazole = 0.461
 A sample problem in the article has been verified . The numerical result
 presented by the author requires high numerical accuracy to obtain .
 Examples
 Problem in [ 1 ] _ :
 > > > SMK ( 553.15 , 751.35 , 0.302)
 39866.17647797959
 References
 . . [ 1 ] Sivaraman , Alwarappa , Joe W . Magee , and Riki Kobayashi . " Generalized
 Correlation of Latent Heats of Vaporization of Coal - Liquid Model Compounds
 between Their Freezing Points and Critical Points . " Industrial &
 Engineering Chemistry Fundamentals 23 , no . 1 ( February 1 , 1984 ) : 97-100.
 doi : 10.1021 / i100013a017.'''


signature:
def MK ( T , Tc , omega ) :
    r'''Calculates enthalpy of vaporization at arbitrary temperatures using a
 the work of [ 1 ] _ ; requires a chemical ' s critical temperature and
 acentric factor .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta H _ { vap } = \ Delta H _ { vap } ^ { ( 0 ) } + \ omega \ Delta H _ { vap } ^ { ( 1 ) } + \ omega ^ 2 \ Delta H _ { vap } ^ { ( 2 ) }
 \ frac { \ Delta H _ { vap } ^ { ( i ) } } { RT _ c } = b ^ { ( j ) } \ tau ^ { 1/3 } + b _ 2 ^ { ( j ) } \ tau ^ { 5/6}
 + b _ 3 ^ { ( j ) } \ tau ^ { 1.2083 } + b _ 4 ^ { ( j ) } \ tau + b _ 5 ^ { ( j ) } \ tau ^ 2 + b _ 6 ^ { ( j ) } \ tau ^ 3
 \ tau = 1 - T / T _ c
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 omega : float
 Acentric factor [ - ]
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 The original article has been reviewed . A total of 18 coefficients are used :
 WARNING : The correlation has been implemented as described in the article ,
 but its results seem different and with some error .
 Its results match with other functions however .
 Has poor behavior for low - temperature use .
 Examples
 Problem in article for SMK function .
 > > > MK ( 553.15 , 751.35 , 0.302)
 38727.993546377205
 References
 . . [ 1 ] Morgan , David L . , and Riki Kobayashi . " Extension of Pitzer CSP
 Models for Vapor Pressures and Heats of Vaporization to Long - Chain
 Hydrocarbons . " Fluid Phase Equilibria 94 ( March 15 , 1994 ) : 51-87.
 doi : 10.1016/0378-3812(94)87051-9.'''


signature:
def Velasco ( T , Tc , omega ) :
    r'''Calculates enthalpy of vaporization at arbitrary temperatures using a
 the work of [ 1 ] _ ; requires a chemical ' s critical temperature and
 acentric factor .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta _ { vap } H = RT _ c ( 7.2729 + 10.4962 \ omega + 0.6061 \ omega ^ 2 ) ( 1 - T _ r ) ^ { 0.38}
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 omega : float
 Acentric factor [ - ]
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 The original article has been reviewed . It is regressed from enthalpy of
 vaporization values at 0.7Tr , from 121 fluids in REFPROP 9.1.
 A value in the article was read to be similar , but slightly too low from
 that calculated here .
 Examples
 From graph , in [ 1 ] _ for perfluoro - n - heptane .
 > > > Velasco ( 333.2 , 476.0 , 0.5559)
 33299.41734936356
 References
 . . [ 1 ] Velasco , S . , M . J . Santos , and J . A . White . " Extended Corresponding
 States Expressions for the Changes in Enthalpy , Compressibility Factor
 and Constant - Volume Heat Capacity at Vaporization . " The Journal of
 Chemical Thermodynamics 85 ( June 2015 ) : 68-76.
 doi : 10.1016 / j . jct . 2015.01.011.'''


signature:
def Riedel ( Tb , Tc , Pc ) :
    r'''Calculates enthalpy of vaporization at the boiling point , using the
 Ridel [ 1 ] _ CSP method . Required information are critical temperature
 and pressure , and boiling point . Equation taken from [ 2 ] _ and [ 3 ] _ .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta _ { vap } H = 1.093 T _ b R \ frac { \ ln P _ c - 1.013 } { 0.930 - T _ { br } }
 Parameters
 Tb : float
 Boiling temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Returns
 Hvap : float
 Enthalpy of vaporization at the normal boiling point , [ J / mol ]
 Notes
 This equation has no example calculation in any source . The source has not
 been verified . It is equation 4-144 in Perry ' s . Perry ' s also claims that
 errors seldom surpass 5 % .
 [2 ] _ is the source of example work here , showing a calculation at 0.0%
 error .
 Internal units of pressure are bar .
 Examples
 Pyridine , 0.0 % err vs . exp : 35090 J / mol ; from Poling [ 2 ] _ .
 > > > Riedel ( 388.4 , 620.0 , 56.3E5)
 35089.78989646058
 References
 . . [ 1 ] Riedel , L . " Eine Neue Universelle Dampfdruckformel Untersuchungen
 Uber Eine Erweiterung Des Theorems Der Ubereinstimmenden Zustande . Teil
 I . " Chemie Ingenieur Technik 26 , no . 2 ( February 1 , 1954 ) : 83-89.
 doi : 10.1002 / cite . 330260206.
 . . [ 2 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.
 . . [ 3 ] Green , Don , and Robert Perry . Perry ' s Chemical Engineers ' Handbook ,
 Eighth Edition . McGraw - Hill Professional , 2007.'''

implementation:
Pc = Pc / 1E5
# Pa to bar
Tbr = Tb / Tc
return 1.093 * Tb * R * ( log ( Pc ) - 1.013 ) / ( 0.93 - Tbr )


signature:
def Chen ( Tb , Tc , Pc ) :
    r'''Calculates enthalpy of vaporization using the Chen [ 1 ] _ correlation
 and a chemical ' s critical temperature , pressure and boiling point .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta H _ { vb } = RT _ b \ frac { 3.978 T _ r - 3.958 + 1.555 \ ln P _ c } { 1.07 - T _ r }
 Parameters
 Tb : float
 Boiling temperature of the fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 The formulation presented in the original article is similar , but uses
 units of atm and calorie instead . The form in [ 2 ] _ has adjusted for this .
 A method for estimating enthalpy of vaporization at other conditions
 has also been developed , but the article is unclear on its implementation .
 Based on the Pitzer correlation .
 Internal units : bar and K
 Examples
 Same problem as in Perry ' s examples .
 > > > Chen ( 294.0 , 466.0 , 5.55E6)
 26705.893506174052
 References
 . . [ 1 ] Chen , N . H . " Generalized Correlation for Latent Heat of Vaporization . "
 Journal of Chemical & Engineering Data 10 , no . 2 ( April 1 , 1965 ) : 207-10.
 doi : 10.1021 / je60025a047
 . . [ 2 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''


signature:
def Liu ( Tb , Tc , Pc ) :
    r'''Calculates enthalpy of vaporization at the normal boiling point using
 the Liu [ 1 ] _ correlation , and a chemical ' s critical temperature , pressure
 and boiling point .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta H _ { vap } = RT _ b \ left [ \ frac { T _ b } { 220 } \ right ] ^ { 0.0627 } \ frac {
 (1 - T _ { br } ) ^ { 0.38 } \ ln ( P _ c / P _ A ) } { 1 - T _ { br } + 0.38 T _ { br } \ ln T _ { br } }
 Parameters
 Tb : float
 Boiling temperature of the fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 This formulation can be adjusted for lower boiling points , due to the use
 of a rationalized pressure relationship . The formulation is taken from
 the original article .
 A correction for alcohols and organic acids based on carbon number ,
 which only modifies the boiling point , is available but not implemented .
 No sample calculations are available in the article .
 Internal units : Pa and K
 Examples
 Same problem as in Perry ' s examples
 > > > Liu ( 294.0 , 466.0 , 5.55E6)
 26378.566319606754
 References
 . . [ 1 ] LIU , ZHI - YONG . " Estimation of Heat of Vaporization of Pure Liquid at
 Its Normal Boiling Temperature . " Chemical Engineering Communications
 184 , no . 1 ( February 1 , 2001 ) : 221-28 . doi : 10.1080/00986440108912849.'''


signature:
def Vetere ( Tb , Tc , Pc , F = 1 ) :
    r'''Calculates enthalpy of vaporization at the boiling point , using the
 Vetere [ 1 ] _ CSP method . Required information are critical temperature
 and pressure , and boiling point . Equation taken from [ 2 ] _ .
 The enthalpy of vaporization is given by :
 . . math : :
 \ frac { \ Delta H _ { vap } } { RT _ b } = \ frac { \ tau _ b ^ { 0.38}
 \ left [ \ ln P _ c - 0.513 + \ frac { 0.5066 } { P _ cT _ { br } ^ 2 } \ right ] }
 { \ tau _ b + F ( 1 - \ tau _ b ^ { 0.38 } ) \ ln T _ { br } }
 Parameters
 Tb : float
 Boiling temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 F : float , optional
 Constant for a fluid , [ - ]
 Returns
 Hvap : float
 Enthalpy of vaporization at the boiling point , [ J / mol ]
 Notes
 The equation cannot be found in the original source . It is believed that a
 second article is its source , or that DIPPR staff have altered the formulation .
 Internal units of pressure are bar .
 Examples
 Example as in [ 2 ] _ , p2-487 ; exp : 25.73
 > > > Vetere ( 294.0 , 466.0 , 5.55E6)
 26363.430021286465
 References
 . . [ 1 ] Vetere , Alessandro . " Methods to Predict the Vaporization Enthalpies
 at the Normal Boiling Temperature of Pure Compounds Revisited . "
 Fluid Phase Equilibria 106 , no . 1-2 ( May 1 , 1995 ) : 1–10.
 doi : 10.1016/0378-3812(94)02627 - D .
 . . [ 2 ] Green , Don , and Robert Perry . Perry ' s Chemical Engineers ' Handbook ,
 Eighth Edition . McGraw - Hill Professional , 2007.'''

implementation:
Tbr = Tb / Tc
taub = 1 - Tb / Tc
Pc = Pc / 1E5
term = taub ** 0.38 * ( log ( Pc ) - 0.513 + 0.5066 / Pc / Tbr ** 2 ) / ( taub + F * ( 1 - taub ** 0.38 ) * log ( Tbr ) )
return R * Tb * term


signature:
def Watson ( T , Hvap_ref , T_Ref , Tc , exponent = 0.38 ) :
    '''Adjusts enthalpy of vaporization of enthalpy for another temperature , for one temperature .'''

implementation:
Tr = T / Tc
Trefr = T_Ref / Tc
H2 = Hvap_ref * ( ( 1 - Tr ) / ( 1 - Trefr ) ) ** exponent
return H2


signature:
def Hfus ( T = 298.15 , P = 101325 , MW = None , AvailableMethods = False , Method = None , CASRN = '' ) : # pragma : no cover
    '''This function handles the calculation of a chemical ' s enthalpy of fusion .
 Generally this , is used by the chemical class , as all parameters are passed .
 Calling the function directly works okay .
 Enthalpy of fusion is a weak function of pressure , and its effects are
 neglected .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in CRCHfus_data . index :
        methods . append ( 'CRC, at melting point' )
    methods . append ( 'None' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
if Method == 'CRC, at melting point' :
    _Hfus = CRCHfus_data . at [ CASRN , 'Hfus' ]
elif Method == 'None' or not MW :
    _Hfus = None
else :
    raise Exception ( 'Failure in in function' )
_Hfus = property_molar_to_mass ( _Hfus , MW )
return _Hfus


signature:
def Hsub ( T = 298.15 , P = 101325 , MW = None , AvailableMethods = False , Method = None , CASRN = '' ) : # pragma : no cover
    '''This function handles the calculation of a chemical ' s enthalpy of sublimation .
 Generally this , is used by the chemical class , as all parameters are passed .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .'''

implementation:
def list_methods ( ) :
    methods = [ ]
    # if Hfus ( T = T , P = P , MW = MW , CASRN = CASRN ) and Hvap ( T = T , P = P , MW = MW , CASRN = CASRN ) :
    # methods . append ( ' Hfus + Hvap ' )
    if CASRN in GharagheiziHsub_data . index :
        methods . append ( 'Ghazerati Appendix, at 298K' )
    methods . append ( 'None' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
# if Method = = ' Hfus + Hvap ' :
# p1 = Hfus ( T = T , P = P , MW = MW , CASRN = CASRN )
# p2 = Hvap ( T = T , P = P , MW = MW , CASRN = CASRN )
# if p1 and p2:
# _ Hsub = p1 + p2
# else :
# _ Hsub = None
if Method == 'Ghazerati Appendix, at 298K' :
    _Hsub = float ( GharagheiziHsub_data . at [ CASRN , 'Hsub' ] )
elif Method == 'None' or not _Hsub or not MW :
    return None
else :
    raise Exception ( 'Failure in in function' )
_Hsub = property_molar_to_mass ( _Hsub , MW )
return _Hsub


signature:
def Tliquidus ( Tms = None , ws = None , xs = None , CASRNs = None , AvailableMethods = False , Method = None ) : # pragma : no cover
    '''This function handles the retrival of a mixtures ' s liquidus point .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > Tliquidus ( Tms = [ 250.0 , 350.0 ] , xs = [ 0.5 , 0.5 ] )
 350.0
 > > > Tliquidus ( Tms = [ 250 , 350 ] , xs = [ 0.5 , 0.5 ] , Method = ' Simple ' )
 300.0
 > > > Tliquidus ( Tms = [ 250 , 350 ] , xs = [ 0.5 , 0.5 ] , AvailableMethods = True )
 [ ' Maximum ' , ' Simple ' , ' None ' ]'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if none_and_length_check ( [ Tms ] ) :
        methods . append ( 'Maximum' )
        methods . append ( 'Simple' )
    methods . append ( 'None' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
if Method == 'Maximum' :
    _Tliq = max ( Tms )
elif Method == 'Simple' :
    _Tliq = mixing_simple ( xs , Tms )
elif Method == 'None' :
    return None
else :
    raise Exception ( 'Failure in in function' )
return _Tliq


signature:
def load_all_methods ( self ) :
    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 .'''

implementation:
methods = [ ]
Tmins , Tmaxs = [ ] , [ ]
if has_CoolProp and self . CASRN in coolprop_dict :
    methods . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
    Tmins . append ( self . CP_f . Tt ) ;
    Tmaxs . append ( self . CP_f . Tc )
if self . CASRN in _VDISaturationDict :
    methods . append ( VDI_TABULAR )
    Ts , props = VDI_tabular_data ( self . CASRN , 'Hvap' )
    self . VDI_Tmin = Ts [ 0 ]
    self . VDI_Tmax = Ts [ - 1 ]
    self . tabular_data [ VDI_TABULAR ] = ( Ts , props )
    Tmins . append ( self . VDI_Tmin ) ;
    Tmaxs . append ( self . VDI_Tmax )
if self . CASRN in Alibakhshi_Cs . index and self . Tc :
    methods . append ( ALIBAKHSHI )
    self . Alibakhshi_C = float ( Alibakhshi_Cs . at [ self . CASRN , 'C' ] )
    Tmaxs . append ( max ( self . Tc - 100. , 0 ) )
if self . CASRN in CRCHvap_data . index and not np . isnan ( CRCHvap_data . at [ self . CASRN , 'HvapTb' ] ) :
    methods . append ( CRC_HVAP_TB )
    self . CRC_HVAP_TB_Tb = float ( CRCHvap_data . at [ self . CASRN , 'Tb' ] )
    self . CRC_HVAP_TB_Hvap = float ( CRCHvap_data . at [ self . CASRN , 'HvapTb' ] )
if self . CASRN in CRCHvap_data . index and not np . isnan ( CRCHvap_data . at [ self . CASRN , 'Hvap298' ] ) :
    methods . append ( CRC_HVAP_298 )
    self . CRC_HVAP_298 = float ( CRCHvap_data . at [ self . CASRN , 'Hvap298' ] )
if self . CASRN in GharagheiziHvap_data . index :
    methods . append ( GHARAGHEIZI_HVAP_298 )
    self . GHARAGHEIZI_HVAP_298_Hvap = float ( GharagheiziHvap_data . at [ self . CASRN , 'Hvap298' ] )
if all ( ( self . Tc , self . omega ) ) :
    methods . extend ( self . CSP_methods )
    Tmaxs . append ( self . Tc ) ;
    Tmins . append ( 0 )
if all ( ( self . Tc , self . Pc ) ) :
    methods . append ( CLAPEYRON )
    Tmaxs . append ( self . Tc ) ;
    Tmins . append ( 0 )
if all ( ( self . Tb , self . Tc , self . Pc ) ) :
    methods . extend ( self . boiling_methods )
    Tmaxs . append ( self . Tc ) ;
    Tmins . append ( 0 )
if self . CASRN in Perrys2_150 . index :
    methods . append ( DIPPR_PERRY_8E )
    _ , Tc , C1 , C2 , C3 , C4 , self . Perrys2_150_Tmin , self . Perrys2_150_Tmax = _Perrys2_150_values [ Perrys2_150 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . Perrys2_150_coeffs = [ Tc , C1 , C2 , C3 , C4 ]
    Tmins . append ( self . Perrys2_150_Tmin ) ;
    Tmaxs . append ( self . Perrys2_150_Tmax )
if self . CASRN in VDI_PPDS_4 . index :
    _ , MW , Tc , A , B , C , D , E = _VDI_PPDS_4_values [ VDI_PPDS_4 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VDI_PPDS_coeffs = [ A , B , C , D , E ]
    self . VDI_PPDS_Tc = Tc
    self . VDI_PPDS_MW = MW
    methods . append ( VDI_PPDS )
    Tmaxs . append ( self . VDI_PPDS_Tc ) ;
self . all_methods = set ( methods )
if Tmins and Tmaxs :
    self . Tmin , self . Tmax = min ( Tmins ) , max ( Tmaxs )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate heat of vaporization 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 of vaporization , [ K ]
 method : str
 Name of the method to use
 Returns
 Hvap : float
 Heat of vaporization of the liquid at T , [ J / mol ]'''

implementation:
if method == COOLPROP :
    Hvap = PropsSI ( 'HMOLAR' , 'T' , T , 'Q' , 1 , self . CASRN ) - PropsSI ( 'HMOLAR' , 'T' , T , 'Q' , 0 , self . CASRN )
elif method == DIPPR_PERRY_8E :
    Hvap = EQ106 ( T , * self . Perrys2_150_coeffs )
# CSP methods
elif method == VDI_PPDS :
    A , B , C , D , E = self . VDI_PPDS_coeffs
    tau = 1. - T / self . VDI_PPDS_Tc
    Hvap = R * self . VDI_PPDS_Tc * ( A * tau ** ( 1 / 3. ) + B * tau ** ( 2 / 3. ) + C * tau + D * tau ** 2 + E * tau ** 6 )
elif method == ALIBAKHSHI :
    Hvap = ( 4.5 * pi * N_A ) ** ( 1 / 3. ) * 4.2E-7 * ( self . Tc - 6. ) - R / 2. * T * log ( T ) + self . Alibakhshi_C * T
elif method == MORGAN_KOBAYASHI :
    Hvap = MK ( T , self . Tc , self . omega )
elif method == SIVARAMAN_MAGEE_KOBAYASHI :
    Hvap = SMK ( T , self . Tc , self . omega )
elif method == VELASCO :
    Hvap = Velasco ( T , self . Tc , self . omega )
elif method == PITZER :
    Hvap = Pitzer ( T , self . Tc , self . omega )
elif method == CLAPEYRON :
    Zg = self . Zg ( T ) if hasattr ( self . Zg , '__call__' ) else self . Zg
    Zl = self . Zl ( T ) if hasattr ( self . Zl , '__call__' ) else self . Zl
    Psat = self . Psat ( T ) if hasattr ( self . Psat , '__call__' ) else self . Psat
    if Zg :
        if Zl :
            dZ = Zg - Zl
        else :
            dZ = Zg
    Hvap = Clapeyron ( T , self . Tc , self . Pc , dZ = dZ , Psat = Psat )
# CSP methods at Tb only
elif method == RIEDEL :
    Hvap = Riedel ( self . Tb , self . Tc , self . Pc )
elif method == CHEN :
    Hvap = Chen ( self . Tb , self . Tc , self . Pc )
elif method == VETERE :
    Hvap = Vetere ( self . Tb , self . Tc , self . Pc )
elif method == LIU :
    Hvap = Liu ( self . Tb , self . Tc , self . Pc )
# Individual data point methods
elif method == CRC_HVAP_TB :
    Hvap = self . CRC_HVAP_TB_Hvap
elif method == CRC_HVAP_298 :
    Hvap = self . CRC_HVAP_298
elif method == GHARAGHEIZI_HVAP_298 :
    Hvap = self . GHARAGHEIZI_HVAP_298_Hvap
elif method in self . tabular_data :
    Hvap = self . interpolate ( T , method )
# Adjust with the watson equation if estimated at Tb or Tc only
if method in self . boiling_methods or ( self . Tc and method in [ CRC_HVAP_TB , CRC_HVAP_298 , GHARAGHEIZI_HVAP_298 ] ) :
    if method in self . boiling_methods :
        Tref = self . Tb
    elif method == CRC_HVAP_TB :
        Tref = self . CRC_HVAP_TB_Tb
    elif method in [ CRC_HVAP_298 , GHARAGHEIZI_HVAP_298 ] :
        Tref = 298.15
    Hvap = Watson ( T , Hvap , Tref , self . Tc , self . Watson_exponent )
return Hvap


signature:
def solubility_parameter ( T = 298.15 , Hvapm = None , Vml = None , CASRN = '' , AvailableMethods = False , Method = None ) :
    r'''This function handles the calculation of a chemical ' s solubility
 parameter . Calculation is a function of temperature , but is not always
 presented as such . No lookup values are available ; either ` Hvapm ` , ` Vml ` ,
 and ` T ` are provided or the calculation cannot be performed .
 . . math : :
 \ delta = \ sqrt { \ frac { \ Delta H _ { vap } - RT } { V _ m } }
 Parameters
 T : float
 Temperature of the fluid [ k ]
 Hvapm : float
 Heat of vaporization [ J / mol / K ]
 Vml : float
 Specific volume of the liquid [ m ^ 3 / mol ]
 CASRN : str , optional
 CASRN of the fluid , not currently used [ - ]
 Returns
 delta : float
 Solubility parameter , [ Pa ^ 0.5]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain the solubility parameter
 with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 solubility _ parameter _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the solubility parameter for the desired chemical , and will return
 methods instead of the solubility parameter
 Notes
 Undefined past the critical point . For convenience , if Hvap is not defined ,
 an error is not raised ; None is returned instead . Also for convenience ,
 if Hvapm is less than RT , None is returned to avoid taking the root of a
 negative number .
 This parameter is often given in units of cal / ml , which is 2045.48 times
 smaller than the value returned here .
 Examples
 Pentane at STP
 > > > solubility _ parameter ( T = 298.2 , Hvapm = 26403.3 , Vml = 0.000116055)
 14357.681538173534
 References
 . . [ 1 ] Barton , Allan F . M . CRC Handbook of Solubility Parameters and Other
 Cohesion Parameters , Second Edition . CRC Press , 1991.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if T and Hvapm and Vml :
        methods . append ( DEFINITION )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == DEFINITION :
    if ( not Hvapm ) or ( not T ) or ( not Vml ) :
        delta = None
    else :
        if Hvapm < R * T or Vml < 0 : # Prevent taking the root of a negative number
            delta = None
        else :
            delta = ( ( Hvapm - R * T ) / Vml ) ** 0.5
elif Method == NONE :
    delta = None
else :
    raise Exception ( 'Failure in in function' )
return delta


signature:
def solubility_eutectic ( T , Tm , Hm , Cpl = 0 , Cps = 0 , gamma = 1 ) :
    r'''Returns the maximum solubility of a solute in a solvent .
 . . math : :
 \ ln x _ i ^ L \ gamma _ i ^ L = \ frac { \ Delta H _ { m , i } } { RT } \ left (
 1 - \ frac { T } { T _ { m , i } } \ right ) - \ frac { \ Delta C _ { p , i } ( T _ { m , i } - T ) } { RT }
 + \ frac { \ Delta C _ { p , i } } { R } \ ln \ frac { T _ m } { T }
 \ Delta C _ { p , i } = C _ { p , i } ^ L - C _ { p , i } ^ S
 Parameters
 T : float
 Temperature of the system [ K ]
 Tm : float
 Melting temperature of the solute [ K ]
 Hm : float
 Heat of melting at the melting temperature of the solute [ J / mol ]
 Cpl : float , optional
 Molar heat capacity of the solute as a liquid [ J / mol / K ]
 Cpls : float , optional
 Molar heat capacity of the solute as a solid [ J / mol / K ]
 gamma : float , optional
 Activity coefficient of the solute as a liquid [ - ]
 Returns
 x : float
 Mole fraction of solute at maximum solubility [ - ]
 Notes
 gamma is of the solute in liquid phase
 Examples
 From [ 1 ] _ , matching example
 > > > solubility _ eutectic ( T = 260 . , Tm = 278.68 , Hm = 9952 . , Cpl = 0 , Cps = 0 , gamma = 3.0176)
 0.24340068761677464
 References
 . . [ 1 ] Gmehling , Jurgen . Chemical Thermodynamics : For Process Simulation .
 Weinheim , Germany : Wiley - VCH , 2012.'''

implementation:
dCp = Cpl - Cps
x = exp ( - Hm / R / T * ( 1 - T / Tm ) + dCp * ( Tm - T ) / R / T - dCp / R * log ( Tm / T ) ) / gamma
return x


signature:
def Tm_depression_eutectic ( Tm , Hm , x = None , M = None , MW = None ) :
    r'''Returns the freezing point depression caused by a solute in a solvent .
 Can use either the mole fraction of the solute or its molality and the
 molecular weight of the solvent . Assumes ideal system behavior .
 . . math : :
 \ Delta T _ m = \ frac { R T _ m ^ 2 x } { \ Delta H _ m }
 \ Delta T _ m = \ frac { R T _ m ^ 2 ( MW ) M } { 1000 \ Delta H _ m }
 Parameters
 Tm : float
 Melting temperature of the solute [ K ]
 Hm : float
 Heat of melting at the melting temperature of the solute [ J / mol ]
 x : float , optional
 Mole fraction of the solute [ - ]
 M : float , optional
 Molality [ mol / kg ]
 MW : float , optional
 Molecular weight of the solvent [ g / mol ]
 Returns
 dTm : float
 Freezing point depression [ K ]
 Notes
 MW is the molecular weight of the solvent . M is the molality of the solute .
 Examples
 From [ 1 ] _ , matching example .
 > > > Tm _ depression _ eutectic ( 353.35 , 19110 , . 02)
 1.0864594900639515
 References
 . . [ 1 ] Gmehling , Jurgen . Chemical Thermodynamics : For Process Simulation .
 Weinheim , Germany : Wiley - VCH , 2012.'''

implementation:
if x :
    dTm = R * Tm ** 2 * x / Hm
elif M and MW :
    MW = MW / 1000.
    # g / mol to kg / mol
    dTm = R * Tm ** 2 * MW * M / Hm
else :
    raise Exception ( 'Either molality or mole fraction of the solute must be specified; MW of the solvent is required also if molality is provided' )
return dTm


signature:
def Yen_Woods_saturation ( T , Tc , Vc , Zc ) :
    r'''Calculates saturation liquid volume , using the Yen and Woods [ 1 ] _ CSP
 method and a chemical ' s critical properties .
 The molar volume of a liquid is given by :
 . . math : :
 Vc / Vs = 1 + A ( 1 - T _ r ) ^ { 1/3 } + B ( 1 - T _ r ) ^ { 2/3 } + D ( 1 - T _ r ) ^ { 4/3}
 D = 0.93 - B
 A = 17.4425 - 214.578Z _ c + 989.625Z _ c ^ 2 - 1522.06Z _ c ^ 3
 B = - 3.28257 + 13.6377Z _ c + 107.4844Z _ c ^ 2-384.211Z _ c ^ 3
 \ text { if } Zc \ le 0.26
 B = 60.2091 - 402.063Z _ c + 501.0 Z _ c ^ 2 + 641.0 Z _ c ^ 3
 \ text { if } Zc \ ge 0.26
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Vc : float
 Critical volume of fluid [ m ^ 3 / mol ]
 Zc : float
 Critical compressibility of fluid , [ - ]
 Returns
 Vs : float
 Saturation liquid volume , [ m ^ 3 / mol ]
 Notes
 Original equation was in terms of density , but it is converted here .
 No example has been found , nor are there points in the article . However ,
 it is believed correct . For compressed liquids with the Yen - Woods method ,
 see the ` YenWoods _ compressed ` function .
 Examples
 > > > Yen _ Woods _ saturation ( 300 , 647.14 , 55.45E - 6 , 0.245)
 1.7695330765295693e - 05
 References
 . . [ 1 ] Yen , Lewis C . , and S . S . Woods . " A Generalized Equation for Computer
 Calculation of Liquid Densities . " AIChE Journal 12 , no . 1 ( 1966 ) :
 95-99 . doi : 10.1002 / aic . 690120119'''


signature:
def Rackett ( T , Tc , Pc , Zc ) :
    r'''Calculates saturation liquid volume , using Rackett CSP method and
 critical properties .
 The molar volume of a liquid is given by :
 . . math : :
 V _ s = \ frac { RT _ c } { P _ c } { Z _ c } ^ { [ 1 + ( 1 - { T / T _ c } ) ^ { 2/7 } ] }
 Units are all currently in m ^ 3 / mol - this can be changed to kg / m ^ 3
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Zc : float
 Critical compressibility of fluid , [ - ]
 Returns
 Vs : float
 Saturation liquid volume , [ m ^ 3 / mol ]
 Notes
 Units are dependent on gas constant R , imported from scipy
 According to Reid et . al , underpredicts volume for compounds with Zc < 0.22
 Examples
 Propane , example from the API Handbook
 > > > Vm _ to _ rho ( Rackett ( 272.03889 , 369.83 , 4248000.0 , 0.2763 ) , 44.09562)
 531.3223212651092
 References
 . . [ 1 ] Rackett , Harold G . " Equation of State for Saturated Liquids . "
 Journal of Chemical & Engineering Data 15 , no . 4 ( 1970 ) : 514-517.
 doi : 10.1021 / je60047a012'''


signature:
def Yamada_Gunn ( T , Tc , Pc , omega ) :
    r'''Calculates saturation liquid volume , using Yamada and Gunn CSP method
 and a chemical ' s critical properties and acentric factor .
 The molar volume of a liquid is given by :
 . . math : :
 V _ s = \ frac { RT _ c } { P _ c } { ( 0.29056-0.08775 \ omega ) } ^ { [ 1 + ( 1 - { T / T _ c } ) ^ { 2/7 } ] }
 Units are in m ^ 3 / mol .
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 Returns
 Vs : float
 saturation liquid volume , [ m ^ 3 / mol ]
 Notes
 This equation is an improvement on the Rackett equation .
 This is often presented as the Rackett equation .
 The acentric factor is used here , instead of the critical compressibility
 A variant using a reference fluid also exists
 Examples
 > > > Yamada _ Gunn ( 300 , 647.14 , 22048320.0 , 0.245)
 2.1882836429895796e - 05
 References
 . . [ 1 ] Gunn , R . D . , and Tomoyoshi Yamada . " A Corresponding States
 Correlation of Saturated Liquid Volumes . " AIChE Journal 17 , no . 6
 (1971 ) : 1341-45 . doi : 10.1002 / aic . 690170613
 . . [ 2 ] Yamada , Tomoyoshi , and Robert D . Gunn . " Saturated Liquid Molar
 Volumes . Rackett Equation . " Journal of Chemical & Engineering Data 18,
 no . 2 ( 1973 ) : 234-36 . doi : 10.1021 / je60057a006'''


signature:
def Townsend_Hales ( T , Tc , Vc , omega ) :
    r'''Calculates saturation liquid density , using the Townsend and Hales
 CSP method as modified from the original Riedel equation . Uses
 chemical critical volume and temperature , as well as acentric factor
 The density of a liquid is given by :
 . . math : :
 Vs = V _ c / \ left ( 1 + 0.85(1 - T _ r ) + ( 1.692 + 0.986 \ omega ) ( 1 - T _ r ) ^ { 1/3 } \ right )
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Vc : float
 Critical volume of fluid [ m ^ 3 / mol ]
 omega : float
 Acentric factor for fluid , [ - ]
 Returns
 Vs : float
 Saturation liquid volume , [ m ^ 3 / mol ]
 Notes
 The requirement for critical volume and acentric factor requires all data .
 Examples
 > > > Townsend _ Hales ( 300 , 647.14 , 55.95E - 6 , 0.3449)
 1.8007361992619923e - 05
 References
 . . [ 1 ] Hales , J . L , and R Townsend . " Liquid Densities from 293 to 490 K of
 Nine Aromatic Hydrocarbons . " The Journal of Chemical Thermodynamics
 4 , no . 5 ( 1972 ) : 763-72 . doi : 10.1016/0021-9614(72)90050 - X'''


signature:
def Bhirud_normal ( T , Tc , Pc , omega ) :
    r'''Calculates saturation liquid density using the Bhirud [ 1 ] _ CSP method .
 Uses Critical temperature and pressure and acentric factor .
 The density of a liquid is given by :
 . . math : :
 & \ ln \ frac { P _ c } { \ rho RT } = \ ln U ^ { ( 0 ) } + \ omega \ ln U ^ { ( 1 ) }
 & \ ln U ^ { ( 0 ) } = 1.396 44 - 24.076T _ r + 102.615T _ r ^ 2
 -255.719T _ r ^ 3 + 355.805T _ r ^ 4-256.671T _ r ^ 5 + 75.1088T _ r ^ 6
 & \ ln U ^ { ( 1 ) } = 13.4412 - 135.7437 T _ r + 533.380T _ r ^ 2-
 1091.453T _ r ^ 3 + 1231.43T _ r ^ 4 - 728.227T _ r ^ 5 + 176.737T _ r ^ 6
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 Returns
 Vm : float
 Saturated liquid molar volume , [ mol / m ^ 3]
 Notes
 Claimed inadequate by others .
 An interpolation table for ln U values are used from Tr = 0.98 - 1.000.
 Has terrible behavior at low reduced temperatures .
 Examples
 Pentane
 > > > Bhirud _ normal ( 280.0 , 469.7 , 33.7E5 , 0.252)
 0.00011249654029488583
 References
 . . [ 1 ] Bhirud , Vasant L . " Saturated Liquid Densities of Normal Fluids . "
 AIChE Journal 24 , no . 6 ( November 1 , 1978 ) : 1127-31.
 doi : 10.1002 / aic . 690240630'''


signature:
def COSTALD ( T , Tc , Vc , omega ) :
    r'''Calculate saturation liquid density using the COSTALD CSP method .
 A popular and accurate estimation method . If possible , fit parameters are
 used ; alternatively critical properties work well .
 The density of a liquid is given by :
 . . math : :
 V _ s = V ^ * V ^ { ( 0 ) } [ 1 - \ omega _ { SRK } V ^ { ( \ delta ) } ]
 V ^ { ( 0 ) } = 1-1.52816(1 - T _ r ) ^ { 1/3 } + 1.43907(1 - T _ r ) ^ { 2/3}
 - 0.81446(1 - T _ r ) + 0.190454(1 - T _ r ) ^ { 4/3}
 V ^ { ( \ delta ) } = \ frac { - 0.296123 + 0.386914T _ r - 0.0427258T _ r ^ 2-0.0480645T _ r ^ 3}
 { T _ r - 1.00001}
 Units are that of critical or fit constant volume .
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Vc : float
 Critical volume of fluid [ m ^ 3 / mol ] .
 This parameter is alternatively a fit parameter
 omega : float
 ( ideally SRK ) Acentric factor for fluid , [ - ]
 This parameter is alternatively a fit parameter .
 Returns
 Vs : float
 Saturation liquid volume
 Notes
 196 constants are fit to this function in [ 1 ] _ .
 Range : 0.25 < Tr < 0.95 , often said to be to 1.0
 This function has been checked with the API handbook example problem .
 Examples
 Propane , from an example in the API Handbook
 > > > Vm _ to _ rho ( COSTALD ( 272.03889 , 369.83333 , 0.20008161E - 3 , 0.1532 ) , 44.097)
 530.3009967969841
 References
 . . [ 1 ] Hankinson , Risdon W . , and George H . Thomson . " A New Correlation for
 Saturated Densities of Liquids and Their Mixtures . " AIChE Journal
 25 , no . 4 ( 1979 ) : 653-663 . doi : 10.1002 / aic . 690250412'''


signature:
def Campbell_Thodos ( T , Tb , Tc , Pc , M , dipole = None , hydroxyl = False ) :
    r'''Calculate saturation liquid density using the Campbell - Thodos [ 1 ] _
 CSP method .
 An old and uncommon estimation method .
 . . math : :
 V _ s = \ frac { RT _ c } { P _ c } { Z _ { RA } } ^ { [ 1 + ( 1 - T _ r ) ^ { 2/7 } ] }
 Z _ { RA } = \ alpha + \ beta ( 1 - T _ r )
 \ alpha = 0.3883-0.0179s
 s = T _ { br } \ frac { \ ln P _ c } { ( 1 - T _ { br } ) }
 \ beta = 0.00318s - 0.0211 + 0.625 \ Lambda ^ { 1.35}
 \ Lambda = \ frac { P _ c ^ { 1/3 } } { M ^ { 1/2 } T _ c ^ { 5/6 } }
 For polar compounds :
 . . math : :
 \ theta = P _ c \ mu ^ 2 / T _ c ^ 2
 \ alpha = 0.3883 - 0.0179s - 130540 \ theta ^ { 2.41}
 \ beta = 0.00318s - 0.0211 + 0.625 \ Lambda ^ { 1.35 } + 9.74 \ times
 10 ^ 6 \ theta ^ { 3.38}
 Polar Combounds with hydroxyl groups ( water , alcohols )
 . . math : :
 \ alpha = \ left [ 0.690T _ { br } - 0.3342 + \ frac { 5.79 \ times 10 ^ { - 10 } }
 { T _ { br } ^ { 32.75 } } \ right ] P _ c ^ { 0.145}
 \ beta = 0.00318s - 0.0211 + 0.625 \ Lambda ^ { 1.35 } + 5.90 \ Theta ^ { 0.835}
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tb : float
 Boiling temperature of the fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 M : float
 Molecular weight of the fluid [ g / mol ]
 dipole : float , optional
 Dipole moment of the fluid [ debye ]
 hydroxyl : bool , optional
 Swith to use the hydroxyl variant for polar fluids
 Returns
 Vs : float
 Saturation liquid volume
 Notes
 If a dipole is provided , the polar chemical method is used .
 The paper is an excellent read .
 Pc is internally converted to atm .
 Examples
 Ammonia , from [ 1 ] _ .
 > > > Campbell _ Thodos ( T = 405.45 , Tb = 239.82 , Tc = 405.45 , Pc = 111.7*101325 , M = 17.03 , dipole = 1.47)
 7.347363635885525e - 05
 References
 . . [ 1 ] Campbell , Scott W . , and George Thodos . " Prediction of Saturated
 Liquid Densities and Critical Volumes for Polar and Nonpolar
 Substances . " Journal of Chemical & Engineering Data 30 , no . 1
 ( January 1 , 1985 ) : 102-11 . doi : 10.1021 / je00039a032.'''


signature:
def SNM0 ( T , Tc , Vc , omega , delta_SRK = None ) :
    r'''Calculates saturated liquid density using the Mchaweh , Moshfeghian
 model [ 1 ] _ . Designed for simple calculations .
 . . math : :
 V _ s = V _ c / ( 1 + 1.169 \ tau ^ { 1/3 } + 1.818 \ tau ^ { 2/3 } - 2.658 \ tau + 2.161 \ tau ^ { 4/3}
 \ tau = 1 - \ frac { ( T / T _ c ) } { \ alpha _ { SRK } }
 \ alpha _ { SRK } = [ 1 + m ( 1 - \ sqrt { T / T _ C } ] ^ 2
 m = 0.480 + 1.574 \ omega - 0.176 \ omega ^ 2
 If the fit parameter ` delta _ SRK ` is provided , the following is used :
 . . math : :
 V _ s = V _ C / ( 1 + 1.169 \ tau ^ { 1/3 } + 1.818 \ tau ^ { 2/3 } - 2.658 \ tau + 2.161 \ tau ^ { 4/3 } )
 / \ left [ 1 + \ delta _ { SRK } ( \ alpha _ { SRK } - 1 ) ^ { 1/3 } \ right ]
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Vc : float
 Critical volume of fluid [ m ^ 3 / mol ]
 omega : float
 Acentric factor for fluid , [ - ]
 delta _ SRK : float , optional
 Fitting parameter [ - ]
 Returns
 Vs : float
 Saturation liquid volume , [ m ^ 3 / mol ]
 Notes
 73 fit parameters have been gathered from the article .
 Examples
 Argon , without the fit parameter and with it . Tabulated result in Perry ' s
 is 3.4613e - 05 . The fit increases the error on this occasion .
 > > > SNM0(121 , 150.8 , 7.49e - 05 , - 0.004)
 3.4402256402733416e - 05
 > > > SNM0(121 , 150.8 , 7.49e - 05 , - 0.004 , - 0.03259620)
 3.493288100008123e - 05
 References
 . . [ 1 ] Mchaweh , A . , A . Alsaygh , Kh . Nasrifar , and M . Moshfeghian .
 " A Simplified Method for Calculating Saturated Liquid Densities . "
 Fluid Phase Equilibria 224 , no . 2 ( October 1 , 2004 ) : 157-67.
 doi : 10.1016 / j . fluid . 2004.06.054'''


signature:
def COSTALD_compressed ( T , P , Psat , Tc , Pc , omega , Vs ) :
    r'''Calculates compressed - liquid volume , using the COSTALD [ 1 ] _ CSP
 method and a chemical ' s critical properties .
 The molar volume of a liquid is given by :
 . . math : :
 V = V _ s \ left ( 1 - C \ ln \ frac { B + P } { B + P ^ { sat } } \ right )
 \ frac { B } { P _ c } = - 1 + a \ tau ^ { 1/3 } + b \ tau ^ { 2/3 } + d \ tau + e \ tau ^ { 4/3}
 e = \ exp ( f + g \ omega _ { SRK } + h \ omega _ { SRK } ^ 2)
 C = j + k \ omega _ { SRK }
 Parameters
 T : float
 Temperature of fluid [ K ]
 P : float
 Pressure of fluid [ Pa ]
 Psat : float
 Saturation pressure of the fluid [ Pa ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 omega : float
 ( ideally SRK ) Acentric factor for fluid , [ - ]
 This parameter is alternatively a fit parameter .
 Vs : float
 Saturation liquid volume , [ m ^ 3 / mol ]
 Returns
 V _ dense : float
 High - pressure liquid volume , [ m ^ 3 / mol ]
 Notes
 Original equation was in terms of density , but it is converted here .
 The example is from DIPPR , and exactly correct .
 This is DIPPR Procedure 4C : Method for Estimating the Density of Pure
 Organic Liquids under Pressure .
 Examples
 > > > COSTALD _ compressed ( 303 . , 9.8E7 , 85857.9 , 466.7 , 3640000.0 , 0.281 , 0.000105047)
 9.287482879788506e - 05
 References
 . . [ 1 ] Thomson , G . H . , K . R . Brobst , and R . W . Hankinson . " An Improved
 Correlation for Densities of Compressed Liquids and Liquid Mixtures . "
 AIChE Journal 28 , no . 4 ( July 1 , 1982 ) : 671-76 . doi : 10.1002 / aic . 690280420'''


signature:
def Amgat ( xs , Vms ) :
    r'''Calculate mixture liquid density using the Amgat mixing rule .
 Highly inacurate , but easy to use . Assumes idea liquids with
 no excess volume . Average molecular weight should be used with it to obtain
 density .
 . . math : :
 V _ { mix } = \ sum _ i x _ i V _ i
 or in terms of density :
 . . math : :
 \ rho _ { mix } = \ sum \ frac { x _ i } { \ rho _ i }
 Parameters
 xs : array
 Mole fractions of each component , [ ]
 Vms : array
 Molar volumes of each fluids at conditions [ m ^ 3 / mol ]
 Returns
 Vm : float
 Mixture liquid volume [ m ^ 3 / mol ]
 Notes
 Units are that of the given volumes .
 It has been suggested to use this equation with weight fractions ,
 but the results have been less accurate .
 Examples
 > > > Amgat ( [ 0.5 , 0.5 ] , [ 4.057e - 05 , 5.861e - 05 ] )
 4.959000005e - 05'''

implementation:
if not none_and_length_check ( [ xs , Vms ] ) :
    raise Exception ( 'Function inputs are incorrect format' )
return mixing_simple ( xs , Vms )


signature:
def Rackett_mixture ( T , xs , MWs , Tcs , Pcs , Zrs ) :
    r'''Calculate mixture liquid density using the Rackett - derived mixing rule
 as shown in [ 2 ] _ .
 . . math : :
 V _ m = \ sum _ i \ frac { x _ i T _ { ci } } { MW _ i P _ { ci } } Z _ { R , m } ^ { ( 1 + ( 1 - T _ r ) ^ { 2/7 } ) } R \ sum _ i x _ i MW _ i
 Parameters
 T : float
 Temperature of liquid [ K ]
 xs : list
 Mole fractions of each component , [ ]
 MWs : list
 Molecular weights of each component [ g / mol ]
 Tcs : list
 Critical temperatures of each component [ K ]
 Pcs : list
 Critical pressures of each component [ Pa ]
 Zrs : list
 Rackett parameters of each component [ ]
 Returns
 Vm : float
 Mixture liquid volume [ m ^ 3 / mol ]
 Notes
 Model for pure compounds in [ 1 ] _ forms the basis for this model , shown in
 [2 ] _ . Molecular weights are used as weighing by such has been found to
 provide higher accuracy in [ 2 ] _ . The model can also be used without
 molecular weights , but results are somewhat different .
 As with the Rackett model , critical compressibilities may be used if
 Rackett parameters have not been regressed .
 Critical mixture temperature , and compressibility are all obtained with
 simple mixing rules .
 Examples
 Calculation in [ 2 ] _ for methanol and water mixture . Result matches example .
 > > > Rackett _ mixture ( T = 298 . , xs = [ 0.4576 , 0.5424 ] , MWs = [ 32.04 , 18.01 ] , Tcs = [ 512.58 , 647.29 ] , Pcs = [ 8.096E6 , 2.209E7 ] , Zrs = [ 0.2332 , 0.2374 ] )
 2.625288603174508e - 05
 References
 . . [ 1 ] Rackett , Harold G . " Equation of State for Saturated Liquids . "
 Journal of Chemical & Engineering Data 15 , no . 4 ( 1970 ) : 514-517.
 doi : 10.1021 / je60047a012
 . . [ 2 ] Danner , Ronald P , and Design Institute for Physical Property Data .
 Manual for Predicting Chemical Process Design Data . New York , N . Y , 1982.'''

implementation:
if not none_and_length_check ( [ xs , MWs , Tcs , Pcs , Zrs ] ) :
    raise Exception ( 'Function inputs are incorrect format' )
Tc = mixing_simple ( xs , Tcs )
Zr = mixing_simple ( xs , Zrs )
MW = mixing_simple ( xs , MWs )
Tr = T / Tc
bigsum = sum ( xs [ i ] * Tcs [ i ] / Pcs [ i ] / MWs [ i ] for i in range ( len ( xs ) ) )
return ( R * bigsum * Zr ** ( 1. + ( 1. - Tr ) ** ( 2 / 7. ) ) ) * MW


signature:
def COSTALD_mixture ( xs , T , Tcs , Vcs , omegas ) :
    r'''Calculate mixture liquid density using the COSTALD CSP method .
 A popular and accurate estimation method . If possible , fit parameters are
 used ; alternatively critical properties work well .
 The mixing rules giving parameters for the pure component COSTALD
 equation are :
 . . math : :
 T _ { cm } = \ frac { \ sum _ i \ sum _ j x _ i x _ j ( V _ { ij } T _ { cij } ) } { V _ m }
 V _ m = 0.25 \ left [ \ sum x _ i V _ i + 3 ( \ sum x _ i V _ i ^ { 2/3 } ) ( \ sum _ i x _ i V _ i ^ { 1/3 } ) \ right ]
 V _ { ij } T _ { cij } = ( V _ iT _ { ci } V _ { j } T _ { cj } ) ^ { 0.5}
 \ omega = \ sum _ i z _ i \ omega _ i
 Parameters
 xs : list
 Mole fractions of each component
 T : float
 Temperature of fluid [ K ]
 Tcs : list
 Critical temperature of fluids [ K ]
 Vcs : list
 Critical volumes of fluids [ m ^ 3 / mol ] .
 This parameter is alternatively a fit parameter
 omegas : list
 ( ideally SRK ) Acentric factor of all fluids , [ - ]
 This parameter is alternatively a fit parameter .
 Returns
 Vs : float
 Saturation liquid mixture volume
 Notes
 Range : 0.25 < Tr < 0.95 , often said to be to 1.0
 No example has been found .
 Units are that of critical or fit constant volume .
 Examples
 > > > COSTALD _ mixture ( [ 0.4576 , 0.5424 ] , 298 . , [ 512.58 , 647.29 ] , [ 0.000117 , 5.6e - 05 ] , [ 0.559,0.344 ] )
 2.706588773271354e - 05
 References
 . . [ 1 ] Hankinson , Risdon W . , and George H . Thomson . " A New Correlation for
 Saturated Densities of Liquids and Their Mixtures . " AIChE Journal
 25 , no . 4 ( 1979 ) : 653-663 . doi : 10.1002 / aic . 690250412'''

implementation:
cmps = range ( len ( xs ) )
if not none_and_length_check ( [ xs , Tcs , Vcs , omegas ] ) :
    raise Exception ( 'Function inputs are incorrect format' )
sum1 = sum ( [ xi * Vci for xi , Vci in zip ( xs , Vcs ) ] )
sum2 = sum ( [ xi * Vci ** ( 2 / 3. ) for xi , Vci in zip ( xs , Vcs ) ] )
sum3 = sum ( [ xi * Vci ** ( 1 / 3. ) for xi , Vci in zip ( xs , Vcs ) ] )
Vm = 0.25 * ( sum1 + 3. * sum2 * sum3 )
VijTcij = [ [ ( Tcs [ i ] * Tcs [ j ] * Vcs [ i ] * Vcs [ j ] ) ** 0.5 for j in cmps ] for i in cmps ]
omega = mixing_simple ( xs , omegas )
Tcm = sum ( [ xs [ i ] * xs [ j ] * VijTcij [ i ] [ j ] / Vm for j in cmps for i in cmps ] )
return COSTALD ( T , Tcm , Vm , omega )


signature:
def load_all_methods ( self ) :
    r'''Method which picks out coefficients for the specified chemical
 from the various dictionaries and DataFrames storing it . All data is
 stored as attributes . This method also sets : obj : ` Tmin ` , : obj : ` Tmax ` ,
 : obj : ` all _ methods ` and obj : ` all _ methods _ P ` as a set of methods for
 which the data exists for .
 Called on initialization only . See the source code for the variables at
 which the coefficients are stored . The coefficients can safely be
 altered once the class is initialized . This method can be called again
 to reset the parameters .'''

implementation:
methods = [ ]
methods_P = [ ]
Tmins , Tmaxs = [ ] , [ ]
if has_CoolProp and self . CASRN in coolprop_dict :
    methods . append ( COOLPROP ) ;
    methods_P . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
    Tmins . append ( self . CP_f . Tt ) ;
    Tmaxs . append ( self . CP_f . Tc )
if self . CASRN in CRC_inorg_l_data . index :
    methods . append ( CRC_INORG_L )
    _ , self . CRC_INORG_L_MW , self . CRC_INORG_L_rho , self . CRC_INORG_L_k , self . CRC_INORG_L_Tm , self . CRC_INORG_L_Tmax = _CRC_inorg_l_data_values [ CRC_inorg_l_data . index . get_loc ( self . CASRN ) ] . tolist ( )
    Tmins . append ( self . CRC_INORG_L_Tm ) ;
    Tmaxs . append ( self . CRC_INORG_L_Tmax )
if self . CASRN in Perry_l_data . index :
    methods . append ( PERRYDIPPR )
    _ , C1 , C2 , C3 , C4 , self . DIPPR_Tmin , self . DIPPR_Tmax = _Perry_l_data_values [ Perry_l_data . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . DIPPR_coeffs = [ C1 , C2 , C3 , C4 ]
    Tmins . append ( self . DIPPR_Tmin ) ;
    Tmaxs . append ( self . DIPPR_Tmax )
if self . CASRN in VDI_PPDS_2 . index :
    methods . append ( VDI_PPDS )
    _ , MW , Tc , rhoc , A , B , C , D = _VDI_PPDS_2_values [ VDI_PPDS_2 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VDI_PPDS_coeffs = [ A , B , C , D ]
    self . VDI_PPDS_MW = MW
    self . VDI_PPDS_Tc = Tc
    self . VDI_PPDS_rhoc = rhoc
    Tmaxs . append ( self . VDI_PPDS_Tc )
if self . CASRN in _VDISaturationDict :
    methods . append ( VDI_TABULAR )
    Ts , props = VDI_tabular_data ( self . CASRN , 'Volume (l)' )
    self . VDI_Tmin = Ts [ 0 ]
    self . VDI_Tmax = Ts [ - 1 ]
    self . tabular_data [ VDI_TABULAR ] = ( Ts , props )
    Tmins . append ( self . VDI_Tmin ) ;
    Tmaxs . append ( self . VDI_Tmax )
if self . Tc and self . CASRN in COSTALD_data . index :
    methods . append ( HTCOSTALDFIT )
    self . COSTALD_Vchar = float ( COSTALD_data . at [ self . CASRN , 'Vchar' ] )
    self . COSTALD_omega_SRK = float ( COSTALD_data . at [ self . CASRN , 'omega_SRK' ] )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if self . Tc and self . Pc and self . CASRN in COSTALD_data . index and not np . isnan ( COSTALD_data . at [ self . CASRN , 'Z_RA' ] ) :
    methods . append ( RACKETTFIT )
    self . RACKETT_Z_RA = float ( COSTALD_data . at [ self . CASRN , 'Z_RA' ] )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if self . CASRN in CRC_inorg_l_const_data . index :
    methods . append ( CRC_INORG_L_CONST )
    self . CRC_INORG_L_CONST_Vm = float ( CRC_inorg_l_const_data . at [ self . CASRN , 'Vm' ] )
    # Roughly data at STP ; not guaranteed however ; not used for Trange
if all ( ( self . Tc , self . Vc , self . Zc ) ) :
    methods . append ( YEN_WOODS_SAT )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Pc , self . Zc ) ) :
    methods . append ( RACKETT )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Pc , self . omega ) ) :
    methods . append ( YAMADA_GUNN )
    methods . append ( BHIRUD_NORMAL )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Vc , self . omega ) ) :
    methods . append ( TOWNSEND_HALES )
    methods . append ( HTCOSTALD )
    methods . append ( MMSNM0 )
    if self . CASRN in SNM0_data . index :
        methods . append ( MMSNM0FIT )
        self . SNM0_delta_SRK = float ( SNM0_data . at [ self . CASRN , 'delta_SRK' ] )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Vc , self . omega , self . Tb , self . MW ) ) :
    methods . append ( CAMPBELL_THODOS )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Pc , self . omega ) ) :
    methods_P . append ( COSTALD_COMPRESSED )
    if self . eos :
        methods_P . append ( EOS )
if Tmins and Tmaxs :
    self . Tmin , self . Tmax = min ( Tmins ) , max ( Tmaxs )
self . all_methods = set ( methods )
self . all_methods_P = set ( methods_P )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate low - pressure liquid molar volume at tempearture
 ` 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 molar volume , [ K ]
 method : str
 Name of the method to use
 Returns
 Vm : float
 Molar volume of the liquid at T and a low pressure , [ m ^ 3 / mol ]'''

implementation:
if method == RACKETT :
    Vm = Rackett ( T , self . Tc , self . Pc , self . Zc )
elif method == YAMADA_GUNN :
    Vm = Yamada_Gunn ( T , self . Tc , self . Pc , self . omega )
elif method == BHIRUD_NORMAL :
    Vm = Bhirud_normal ( T , self . Tc , self . Pc , self . omega )
elif method == TOWNSEND_HALES :
    Vm = Townsend_Hales ( T , self . Tc , self . Vc , self . omega )
elif method == HTCOSTALD :
    Vm = COSTALD ( T , self . Tc , self . Vc , self . omega )
elif method == YEN_WOODS_SAT :
    Vm = Yen_Woods_saturation ( T , self . Tc , self . Vc , self . Zc )
elif method == MMSNM0 :
    Vm = SNM0 ( T , self . Tc , self . Vc , self . omega )
elif method == MMSNM0FIT :
    Vm = SNM0 ( T , self . Tc , self . Vc , self . omega , self . SNM0_delta_SRK )
elif method == CAMPBELL_THODOS :
    Vm = Campbell_Thodos ( T , self . Tb , self . Tc , self . Pc , self . MW , self . dipole )
elif method == HTCOSTALDFIT :
    Vm = COSTALD ( T , self . Tc , self . COSTALD_Vchar , self . COSTALD_omega_SRK )
elif method == RACKETTFIT :
    Vm = Rackett ( T , self . Tc , self . Pc , self . RACKETT_Z_RA )
elif method == PERRYDIPPR :
    A , B , C , D = self . DIPPR_coeffs
    Vm = 1. / EQ105 ( T , A , B , C , D )
elif method == CRC_INORG_L :
    rho = CRC_inorganic ( T , self . CRC_INORG_L_rho , self . CRC_INORG_L_k , self . CRC_INORG_L_Tm )
    Vm = rho_to_Vm ( rho , self . CRC_INORG_L_MW )
elif method == VDI_PPDS :
    A , B , C , D = self . VDI_PPDS_coeffs
    tau = 1. - T / self . VDI_PPDS_Tc
    rho = self . VDI_PPDS_rhoc + A * tau ** 0.35 + B * tau ** ( 2 / 3. ) + C * tau + D * tau ** ( 4 / 3. )
    Vm = rho_to_Vm ( rho , self . VDI_PPDS_MW )
elif method == CRC_INORG_L_CONST :
    Vm = self . CRC_INORG_L_CONST_Vm
elif method == COOLPROP :
    Vm = 1. / CoolProp_T_dependent_property ( T , self . CASRN , 'DMOLAR' , 'l' )
elif method in self . tabular_data :
    Vm = self . interpolate ( T , method )
return Vm


signature:
def calculate_P ( self , T , P , method ) :
    r'''Method to calculate pressure - dependent liquid molar volume at
 temperature ` T ` and pressure ` P ` with a given method .
 This method has no exception handling ; see ` TP _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate molar volume , [ K ]
 P : float
 Pressure at which to calculate molar volume , [ K ]
 method : str
 Name of the method to use
 Returns
 Vm : float
 Molar volume of the liquid at T and P , [ m ^ 3 / mol ]'''

implementation:
if method == COSTALD_COMPRESSED :
    Vm = self . T_dependent_property ( T )
    Psat = self . Psat ( T ) if hasattr ( self . Psat , '__call__' ) else self . Psat
    Vm = COSTALD_compressed ( T , P , Psat , self . Tc , self . Pc , self . omega , Vm )
elif method == COOLPROP :
    Vm = 1. / PropsSI ( 'DMOLAR' , 'T' , T , 'P' , P , self . CASRN )
elif method == EOS :
    self . eos [ 0 ] = self . eos [ 0 ] . to_TP ( T = T , P = P )
    Vm = self . eos [ 0 ] . V_l
elif method in self . tabular_data :
    Vm = self . interpolate_P ( T , P , method )
return Vm


signature:
def load_all_methods ( self ) :
    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 .'''

implementation:
methods = [ SIMPLE ]
if none_and_length_check ( [ self . Tcs , self . Vcs , self . omegas , self . CASs ] ) :
    methods . append ( COSTALD_MIXTURE )
    if all ( [ i in COSTALD_data . index for i in self . CASs ] ) :
        self . COSTALD_Vchars = [ COSTALD_data . at [ CAS , 'Vchar' ] for CAS in self . CASs ]
        self . COSTALD_omegas = [ COSTALD_data . at [ CAS , 'omega_SRK' ] for CAS in self . CASs ]
        methods . append ( COSTALD_MIXTURE_FIT )
if none_and_length_check ( [ self . MWs , self . Tcs , self . Pcs , self . Zcs , self . CASs ] ) :
    methods . append ( RACKETT )
    if all ( [ CAS in COSTALD_data . index for CAS in self . CASs ] ) :
        Z_RAs = [ COSTALD_data . at [ CAS , 'Z_RA' ] for CAS in self . CASs ]
        if not any ( np . isnan ( Z_RAs ) ) :
            self . Z_RAs = Z_RAs
            methods . append ( RACKETT_PARAMETERS )
if len ( self . CASs ) > 1 and '7732-18-5' in self . CASs :
    wCASs = [ i for i in self . CASs if i != '7732-18-5' ]
    if all ( [ i in _Laliberte_Density_ParametersDict for i in wCASs ] ) :
        methods . append ( LALIBERTE )
        self . wCASs = wCASs
        self . index_w = self . CASs . index ( '7732-18-5' )
self . all_methods = set ( methods )


signature:
def calculate ( self , T , P , zs , ws , method ) :
    r'''Method to calculate molar volume 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
 Vm : float
 Molar volume of the liquid mixture at the given conditions ,
 [ m ^ 3 / mol ]'''

implementation:
if method == SIMPLE :
    Vms = [ i ( T , P ) for i in self . VolumeLiquids ]
    return Amgat ( zs , Vms )
elif method == COSTALD_MIXTURE :
    return COSTALD_mixture ( zs , T , self . Tcs , self . Vcs , self . omegas )
elif method == COSTALD_MIXTURE_FIT :
    return COSTALD_mixture ( zs , T , self . Tcs , self . COSTALD_Vchars , self . COSTALD_omegas )
elif method == RACKETT :
    return Rackett_mixture ( T , zs , self . MWs , self . Tcs , self . Pcs , self . Zcs )
elif method == RACKETT_PARAMETERS :
    return Rackett_mixture ( T , zs , self . MWs , self . Tcs , self . Pcs , self . Z_RAs )
elif method == LALIBERTE :
    ws = list ( ws ) ;
    ws . pop ( self . index_w )
    rho = Laliberte_density ( T , ws , self . wCASs )
    MW = mixing_simple ( zs , self . MWs )
    return rho_to_Vm ( rho , MW )
else :
    raise Exception ( 'Method not valid' )


signature:
def load_all_methods ( self ) :
    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 : ` all _ methods _ P ` as a
 set of methods for which the data exists for .
 Called on initialization only . See the source code for the variables at
 which the coefficients are stored . The coefficients can safely be
 altered once the class is initialized . This method can be called again
 to reset the parameters .'''

implementation:
methods_P = [ IDEAL ]
# no point in getting Tmin , Tmax
if all ( ( self . Tc , self . Pc , self . omega ) ) :
    methods_P . extend ( [ TSONOPOULOS_EXTENDED , TSONOPOULOS , ABBOTT , PITZER_CURL ] )
    if self . eos :
        methods_P . append ( EOS )
if self . CASRN in CRC_virial_data . index :
    methods_P . append ( CRC_VIRIAL )
    self . CRC_VIRIAL_coeffs = _CRC_virial_data_values [ CRC_virial_data . index . get_loc ( self . CASRN ) ] . tolist ( ) [ 1 : ]
if has_CoolProp and self . CASRN in coolprop_dict :
    methods_P . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
self . all_methods_P = set ( methods_P )


signature:
def calculate_P ( self , T , P , method ) :
    r'''Method to calculate pressure - dependent gas molar volume at
 temperature ` T ` and pressure ` P ` with a given method .
 This method has no exception handling ; see ` TP _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate molar volume , [ K ]
 P : float
 Pressure at which to calculate molar volume , [ K ]
 method : str
 Name of the method to use
 Returns
 Vm : float
 Molar volume of the gas at T and P , [ m ^ 3 / mol ]'''

implementation:
if method == EOS :
    self . eos [ 0 ] = self . eos [ 0 ] . to_TP ( T = T , P = P )
    Vm = self . eos [ 0 ] . V_g
elif method == TSONOPOULOS_EXTENDED :
    B = BVirial_Tsonopoulos_extended ( T , self . Tc , self . Pc , self . omega , dipole = self . dipole )
    Vm = ideal_gas ( T , P ) + B
elif method == TSONOPOULOS :
    B = BVirial_Tsonopoulos ( T , self . Tc , self . Pc , self . omega )
    Vm = ideal_gas ( T , P ) + B
elif method == ABBOTT :
    B = BVirial_Abbott ( T , self . Tc , self . Pc , self . omega )
    Vm = ideal_gas ( T , P ) + B
elif method == PITZER_CURL :
    B = BVirial_Pitzer_Curl ( T , self . Tc , self . Pc , self . omega )
    Vm = ideal_gas ( T , P ) + B
elif method == CRC_VIRIAL :
    a1 , a2 , a3 , a4 , a5 = self . CRC_VIRIAL_coeffs
    t = 298.15 / T - 1.
    B = ( a1 + a2 * t + a3 * t ** 2 + a4 * t ** 3 + a5 * t ** 4 ) / 1E6
    Vm = ideal_gas ( T , P ) + B
elif method == IDEAL :
    Vm = ideal_gas ( T , P )
elif method == COOLPROP :
    Vm = 1. / PropsSI ( 'DMOLAR' , 'T' , T , 'P' , P , self . CASRN )
elif method in self . tabular_data :
    Vm = self . interpolate_P ( T , P , method )
return Vm


implementation:
methods = [ SIMPLE , IDEAL ]
if self . eos :
    methods . append ( EOS )
self . all_methods = set ( methods )


signature:
def calculate ( self , T , P , zs , ws , method ) :
    r'''Method to calculate molar volume 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
 Vm : float
 Molar volume of the gas mixture at the given conditions , [ m ^ 3 / mol ]'''

implementation:
if method == SIMPLE :
    Vms = [ i ( T , P ) for i in self . VolumeGases ]
    return mixing_simple ( zs , Vms )
elif method == IDEAL :
    return ideal_gas ( T , P )
elif method == EOS :
    self . eos [ 0 ] = self . eos [ 0 ] . to_TP_zs ( T = T , P = P , zs = zs )
    return self . eos [ 0 ] . V_g
else :
    raise Exception ( 'Method not valid' )


signature:
def load_all_methods ( self ) :
    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 .'''

implementation:
methods = [ ]
if self . CASRN in CRC_inorg_s_const_data . index :
    methods . append ( CRC_INORG_S )
    self . CRC_INORG_S_Vm = float ( CRC_inorg_s_const_data . at [ self . CASRN , 'Vm' ] )
# if all ( ( self . Tt , self . Vml _ Tt , self . MW ) ) :
# self . rhol _ Tt = Vm _ to _ rho ( self . Vml _ Tt , self . MW )
# methods . append ( GOODMAN )
self . all_methods = set ( methods )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate the molar volume of a solid at tempearture ` 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 molar volume , [ K ]
 method : str
 Name of the method to use
 Returns
 Vms : float
 Molar volume of the solid at T , [ m ^ 3 / mol ]'''

implementation:
if method == CRC_INORG_S :
    Vms = self . CRC_INORG_S_Vm
# elif method = = GOODMAN :
# Vms = Goodman ( T , self . Tt , self . rhol _ Tt )
elif method in self . tabular_data :
    Vms = self . interpolate ( T , method )
return Vms


signature:
def calculate ( self , T , P , zs , ws , method ) :
    r'''Method to calculate molar volume 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
 Vm : float
 Molar volume of the solid mixture at the given conditions ,
 [ m ^ 3 / mol ]'''

implementation:
if method == SIMPLE :
    Vms = [ i ( T , P ) for i in self . VolumeSolids ]
    return mixing_simple ( zs , Vms )
else :
    raise Exception ( 'Method not valid' )


signature:
def enthalpy_Cpg_Hvap ( self ) :
    r'''Method to calculate the enthalpy of an ideal mixture ( no pressure
 effects ) . This routine is based on " route A " , where only the gas heat
 capacity and enthalpy of vaporization are used .
 The reference temperature is a property of the class ; it defaults to
 298.15 K .
 For a pure gas mixture :
 . . math : :
 H = \ sum _ i z _ i \ cdot \ int _ { T _ { ref } } ^ T C _ { p } ^ { ig } ( T ) dT
 For a pure liquid mixture :
 . . math : :
 H = \ sum _ i z _ i \ left ( \ int _ { T _ { ref } } ^ T C _ { p } ^ { ig } ( T ) dT + H _ { vap , i } ( T ) \ right )
 For a vapor - liquid mixture :
 . . math : :
 H = \ sum _ i z _ i \ cdot \ int _ { T _ { ref } } ^ T C _ { p } ^ { ig } ( T ) dT
 + \ sum _ i x _ i \ left ( 1 - \ frac { V } { F } \ right ) H _ { vap , i } ( T )
 Returns
 H : float
 Enthalpy of the mixture with respect to the reference temperature ,
 [ J / mol ]
 Notes
 The object must be flashed before this routine can be used . It
 depends on the properties T , zs , xs , V _ over _ F , HeatCapacityGases ,
 EnthalpyVaporizations , and .'''

implementation:
H = 0
T = self . T
if self . phase == 'g' :
    for i in self . cmps :
        H += self . zs [ i ] * self . HeatCapacityGases [ i ] . T_dependent_property_integral ( self . T_REF_IG , T )
elif self . phase == 'l' :
    for i in self . cmps : # No further contribution needed
        Hg298_to_T = self . HeatCapacityGases [ i ] . T_dependent_property_integral ( self . T_REF_IG , T )
        Hvap = self . EnthalpyVaporizations [ i ] ( T )
        # Do the transition at the temperature of the liquid
        if Hvap is None :
            Hvap = 0
            # Handle the case of a package predicting a transition past the Tc
        H += self . zs [ i ] * ( Hg298_to_T - Hvap )
elif self . phase == 'l/g' :
    for i in self . cmps :
        Hg298_to_T_zi = self . zs [ i ] * self . HeatCapacityGases [ i ] . T_dependent_property_integral ( self . T_REF_IG , T )
        Hvap = self . EnthalpyVaporizations [ i ] ( T )
        if Hvap is None :
            Hvap = 0
            # Handle the case of a package predicting a transition past the Tc
        Hvap_contrib = - self . xs [ i ] * ( 1 - self . V_over_F ) * Hvap
        H += ( Hg298_to_T_zi + Hvap_contrib )
return H


signature:
def entropy_Cpg_Hvap ( self ) :
    r'''Method to calculate the entropy of an ideal mixture . This routine
 is based on " route A " , where only the gas heat capacity and enthalpy of
 vaporization are used .
 The reference temperature and pressure are properties of the class ; it
 defaults to 298.15 K and 101325 Pa .
 There is a contribution due to mixing :
 . . math : :
 \ Delta S _ { mixing } = - R \ sum _ i z _ i \ log ( z _ i )
 The ideal gas pressure contribution is :
 . . math : :
 \ Delta S _ { P } = - R \ log \ left ( \ frac { P } { P _ { ref } } \ right )
 For a liquid mixture or a partially liquid mixture , the entropy
 contribution is not so strong - all such pressure effects find that
 expression capped at the vapor pressure , as shown in [ 1 ] _ .
 . . math : :
 \ Delta S _ { P } = - \ sum _ i x _ i \ left ( 1 - \ frac { V } { F } \ right )
 R \ log \ left ( \ frac { P _ { sat , i } } { P _ { ref } } \ right ) - \ sum _ i y _ i \ left (
 \ frac { V } { F } \ right ) R \ log \ left ( \ frac { P } { P _ { ref } } \ right )
 These expressions are combined with the standard heat capacity and
 enthalpy of vaporization expressions to calculate the total entropy :
 For a pure gas mixture :
 . . math : :
 S = \ Delta S _ { mixing } + \ Delta S _ { P } + \ sum _ i z _ i \ cdot
 \ int _ { T _ { ref } } ^ T \ frac { C _ { p } ^ { ig } ( T ) } { T } dT
 For a pure liquid mixture :
 . . math : :
 S = \ Delta S _ { mixing } + \ Delta S _ { P } + \ sum _ i z _ i \ left (
 \ int _ { T _ { ref } } ^ T \ frac { C _ { p } ^ { ig } ( T ) } { T } dT + \ frac { H _ { vap , i }
 ( T ) } { T } \ right )
 For a vapor - liquid mixture :
 . . math : :
 S = \ Delta S _ { mixing } + \ Delta S _ { P } + \ sum _ i z _ i \ cdot
 \ int _ { T _ { ref } } ^ T \ frac { C _ { p } ^ { ig } ( T ) } { T } dT + \ sum _ i x _ i \ left ( 1
 - \ frac { V } { F } \ right ) \ frac { H _ { vap , i } ( T ) } { T }
 Returns
 S : float
 Entropy of the mixture with respect to the reference temperature ,
 [ J / mol / K ]
 Notes
 The object must be flashed before this routine can be used . It
 depends on the properties T , P , zs , V _ over _ F , HeatCapacityGases ,
 EnthalpyVaporizations , VaporPressures , and xs .
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''

implementation:
S = 0
T = self . T
P = self . P
S -= R * sum ( [ zi * log ( zi ) for zi in self . zs if zi > 0 ] )
# ideal composition entropy composition ; chemsep checked
# Both of the mixing and vapor pressure terms have negative signs
# Equation 6-4.4b in Poling for the vapor pressure component
# For liquids above their critical temperatures , Psat is equal to the system P ( COCO ) .
if self . phase == 'g' :
    S -= R * log ( P / 101325. )
    # Gas - phase ideal pressure contribution ( checked repeatedly )
    for i in self . cmps :
        S += self . HeatCapacityGases [ i ] . T_dependent_property_integral_over_T ( 298.15 , T )
elif self . phase == 'l' :
    Psats = self . _Psats ( T )
    for i in self . cmps :
        Sg298_to_T = self . HeatCapacityGases [ i ] . T_dependent_property_integral_over_T ( 298.15 , T )
        Hvap = self . EnthalpyVaporizations [ i ] ( T )
        if Hvap is None :
            Hvap = 0
            # Handle the case of a package predicting a transition past the Tc
        Svap = - Hvap / T
        # Do the transition at the temperature of the liquid
        S_P = - R * log ( Psats [ i ] / 101325. )
        S += self . zs [ i ] * ( Sg298_to_T + Svap + S_P )
elif self . phase == 'l/g' :
    Psats = self . _Psats ( T )
    S_P_vapor = - R * log ( P / 101325. )
    # Gas - phase ideal pressure contribution ( checked repeatedly )
    for i in self . cmps :
        Sg298_to_T_zi = self . zs [ i ] * self . HeatCapacityGases [ i ] . T_dependent_property_integral_over_T ( 298.15 , T )
        Hvap = self . EnthalpyVaporizations [ i ] ( T )
        if Hvap is None :
            Hvap = 0
        # Handle the case of a package predicting a transition past the Tc
        Svap_contrib = - self . xs [ i ] * ( 1 - self . V_over_F ) * Hvap / T
        # Pressure contributions from both phases
        S_P_vapor_i = self . V_over_F * self . ys [ i ] * S_P_vapor
        S_P_liquid_i = - R * log ( Psats [ i ] / 101325. ) * ( 1 - self . V_over_F ) * self . xs [ i ]
        S += ( Sg298_to_T_zi + Svap_contrib + S_P_vapor_i + S_P_liquid_i )
return S


signature:
def legal_status ( CASRN , Method = None , AvailableMethods = False , CASi = None ) :
    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 .'''

implementation:
load_law_data ( )
if not CASi :
    CASi = CAS2int ( CASRN )
methods = [ COMBINED , DSL , TSCA , EINECS , NLP , SPIN ]
if AvailableMethods :
    return methods
if not Method :
    Method = methods [ 0 ]
if Method == DSL :
    if CASi in DSL_data . index :
        status = CAN_DSL_flags [ DSL_data . at [ CASi , 'Registry' ] ]
    else :
        status = UNLISTED
elif Method == TSCA :
    if CASi in TSCA_data . index :
        data = TSCA_data . loc [ CASi ] . to_dict ( )
        if any ( data . values ( ) ) :
            status = sorted ( [ TSCA_flags [ i ] for i in data . keys ( ) if data [ i ] ] )
        else :
            status = LISTED
    else :
        status = UNLISTED
elif Method == EINECS :
    if CASi in EINECS_data . index :
        status = LISTED
    else :
        status = UNLISTED
elif Method == NLP :
    if CASi in NLP_data . index :
        status = LISTED
    else :
        status = UNLISTED
elif Method == SPIN :
    if CASi in SPIN_data . index :
        status = LISTED
    else :
        status = UNLISTED
elif Method == COMBINED :
    status = { }
    for method in methods [ 1 : ] :
        status [ method ] = legal_status ( CASRN , Method = method , CASi = CASi )
else :
    raise Exception ( 'Failure in in function' )
return status


signature:
def economic_status ( CASRN , Method = None , AvailableMethods = False ) : # pragma : no cover
    '''Look up the economic status of a chemical .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > pprint ( economic _ status ( CASRN = ' 98-00-0 ' ) )
 [ " US public : { ' Manufactured ' : 0.0 , ' Imported ' : 10272.711 , ' Exported ' : 184.127 } " ,
 u ' 10,000 - 100,000 tonnes per annum ' ,
 ' OECD HPV Chemicals ' ]
 > > > economic _ status ( CASRN = ' 13775-50-3 ' ) # SODIUM SESQUISULPHATE
 > > > economic _ status ( CASRN = ' 98-00-0 ' , Method = ' OECD high production volume chemicals ' )
 ' OECD HPV Chemicals '
 > > > economic _ status ( CASRN = ' 98-01-1 ' , Method = ' European Chemicals Agency Total Tonnage Bands ' )
 [ u ' 10,000 - 100,000 tonnes per annum ' ]'''

implementation:
load_economic_data ( )
CASi = CAS2int ( CASRN )
def list_methods ( ) :
    methods = [ ]
    methods . append ( 'Combined' )
    if CASRN in _EPACDRDict :
        methods . append ( EPACDR )
    if CASRN in _ECHATonnageDict :
        methods . append ( ECHA )
    if CASi in HPV_data . index :
        methods . append ( OECD )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
if Method == EPACDR :
    status = 'US public: ' + str ( _EPACDRDict [ CASRN ] )
elif Method == ECHA :
    status = _ECHATonnageDict [ CASRN ]
elif Method == OECD :
    status = 'OECD HPV Chemicals'
elif Method == 'Combined' :
    status = [ ]
    if CASRN in _EPACDRDict :
        status += [ 'US public: ' + str ( _EPACDRDict [ CASRN ] ) ]
    if CASRN in _ECHATonnageDict :
        status += _ECHATonnageDict [ CASRN ]
    if CASi in HPV_data . index :
        status += [ 'OECD HPV Chemicals' ]
elif Method == NONE :
    status = None
else :
    raise Exception ( 'Failure in in function' )
return status


signature:
def BVirial_Pitzer_Curl ( T , Tc , Pc , omega , order = 0 ) :
    r'''Calculates the second virial coefficient using the model in [ 1 ] _ .
 Designed for simple calculations .
 . . math : :
 B _ r = B ^ { ( 0 ) } + \ omega B ^ { ( 1 ) }
 B ^ { ( 0 ) } = 0.1445-0.33 / T _ r - 0.1385 / T _ r ^ 2-0.0121 / T _ r ^ 3
 B ^ { ( 1 ) } = 0.073 + 0.46 / T _ r - 0.5 / T _ r ^ 2 - 0.097 / T _ r ^ 3 - 0.0073 / T _ r ^ 8
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 order : int , optional
 Order of the calculation . 0 for the calculation of B itself ; for 1/2/3,
 the first / second / third derivative of B with respect to temperature ; and
 for - 1 / - 2 , the first / second indefinite integral of B with respect to
 temperature . No other integrals or derivatives are implemented , and an
 exception will be raised if any other order is given .
 Returns
 B : float
 Second virial coefficient in density form or its integral / derivative if
 specified , [ m ^ 3 / mol or m ^ 3 / mol / K ^ order ]
 Notes
 Analytical models for derivatives and integrals are available for orders
 -2 , - 1 , 1 , 2 , and 3 , all obtained with SymPy .
 For first temperature derivative of B :
 . . math : :
 \ frac { d B ^ { ( 0 ) } } { dT } = \ frac { 33 Tc } { 100 T ^ { 2 } } + \ frac { 277 Tc ^ { 2 } } { 1000 T ^ { 3 } } + \ frac { 363 Tc ^ { 3 } } { 10000 T ^ { 4 } }
 \ frac { d B ^ { ( 1 ) } } { dT } = - \ frac { 23 Tc } { 50 T ^ { 2 } } + \ frac { Tc ^ { 2 } } { T ^ { 3 } } + \ frac { 291 Tc ^ { 3 } } { 1000 T ^ { 4 } } + \ frac { 73 Tc ^ { 8 } } { 1250 T ^ { 9 } }
 For the second temperature derivative of B :
 . . math : :
 \ frac { d ^ 2 B ^ { ( 0 ) } } { dT ^ 2 } = - \ frac { 3 Tc } { 5000 T ^ { 3 } } \ left ( 1100 + \ frac { 1385 Tc } { T } + \ frac { 242 Tc ^ { 2 } } { T ^ { 2 } } \ right )
 \ frac { d ^ 2 B ^ { ( 1 ) } } { dT ^ 2 } = \ frac { Tc } { T ^ { 3 } } \ left ( \ frac { 23 } { 25 } - \ frac { 3 Tc } { T } - \ frac { 291 Tc ^ { 2 } } { 250 T ^ { 2 } } - \ frac { 657 Tc ^ { 7 } } { 1250 T ^ { 7 } } \ right )
 For the third temperature derivative of B :
 . . math : :
 \ frac { d ^ 3 B ^ { ( 0 ) } } { dT ^ 3 } = \ frac { 3 Tc } { 500 T ^ { 4 } } \ left ( 330 + \ frac { 554 Tc } { T } + \ frac { 121 Tc ^ { 2 } } { T ^ { 2 } } \ right )
 \ frac { d ^ 3 B ^ { ( 1 ) } } { dT ^ 3 } = \ frac { 3 Tc } { T ^ { 4 } } \ left ( - \ frac { 23 } { 25 } + \ frac { 4 Tc } { T } + \ frac { 97 Tc ^ { 2 } } { 50 T ^ { 2 } } + \ frac { 219 Tc ^ { 7 } } { 125 T ^ { 7 } } \ right )
 For the first indefinite integral of B :
 . . math : :
 \ int { B ^ { ( 0 ) } } dT = \ frac { 289 T } { 2000 } - \ frac { 33 Tc } { 100 } \ log { \ left ( T \ right ) } + \ frac { 1 } { 20000 T ^ { 2 } } \ left ( 2770 T Tc ^ { 2 } + 121 Tc ^ { 3 } \ right )
 \ int { B ^ { ( 1 ) } } dT = \ frac { 73 T } { 1000 } + \ frac { 23 Tc } { 50 } \ log { \ left ( T \ right ) } + \ frac { 1 } { 70000 T ^ { 7 } } \ left ( 35000 T ^ { 6 } Tc ^ { 2 } + 3395 T ^ { 5 } Tc ^ { 3 } + 73 Tc ^ { 8 } \ right )
 For the second indefinite integral of B :
 . . math : :
 \ int \ int B ^ { ( 0 ) } dT dT = \ frac { 289 T ^ { 2 } } { 4000 } - \ frac { 33 T } { 100 } Tc \ log { \ left ( T \ right ) } + \ frac { 33 T } { 100 } Tc + \ frac { 277 Tc ^ { 2 } } { 2000 } \ log { \ left ( T \ right ) } - \ frac { 121 Tc ^ { 3 } } { 20000 T }
 \ int \ int B ^ { ( 1 ) } dT dT = \ frac { 73 T ^ { 2 } } { 2000 } + \ frac { 23 T } { 50 } Tc \ log { \ left ( T \ right ) } - \ frac { 23 T } { 50 } Tc + \ frac { Tc ^ { 2 } } { 2 } \ log { \ left ( T \ right ) } - \ frac { 1 } { 420000 T ^ { 6 } } \ left ( 20370 T ^ { 5 } Tc ^ { 3 } + 73 Tc ^ { 8 } \ right )
 Examples
 Example matching that in BVirial _ Abbott , for isobutane .
 > > > BVirial _ Pitzer _ Curl ( 510 . , 425.2 , 38E5 , 0.193)
 -0.0002084535541385102
 References
 . . [ 1 ] Pitzer , Kenneth S . , and R . F . Curl . " The Volumetric and
 Thermodynamic Properties of Fluids . III . Empirical Equation for the
 Second Virial Coefficient1 . " Journal of the American Chemical Society
 79 , no . 10 ( May 1 , 1957 ) : 2369-70 . doi : 10.1021 / ja01567a007.'''


signature:
def BVirial_Abbott ( T , Tc , Pc , omega , order = 0 ) :
    r'''Calculates the second virial coefficient using the model in [ 1 ] _ .
 Simple fit to the Lee - Kesler equation .
 . . math : :
 B _ r = B ^ { ( 0 ) } + \ omega B ^ { ( 1 ) }
 B ^ { ( 0 ) } = 0.083 + \ frac { 0.422 } { T _ r ^ { 1.6 } }
 B ^ { ( 1 ) } = 0.139 - \ frac { 0.172 } { T _ r ^ { 4.2 } }
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 order : int , optional
 Order of the calculation . 0 for the calculation of B itself ; for 1/2/3,
 the first / second / third derivative of B with respect to temperature ; and
 for - 1 / - 2 , the first / second indefinite integral of B with respect to
 temperature . No other integrals or derivatives are implemented , and an
 exception will be raised if any other order is given .
 Returns
 B : float
 Second virial coefficient in density form or its integral / derivative if
 specified , [ m ^ 3 / mol or m ^ 3 / mol / K ^ order ]
 Notes
 Analytical models for derivatives and integrals are available for orders
 -2 , - 1 , 1 , 2 , and 3 , all obtained with SymPy .
 For first temperature derivative of B :
 . . math : :
 \ frac { d B ^ { ( 0 ) } } { dT } = \ frac { 0.6752 } { T \ left ( \ frac { T } { Tc } \ right ) ^ { 1.6 } }
 \ frac { d B ^ { ( 1 ) } } { dT } = \ frac { 0.7224 } { T \ left ( \ frac { T } { Tc } \ right ) ^ { 4.2 } }
 For the second temperature derivative of B :
 . . math : :
 \ frac { d ^ 2 B ^ { ( 0 ) } } { dT ^ 2 } = - \ frac { 1.75552 } { T ^ { 2 } \ left ( \ frac { T } { Tc } \ right ) ^ { 1.6 } }
 \ frac { d ^ 2 B ^ { ( 1 ) } } { dT ^ 2 } = - \ frac { 3.75648 } { T ^ { 2 } \ left ( \ frac { T } { Tc } \ right ) ^ { 4.2 } }
 For the third temperature derivative of B :
 . . math : :
 \ frac { d ^ 3 B ^ { ( 0 ) } } { dT ^ 3 } = \ frac { 6.319872 } { T ^ { 3 } \ left ( \ frac { T } { Tc } \ right ) ^ { 1.6 } }
 \ frac { d ^ 3 B ^ { ( 1 ) } } { dT ^ 3 } = \ frac { 23.290176 } { T ^ { 3 } \ left ( \ frac { T } { Tc } \ right ) ^ { 4.2 } }
 For the first indefinite integral of B :
 . . math : :
 \ int { B ^ { ( 0 ) } } dT = 0.083 T + \ frac { \ frac { 211 } { 300 } Tc } { \ left ( \ frac { T } { Tc } \ right ) ^ { 0.6 } }
 \ int { B ^ { ( 1 ) } } dT = 0.139 T + \ frac { 0.05375 Tc } { \ left ( \ frac { T } { Tc } \ right ) ^ { 3.2 } }
 For the second indefinite integral of B :
 . . math : :
 \ int \ int B ^ { ( 0 ) } dT dT = 0.0415 T ^ { 2 } + \ frac { 211 } { 120 } Tc ^ { 2 } \ left ( \ frac { T } { Tc } \ right ) ^ { 0.4}
 \ int \ int B ^ { ( 1 ) } dT dT = 0.0695 T ^ { 2 } - \ frac { \ frac { 43 } { 1760 } Tc ^ { 2 } } { \ left ( \ frac { T } { Tc } \ right ) ^ { 2.2 } }
 Examples
 Example is from [ 1 ] _ , p . 93 , and matches the result exactly , for isobutane .
 > > > BVirial _ Abbott ( 510 . , 425.2 , 38E5 , 0.193)
 -0.00020570178037383633
 References
 . . [ 1 ] Smith , H . C . Van Ness Joseph M . Introduction to Chemical Engineering
 Thermodynamics 4E 1987.'''


signature:
def BVirial_Tsonopoulos_extended ( T , Tc , Pc , omega , a = 0 , b = 0 , species_type = '' , dipole = 0 , order = 0 ) :
    r'''Calculates the second virial coefficient using the
 comprehensive model in [ 1 ] _ . See the notes for the calculation of ` a ` and
 . . math : :
 \ frac { BP _ c } { RT _ c } = B ^ { ( 0 ) } + \ omega B ^ { ( 1 ) } + a B ^ { ( 2 ) } + b B ^ { ( 3 ) }
 B ^ { ( 0 ) } = 0.1445-0.33 / T _ r - 0.1385 / T _ r ^ 2-0.0121 / T _ r ^ 3
 B ^ { ( 1 ) } = 0.0637 + 0.331 / T _ r ^ 2-0.423 / T _ r ^ 3 - 0.423 / T _ r ^ 3 - 0.008 / T _ r ^ 8
 B ^ { ( 2 ) } = 1 / T _ r ^ 6
 B ^ { ( 3 ) } = - 1 / T _ r ^ 8
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 a : float , optional
 Fit parameter , calculated based on species _ type if a is not given and
 species _ type matches on of the supported chemical classes .
 b : float , optional
 Fit parameter , calculated based on species _ type if a is not given and
 species _ type matches on of the supported chemical classes .
 species _ type : str , optional
 One of .
 dipole : float
 dipole moment , optional , [ Debye ]
 order : int , optional
 Order of the calculation . 0 for the calculation of B itself ; for 1/2/3,
 the first / second / third derivative of B with respect to temperature ; and
 for - 1 / - 2 , the first / second indefinite integral of B with respect to
 temperature . No other integrals or derivatives are implemented , and an
 exception will be raised if any other order is given .
 Returns
 B : float
 Second virial coefficient in density form or its integral / derivative if
 specified , [ m ^ 3 / mol or m ^ 3 / mol / K ^ order ]
 Notes
 Analytical models for derivatives and integrals are available for orders
 -2 , - 1 , 1 , 2 , and 3 , all obtained with SymPy .
 To calculate ` a ` or ` b ` , the following rules are used :
 For ' simple ' or ' normal ' fluids :
 . . math : :
 a = 0
 b = 0
 For ' ketone ' , ' aldehyde ' , ' alkyl nitrile ' , ' ether ' , ' carboxylic acid ' ,
 or ' ester ' types of chemicals :
 . . math : :
 a = - 2.14 \ times 10 ^ { - 4 } \ mu _ r - 4.308 \ times 10 ^ { - 21 } ( \ mu _ r ) ^ 8
 b = 0
 For ' alkyl halide ' , ' mercaptan ' , ' sulfide ' , or ' disulfide ' types of
 chemicals :
 . . math : :
 a = - 2.188 \ times 10 ^ { - 4 } ( \ mu _ r ) ^ 4 - 7.831 \ times 10 ^ { - 21 } ( \ mu _ r ) ^ 8
 b = 0
 For ' alkanol ' types of chemicals ( except methanol ) :
 . . math : :
 a = 0.0878
 b = 0.00908 + 0.0006957 \ mu _ r
 For methanol :
 . . math : :
 a = 0.0878
 b = 0.0525
 For water :
 . . math : :
 a = - 0.0109
 b = 0
 If required , the form of dipole moment used in the calculation of some
 types of ` a ` and ` b ` values is as follows :
 . . math : :
 \ mu _ r = 100000 \ frac { \ mu ^ 2 ( Pc / 101325.0 ) } { Tc ^ 2}
 For first temperature derivative of B :
 . . math : :
 \ frac { d B ^ { ( 0 ) } } { dT } = \ frac { 33 Tc } { 100 T ^ { 2 } } + \ frac { 277 Tc ^ { 2 } } { 1000 T ^ { 3 } } + \ frac { 363 Tc ^ { 3 } } { 10000 T ^ { 4 } } + \ frac { 607 Tc ^ { 8 } } { 125000 T ^ { 9 } }
 \ frac { d B ^ { ( 1 ) } } { dT } = - \ frac { 331 Tc ^ { 2 } } { 500 T ^ { 3 } } + \ frac { 1269 Tc ^ { 3 } } { 1000 T ^ { 4 } } + \ frac { 8 Tc ^ { 8 } } { 125 T ^ { 9 } }
 \ frac { d B ^ { ( 2 ) } } { dT } = - \ frac { 6 Tc ^ { 6 } } { T ^ { 7 } }
 \ frac { d B ^ { ( 3 ) } } { dT } = \ frac { 8 Tc ^ { 8 } } { T ^ { 9 } }
 For the second temperature derivative of B :
 . . math : :
 \ frac { d ^ 2 B ^ { ( 0 ) } } { dT ^ 2 } = - \ frac { 3 Tc } { 125000 T ^ { 3 } } \ left ( 27500 + \ frac { 34625 Tc } { T } + \ frac { 6050 Tc ^ { 2 } } { T ^ { 2 } } + \ frac { 1821 Tc ^ { 7 } } { T ^ { 7 } } \ right )
 \ frac { d ^ 2 B ^ { ( 1 ) } } { dT ^ 2 } = \ frac { 3 Tc ^ { 2 } } { 500 T ^ { 4 } } \ left ( 331 - \ frac { 846 Tc } { T } - \ frac { 96 Tc ^ { 6 } } { T ^ { 6 } } \ right )
 \ frac { d ^ 2 B ^ { ( 2 ) } } { dT ^ 2 } = \ frac { 42 Tc ^ { 6 } } { T ^ { 8 } }
 \ frac { d ^ 2 B ^ { ( 3 ) } } { dT ^ 2 } = - \ frac { 72 Tc ^ { 8 } } { T ^ { 10 } }
 For the third temperature derivative of B :
 . . math : :
 \ frac { d ^ 3 B ^ { ( 0 ) } } { dT ^ 3 } = \ frac { 3 Tc } { 12500 T ^ { 4 } } \ left ( 8250 + \ frac { 13850 Tc } { T } + \ frac { 3025 Tc ^ { 2 } } { T ^ { 2 } } + \ frac { 1821 Tc ^ { 7 } } { T ^ { 7 } } \ right )
 \ frac { d ^ 3 B ^ { ( 1 ) } } { dT ^ 3 } = \ frac { 3 Tc ^ { 2 } } { 250 T ^ { 5 } } \ left ( - 662 + \ frac { 2115 Tc } { T } + \ frac { 480 Tc ^ { 6 } } { T ^ { 6 } } \ right )
 \ frac { d ^ 3 B ^ { ( 2 ) } } { dT ^ 3 } = - \ frac { 336 Tc ^ { 6 } } { T ^ { 9 } }
 \ frac { d ^ 3 B ^ { ( 3 ) } } { dT ^ 3 } = \ frac { 720 Tc ^ { 8 } } { T ^ { 11 } }
 For the first indefinite integral of B :
 . . math : :
 \ int { B ^ { ( 0 ) } } dT = \ frac { 289 T } { 2000 } - \ frac { 33 Tc } { 100 } \ log { \ left ( T \ right ) } + \ frac { 1 } { 700000 T ^ { 7 } } \ left ( 969500 T ^ { 6 } Tc ^ { 2 } + 42350 T ^ { 5 } Tc ^ { 3 } + 607 Tc ^ { 8 } \ right )
 \ int { B ^ { ( 1 ) } } dT = \ frac { 637 T } { 10000 } - \ frac { 1 } { 70000 T ^ { 7 } } \ left ( 23170 T ^ { 6 } Tc ^ { 2 } - 14805 T ^ { 5 } Tc ^ { 3 } - 80 Tc ^ { 8 } \ right )
 \ int { B ^ { ( 2 ) } } dT = - \ frac { Tc ^ { 6 } } { 5 T ^ { 5 } }
 \ int { B ^ { ( 3 ) } } dT = \ frac { Tc ^ { 8 } } { 7 T ^ { 7 } }
 For the second indefinite integral of B :
 . . math : :
 \ int \ int B ^ { ( 0 ) } dT dT = \ frac { 289 T ^ { 2 } } { 4000 } - \ frac { 33 T } { 100 } Tc \ log { \ left ( T \ right ) } + \ frac { 33 T } { 100 } Tc + \ frac { 277 Tc ^ { 2 } } { 2000 } \ log { \ left ( T \ right ) } - \ frac { 1 } { 4200000 T ^ { 6 } } \ left ( 254100 T ^ { 5 } Tc ^ { 3 } + 607 Tc ^ { 8 } \ right )
 \ int \ int B ^ { ( 1 ) } dT dT = \ frac { 637 T ^ { 2 } } { 20000 } - \ frac { 331 Tc ^ { 2 } } { 1000 } \ log { \ left ( T \ right ) } - \ frac { 1 } { 210000 T ^ { 6 } } \ left ( 44415 T ^ { 5 } Tc ^ { 3 } + 40 Tc ^ { 8 } \ right )
 \ int \ int B ^ { ( 2 ) } dT dT = \ frac { Tc ^ { 6 } } { 20 T ^ { 4 } }
 \ int \ int B ^ { ( 3 ) } dT dT = - \ frac { Tc ^ { 8 } } { 42 T ^ { 6 } }
 Examples
 Example from Perry ' s Handbook , 8E , p2-499 . Matches to a decimal place .
 > > > BVirial _ Tsonopoulos _ extended ( 430 . , 405.65 , 11.28E6 , 0.252608 , a = 0 , b = 0 , species _ type = ' ketone ' , dipole = 1.469)
 -9.679715056695323e - 05
 References
 . . [ 1 ] Tsonopoulos , C . , and J . L . Heidman . " From the Virial to the Cubic
 Equation of State . " Fluid Phase Equilibria 57 , no . 3 ( 1990 ) : 261-76.
 doi : 10.1016/0378-3812(90)85126 - U
 . . [ 2 ] Tsonopoulos , Constantine , and John H . Dymond . " Second Virial
 Coefficients of Normal Alkanes , Linear 1 - Alkanols ( and Water ) , Alkyl
 Ethers , and Their Mixtures . " Fluid Phase Equilibria , International
 Workshop on Vapour - Liquid Equilibria and Related Properties in Binary
 and Ternary Mixtures of Ethers , Alkanes and Alkanols , 133 , no . 1-2
 ( June 1997 ) : 11-34 . doi : 10.1016 / S0378-3812(97)00058-7.'''


signature:
def smarts_fragment ( catalog , rdkitmol = None , smi = None ) :
    r'''Fragments a molecule into a set of unique groups and counts as
 specified by the ` catalog ` . The molecule can either be an rdkit
 molecule object , or a smiles string which will be parsed by rdkit .
 Returns a dictionary of groups and their counts according to the
 indexes of the catalog provided .
 Parameters
 catalog : dict
 Dictionary indexed by keys pointing to smarts strings , [ - ]
 rdkitmol : mol , optional
 Molecule as rdkit object , [ - ]
 smi : str , optional
 Smiles string representing a chemical , [ - ]
 Returns
 counts : dict
 Dictionaty of integer counts of the found groups only , indexed by
 the same keys used by the catalog [ - ]
 success : bool
 Whether or not molecule was fully and uniquely fragmented , [ - ]
 status : str
 A string holding an explanation of why the molecule failed to be
 fragmented , if it fails ; ' OK ' if it suceeds .
 Notes
 Raises an exception if rdkit is not installed , or ` smi ` or ` rdkitmol ` is
 not defined .
 Examples
 Acetone :
 > > > smarts _ fragment ( catalog = J _ BIGGS _ JOBACK _ SMARTS _ id _ dict , smi = ' CC ( = O ) C ' )
 ( { 24 : 1 , 1 : 2 } , True , ' OK ' )
 Sodium sulfate , ( Na2O4S ) :
 > > > smarts _ fragment ( catalog = J _ BIGGS _ JOBACK _ SMARTS _ id _ dict , smi = ' [ O - ] S ( = O ) ( = O ) [ O - ] . [ Na + ] . [ Na + ] ' )
 ( { 29 : 4 } , False , ' Did not match all atoms present ' )
 Propionic anhydride ( C6H10O3 ) :
 > > > smarts _ fragment ( catalog = J _ BIGGS _ JOBACK _ SMARTS _ id _ dict , smi = ' CCC ( = O ) OC ( = O ) CC ' )
 ( { 1 : 2 , 2 : 2 , 28 : 2 } , False , ' Matched some atoms repeatedly : [ 4 ] ' )'''

implementation:
if not hasRDKit : # pragma : no cover
    raise Exception ( rdkit_missing )
if rdkitmol is None and smi is None :
    raise Exception ( 'Either an rdkit mol or a smiles string is required' )
if smi is not None :
    rdkitmol = Chem . MolFromSmiles ( smi )
    if rdkitmol is None :
        status = 'Failed to construct mol'
        success = False
        return { } , success , status
atom_count = len ( rdkitmol . GetAtoms ( ) )
status = 'OK'
success = True
counts = { }
all_matches = { }
for key , smart in catalog . items ( ) :
    patt = Chem . MolFromSmarts ( smart )
    hits = rdkitmol . GetSubstructMatches ( patt )
    if hits :
        all_matches [ smart ] = hits
        counts [ key ] = len ( hits )
matched_atoms = set ( )
for i in all_matches . values ( ) :
    for j in i :
        matched_atoms . update ( j )
if len ( matched_atoms ) != atom_count :
    status = 'Did not match all atoms present'
    success = False
# Check the atom aount again , this time looking for duplicate matches ( only if have yet to fail )
if success :
    matched_atoms = [ ]
    for i in all_matches . values ( ) :
        for j in i :
            matched_atoms . extend ( j )
    if len ( matched_atoms ) < atom_count :
        status = 'Matched %d of %d atoms only' % ( len ( matched_atoms ) , atom_count )
        success = False
    elif len ( matched_atoms ) > atom_count :
        status = 'Matched some atoms repeatedly: %s' % ( [ i for i , c in Counter ( matched_atoms ) . items ( ) if c > 1 ] )
        success = False
return counts , success , status


signature:
def estimate ( self ) :
    '''Method to compute all available properties with the Joback method ;
 returns their results as a dict . For the tempearture dependent values
 Cpig and mul , both the coefficients and objects to perform calculations
 are returned .'''

implementation:
# Pre - generate the coefficients or they will not be returned
self . mul ( 300 )
self . Cpig ( 300 )
estimates = { 'Tb' : self . Tb ( self . counts ) , 'Tm' : self . Tm ( self . counts ) , 'Tc' : self . Tc ( self . counts , self . Tb_estimated ) , 'Pc' : self . Pc ( self . counts , self . atom_count ) , 'Vc' : self . Vc ( self . counts ) , 'Hf' : self . Hf ( self . counts ) , 'Gf' : self . Gf ( self . counts ) , 'Hfus' : self . Hfus ( self . counts ) , 'Hvap' : self . Hvap ( self . counts ) , 'mul' : self . mul , 'mul_coeffs' : self . calculated_mul_coeffs , 'Cpig' : self . Cpig , 'Cpig_coeffs' : self . calculated_Cpig_coeffs }
return estimates


signature:
def Tb ( counts ) :
    r'''Estimates the normal boiling temperature of an organic compound
 using the Joback method as a function of chemical structure only .
 . . math : :
 T _ b = 198.2 + \ sum _ i { T _ { b , i } }
 For 438 compounds tested by Joback , the absolute average error was
 12.91 K and standard deviation was 17.85 K ; the average relative error
 was 3.6 % .
 Parameters
 counts : dict
 Dictionary of Joback groups present ( numerically indexed ) and their
 counts , [ - ]
 Returns
 Tb : float
 Estimated normal boiling temperature , [ K ]
 Examples
 > > > Joback . Tb ( { 1 : 2 , 24 : 1 } )
 322.11'''

implementation:
tot = 0.0
for group , count in counts . items ( ) :
    tot += joback_groups_id_dict [ group ] . Tb * count
Tb = 198.2 + tot
return Tb