signature:
def ITS90_68_difference ( T ) :
    r'''Calculates the difference between ITS - 90 and ITS - 68 scales using a
 series of models listed in [ 1 ] _ , [ 2 ] _ , and [ 3 ] _ .
 The temperature difference is given by the following equations :
 From 13.8 K to 73.15 K :
 . . math : :
 T _ { 90 } - T _ { 68 } = a _ 0 + \ sum _ { i = 1 } ^ { 12 } a _ i [ ( T _ { 90 } / K - 40 ) / 40 ] ^ i
 From 83.8 K to 903.75 K :
 . . math : :
 T _ { 90 } - T _ { 68 } = \ sum _ { i = 1 } ^ 8 b _ i [ ( T _ { 90 } / K - 273.15 ) / 630 ] ^ i
 From 903.75 K to 1337.33 K :
 . . math : :
 T _ { 90 } - T _ { 68 } = \ sum _ { i = 0 } ^ 5 c _ i [ T _ { 90 } / ^ \ circ C ] ^ i
 Above 1337.33 K :
 . . math : :
 T _ { 90 } - T _ { 68 } = - 1.398 \ cdot 10 ^ { - 7 } \ left ( \ frac { T _ { 90 } } { K } \ right ) ^ 2
 Parameters
 T : float
 Temperature , ITS - 90 , or approximately ITS - 68 [ K ]
 Returns
 dT : float
 Temperature , difference between ITS - 90 and ITS - 68 at T [ K ]
 Notes
 The conversion is straightforward when T90 is known . Theoretically , the
 model should be solved numerically to convert the reverse way . However ,
 according to [ 4 ] _ , the difference is under 0.05 mK from 73.15 K to
 903.15 K , and under 0.26 mK up to 1337.33 K .
 For temperatures under 13.8 K , no conversion is performed .
 The first set of coefficients are :
 -0.005903 , 0.008174 , - 0.061924 , - 0.193388 , 1.490793 , 1.252347 , - 9.835868,
 1.411912 , 25.277595 , - 19.183815 , - 18.437089 , 27.000895 , - 8.716324.
 The second set of coefficients are :
 0 , - 0.148759 , - 0.267408 , 1.08076 , 1.269056 , - 4.089591 , - 1.871251,
 7.438081 , - 3.536296.
 The third set of coefficients are :
 7.8687209E1 , - 4.7135991E - 1 , 1.0954715E - 3 , - 1.2357884E - 6 , 6.7736583E - 10,
 -1.4458081E - 13.
 These last coefficients use the temperature in degrees Celcius . A slightly
 older model used the following coefficients but a different equation over
 the same range :
 -0.00317 , - 0.97737 , 1.2559 , 2.03295 , - 5.91887 , - 3.23561 , 7.23364,
 5.04151 . The model for these coefficients was :
 . . math : :
 T _ { 90 } - T _ { 68 } = c _ 0 + \ sum _ { i = 1 } ^ 7 c _ i [ ( T _ { 90 } / K - 1173.15 ) / 300 ] ^ i
 For temperatures larger than several thousand K , the differences have no
 meaning and grows quadratically .
 Examples
 > > > ITS90_68 _ difference ( 1000 . )
 0.01231818956580355
 References
 . . [ 1 ] Bedford , R . E . , G . Bonnier , H . Maas , and F . Pavese . " Techniques for
 Approximating the International Temperature Scale of 1990 . " Bureau
 International Des Poids et Mesures , Sfievres , 1990.
 . . [ 2 ] Wier , Ron D . , and Robert N . Goldberg . " On the Conversion of
 Thermodynamic Properties to the Basis of the International Temperature
 Scale of 1990 . " The Journal of Chemical Thermodynamics 28 , no . 3
 ( March 1996 ) : 261-76 . doi : 10.1006 / jcht . 1996.0026.
 . . [ 3 ] Goldberg , Robert N . , and R . D . Weir . " Conversion of Temperatures
 and Thermodynamic Properties to the Basis of the International
 Temperature Scale of 1990 ( Technical Report ) . " Pure and Applied
 Chemistry 64 , no . 10 ( 1992 ) : 1545-1562 . doi : 10.1351 / pac199264101545.
 . . [ 4 ] Code10 . info . " Conversions among International Temperature Scales . "
 Accessed May 22 , 2016 . http : / / www . code10 . info / index . php % 3Foption % 3Dcom _ content % 26view % 3Darticle % 26id % 3D83 : conversions - among - international - temperature - scales % 26catid % 3D60 : temperature % 26Itemid % 3D83.'''


signature:
def T_converter ( T , current , desired ) :
    r'''Converts the a temperature reading made in any of the scales
 ' ITS - 90 ' , ' ITS - 68 ' , ' ITS - 48 ' , ' ITS - 76 ' , or ' ITS - 27 ' to any of the other
 scales . Not all temperature ranges can be converted to other ranges ; for
 instance , ' ITS - 76 ' is purely for low temperatures , and 5 K on it has no
 conversion to ' ITS - 90 ' or any other scale . Both a conversion to ITS - 90 and
 to the desired scale must be possible for the conversion to occur .
 The conversion uses cubic spline interpolation .
 ITS - 68 conversion is valid from 14 K to 4300 K .
 ITS - 48 conversion is valid from 93.15 K to 4273.15 K
 ITS - 76 conversion is valid from 5 K to 27 K .
 ITS - 27 is valid from 903.15 K to 4273.15 k .
 Parameters
 T : float
 Temperature , on ` current ` scale [ K ]
 current : str
 String representing the scale T is in , ' ITS - 90 ' , ' ITS - 68 ' ,
 ' ITS - 48 ' , ' ITS - 76 ' , or ' ITS - 27 ' .
 desired : str
 String representing the scale T will be returned in , ' ITS - 90 ' ,
 ' ITS - 68 ' , ' ITS - 48 ' , ' ITS - 76 ' , or ' ITS - 27 ' .
 Returns
 T : float
 Temperature , on scale ` desired ` [ K ]
 Notes
 Because the conversion is performed by spline functions , a re - conversion
 of a value will not yield exactly the original value . However , it is quite
 close .
 The use of splines is quite quick ( 20 micro seconds / calculation ) . While
 just a spline for one - way conversion could be used , a numerical solver
 would have to be used to obtain an exact result for the reverse conversion .
 This was found to take approximately 1 ms / calculation , depending on the
 region .
 Examples
 > > > T _ converter ( 500 , ' ITS - 68 ' , ' ITS - 48 ' )
 499.9470092992346
 References
 . . [ 1 ] Wier , Ron D . , and Robert N . Goldberg . " On the Conversion of
 Thermodynamic Properties to the Basis of the International Temperature
 Scale of 1990 . " The Journal of Chemical Thermodynamics 28 , no . 3
 ( March 1996 ) : 261-76 . doi : 10.1006 / jcht . 1996.0026.
 . . [ 2 ] Goldberg , Robert N . , and R . D . Weir . " Conversion of Temperatures
 and Thermodynamic Properties to the Basis of the International
 Temperature Scale of 1990 ( Technical Report ) . " Pure and Applied
 Chemistry 64 , no . 10 ( 1992 ) : 1545-1562 . doi : 10.1351 / pac199264101545.'''

implementation:
def range_check ( T , Tmin , Tmax ) :
    if T < Tmin or T > Tmax :
        raise Exception ( 'Temperature conversion is outside one or both scales' )
try :
    if current == 'ITS-90' :
        pass
    elif current == 'ITS-68' :
        range_check ( T , 13.999 , 4300.0001 )
        T = T68_to_T90 ( T )
    elif current == 'ITS-76' :
        range_check ( T , 4.9999 , 27.0001 )
        T = T76_to_T90 ( T )
    elif current == 'ITS-48' :
        range_check ( T , 93.149999 , 4273.15001 )
        T = T48_to_T90 ( T )
    elif current == 'ITS-27' :
        range_check ( T , 903.15 , 4273.15 )
        T = T27_to_T90 ( T )
    else :
        raise Exception ( 'Current scale not supported' )
    # T should be in ITS - 90 now
    if desired == 'ITS-90' :
        pass
    elif desired == 'ITS-68' :
        range_check ( T , 13.999 , 4300.0001 )
        T = T90_to_T68 ( T )
    elif desired == 'ITS-76' :
        range_check ( T , 4.9999 , 27.0001 )
        T = T90_to_T76 ( T )
    elif desired == 'ITS-48' :
        range_check ( T , 93.149999 , 4273.15001 )
        T = T90_to_T48 ( T )
    elif desired == 'ITS-27' :
        range_check ( T , 903.15 , 4273.15 )
        T = T90_to_T27 ( T )
    else :
        raise Exception ( 'Desired scale not supported' )
except ValueError :
    raise Exception ( 'Temperature could not be converted to desired scale' )
return float ( T )


signature:
def GWP ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s Global Warming
 Potential , relative to CO2 . Lookup is based on CASRNs . Will automatically
 select a data source to use if no Method is provided ; returns None if the
 data is not available .
 Returns the GWP for the 100yr outlook by default .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 GWP : float
 Global warming potential , [ ( impact / mass chemical ) / ( impact / mass CO2 ) ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain GWP with the
 given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Accepted methods are IPCC ( 2007 ) 100yr ' ,
 ' IPCC ( 2007 ) 100yr - SAR ' , ' IPCC ( 2007 ) 20yr ' , and ' IPCC ( 2007 ) 500yr ' .
 All valid values are also held in the list GWP _ methods .
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the GWP for the desired chemical , and will return methods
 instead of the GWP
 Notes
 All data is from [ 1 ] _ , the official source . Several chemicals are available
 in [ 1 ] _ are not included here as they do not have a CAS .
 Methods are ' IPCC ( 2007 ) 100yr ' , ' IPCC ( 2007 ) 100yr - SAR ' ,
 ' IPCC ( 2007 ) 20yr ' , and ' IPCC ( 2007 ) 500yr ' .
 Examples
 Methane , 100 - yr outlook
 > > > GWP ( CASRN = ' 74-82-8 ' )
 25.0
 References
 . . [ 1 ] IPCC . " 2.10.2 Direct Global Warming Potentials - AR4 WGI Chapter 2:
 Changes in Atmospheric Constituents and in Radiative Forcing . " 2007.
 https : / / www . ipcc . ch / publications _ and _ data / ar4 / wg1 / en / ch2s2-10-2 . html .'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in GWP_data . index :
        methods . append ( IPCC100 )
        if not pd . isnull ( GWP_data . at [ CASRN , 'SAR 100yr' ] ) :
            methods . append ( IPCC100SAR )
        methods . append ( IPCC20 )
        methods . append ( IPCC500 )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == IPCC100 :
    return float ( GWP_data . at [ CASRN , '100yr GWP' ] )
elif Method == IPCC100SAR :
    return float ( GWP_data . at [ CASRN , 'SAR 100yr' ] )
elif Method == IPCC20 :
    return float ( GWP_data . at [ CASRN , '20yr GWP' ] )
elif Method == IPCC500 :
    return float ( GWP_data . at [ CASRN , '500yr GWP' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def ODP ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s Ozone Depletion
 Potential , relative to CFC - 11 ( trichlorofluoromethane ) . Lookup is based on
 CASRNs . Will automatically select a data source to use if no Method is
 provided ; returns None if the data is not available .
 Returns the ODP of a chemical according to [ 2 ] _ when a method is not
 specified . If a range is provided in [ 2 ] _ , the highest value is returned .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 ODP : float or str
 Ozone Depletion potential , [ ( impact / mass chemical ) / ( impact / mass CFC - 11 ) ] ;
 if method selected has ` string ` in it , this will be returned as a
 string regardless of if a range is given or a number
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain ODP with the
 given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Accepted methods are ' ODP2 Max ' , ' ODP2 Min ' ,
 ' ODP2 string ' , ' ODP2 logarithmic average ' , and methods for older values
 are ' ODP1 Max ' , ' ODP1 Min ' , ' ODP1 string ' , and ' ODP1 logarithmic average ' .
 All valid values are also held in the list ODP _ methods .
 Method : string , optional
 A string for the method name to use , as defined by constants in
 ODP _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the ODP for the desired chemical , and will return methods
 instead of the ODP
 Notes
 Values are tabulated only for a small number of halogenated hydrocarbons ,
 responsible for the largest impact . The original values of ODP as defined
 in the Montreal Protocol are also available , as methods with the ` ODP1 `
 prefix .
 All values are somewhat emperical , as actual reaction rates of chemicals
 with ozone depend on temperature which depends on latitude , longitude ,
 time of day , weather , and the concentrations of other pollutants .
 All data is from [ 1 ] _ . Several mixtures listed in [ 1 ] _ are not included
 here as they are not pure species .
 Methods for values in [ 2 ] _ are ' ODP2 Max ' , ' ODP2 Min ' , ' ODP2 string ' ,
 ' ODP2 logarithmic average ' , and methods for older values are ' ODP1 Max ' ,
 ' ODP1 Min ' , ' ODP1 string ' , and ' ODP1 logarithmic average ' .
 Examples
 Dichlorotetrafluoroethane , according to [ 2 ] _ .
 > > > ODP ( CASRN = ' 76-14-2 ' )
 0.58
 References
 . . [ 1 ] US EPA , OAR . " Ozone - Depleting Substances . " Accessed April 26 , 2016.
 https : / / www . epa . gov / ozone - layer - protection / ozone - depleting - substances .
 . . [ 2 ] WMO ( World Meteorological Organization ) , 2011 : Scientific Assessment
 of Ozone Depletion : 2010 . Global Ozone Research and Monitoring
 Project - Report No . 52 , Geneva , Switzerland , 516 p .
 https : / / www . wmo . int / pages / prog / arep / gaw / ozone _ 2010 / documents / Ozone - Assessment - 2010 - complete . pdf'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in ODP_data . index :
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP2 Max' ] ) :
            methods . append ( ODP2MAX )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP1 Max' ] ) :
            methods . append ( ODP1MAX )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP2 Design' ] ) :
            methods . append ( ODP2LOG )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP1 Design' ] ) :
            methods . append ( ODP1LOG )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP2 Min' ] ) :
            methods . append ( ODP2MIN )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP1 Min' ] ) :
            methods . append ( ODP1MIN )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP2' ] ) :
            methods . append ( ODP2STR )
        if not pd . isnull ( ODP_data . at [ CASRN , 'ODP1' ] ) :
            methods . append ( ODP1STR )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ODP2MAX :
    return float ( ODP_data . at [ CASRN , 'ODP2 Max' ] )
elif Method == ODP1MAX :
    return float ( ODP_data . at [ CASRN , 'ODP1 Max' ] )
elif Method == ODP2MIN :
    return float ( ODP_data . at [ CASRN , 'ODP2 Min' ] )
elif Method == ODP1MIN :
    return float ( ODP_data . at [ CASRN , 'ODP1 Min' ] )
elif Method == ODP2LOG :
    return float ( ODP_data . at [ CASRN , 'ODP2 Design' ] )
elif Method == ODP1LOG :
    return float ( ODP_data . at [ CASRN , 'ODP1 Design' ] )
elif Method == ODP2STR :
    return str ( ODP_data . at [ CASRN , 'ODP2' ] )
elif Method == ODP1STR :
    return str ( ODP_data . at [ CASRN , 'ODP1' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def logP ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s octanol - water
 partition coefficient . Lookup is based on CASRNs . Will automatically
 select a data source to use if no Method is provided ; returns None if the
 data is not available .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 logP : float
 Octanol - water partition coefficient , [ - ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain logP with the
 given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Accepted methods are ' SYRRES ' , or ' CRC ' ,
 All valid values are also held in the list logP _ methods .
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the logP for the desired chemical , and will return methods
 instead of the logP
 Notes
 . . math : :
 \ log P _ { oct / wat } = \ log \ left ( \ frac { \ left [ { solute }
 \ right ] _ { octanol } ^ { un - ionized } } { \ left [ { solute }
 \ right ] _ { water } ^ { un - ionized } } \ right )
 Examples
 > > > logP ( ' 67-56-1 ' )
 -0.74
 References
 . . [ 1 ] Syrres . 2006 . KOWWIN Data , SrcKowData2 . zip .
 http : / / esc . syrres . com / interkow / Download / SrcKowData2 . zip
 . . [ 2 ] Haynes , W . M . , Thomas J . Bruno , and David R . Lide . CRC Handbook of
 Chemistry and Physics , 95E . Boca Raton , FL : CRC press , 2014.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in CRClogPDict . index :
        methods . append ( CRC )
    if CASRN in SyrresDict2 . index :
        methods . append ( SYRRES )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == CRC :
    return float ( CRClogPDict . at [ CASRN , 'logP' ] )
elif Method == SYRRES :
    return float ( SyrresDict2 . at [ CASRN , 'logP' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def Antoine ( T , A , B , C , base = 10.0 ) :
    r'''Calculates vapor pressure of a chemical using the Antoine equation .
 Parameters ` A ` , ` B ` , and ` C ` are chemical - dependent . Parameters can be
 found in numerous sources ; however units of the coefficients used vary .
 Originally proposed by Antoine ( 1888 ) [ 2 ] _ .
 . . math : :
 \ log _ { \ text { base } } P ^ { \ text { sat } } = A - \ frac { B } { T + C }
 Parameters
 T : float
 Temperature of fluid , [ K ]
 A , B , C : floats
 Regressed coefficients for Antoine equation for a chemical
 Returns
 Psat : float
 Vapor pressure calculated with coefficients [ Pa ]
 Other Parameters
 Base : float
 Optional base of logarithm ; 10 by default
 Notes
 Assumes coefficients are for calculating vapor pressure in Pascal .
 Coefficients should be consistent with input temperatures in Kelvin ;
 however , if both the given temperature and units are specific to degrees
 Celcius , the result will still be correct .
 * * Converting units in input coefficients : * *
 * * * ln to log10 * * : Divide A and B by ln ( 10 ) = 2.302585 to change
 parameters for a ln equation to a log10 equation .
 * * * log10 to ln * * : Multiply A and B by ln ( 10 ) = 2.302585 to change
 parameters for a log equation to a ln equation .
 * * * mmHg to Pa * * : Add log10(101325/760 ) = 2.1249 to A .
 * * * kPa to Pa * * : Add log _ { base } ( 1000 ) = 6.908 to A for log ( base )
 * * * ° C to K * * : Subtract 273.15 from C only !
 Examples
 Methane , coefficients from [ 1 ] _ , at 100 K :
 > > > Antoine ( 100.0 , 8.7687 , 395.744 , - 6.469)
 34478.367349639906
 Tetrafluoromethane , coefficients from [ 1 ] _ , at 180 K
 > > > Antoine ( 180 , A = 8.95894 , B = 510.595 , C = - 15.95)
 702271.0518579542
 Oxygen at 94.91 K , with coefficients from [ 3 ] _ in units of ° C , mmHg , log10,
 showing the conversion of coefficients A ( mmHg to Pa ) and C ( ° C to K )
 > > > Antoine ( 94.91 , 6.83706 + 2.1249 , 339.2095 , 268.70-273.15)
 162978.88655572367
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.
 . . [ 2 ] Antoine , C . 1888 . Tensions des Vapeurs : Nouvelle Relation Entre les
 Tensions et les Tempé . Compt . Rend . 107:681-684.
 . . [ 3 ] Yaws , Carl L . The Yaws Handbook of Vapor Pressure : Antoine
 Coefficients . 1 edition . Houston , Tex : Gulf Publishing Company , 2007.'''

implementation: return base ** ( A - B / ( T + C ) )


signature:
def TRC_Antoine_extended ( T , Tc , to , A , B , C , n , E , F ) :
    r'''Calculates vapor pressure of a chemical using the TRC Extended Antoine
 equation . Parameters are chemical dependent , and said to be from the
 Thermodynamics Research Center ( TRC ) at Texas A & M . Coefficients for various
 chemicals can be found in [ 1 ] _ .
 . . math : :
 \ log _ { 10 } P ^ { sat } = A - \ frac { B } { T + C } + 0.43429x ^ n + Ex ^ 8 + Fx ^ { 12}
 x = \ max \ left ( \ frac { T - t _ o - 273.15 } { T _ c } , 0 \ right )
 Parameters
 T : float
 Temperature of fluid , [ K ]
 A , B , C , n , E , F : floats
 Regressed coefficients for the Antoine Extended ( TRC ) equation ,
 specific for each chemical , [ - ]
 Returns
 Psat : float
 Vapor pressure calculated with coefficients [ Pa ]
 Notes
 Assumes coefficients are for calculating vapor pressure in Pascal .
 Coefficients should be consistent with input temperatures in Kelvin ;
 Examples
 Tetrafluoromethane , coefficients from [ 1 ] _ , at 180 K :
 > > > TRC _ Antoine _ extended ( 180.0 , 227.51 , - 120 . , 8.95894 , 510.595 , - 15.95,
 . . . 2.41377 , - 93.74 , 7425.9)
 706317.0898414153
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''


signature:
def Wagner_original ( T , Tc , Pc , a , b , c , d ) :
    r'''Calculates vapor pressure using the Wagner equation ( 3 , 6 form ) .
 Requires critical temperature and pressure as well as four coefficients
 specific to each chemical .
 . . math : :
 \ ln P ^ { sat } = \ ln P _ c + \ frac { a \ tau + b \ tau ^ { 1.5 } + c \ tau ^ 3 + d \ tau ^ 6}
 { T _ r }
 \ tau = 1 - \ frac { T } { T _ c }
 Parameters
 T : float
 Temperature of fluid , [ K ]
 Tc : float
 Critical temperature , [ K ]
 Pc : float
 Critical pressure , [ Pa ]
 a , b , c , d : floats
 Parameters for wagner equation . Specific to each chemical . [ - ]
 Returns
 Psat : float
 Vapor pressure at T [ Pa ]
 Notes
 Warning : Pc is often treated as adjustable constant .
 Examples
 Methane , coefficients from [ 2 ] _ , at 100 K .
 > > > Wagner _ original ( 100.0 , 190.53 , 4596420 . , a = - 6.00435 , b = 1.1885,
 . . . c = - 0.834082 , d = - 1.22833)
 34520.44601450496
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.
 . . [ 2 ] McGarry , Jack . " Correlation and Prediction of the Vapor Pressures of
 Pure Liquids over Large Pressure Ranges . " Industrial & Engineering
 Chemistry Process Design and Development 22 , no . 2 ( April 1 , 1983 ) :
 313-22 . doi : 10.1021 / i200021a023.'''

implementation:
Tr = T / Tc
tau = 1.0 - Tr
return Pc * exp ( ( a * tau + b * tau ** 1.5 + c * tau ** 3 + d * tau ** 6 ) / Tr )


signature:
def boiling_critical_relation ( T , Tb , Tc , Pc ) :
    r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
 CSP relationship as in [ 1 ] _ ; requires a chemical ' s critical temperature
 and pressure as well as boiling point .
 The vapor pressure is given by :
 . . math : :
 \ ln P ^ { sat } _ r = h \ left ( 1 - \ frac { 1 } { T _ r } \ right )
 h = T _ { br } \ frac { \ ln ( P _ c / 101325 ) } { 1 - T _ { br } }
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tb : float
 Boiling temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Returns
 Psat : float
 Vapor pressure at T [ Pa ]
 Notes
 Units are Pa . Formulation makes intuitive sense ; a logarithmic form of
 interpolation .
 Examples
 Example as in [ 1 ] _ for ethylbenzene
 > > > boiling _ critical _ relation ( 347.2 , 409.3 , 617.1 , 36E5)
 15209.467273093938
 References
 . . [ 1 ] Reid , Robert C . . ; Prausnitz , John M . ; ; Poling , Bruce E .
 The Properties of Gases and Liquids . McGraw - Hill Companies , 1987.'''

implementation:
Tbr = Tb / Tc
Tr = T / Tc
h = Tbr * log ( Pc / 101325. ) / ( 1 - Tbr )
return exp ( h * ( 1 - 1 / Tr ) ) * Pc


signature:
def Lee_Kesler ( T , Tc , Pc , omega ) :
    r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
 CSP relationship by [ 1 ] _ ; requires a chemical ' s critical temperature and
 acentric factor .
 The vapor pressure is given by :
 . . math : :
 \ ln P ^ { sat } _ r = f ^ { ( 0 ) } + \ omega f ^ { ( 1 ) }
 f ^ { ( 0 ) } = 5.92714 - \ frac { 6.09648 } { T _ r } - 1.28862 \ ln T _ r + 0.169347T _ r ^ 6
 f ^ { ( 1 ) } = 15.2518 - \ frac { 15.6875 } { T _ r } - 13.4721 \ ln T _ r + 0.43577T _ 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 [ - ]
 Returns
 Psat : float
 Vapor pressure at T [ Pa ]
 Notes
 This equation appears in [ 1 ] _ in expanded form .
 The reduced pressure form of the equation ensures predicted vapor pressure
 cannot surpass the critical pressure .
 Examples
 Example from [ 2 ] _ ; ethylbenzene at 347.2 K .
 > > > Lee _ Kesler ( 347.2 , 617.1 , 36E5 , 0.299)
 13078.694162949312
 References
 . . [ 1 ] Lee , Byung Ik , and Michael G . Kesler . " A Generalized Thermodynamic
 Correlation Based on Three - Parameter Corresponding States . " AIChE Journal
 21 , no . 3 ( 1975 ) : 510-527 . doi : 10.1002 / aic . 690210313.
 . . [ 2 ] Reid , Robert C . . ; Prausnitz , John M . ; ; Poling , Bruce E .
 The Properties of Gases and Liquids . McGraw - Hill Companies , 1987.'''


signature:
def Ambrose_Walton ( T , Tc , Pc , omega ) :
    r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
 CSP relationship by [ 1 ] _ ; requires a chemical ' s critical temperature and
 acentric factor .
 The vapor pressure is given by :
 . . math : :
 \ ln P _ r = f ^ { ( 0 ) } + \ omega f ^ { ( 1 ) } + \ omega ^ 2f ^ { ( 2 ) }
 f ^ { ( 0 ) } = \ frac { - 5.97616 \ tau + 1.29874 \ tau ^ { 1.5 } - 0.60394 \ tau ^ { 2.5}
 -1.06841 \ tau ^ 5 } { T _ r }
 f ^ { ( 1 ) } = \ frac { - 5.03365 \ tau + 1.11505 \ tau ^ { 1.5 } - 5.41217 \ tau ^ { 2.5}
 -7.46628 \ tau ^ 5 } { T _ r }
 f ^ { ( 2 ) } = \ frac { - 0.64771 \ tau + 2.41539 \ tau ^ { 1.5 } - 4.26979 \ tau ^ { 2.5}
 + 3.25259 \ tau ^ 5 } { T _ r }
 \ tau = 1 - T _ { r }
 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 [ - ]
 Returns
 Psat : float
 Vapor pressure at T [ Pa ]
 Notes
 Somewhat more accurate than the : obj : ` Lee _ Kesler ` formulation .
 Examples
 Example from [ 2 ] _ ; ethylbenzene at 347.25 K .
 > > > Ambrose _ Walton ( 347.25 , 617.15 , 36.09E5 , 0.304)
 13278.878504306222
 References
 . . [ 1 ] Ambrose , D . , and J . Walton . " Vapour Pressures up to Their Critical
 Temperatures of Normal Alkanes and 1 - Alkanols . " Pure and Applied
 Chemistry 61 , no . 8 ( 1989 ) : 1395-1403 . doi : 10.1351 / pac198961081395.
 . . [ 2 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''


signature:
def Sanjari ( T , Tc , Pc , omega ) :
    r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
 CSP relationship by [ 1 ] _ . Requires a chemical ' s critical temperature ,
 pressure , and acentric factor . Although developed for refrigerants ,
 this model should have some general predictive ability .
 The vapor pressure of a chemical at ` T ` is given by :
 . . math : :
 P ^ { sat } = P _ c \ exp ( f ^ { ( 0 ) } + \ omega f ^ { ( 1 ) } + \ omega ^ 2 f ^ { ( 2 ) } )
 f ^ { ( 0 ) } = a _ 1 + \ frac { a _ 2 } { T _ r } + a _ 3 \ ln T _ r + a _ 4 T _ r ^ { 1.9}
 f ^ { ( 1 ) } = a _ 5 + \ frac { a _ 6 } { T _ r } + a _ 7 \ ln T _ r + a _ 8 T _ r ^ { 1.9}
 f ^ { ( 2 ) } = a _ 9 + \ frac { a _ { 10 } } { T _ r } + a _ { 11 } \ ln T _ r + a _ { 12 } T _ r ^ { 1.9}
 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 [ - ]
 Returns
 Psat : float
 Vapor pressure , [ Pa ]
 Notes
 a [ 1-12 ] are as follows :
 6.83377 , - 5.76051 , 0.90654 , - 1.16906,
 5.32034 , - 28.1460 , - 58.0352 , 23.57466,
 18.19967 , 16.33839 , 65.6995 , - 35.9739.
 For a claimed fluid not included in the regression , R128 , the claimed AARD
 was 0.428 % . A re - calculation using 200 data points from 125.45 K to
 343.90225 K evenly spaced by 1.09775 K as generated by NIST Webbook April
 2016 produced an AARD of 0.644 % . It is likely that the author ' s regression
 used more precision in its coefficients than was shown here . Nevertheless ,
 the function is reproduced as shown in [ 1 ] _ .
 For Tc = 808 K , Pc = 1100000 Pa , omega = 1.1571 , this function actually declines
 after 770 K .
 Examples
 > > > Sanjari ( 347.2 , 617.1 , 36E5 , 0.299)
 13651.916109552498
 References
 . . [ 1 ] Sanjari , Ehsan , Mehrdad Honarmand , Hamidreza Badihi , and Ali
 Ghaheri . " An Accurate Generalized Model for Predict Vapor Pressure of
 Refrigerants . " International Journal of Refrigeration 36 , no . 4
 ( June 2013 ) : 1327-32 . doi : 10.1016 / j . ijrefrig . 2013.01.007.'''


signature:
def Edalat ( T , Tc , Pc , omega ) :
    r'''Calculates vapor pressure of a fluid at arbitrary temperatures using a
 CSP relationship by [ 1 ] _ . Requires a chemical ' s critical temperature ,
 pressure , and acentric factor . Claimed to have a higher accuracy than the
 Lee - Kesler CSP relationship .
 The vapor pressure of a chemical at ` T ` is given by :
 . . math : :
 \ ln ( P ^ { sat } / P _ c ) = \ frac { a \ tau + b \ tau ^ { 1.5 } + c \ tau ^ 3 + d \ tau ^ 6}
 {1 - \ tau }
 a = - 6.1559 - 4.0855 \ omega
 b = 1.5737 - 1.0540 \ omega - 4.4365 \ times 10 ^ { - 3 } d
 c = - 0.8747 - 7.8874 \ omega
 d = \ frac { 1 } { - 0.4893 - 0.9912 \ omega + 3.1551 \ omega ^ 2}
 \ tau = 1 - \ frac { T } { T _ c }
 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 [ - ]
 Returns
 Psat : float
 Vapor pressure , [ Pa ]
 Notes
 [1 ] _ found an average error of 6.06 % on 94 compounds and 1106 data points .
 Examples
 > > > Edalat ( 347.2 , 617.1 , 36E5 , 0.299)
 13461.273080743307
 References
 . . [ 1 ] Edalat , M . , R . B . Bozar - Jomehri , and G . A . Mansoori . " Generalized
 Equation Predicts Vapor Pressure of Hydrocarbons . " Oil and Gas Journal ;
 91:5 ( February 1 , 1993 ) .'''


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 self . CASRN in WagnerMcGarry . index :
    methods . append ( WAGNER_MCGARRY )
    _ , A , B , C , D , self . WAGNER_MCGARRY_Pc , self . WAGNER_MCGARRY_Tc , self . WAGNER_MCGARRY_Tmin = _WagnerMcGarry_values [ WagnerMcGarry . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . WAGNER_MCGARRY_coefs = [ A , B , C , D ]
    Tmins . append ( self . WAGNER_MCGARRY_Tmin ) ;
    Tmaxs . append ( self . WAGNER_MCGARRY_Tc )
if self . CASRN in WagnerPoling . index :
    methods . append ( WAGNER_POLING )
    _ , A , B , C , D , self . WAGNER_POLING_Tc , self . WAGNER_POLING_Pc , Tmin , self . WAGNER_POLING_Tmax = _WagnerPoling_values [ WagnerPoling . index . get_loc ( self . CASRN ) ] . tolist ( )
    # Some Tmin values are missing ; Arbitrary choice of 0.1 lower limit
    self . WAGNER_POLING_Tmin = Tmin if not np . isnan ( Tmin ) else self . WAGNER_POLING_Tmax * 0.1
    self . WAGNER_POLING_coefs = [ A , B , C , D ]
    Tmins . append ( Tmin ) ;
    Tmaxs . append ( self . WAGNER_POLING_Tmax )
if self . CASRN in AntoineExtended . index :
    methods . append ( ANTOINE_EXTENDED_POLING )
    _ , A , B , C , Tc , to , n , E , F , self . ANTOINE_EXTENDED_POLING_Tmin , self . ANTOINE_EXTENDED_POLING_Tmax = _AntoineExtended_values [ AntoineExtended . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . ANTOINE_EXTENDED_POLING_coefs = [ Tc , to , A , B , C , n , E , F ]
    Tmins . append ( self . ANTOINE_EXTENDED_POLING_Tmin ) ;
    Tmaxs . append ( self . ANTOINE_EXTENDED_POLING_Tmax )
if self . CASRN in AntoinePoling . index :
    methods . append ( ANTOINE_POLING )
    _ , A , B , C , self . ANTOINE_POLING_Tmin , self . ANTOINE_POLING_Tmax = _AntoinePoling_values [ AntoinePoling . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . ANTOINE_POLING_coefs = [ A , B , C ]
    Tmins . append ( self . ANTOINE_POLING_Tmin ) ;
    Tmaxs . append ( self . ANTOINE_POLING_Tmax )
if self . CASRN in Perrys2_8 . index :
    methods . append ( DIPPR_PERRY_8E )
    _ , C1 , C2 , C3 , C4 , C5 , self . Perrys2_8_Tmin , self . Perrys2_8_Tmax = _Perrys2_8_values [ Perrys2_8 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . Perrys2_8_coeffs = [ C1 , C2 , C3 , C4 , C5 ]
    Tmins . append ( self . Perrys2_8_Tmin ) ;
    Tmaxs . append ( self . Perrys2_8_Tmax )
if has_CoolProp and self . CASRN in coolprop_dict :
    methods . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
    Tmins . append ( self . CP_f . Tmin ) ;
    Tmaxs . append ( self . CP_f . Tc )
if self . CASRN in _VDISaturationDict :
    methods . append ( VDI_TABULAR )
    Ts , props = VDI_tabular_data ( self . CASRN , 'P' )
    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 VDI_PPDS_3 . index :
    _ , Tm , Tc , Pc , A , B , C , D = _VDI_PPDS_3_values [ VDI_PPDS_3 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VDI_PPDS_coeffs = [ A , B , C , D ]
    self . VDI_PPDS_Tc = Tc
    self . VDI_PPDS_Tm = Tm
    self . VDI_PPDS_Pc = Pc
    methods . append ( VDI_PPDS )
    Tmins . append ( self . VDI_PPDS_Tm ) ;
    Tmaxs . append ( self . VDI_PPDS_Tc )
if all ( ( self . Tb , self . Tc , self . Pc ) ) :
    methods . append ( BOILING_CRITICAL )
    Tmins . append ( 0.01 ) ;
    Tmaxs . append ( self . Tc )
if all ( ( self . Tc , self . Pc , self . omega ) ) :
    methods . append ( LEE_KESLER_PSAT )
    methods . append ( AMBROSE_WALTON )
    methods . append ( SANJARI )
    methods . append ( EDALAT )
    if self . eos :
        methods . append ( EOS )
    Tmins . append ( 0.01 ) ;
    Tmaxs . append ( self . Tc )
self . all_methods = set ( methods )
if Tmins and Tmaxs :
    self . Tmin = min ( Tmins )
    self . Tmax = max ( Tmaxs )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate vapor pressure of a fluid at temperature ` T `
 with a given method .
 This method has no exception handling ; see ` T _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at calculate vapor pressure , [ K ]
 method : str
 Name of the method to use
 Returns
 Psat : float
 Vapor pressure at T , [ pa ]'''

implementation:
if method == WAGNER_MCGARRY :
    Psat = Wagner_original ( T , self . WAGNER_MCGARRY_Tc , self . WAGNER_MCGARRY_Pc , * self . WAGNER_MCGARRY_coefs )
elif method == WAGNER_POLING :
    Psat = Wagner ( T , self . WAGNER_POLING_Tc , self . WAGNER_POLING_Pc , * self . WAGNER_POLING_coefs )
elif method == ANTOINE_EXTENDED_POLING :
    Psat = TRC_Antoine_extended ( T , * self . ANTOINE_EXTENDED_POLING_coefs )
elif method == ANTOINE_POLING :
    A , B , C = self . ANTOINE_POLING_coefs
    Psat = Antoine ( T , A , B , C , base = 10.0 )
elif method == DIPPR_PERRY_8E :
    Psat = EQ101 ( T , * self . Perrys2_8_coeffs )
elif method == VDI_PPDS :
    Psat = Wagner ( T , self . VDI_PPDS_Tc , self . VDI_PPDS_Pc , * self . VDI_PPDS_coeffs )
elif method == COOLPROP :
    Psat = PropsSI ( 'P' , 'T' , T , 'Q' , 0 , self . CASRN )
elif method == BOILING_CRITICAL :
    Psat = boiling_critical_relation ( T , self . Tb , self . Tc , self . Pc )
elif method == LEE_KESLER_PSAT :
    Psat = Lee_Kesler ( T , self . Tc , self . Pc , self . omega )
elif method == AMBROSE_WALTON :
    Psat = Ambrose_Walton ( T , self . Tc , self . Pc , self . omega )
elif method == SANJARI :
    Psat = Sanjari ( T , self . Tc , self . Pc , self . omega )
elif method == EDALAT :
    Psat = Edalat ( T , self . Tc , self . Pc , self . omega )
elif method == EOS :
    Psat = self . eos [ 0 ] . Psat ( T )
elif method in self . tabular_data :
    Psat = self . interpolate ( T , method )
return Psat


signature:
def TWU_a_alpha_common ( T , Tc , omega , a , full = True , quick = True , method = 'PR' ) :
    r'''Function to calculate ` a _ alpha ` and optionally its first and second
 derivatives for the TWUPR or TWUSRK EOS . Returns ' a _ alpha ' , and
 optionally ' da _ alpha _ dT ' and ' d2a _ alpha _ dT2 ' .
 Used by ` TWUPR ` and ` TWUSRK ` ; has little purpose on its own .
 See either class for the correct reference , and examples of using the EOS .
 Parameters
 T : float
 Temperature , [ K ]
 Tc : float
 Critical temperature , [ K ]
 omega : float
 Acentric factor , [ - ]
 a : float
 Coefficient calculated by EOS - specific method , [ J ^ 2 / mol ^ 2 / Pa ]
 full : float
 Whether or not to return its first and second derivatives
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 method : str
 Either ' PR ' or ' SRK '
 Notes
 The derivatives are somewhat long and are not described here for
 brevity ; they are obtainable from the following SymPy expression .
 > > > from sympy import *
 > > > T , Tc , omega , N1 , N0 , M1 , M0 , L1 , L0 = symbols ( ' T , Tc , omega , N1 , N0 , M1 , M0 , L1 , L0 ' )
 > > > Tr = T / Tc
 > > > alpha0 = Tr * * ( N0 * ( M0-1 ) ) * exp ( L0 * ( 1 - Tr * * ( N0 * M0 ) ) )
 > > > alpha1 = Tr * * ( N1 * ( M1-1 ) ) * exp ( L1 * ( 1 - Tr * * ( N1 * M1 ) ) )
 > > > alpha = alpha0 + omega * ( alpha1 - alpha0)
 > > > # diff ( alpha , T )
 > > > # diff ( alpha , T , T )'''


signature:
def check_sufficient_inputs ( self ) :
    '''Method to an exception if none of the pairs ( T , P ) , ( T , V ) , or
 ( P , V ) are given .'''

implementation:
if not ( ( self . T and self . P ) or ( self . T and self . V ) or ( self . P and self . V ) ) :
    raise Exception ( 'Either T and P, or T and V, or P and V are required' )


signature:
def solve ( self ) :
    '''First EOS - generic method ; should be called by all specific EOSs .
 For solving for ` T ` , the EOS must provide the method ` solve _ T ` .
 For all cases , the EOS must provide ` a _ alpha _ and _ derivatives ` .
 Calls ` set _ from _ PT ` once done .'''

implementation:
self . check_sufficient_inputs ( )
if self . V :
    if self . P :
        self . T = self . solve_T ( self . P , self . V )
        self . a_alpha , self . da_alpha_dT , self . d2a_alpha_dT2 = self . a_alpha_and_derivatives ( self . T )
    else :
        self . a_alpha , self . da_alpha_dT , self . d2a_alpha_dT2 = self . a_alpha_and_derivatives ( self . T )
        self . P = R * self . T / ( self . V - self . b ) - self . a_alpha / ( self . V * self . V + self . delta * self . V + self . epsilon )
    Vs = [ self . V , 1j , 1j ]
else :
    self . a_alpha , self . da_alpha_dT , self . d2a_alpha_dT2 = self . a_alpha_and_derivatives ( self . T )
    Vs = self . volume_solutions ( self . T , self . P , self . b , self . delta , self . epsilon , self . a_alpha )
self . set_from_PT ( Vs )


signature:
def set_from_PT ( self , Vs ) :
    '''Counts the number of real volumes in ` Vs ` , and determines what to do .
 If there is only one real volume , the method
 ` set _ properties _ from _ solution ` is called with it . If there are
 two real volumes , ` set _ properties _ from _ solution ` is called once with
 each volume . The phase is returned by ` set _ properties _ from _ solution ` ,
 and the volumes is set to either ` V _ l ` or ` V _ g ` as appropriate .
 Parameters
 Vs : list [ float ]
 Three possible molar volumes , [ m ^ 3 / mol ]'''

implementation:
# All roots will have some imaginary component ; ignore them if > 1E - 9
good_roots = [ ]
bad_roots = [ ]
for i in Vs :
    j = i . real
    if abs ( i . imag ) > 1E-9 or j < 0 :
        bad_roots . append ( i )
    else :
        good_roots . append ( j )
if len ( bad_roots ) == 2 :
    V = good_roots [ 0 ]
    self . phase = self . set_properties_from_solution ( self . T , self . P , V , self . b , self . delta , self . epsilon , self . a_alpha , self . da_alpha_dT , self . d2a_alpha_dT2 )
    if self . phase == 'l' :
        self . V_l = V
    else :
        self . V_g = V
else : # Even in the case of three real roots , it is still the min / max that make sense
    self . V_l , self . V_g = min ( good_roots ) , max ( good_roots )
    [ self . set_properties_from_solution ( self . T , self . P , V , self . b , self . delta , self . epsilon , self . a_alpha , self . da_alpha_dT , self . d2a_alpha_dT2 ) for V in [ self . V_l , self . V_g ] ]
    self . phase = 'l/g'


signature:
def set_properties_from_solution ( self , T , P , V , b , delta , epsilon , a_alpha , da_alpha_dT , d2a_alpha_dT2 , quick = True ) :
    r'''Sets all interesting properties which can be calculated from an
 EOS alone . Determines which phase the fluid is on its own ; for details ,
 see ` phase _ identification _ parameter ` .
 The list of properties set is as follows , with all properties suffixed
 with ' _ l ' or ' _ g ' .
 dP _ dT , dP _ dV , dV _ dT , dV _ dP , dT _ dV , dT _ dP , d2P _ dT2 , d2P _ dV2 , d2V _ dT2,
 d2V _ dP2 , d2T _ dV2 , d2T _ dP2 , d2V _ dPdT , d2P _ dTdV , d2T _ dPdV , H _ dep , S _ dep ,
 beta , kappa , Cp _ minus _ Cv , V _ dep , U _ dep , G _ dep , A _ dep , fugacity , phi ,
 and PIP .
 Parameters
 T : float
 Temperature , [ K ]
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 b : float
 Coefficient calculated by EOS - specific method , [ m ^ 3 / mol ]
 delta : float
 Coefficient calculated by EOS - specific method , [ m ^ 3 / mol ]
 epsilon : float
 Coefficient calculated by EOS - specific method , [ m ^ 6 / mol ^ 2]
 a _ alpha : float
 Coefficient calculated by EOS - specific method , [ J ^ 2 / mol ^ 2 / Pa ]
 da _ alpha _ dT : float
 Temperature derivative of coefficient calculated by EOS - specific
 method , [ J ^ 2 / mol ^ 2 / Pa / K ]
 d2a _ alpha _ dT2 : float
 Second temperature derivative of coefficient calculated by
 EOS - specific method , [ J ^ 2 / mol ^ 2 / Pa / K * * 2]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 phase : str
 Either ' l ' or ' g '
 Notes
 The individual formulas for the derivatives and excess properties are
 as follows . For definitions of ` beta ` , see ` isobaric _ expansion ` ;
 for ` kappa ` , see isothermal _ compressibility ; for ` Cp _ minus _ Cv ` , see
 ` Cp _ minus _ Cv ` ; for ` phase _ identification _ parameter ` , see
 ` phase _ identification _ parameter ` .
 First derivatives ; in part using the Triple Product Rule [ 2 ] _ , [ 3 ] _ :
 . . math : :
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V = \ frac { R } { V - b }
 - \ frac { a \ frac { d \ alpha { \ left ( T \ right ) } } { d T } } { V ^ { 2 } + V \ delta
 + \ epsilon }
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T = - \ frac { R T } { \ left (
 V - b \ right ) ^ { 2 } } - \ frac { a \ left ( - 2 V - \ delta \ right ) \ alpha {
 \ left ( T \ right ) } } { \ left ( V ^ { 2 } + V \ delta + \ epsilon \ right ) ^ { 2 } }
 \ left ( \ frac { \ partial V } { \ partial T } \ right ) _ P = - \ frac {
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V } {
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T }
 \ left ( \ frac { \ partial V } { \ partial P } \ right ) _ T = - \ frac {
 \ left ( \ frac { \ partial V } { \ partial T } \ right ) _ P } {
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V }
 \ left ( \ frac { \ partial T } { \ partial V } \ right ) _ P = \ frac { 1}
 { \ left ( \ frac { \ partial V } { \ partial T } \ right ) _ P }
 \ left ( \ frac { \ partial T } { \ partial P } \ right ) _ V = \ frac { 1}
 { \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V }
 Second derivatives with respect to one variable ; those of ` T ` and ` V `
 use identities shown in [ 1 ] _ and verified numerically :
 . . math : :
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T ^ 2 } \ right ) _ V = - \ frac { a
 \ frac { d ^ { 2 } \ alpha { \ left ( T \ right ) } } { d T ^ { 2 } } } { V ^ { 2 } + V \ delta
 + \ epsilon }
 \ left ( \ frac { \ partial ^ 2 P } { \ partial V ^ 2 } \ right ) _ T = 2 \ left ( \ frac {
 R T } { \ left ( V - b \ right ) ^ { 3 } } - \ frac { a \ left ( 2 V + \ delta \ right ) ^ {
 2 } \ alpha { \ left ( T \ right ) } } { \ left ( V ^ { 2 } + V \ delta + \ epsilon
 \ right ) ^ { 3 } } + \ frac { a \ alpha { \ left ( T \ right ) } } { \ left ( V ^ { 2 } + V
 \ delta + \ epsilon \ right ) ^ { 2 } } \ right )
 \ left ( \ frac { \ partial ^ 2 T } { \ partial P ^ 2 } \ right ) _ V = - \ left ( \ frac {
 \ partial ^ 2 P } { \ partial T ^ 2 } \ right ) _ V \ left ( \ frac { \ partial P } {
 \ partial T } \ right ) ^ { - 3 } _ V
 \ left ( \ frac { \ partial ^ 2 V } { \ partial P ^ 2 } \ right ) _ T = - \ left ( \ frac {
 \ partial ^ 2 P } { \ partial V ^ 2 } \ right ) _ T \ left ( \ frac { \ partial P } {
 \ partial V } \ right ) ^ { - 3 } _ T
 \ left ( \ frac { \ partial ^ 2 T } { \ partial V ^ 2 } \ right ) _ P = - \ left [
 \ left ( \ frac { \ partial ^ 2 P } { \ partial V ^ 2 } \ right ) _ T
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 - \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right ) \ right ]
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) ^ { - 2 } _ V
 + \ left [ \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right )
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 - \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T ^ 2 } \ right ) _ V \ right ]
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V ^ { - 3}
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 \ left ( \ frac { \ partial ^ 2 V } { \ partial T ^ 2 } \ right ) _ P = - \ left [
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T ^ 2 } \ right ) _ V
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 - \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right ) \ right ]
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) ^ { - 2 } _ T
 + \ left [ \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right )
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 - \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 \ left ( \ frac { \ partial ^ 2 P } { \ partial V ^ 2 } \ right ) _ T \ right ]
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T ^ { - 3}
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 Second derivatives with respect to the other two variables ; those of
 ` T ` and ` V ` use identities shown in [ 1 ] _ and verified numerically :
 . . math : :
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right ) = - \ frac {
 R } { \ left ( V - b \ right ) ^ { 2 } } + \ frac { a \ left ( 2 V + \ delta \ right )
 \ frac { d \ alpha { \ left ( T \ right ) } } { d T } } { \ left ( V ^ { 2 } + V \ delta
 + \ epsilon \ right ) ^ { 2 } }
 \ left ( \ frac { \ partial ^ 2 T } { \ partial P \ partial V } \ right ) =
 - \ left [ \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right )
 \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 - \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 \ left ( \ frac { \ partial ^ 2 P } { \ partial T ^ 2 } \ right ) _ V
 \ right ] \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V ^ { - 3}
 \ left ( \ frac { \ partial ^ 2 V } { \ partial T \ partial P } \ right ) =
 - \ left [ \ left ( \ frac { \ partial ^ 2 P } { \ partial T \ partial V } \ right )
 \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T
 - \ left ( \ frac { \ partial P } { \ partial T } \ right ) _ V
 \ left ( \ frac { \ partial ^ 2 P } { \ partial V ^ 2 } \ right ) _ T
 \ right ] \ left ( \ frac { \ partial P } { \ partial V } \ right ) _ T ^ { - 3}
 Excess properties
 . . math : :
 H _ { dep } = \ int _ { \ infty } ^ V \ left [ T \ frac { \ partial P } { \ partial T } _ V
 - P \ right ] dV + PV - RT = P V - R T + \ frac { 2 } { \ sqrt {
 \ delta ^ { 2 } - 4 \ epsilon } } \ left ( T a \ frac { d \ alpha { \ left ( T \ right
 ) } } { d T } - a \ alpha { \ left ( T \ right ) } \ right ) \ operatorname { atanh }
 { \ left ( \ frac { 2 V + \ delta } { \ sqrt { \ delta ^ { 2 } - 4 \ epsilon } }
 \ right ) }
 S _ { dep } = \ int _ { \ infty } ^ V \ left [ \ frac { \ partial P } { \ partial T }
 - \ frac { R } { V } \ right ] dV + R \ log \ frac { PV } { RT } = - R \ log { \ left ( V
 \ right ) } + R \ log { \ left ( \ frac { P V } { R T } \ right ) } + R \ log { \ left
 ( V - b \ right ) } + \ frac { 2 a \ frac { d \ alpha { \ left ( T \ right ) } } { d T }
 } { \ sqrt { \ delta ^ { 2 } - 4 \ epsilon } } \ operatorname { atanh } { \ left ( \ frac
 {2 V + \ delta } { \ sqrt { \ delta ^ { 2 } - 4 \ epsilon } } \ right ) }
 V _ { dep } = V - \ frac { RT } { P }
 U _ { dep } = H _ { dep } - P V _ { dep }
 G _ { dep } = H _ { dep } - T S _ { dep }
 A _ { dep } = U _ { dep } - T S _ { dep }
 \ text { fugacity } = P \ exp \ left ( \ frac { G _ { dep } } { RT } \ right )
 \ phi = \ frac { \ text { fugacity } } { P }
 C _ { v , dep } = T \ int _ \ infty ^ V \ left ( \ frac { \ partial ^ 2 P } { \ partial
 T ^ 2 } \ right ) dV = - T a \ left ( \ sqrt { \ frac { 1 } { \ delta ^ { 2 } - 4
 \ epsilon } } \ log { \ left ( V - \ frac { \ delta ^ { 2 } } { 2 } \ sqrt { \ frac { 1 } {
 \ delta ^ { 2 } - 4 \ epsilon } } + \ frac { \ delta } { 2 } + 2 \ epsilon \ sqrt {
 \ frac { 1 } { \ delta ^ { 2 } - 4 \ epsilon } } \ right ) } - \ sqrt { \ frac { 1 } {
 \ delta ^ { 2 } - 4 \ epsilon } } \ log { \ left ( V + \ frac { \ delta ^ { 2 } } { 2}
 \ sqrt { \ frac { 1 } { \ delta ^ { 2 } - 4 \ epsilon } } + \ frac { \ delta } { 2}
 - 2 \ epsilon \ sqrt { \ frac { 1 } { \ delta ^ { 2 } - 4 \ epsilon } } \ right ) }
 \ right ) \ frac { d ^ { 2 } \ alpha { \ left ( T \ right ) } } { d T ^ { 2 } }
 C _ { p , dep } = ( C _ p - C _ v ) _ { \ text { from EOS } } + C _ { v , dep } - R
 References
 . . [ 1 ] Thorade , Matthis , and Ali Saadat . " Partial Derivatives of
 Thermodynamic State Properties for Dynamic Simulation . "
 Environmental Earth Sciences 70 , no . 8 ( April 10 , 2013 ) : 3497-3503.
 doi : 10.1007 / s12665-013-2394 - z .
 . . [ 2 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th
 edition . New York : McGraw - Hill Professional , 2000.
 . . [ 3 ] Walas , Stanley M . Phase Equilibria in Chemical Engineering .
 Butterworth - Heinemann , 1985.'''

implementation:
( [ dP_dT , dP_dV , dV_dT , dV_dP , dT_dV , dT_dP ] , [ d2P_dT2 , d2P_dV2 , d2V_dT2 , d2V_dP2 , d2T_dV2 , d2T_dP2 ] , [ d2V_dPdT , d2P_dTdV , d2T_dPdV ] , [ H_dep , S_dep , Cv_dep ] ) = self . derivatives_and_departures ( T , P , V , b , delta , epsilon , a_alpha , da_alpha_dT , d2a_alpha_dT2 , quick = quick )
beta = dV_dT / V
# isobaric _ expansion ( V , dV _ dT )
kappa = - dV_dP / V
# isothermal _ compressibility ( V , dV _ dP )
Cp_m_Cv = - T * dP_dT * dP_dT / dP_dV
# Cp _ minus _ Cv ( T , dP _ dT , dP _ dV )
Cp_dep = Cp_m_Cv + Cv_dep - R
V_dep = ( V - R * T / P )
U_dep = H_dep - P * V_dep
G_dep = H_dep - T * S_dep
A_dep = U_dep - T * S_dep
fugacity = P * exp ( G_dep / ( R * T ) )
phi = fugacity / P
PIP = V * ( d2P_dTdV / dP_dT - d2P_dV2 / dP_dV )
# phase _ identification _ parameter ( V , dP _ dT , dP _ dV , d2P _ dV2 , d2P _ dTdV )
phase = 'l' if PIP > 1 else 'g'
# phase _ identification _ parameter _ phase ( PIP )
if phase == 'l' :
    self . Z_l = self . P * V / ( R * self . T )
    self . beta_l , self . kappa_l = beta , kappa
    self . PIP_l , self . Cp_minus_Cv_l = PIP , Cp_m_Cv
    self . dP_dT_l , self . dP_dV_l , self . dV_dT_l = dP_dT , dP_dV , dV_dT
    self . dV_dP_l , self . dT_dV_l , self . dT_dP_l = dV_dP , dT_dV , dT_dP
    self . d2P_dT2_l , self . d2P_dV2_l = d2P_dT2 , d2P_dV2
    self . d2V_dT2_l , self . d2V_dP2_l = d2V_dT2 , d2V_dP2
    self . d2T_dV2_l , self . d2T_dP2_l = d2T_dV2 , d2T_dP2
    self . d2V_dPdT_l , self . d2P_dTdV_l , self . d2T_dPdV_l = d2V_dPdT , d2P_dTdV , d2T_dPdV
    self . H_dep_l , self . S_dep_l , self . V_dep_l = H_dep , S_dep , V_dep ,
    self . U_dep_l , self . G_dep_l , self . A_dep_l = U_dep , G_dep , A_dep ,
    self . fugacity_l , self . phi_l = fugacity , phi
    self . Cp_dep_l , self . Cv_dep_l = Cp_dep , Cv_dep
else :
    self . Z_g = self . P * V / ( R * self . T )
    self . beta_g , self . kappa_g = beta , kappa
    self . PIP_g , self . Cp_minus_Cv_g = PIP , Cp_m_Cv
    self . dP_dT_g , self . dP_dV_g , self . dV_dT_g = dP_dT , dP_dV , dV_dT
    self . dV_dP_g , self . dT_dV_g , self . dT_dP_g = dV_dP , dT_dV , dT_dP
    self . d2P_dT2_g , self . d2P_dV2_g = d2P_dT2 , d2P_dV2
    self . d2V_dT2_g , self . d2V_dP2_g = d2V_dT2 , d2V_dP2
    self . d2T_dV2_g , self . d2T_dP2_g = d2T_dV2 , d2T_dP2
    self . d2V_dPdT_g , self . d2P_dTdV_g , self . d2T_dPdV_g = d2V_dPdT , d2P_dTdV , d2T_dPdV
    self . H_dep_g , self . S_dep_g , self . V_dep_g = H_dep , S_dep , V_dep ,
    self . U_dep_g , self . G_dep_g , self . A_dep_g = U_dep , G_dep , A_dep ,
    self . fugacity_g , self . phi_g = fugacity , phi
    self . Cp_dep_g , self . Cv_dep_g = Cp_dep , Cv_dep
return phase


signature:
def solve_T ( self , P , V , quick = True ) :
    '''Generic method to calculate ` T ` from a specified ` P ` and ` V ` .
 Provides SciPy ' s ` newton ` solver , and iterates to solve the general
 equation for ` P ` , recalculating ` a _ alpha ` as a function of temperature
 using ` a _ alpha _ and _ derivatives ` each iteration .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas - not applicable where a numerical solver is
 used .
 Returns
 T : float
 Temperature , [ K ]'''

implementation:
def to_solve ( T ) :
    a_alpha = self . a_alpha_and_derivatives ( T , full = False )
    P_calc = R * T / ( V - self . b ) - a_alpha / ( V * V + self . delta * V + self . epsilon )
    return P_calc - P
return newton ( to_solve , self . Tc * 0.5 )


signature:
def volume_solutions ( T , P , b , delta , epsilon , a_alpha , quick = True ) :
    r'''Solution of this form of the cubic EOS in terms of volumes . Returns
 three values , all with some complex part .
 Parameters
 T : float
 Temperature , [ K ]
 P : float
 Pressure , [ Pa ]
 b : float
 Coefficient calculated by EOS - specific method , [ m ^ 3 / mol ]
 delta : float
 Coefficient calculated by EOS - specific method , [ m ^ 3 / mol ]
 epsilon : float
 Coefficient calculated by EOS - specific method , [ m ^ 6 / mol ^ 2]
 a _ alpha : float
 Coefficient calculated by EOS - specific method , [ J ^ 2 / mol ^ 2 / Pa ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 Vs : list [ float ]
 Three possible molar volumes , [ m ^ 3 / mol ]
 Notes
 Using explicit formulas , as can be derived in the following example ,
 is faster than most numeric root finding techniques , and
 finds all values explicitly . It takes several seconds .
 > > > from sympy import *
 > > > P , T , V , R , b , a , delta , epsilon , alpha = symbols ( ' P , T , V , R , b , a , delta , epsilon , alpha ' )
 > > > Tc , Pc , omega = symbols ( ' Tc , Pc , omega ' )
 > > > CUBIC = R * T / ( V - b ) - a * alpha / ( V * V + delta * V + epsilon ) - P
 > > > # solve ( CUBIC , V )'''


signature:
def Psat ( self , T , polish = False ) :
    r'''Generic method to calculate vapor pressure for a specified ` T ` .
 From Tc to 0.32Tc , uses a 10th order polynomial of the following form :
 . . math : :
 \ ln \ frac { P _ r } { T _ r } = \ sum _ { k = 0 } ^ { 10 } C _ k \ left ( \ frac { \ alpha } { T _ r }
 -1 \ right ) ^ { k }
 If ` polish ` is True , SciPy ' s ` newton ` solver is launched with the
 calculated vapor pressure as an initial guess in an attempt to get more
 accuracy . This may not converge however .
 Results above the critical temperature are meaningless . A first - order
 polynomial is used to extrapolate under 0.32 Tc ; however , there is
 normally not a volume solution to the EOS which can produce that
 low of a pressure .
 Parameters
 T : float
 Temperature , [ K ]
 polish : bool , optional
 Whether to attempt to use a numerical solver to make the solution
 more precise or not
 Returns
 Psat : float
 Vapor pressure , [ Pa ]
 Notes
 EOSs sharing the same ` b ` , ` delta ` , and ` epsilon ` have the same
 coefficient sets .
 All coefficients were derived with numpy ' s polyfit . The intersection
 between the polynomials is continuous , but there is a step change
 in its derivative .
 Form for the regression is inspired from [ 1 ] _ .
 References
 . . [ 1 ] Soave , G . " Direct Calculation of Pure - Compound Vapour Pressures
 through Cubic Equations of State . " Fluid Phase Equilibria 31 , no . 2
 ( January 1 , 1986 ) : 203-7 . doi : 10.1016/0378-3812(86)90013-0.'''

implementation:
alpha = self . a_alpha_and_derivatives ( T , full = False ) / self . a
Tr = T / self . Tc
x = alpha / Tr - 1.
c = self . Psat_coeffs_limiting if Tr < 0.32 else self . Psat_coeffs
y = horner ( c , x )
try :
    Psat = exp ( y ) * Tr * self . Pc
except OverflowError : # coefficients sometimes overflow before T is lowered to 0.32Tr
    polish = False
    Psat = 0
if polish :
    def to_solve ( P ) : # For use by newton . Only supports initialization with Tc , Pc and omega
    # ~ 200x slower and not guaranteed to converge
        e = self . __class__ ( Tc = self . Tc , Pc = self . Pc , omega = self . omega , T = T , P = P )
        err = e . fugacity_l - e . fugacity_g
        return err
    Psat = newton ( to_solve , Psat )
return Psat


signature:
def dPsat_dT ( self , T ) :
    r'''Generic method to calculate the temperature derivative of vapor
 pressure for a specified ` T ` . Implements the analytical derivative
 of the two polynomials described in ` Psat ` .
 As with ` Psat ` , results above the critical temperature are meaningless .
 The first - order polynomial which is used to calculate it under 0.32 Tc
 may not be physicall meaningful , due to there normally not being a
 volume solution to the EOS which can produce that low of a pressure .
 Parameters
 T : float
 Temperature , [ K ]
 Returns
 dPsat _ dT : float
 Derivative of vapor pressure with respect to temperature , [ Pa / K ]
 Notes
 There is a small step change at 0.32 Tc for all EOS due to the two
 switch between polynomials at that point .
 Useful for calculating enthalpy of vaporization with the Clausius
 Clapeyron Equation . Derived with SymPy ' s diff and cse .'''


signature:
def V_l_sat ( self , T ) :
    r'''Method to calculate molar volume of the liquid phase along the
 saturation line .
 Parameters
 T : float
 Temperature , [ K ]
 Returns
 V _ l _ sat : float
 Liquid molar volume along the saturation line , [ m ^ 3 / mol ]
 Notes
 Computers ` Psat ` , and then uses ` volume _ solutions ` to obtain the three
 possible molar volumes . The lowest value is returned .'''

implementation:
Psat = self . Psat ( T )
a_alpha = self . a_alpha_and_derivatives ( T , full = False )
Vs = self . volume_solutions ( T , Psat , self . b , self . delta , self . epsilon , a_alpha )
# Assume we can safely take the Vmax as gas , Vmin as l on the saturation line
return min ( [ i . real for i in Vs ] )


signature:
def V_g_sat ( self , T ) :
    r'''Method to calculate molar volume of the vapor phase along the
 saturation line .
 Parameters
 T : float
 Temperature , [ K ]
 Returns
 V _ g _ sat : float
 Gas molar volume along the saturation line , [ m ^ 3 / mol ]
 Notes
 Computers ` Psat ` , and then uses ` volume _ solutions ` to obtain the three
 possible molar volumes . The highest value is returned .'''

implementation:
Psat = self . Psat ( T )
a_alpha = self . a_alpha_and_derivatives ( T , full = False )
Vs = self . volume_solutions ( T , Psat , self . b , self . delta , self . epsilon , a_alpha )
# Assume we can safely take the Vmax as gas , Vmin as l on the saturation line
return max ( [ i . real for i in Vs ] )


signature:
def Hvap ( self , T ) :
    r'''Method to calculate enthalpy of vaporization for a pure fluid from
 an equation of state , without iteration .
 . . math : :
 \ frac { dP ^ { sat } } { dT } = \ frac { \ Delta H _ { vap } } { T ( V _ g - V _ l ) }
 Results above the critical temperature are meaningless . A first - order
 polynomial is used to extrapolate under 0.32 Tc ; however , there is
 normally not a volume solution to the EOS which can produce that
 low of a pressure .
 Parameters
 T : float
 Temperature , [ K ]
 Returns
 Hvap : float
 Increase in enthalpy needed for vaporization of liquid phase along
 the saturation line , [ J / mol ]
 Notes
 Calculates vapor pressure and its derivative with ` Psat ` and ` dPsat _ dT `
 as well as molar volumes of the saturation liquid and vapor phase in
 the process .
 Very near the critical point this provides unrealistic results due to
 ` Psat ` ' s polynomials being insufficiently accurate .
 References
 . . [ 1 ] Walas , Stanley M . Phase Equilibria in Chemical Engineering .
 Butterworth - Heinemann , 1985.'''

implementation:
Psat = self . Psat ( T )
dPsat_dT = self . dPsat_dT ( T )
a_alpha = self . a_alpha_and_derivatives ( T , full = False )
Vs = self . volume_solutions ( T , Psat , self . b , self . delta , self . epsilon , a_alpha )
# Assume we can safely take the Vmax as gas , Vmin as l on the saturation line
Vs = [ i . real for i in Vs ]
V_l , V_g = min ( Vs ) , max ( Vs )
return dPsat_dT * T * ( V_g - V_l )


signature:
def Heyen ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Heyen ( 1980 ) [ 1 ] _ . Returns ` a _ alpha ` , ` da _ alpha _ dT ` ,
 and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Two coefficients needed .
 . . math : :
 \ alpha = e ^ { c _ { 1 } \ left ( - \ left ( \ frac { T } { Tc } \ right ) ^ { c _ { 2 } }
 + 1 \ right ) }
 References
 . . [ 1 ] Heyen , G . Liquid and Vapor Properties from a Cubic Equation of
 State . In " Proceedings of the 2nd International Conference on Phase
 Equilibria and Fluid Properties in the Chemical Industry " . DECHEMA :
 Frankfurt , 1980 ; p 9-13.'''

implementation:
c1 , c2 = self . alpha_function_coeffs
T , Tc , a = self . T , self . Tc , self . a
a_alpha = a * exp ( c1 * ( 1 - ( T / Tc ) ** c2 ) )
if not full :
    return a_alpha
else :
    da_alpha_dT = - a * c1 * c2 * ( T / Tc ) ** c2 * exp ( c1 * ( - ( T / Tc ) ** c2 + 1 ) ) / T
    d2a_alpha_dT2 = a * c1 * c2 * ( T / Tc ) ** c2 * ( c1 * c2 * ( T / Tc ) ** c2 - c2 + 1 ) * exp ( - c1 * ( ( T / Tc ) ** c2 - 1 ) ) / T ** 2
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def Soave_1984 ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Soave ( 1984 ) [ 1 ] _ . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Two coefficients needed .
 . . math : :
 \ alpha = c _ { 1 } \ left ( - \ frac { T } { Tc } + 1 \ right ) + c _ { 2 } \ left ( - 1
 + \ frac { Tc } { T } \ right ) + 1
 References
 . . [ 1 ] Soave , G . " Improvement of the Van Der Waals Equation of State . "
 Chemical Engineering Science 39 , no . 2 ( January 1 , 1984 ) : 357-69.
 doi : 10.1016/0009-2509(84)80034-2.'''

implementation:
c1 , c2 = self . alpha_function_coeffs
T , Tc , a = self . T , self . Tc , self . a
a_alpha = a * ( c1 * ( - T / Tc + 1 ) + c2 * ( - 1 + Tc / T ) + 1 )
if not full :
    return a_alpha
else :
    da_alpha_dT = a * ( - c1 / Tc - Tc * c2 / T ** 2 )
    d2a_alpha_dT2 = a * ( 2 * Tc * c2 / T ** 3 )
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def Yu_Lu ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Yu and Lu ( 1987 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . Four coefficients needed .
 . . math : :
 \ alpha = 10 ^ { c _ { 4 } \ left ( - \ frac { T } { Tc } + 1 \ right ) \ left (
 \ frac { T ^ { 2 } c _ { 3 } } { Tc ^ { 2 } } + \ frac { T c _ { 2 } } { Tc } + c _ { 1 } \ right ) }
 References
 . . [ 1 ] Yu , Jin - Min , and Benjamin C . - Y . Lu . " A Three - Parameter Cubic
 Equation of State for Asymmetric Mixture Density Calculations . "
 Fluid Phase Equilibria 34 , no . 1 ( January 1 , 1987 ) : 1-19.
 doi : 10.1016/0378-3812(87)85047-1.'''


signature:
def Trebble_Bishnoi ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Trebble and Bishnoi ( 1987 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . One coefficient needed .
 . . math : :
 \ alpha = e ^ { c _ { 1 } \ left ( - \ frac { T } { Tc } + 1 \ right ) }
 References
 . . [ 1 ] Trebble , M . A . , and P . R . Bishnoi . " Development of a New Four -
 Parameter Cubic Equation of State . " Fluid Phase Equilibria 35 , no . 1
 ( September 1 , 1987 ) : 1-18 . doi : 10.1016/0378-3812(87)80001-8.'''

implementation:
c1 = self . alpha_function_coeffs
T , Tc , a = self . T , self . Tc , self . a
a_alpha = a * exp ( c1 * ( - T / Tc + 1 ) )
if not full :
    return a_alpha
else :
    da_alpha_dT = a * - c1 * exp ( c1 * ( - T / Tc + 1 ) ) / Tc
    d2a_alpha_dT2 = a * c1 ** 2 * exp ( - c1 * ( T / Tc - 1 ) ) / Tc ** 2
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def Androulakis ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Androulakis et al . ( 1989 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . Three coefficients needed .
 . . math : :
 \ alpha = c _ { 1 } \ left ( - \ left ( \ frac { T } { Tc } \ right ) ^ { \ frac { 2 } { 3 } }
 + 1 \ right ) + c _ { 2 } \ left ( - \ left ( \ frac { T } { Tc } \ right ) ^ { \ frac { 2 } { 3 } }
 + 1 \ right ) ^ { 2 } + c _ { 3 } \ left ( - \ left ( \ frac { T } { Tc } \ right ) ^ {
 \ frac { 2 } { 3 } } + 1 \ right ) ^ { 3 } + 1
 References
 . . [ 1 ] Androulakis , I . P . , N . S . Kalospiros , and D . P . Tassios .
 " Thermophysical Properties of Pure Polar and Nonpolar Compounds with
 a Modified VdW - 711 Equation of State . " Fluid Phase Equilibria 45,
 no . 2 ( April 1 , 1989 ) : 135-63 . doi : 10.1016/0378-3812(89)80254-7.'''


signature:
def Schwartzentruber ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Schwartzentruber et al . ( 1990 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . Three coefficients needed .
 . . math : :
 \ alpha = \ left ( c _ { 4 } \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right )
 - \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right ) \ left ( \ frac { T ^ { 2 } c _ { 3 } }
 { Tc ^ { 2 } } + \ frac { T c _ { 2 } } { Tc } + c _ { 1 } \ right ) + 1 \ right ) ^ { 2}
 References
 . . [ 1 ] J . Schwartzentruber , H . Renon , and S . Watanasiri , " K - values for
 Non - Ideal Systems : An Easier Way , " Chem . Eng . , March 1990 , 118-124.'''


signature:
def Almeida ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Almeida et al . ( 1991 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . Three coefficients needed .
 . . math : :
 \ alpha = e ^ { c _ { 1 } \ left ( - \ frac { T } { Tc } + 1 \ right ) \ left | {
 \ frac { T } { Tc } - 1 } \ right | ^ { c _ { 2 } - 1 } + c _ { 3 } \ left ( - 1
 + \ frac { Tc } { T } \ right ) }
 References
 . . [ 1 ] Almeida , G . S . , M . Aznar , and A . S . Telles . " Uma Nova Forma de
 Dependência Com a Temperatura Do Termo Atrativo de Equações de
 Estado Cúbicas . " RBE , Rev . Bras . Eng . , Cad . Eng . Quim 8 ( 1991 ) : 95.'''


signature:
def Coquelet ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Coquelet et al . ( 2004 ) [ 1 ] _ . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Three coefficients needed .
 . . math : :
 \ alpha = e ^ { c _ { 1 } \ left ( - \ frac { T } { Tc } + 1 \ right ) \ left ( c _ { 2}
 \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right ) ^ { 2 } + c _ { 3}
 \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right ) ^ { 3 } + 1 \ right ) ^ { 2 } }
 References
 . . [ 1 ] Coquelet , C . , A . Chapoy , and D . Richon . " Development of a New
 Alpha Function for the Peng – Robinson Equation of State : Comparative
 Study of Alpha Function Models for Pure Gases ( Natural Gas
 Components ) and Water - Gas Systems . " International Journal of
 Thermophysics 25 , no . 1 ( January 1 , 2004 ) : 133-58.
 doi : 10.1023 / B : IJOT . 0000022331.46865.2f .'''


signature:
def Chen_Yang ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives according to Hamid and Yang ( 2017 ) [ 1 ] _ . Returns ` a _ alpha ` ,
 ` da _ alpha _ dT ` , and ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives `
 for more documentation . Seven coefficients needed .
 . . math : :
 \ alpha = e ^ { \ left ( - c _ { 3 } ^ { \ log { \ left ( \ frac { T } { Tc } \ right ) } }
 + 1 \ right ) \ left ( - \ frac { T c _ { 2 } } { Tc } + c _ { 1 } \ right ) }
 References
 . . [ 1 ] Chen , Zehua , and Daoyong Yang . " Optimization of the Reduced
 Temperature Associated with Peng – Robinson Equation of State and
 Soave - Redlich - Kwong Equation of State To Improve Vapor Pressure
 Prediction for Heavy Hydrocarbon Compounds . " Journal of Chemical &
 Engineering Data , August 31 , 2017 . doi : 10.1021 / acs . jced . 7b00496.'''

implementation:
c1 , c2 , c3 , c4 , c5 , c6 , c7 = self . alpha_function_coeffs
T , Tc , a = self . T , self . Tc , self . a
a_alpha = a * exp ( c4 * log ( ( - sqrt ( T / Tc ) + 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) ** 2 + ( - T / Tc + 1 ) * ( c1 + c2 * omega + c3 * omega ** 2 ) )
if not full :
    return a_alpha
else :
    da_alpha_dT = a * ( - ( c1 + c2 * omega + c3 * omega ** 2 ) / Tc - c4 * sqrt ( T / Tc ) * ( c5 + c6 * omega + c7 * omega ** 2 ) * log ( ( - sqrt ( T / Tc ) + 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) / ( T * ( ( - sqrt ( T / Tc ) + 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) ) ) * exp ( c4 * log ( ( - sqrt ( T / Tc ) + 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) ** 2 + ( - T / Tc + 1 ) * ( c1 + c2 * omega + c3 * omega ** 2 ) )
    d2a_alpha_dT2 = a * ( ( ( c1 + c2 * omega + c3 * omega ** 2 ) / Tc - c4 * sqrt ( T / Tc ) * ( c5 + c6 * omega + c7 * omega ** 2 ) * log ( - ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) / ( T * ( ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) - 1 ) ) ) ** 2 - c4 * ( c5 + c6 * omega + c7 * omega ** 2 ) * ( ( c5 + c6 * omega + c7 * omega ** 2 ) * log ( - ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) / ( Tc * ( ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) - 1 ) ) - ( c5 + c6 * omega + c7 * omega ** 2 ) / ( Tc * ( ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) - 1 ) ) + sqrt ( T / Tc ) * log ( - ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) / T ) / ( 2 * T * ( ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) - 1 ) ) ) * exp ( c4 * log ( - ( sqrt ( T / Tc ) - 1 ) * ( c5 + c6 * omega + c7 * omega ** 2 ) + 1 ) ** 2 - ( T / Tc - 1 ) * ( c1 + c2 * omega + c3 * omega ** 2 ) )
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` kappa ` , and ` a ` .
 For use in ` solve _ T ` , returns only ` a _ alpha ` if full is False .
 . . math : :
 a \ alpha = a \ left ( \ kappa \ left ( - \ frac { T ^ { 0.5 } } { Tc ^ { 0.5 } }
 + 1 \ right ) + 1 \ right ) ^ { 2}
 \ frac { d a \ alpha } { dT } = - \ frac { 1.0 a \ kappa } { T ^ { 0.5 } Tc ^ { 0.5 } }
 \ left ( \ kappa \ left ( - \ frac { T ^ { 0.5 } } { Tc ^ { 0.5 } } + 1 \ right ) + 1 \ right )
 \ frac { d ^ 2 a \ alpha } { dT ^ 2 } = 0.5 a \ kappa \ left ( - \ frac { 1 } { T ^ { 1.5}
 Tc ^ { 0.5 } } \ left ( \ kappa \ left ( \ frac { T ^ { 0.5 } } { Tc ^ { 0.5 } } - 1 \ right )
 - 1 \ right ) + \ frac { \ kappa } { T ^ { 1.0 } Tc ^ { 1.0 } } \ right )'''

implementation:
if not full :
    return self . a * ( 1 + self . kappa * ( 1 - ( T / self . Tc ) ** 0.5 ) ) ** 2
else :
    if quick :
        Tc , kappa = self . Tc , self . kappa
        x0 = T ** 0.5
        x1 = Tc ** - 0.5
        x2 = kappa * ( x0 * x1 - 1. ) - 1.
        x3 = self . a * kappa
        a_alpha = self . a * x2 * x2
        da_alpha_dT = x1 * x2 * x3 / x0
        d2a_alpha_dT2 = x3 * ( - 0.5 * T ** - 1.5 * x1 * x2 + 0.5 / ( T * Tc ) * kappa )
    else :
        a_alpha = self . a * ( 1 + self . kappa * ( 1 - ( T / self . Tc ) ** 0.5 ) ) ** 2
        da_alpha_dT = - self . a * self . kappa * sqrt ( T / self . Tc ) * ( self . kappa * ( - sqrt ( T / self . Tc ) + 1. ) + 1. ) / T
        d2a_alpha_dT2 = self . a * self . kappa * ( self . kappa / self . Tc - sqrt ( T / self . Tc ) * ( self . kappa * ( sqrt ( T / self . Tc ) - 1. ) - 1. ) / T ) / ( 2. * T )
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def solve_T ( self , P , V , quick = True ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the PR
 EOS . Uses ` Tc ` , ` a ` , ` b ` , and ` kappa ` as well , obtained from the
 class ' s namespace .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 T : float
 Temperature , [ K ]
 Notes
 The exact solution can be derived as follows , and is excluded for
 breviety .
 > > > from sympy import *
 > > > P , T , V = symbols ( ' P , T , V ' )
 > > > Tc , Pc , omega = symbols ( ' Tc , Pc , omega ' )
 > > > R , a , b , kappa = symbols ( ' R , a , b , kappa ' )
 > > > a _ alpha = a * ( 1 + kappa * ( 1 - sqrt ( T / Tc ) ) ) * * 2
 > > > PR _ formula = R * T / ( V - b ) - a _ alpha / ( V * ( V + b ) + b * ( V - b ) ) - P
 > > > # solve ( PR _ formula , T )'''


signature:
def solve_T ( self , P , V , quick = True ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the PRSV
 EOS . Uses ` Tc ` , ` a ` , ` b ` , ` kappa0 ` and ` kappa ` as well , obtained from
 the class ' s namespace .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( somewhat faster ) or
 individual formulas .
 Returns
 T : float
 Temperature , [ K ]
 Notes
 Not guaranteed to produce a solution . There are actually two solution ,
 one much higher than normally desired ; it is possible the solver could
 converge on this .'''

implementation:
Tc , a , b , kappa0 , kappa1 = self . Tc , self . a , self . b , self . kappa0 , self . kappa1
if quick :
    x0 = V - b
    R_x0 = R / x0
    x3 = ( 100. * ( V * ( V + b ) + b * x0 ) )
    x4 = 10. * kappa0
    kappa110 = kappa1 * 10.
    kappa17 = kappa1 * 7.
    def to_solve ( T ) :
        x1 = T / Tc
        x2 = x1 ** 0.5
        return ( T * R_x0 - a * ( ( x4 - ( kappa110 * x1 - kappa17 ) * ( x2 + 1. ) ) * ( x2 - 1. ) - 10. ) ** 2 / x3 ) - P
else :
    def to_solve ( T ) :
        P_calc = R * T / ( V - b ) - a * ( ( kappa0 + kappa1 * ( sqrt ( T / Tc ) + 1 ) * ( - T / Tc + 7 / 10 ) ) * ( - sqrt ( T / Tc ) + 1 ) + 1 ) ** 2 / ( V * ( V + b ) + b * ( V - b ) )
        return P_calc - P
return newton ( to_solve , Tc * 0.5 )


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` kappa0 ` , ` kappa1 ` , and
 For use in root - finding , returns only ` a _ alpha ` if full is False .
 The ` a _ alpha ` function is shown below ; its first and second derivatives
 are long available through the SymPy expression under it .
 . . math : :
 a \ alpha = a \ left ( \ left ( \ kappa _ { 0 } + \ kappa _ { 1 } \ left ( \ sqrt { \ frac {
 T } { Tc } } + 1 \ right ) \ left ( - \ frac { T } { Tc } + \ frac { 7 } { 10 } \ right )
 \ right ) \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right ) + 1 \ right ) ^ { 2}
 > > > from sympy import *
 > > > P , T , V = symbols ( ' P , T , V ' )
 > > > Tc , Pc , omega = symbols ( ' Tc , Pc , omega ' )
 > > > R , a , b , kappa0 , kappa1 = symbols ( ' R , a , b , kappa0 , kappa1 ' )
 > > > kappa = kappa0 + kappa1 * ( 1 + sqrt ( T / Tc ) ) * ( Rational ( 7 , 10 ) - T / Tc )
 > > > a _ alpha = a * ( 1 + kappa * ( 1 - sqrt ( T / Tc ) ) ) * * 2
 > > > # diff ( a _ alpha , T )
 > > > # diff ( a _ alpha , T , 2)'''


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` kappa0 ` , ` kappa1 ` ,
 ` kappa2 ` , ` kappa3 ` , and ` a ` .
 For use in ` solve _ T ` , returns only ` a _ alpha ` if full is False .
 The first and second derivatives of ` a _ alpha ` are available through the
 following SymPy expression .
 > > > from sympy import *
 > > > P , T , V = symbols ( ' P , T , V ' )
 > > > Tc , Pc , omega = symbols ( ' Tc , Pc , omega ' )
 > > > R , a , b , kappa0 , kappa1 , kappa2 , kappa3 = symbols ( ' R , a , b , kappa0 , kappa1 , kappa2 , kappa3 ' )
 > > > Tr = T / Tc
 > > > kappa = kappa0 + ( kappa1 + kappa2 * ( kappa3 - Tr ) * ( 1 - sqrt ( Tr ) ) ) * ( 1 + sqrt ( Tr ) ) * ( Rational ( ' 0.7 ' ) - Tr )
 > > > a _ alpha = a * ( 1 + kappa * ( 1 - sqrt ( T / Tc ) ) ) * * 2
 > > > # diff ( a _ alpha , T )
 > > > # diff ( a _ alpha , T , 2)'''


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` a ` .
 . . math : :
 a \ alpha = a
 \ frac { d a \ alpha } { dT } = 0
 \ frac { d ^ 2 a \ alpha } { dT ^ 2 } = 0'''

implementation:
if not full :
    return self . a
else :
    a_alpha = self . a
    da_alpha_dT = 0.0
    d2a_alpha_dT2 = 0.0
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def solve_T ( self , P , V ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the VDW
 EOS . Uses ` a ` , and ` b ` , obtained from the class ' s namespace .
 . . math : :
 T = \ frac { 1 } { R V ^ { 2 } } \ left ( P V ^ { 2 } \ left ( V - b \ right )
 + V a - a b \ right )
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 Returns
 T : float
 Temperature , [ K ]'''

implementation: return ( P * V ** 2 * ( V - self . b ) + V * self . a - self . a * self . b ) / ( R * V ** 2 )


signature:
def main_derivatives_and_departures ( T , P , V , b , delta , epsilon , a_alpha , da_alpha_dT , d2a_alpha_dT2 , quick = True ) :
    '''Re - implementation of derivatives and excess property calculations ,
 as ZeroDivisionError errors occur with the general solution . The
 following derivation is the source of these formulas .
 > > > from sympy import *
 > > > P , T , V , R , b , a = symbols ( ' P , T , V , R , b , a ' )
 > > > P _ vdw = R * T / ( V - b ) - a / ( V * V )
 > > > vdw = P _ vdw - P
 > > > dP _ dT = diff ( vdw , T )
 > > > dP _ dV = diff ( vdw , V )
 > > > d2P _ dT2 = diff ( vdw , T , 2)
 > > > d2P _ dV2 = diff ( vdw , V , 2)
 > > > d2P _ dTdV = diff ( vdw , T , V )
 > > > H _ dep = integrate ( T * dP _ dT - P _ vdw , ( V , oo , V ) )
 > > > H _ dep + = P * V - R * T
 > > > S _ dep = integrate ( dP _ dT - R / V , ( V , oo , V ) )
 > > > S _ dep + = R * log ( P * V / ( R * T ) )
 > > > Cv _ dep = T * integrate ( d2P _ dT2 , ( V , oo , V ) )
 > > > dP _ dT , dP _ dV , d2P _ dT2 , d2P _ dV2 , d2P _ dTdV , H _ dep , S _ dep , Cv _ dep
 ( R / ( V - b ) , - R * T / ( V - b ) * * 2 + 2 * a / V * * 3 , 0 , 2 * ( R * T / ( V - b ) * * 3 - 3 * a / V * * 4 ) , - R / ( V - b ) * * 2 , P * V - R * T - a / V , R * ( - log ( V ) + log ( V - b ) ) + R * log ( P * V / ( R * T ) ) , 0)'''

implementation:
dP_dT = R / ( V - b )
dP_dV = - R * T / ( V - b ) ** 2 + 2 * a_alpha / V ** 3
d2P_dT2 = 0
d2P_dV2 = 2 * ( R * T / ( V - b ) ** 3 - 3 * a_alpha / V ** 4 )
d2P_dTdV = - R / ( V - b ) ** 2
H_dep = P * V - R * T - a_alpha / V
S_dep = R * ( - log ( V ) + log ( V - b ) ) + R * log ( P * V / ( R * T ) )
Cv_dep = 0
return [ dP_dT , dP_dV , d2P_dT2 , d2P_dV2 , d2P_dTdV , H_dep , S_dep , Cv_dep ]


signature:
def solve_T ( self , P , V , quick = True ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the RK
 EOS . Uses ` a ` , and ` b ` , obtained from the class ' s namespace .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 T : float
 Temperature , [ K ]
 Notes
 The exact solution can be derived as follows ; it is excluded for
 breviety .
 > > > from sympy import *
 > > > P , T , V , R = symbols ( ' P , T , V , R ' )
 > > > Tc , Pc = symbols ( ' Tc , Pc ' )
 > > > a , b = symbols ( ' a , b ' )
 > > > RK = Eq ( P , R * T / ( V - b ) - a / sqrt ( T ) / ( V * V + b * V ) )
 > > > # solve ( RK , T )'''


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` m ` , and ` a ` .
 . . math : :
 a \ alpha = a \ left ( m \ left ( - \ sqrt { \ frac { T } { Tc } } + 1 \ right )
 + 1 \ right ) ^ { 2}
 \ frac { d a \ alpha } { dT } = \ frac { a m } { T } \ sqrt { \ frac { T } { Tc } } \ left ( m
 \ left ( \ sqrt { \ frac { T } { Tc } } - 1 \ right ) - 1 \ right )
 \ frac { d ^ 2 a \ alpha } { dT ^ 2 } = \ frac { a m \ sqrt { \ frac { T } { Tc } } } { 2 T ^ { 2 } }
 \ left ( m + 1 \ right )'''

implementation:
a , Tc , m = self . a , self . Tc , self . m
sqTr = ( T / Tc ) ** 0.5
a_alpha = a * ( m * ( 1. - sqTr ) + 1. ) ** 2
if not full :
    return a_alpha
else :
    da_alpha_dT = - a * m * sqTr * ( m * ( - sqTr + 1. ) + 1. ) / T
    d2a_alpha_dT2 = a * m * sqTr * ( m + 1. ) / ( 2. * T * T )
    return a_alpha , da_alpha_dT , d2a_alpha_dT2


signature:
def solve_T ( self , P , V , quick = True ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the SRK
 EOS . Uses ` a ` , ` b ` , and ` Tc ` obtained from the class ' s namespace .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 T : float
 Temperature , [ K ]
 Notes
 The exact solution can be derived as follows ; it is excluded for
 breviety .
 > > > from sympy import *
 > > > P , T , V , R , a , b , m = symbols ( ' P , T , V , R , a , b , m ' )
 > > > Tc , Pc , omega = symbols ( ' Tc , Pc , omega ' )
 > > > a _ alpha = a * ( 1 + m * ( 1 - sqrt ( T / Tc ) ) ) * * 2
 > > > SRK = R * T / ( V - b ) - a _ alpha / ( V * ( V + b ) ) - P
 > > > # solve ( SRK , T )'''


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` a ` , ` S1 ` , and ` S2 ` .
 . . math : :
 a \ alpha ( T ) = a \ left [ 1 + S _ 1 \ left ( 1 - \ sqrt { T _ r } \ right ) + S _ 2 \ frac { 1
 - \ sqrt { T _ r } } { \ sqrt { T _ r } } \ right ] ^ 2
 \ frac { d a \ alpha } { dT } = a \ frac { Tc } { T ^ { 2 } } \ left ( - S _ { 2 } \ left ( \ sqrt {
 \ frac { T } { Tc } } - 1 \ right ) + \ sqrt { \ frac { T } { Tc } } \ left ( S _ { 1 } \ sqrt {
 \ frac { T } { Tc } } + S _ { 2 } \ right ) \ right ) \ left ( S _ { 2 } \ left ( \ sqrt { \ frac {
 T } { Tc } } - 1 \ right ) + \ sqrt { \ frac { T } { Tc } } \ left ( S _ { 1 } \ left ( \ sqrt {
 \ frac { T } { Tc } } - 1 \ right ) - 1 \ right ) \ right )
 \ frac { d ^ 2 a \ alpha } { dT ^ 2 } = a \ frac { 1 } { 2 T ^ { 3 } } \ left ( S _ { 1 } ^ { 2 } T
 \ sqrt { \ frac { T } { Tc } } - S _ { 1 } S _ { 2 } T \ sqrt { \ frac { T } { Tc } } + 3 S _ { 1}
 S _ { 2 } Tc \ sqrt { \ frac { T } { Tc } } + S _ { 1 } T \ sqrt { \ frac { T } { Tc } }
 - 3 S _ { 2 } ^ { 2 } Tc \ sqrt { \ frac { T } { Tc } } + 4 S _ { 2 } ^ { 2 } Tc + 3 S _ { 2}
 Tc \ sqrt { \ frac { T } { Tc } } \ right )'''


signature:
def solve_T ( self , P , V , quick = True ) :
    r'''Method to calculate ` T ` from a specified ` P ` and ` V ` for the API
 SRK EOS . Uses ` a ` , ` b ` , and ` Tc ` obtained from the class ' s namespace .
 Parameters
 P : float
 Pressure , [ Pa ]
 V : float
 Molar volume , [ m ^ 3 / mol ]
 quick : bool , optional
 Whether to use a SymPy cse - derived expression ( 3x faster ) or
 individual formulas
 Returns
 T : float
 Temperature , [ K ]
 Notes
 If S2 is set to 0 , the solution is the same as in the SRK EOS , and that
 is used . Otherwise , newton ' s method must be used to solve for ` T ` .
 There are 8 roots of T in that case , six of them real . No guarantee can
 be made regarding which root will be obtained .'''

implementation:
if self . S2 == 0 :
    self . m = self . S1
    return SRK . solve_T ( self , P , V , quick = quick )
else : # Previously coded method is 63 microseconds vs 47 here
# return super ( SRK , self ) . solve _ T ( P , V , quick = quick )
    Tc , a , b , S1 , S2 = self . Tc , self . a , self . b , self . S1 , self . S2
    if quick :
        x2 = R / ( V - b )
        x3 = ( V * ( V + b ) )
        def to_solve ( T ) :
            x0 = ( T / Tc ) ** 0.5
            x1 = x0 - 1.
            return ( x2 * T - a * ( S1 * x1 + S2 * x1 / x0 - 1. ) ** 2 / x3 ) - P
    else :
        def to_solve ( T ) :
            P_calc = R * T / ( V - b ) - a * ( S1 * ( - sqrt ( T / Tc ) + 1 ) + S2 * ( - sqrt ( T / Tc ) + 1 ) / sqrt ( T / Tc ) + 1 ) ** 2 / ( V * ( V + b ) )
            return P_calc - P
    return newton ( to_solve , Tc * 0.5 )


signature:
def a_alpha_and_derivatives ( self , T , full = True , quick = True ) :
    r'''Method to calculate ` a _ alpha ` and its first and second
 derivatives for this EOS . Returns ` a _ alpha ` , ` da _ alpha _ dT ` , and
 ` d2a _ alpha _ dT2 ` . See ` GCEOS . a _ alpha _ and _ derivatives ` for more
 documentation . Uses the set values of ` Tc ` , ` omega ` , and ` a ` .
 Because of its similarity for the TWUPR EOS , this has been moved to an
 external ` TWU _ a _ alpha _ common ` function . See it for further
 documentation .'''

implementation: return TWU_a_alpha_common ( T , self . Tc , self . omega , self . a , full = full , quick = quick , method = 'SRK' )


signature:
def Tb ( CASRN , AvailableMethods = False , Method = None , IgnoreMethods = [ PSAT_DEFINITION ] ) :
    r'''This function handles the retrieval of a chemical ' s boiling
 point . Lookup is based on CASRNs . Will automatically select a data
 source to use if no Method is provided ; returns None if the data is not
 available .
 Prefered sources are ' CRC Physical Constants , organic ' for organic
 chemicals , and ' CRC Physical Constants , inorganic ' for inorganic
 chemicals . Function has data for approximately 13000 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 Tb : float
 Boiling temperature , [ K ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Tb with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Tb _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Tb for the desired chemical , and will return methods instead of Tb
 IgnoreMethods : list , optional
 A list of methods to ignore in obtaining the full list of methods ,
 useful for for performance reasons and ignoring inaccurate methods
 Notes
 A total of four methods are available for this function . They are :
 * ' CRC _ ORG ' , a compillation of data on organics
 as published in [ 1 ] _ .
 * ' CRC _ INORG ' , a compillation of data on
 inorganic as published in [ 1 ] _ .
 * ' YAWS ' , a large compillation of data from a
 variety of sources ; no data points are sourced in the work of [ 2 ] _ .
 * ' PSAT _ DEFINITION ' , calculation of boiling point from a
 vapor pressure calculation . This is normally off by a fraction of a
 degree even in the best cases . Listed in IgnoreMethods by default
 for performance reasons .
 Examples
 > > > Tb ( ' 7732-18-5 ' )
 373.124
 References
 . . [ 1 ] Haynes , W . M . , Thomas J . Bruno , and David R . Lide . CRC Handbook of
 Chemistry and Physics , 95E . Boca Raton , FL : CRC press , 2014.
 . . [ 2 ] Yaws , Carl L . Thermophysical Properties of Chemicals and
 Hydrocarbons , Second Edition . Amsterdam Boston : Gulf Professional
 Publishing , 2014.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in CRC_inorganic_data . index and not np . isnan ( CRC_inorganic_data . at [ CASRN , 'Tb' ] ) :
        methods . append ( CRC_INORG )
    if CASRN in CRC_organic_data . index and not np . isnan ( CRC_organic_data . at [ CASRN , 'Tb' ] ) :
        methods . append ( CRC_ORG )
    if CASRN in Yaws_data . index :
        methods . append ( YAWS )
    if PSAT_DEFINITION not in IgnoreMethods :
        try : # For some chemicals , vapor pressure range will exclude Tb
            VaporPressure ( CASRN = CASRN ) . solve_prop ( 101325. )
            methods . append ( PSAT_DEFINITION )
        except : # pragma : no cover
            pass
    if IgnoreMethods :
        for Method in IgnoreMethods :
            if Method in methods :
                methods . remove ( Method )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == CRC_INORG :
    return float ( CRC_inorganic_data . at [ CASRN , 'Tb' ] )
elif Method == CRC_ORG :
    return float ( CRC_organic_data . at [ CASRN , 'Tb' ] )
elif Method == YAWS :
    return float ( Yaws_data . at [ CASRN , 'Tb' ] )
elif Method == PSAT_DEFINITION :
    return VaporPressure ( CASRN = CASRN ) . solve_prop ( 101325. )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def Tm ( CASRN , AvailableMethods = False , Method = None , IgnoreMethods = [ ] ) :
    r'''This function handles the retrieval of a chemical ' s melting
 point . Lookup is based on CASRNs . Will automatically select a data
 source to use if no Method is provided ; returns None if the data is not
 available .
 Prefered sources are ' Open Notebook Melting Points ' , with backup sources
 ' CRC Physical Constants , organic ' for organic chemicals , and
 ' CRC Physical Constants , inorganic ' for inorganic chemicals . Function has
 data for approximately 14000 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 Tm : float
 Melting temperature , [ K ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Tm with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Tm _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Tm for the desired chemical , and will return methods instead of Tm
 IgnoreMethods : list , optional
 A list of methods to ignore in obtaining the full list of methods
 Notes
 A total of three sources are available for this function . They are :
 * ' OPEN _ NTBKM , a compillation of data on organics
 as published in [ 1 ] _ as Open Notebook Melting Points ; Averaged
 ( median ) values were used when
 multiple points were available . For more information on this
 invaluable and excellent collection , see
 http : / / onswebservices . wikispaces . com / meltingpoint .
 * ' CRC _ ORG ' , a compillation of data on organics
 as published in [ 2 ] _ .
 * ' CRC _ INORG ' , a compillation of data on
 inorganic as published in [ 2 ] _ .
 Examples
 > > > Tm ( CASRN = ' 7732-18-5 ' )
 273.15
 References
 . . [ 1 ] Bradley , Jean - Claude , Antony Williams , and Andrew Lang .
 " Jean - Claude Bradley Open Melting Point Dataset " , May 20 , 2014.
 https : / / figshare . com / articles / Jean _ Claude _ Bradley _ Open _ Melting _ Point _ Datset / 1031637.
 . . [ 2 ] Haynes , W . M . , Thomas J . Bruno , and David R . Lide . CRC Handbook of
 Chemistry and Physics , 95E . Boca Raton , FL : CRC press , 2014.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in Tm_ON_data . index :
        methods . append ( OPEN_NTBKM )
    if CASRN in CRC_inorganic_data . index and not np . isnan ( CRC_inorganic_data . at [ CASRN , 'Tm' ] ) :
        methods . append ( CRC_INORG )
    if CASRN in CRC_organic_data . index and not np . isnan ( CRC_organic_data . at [ CASRN , 'Tm' ] ) :
        methods . append ( CRC_ORG )
    if IgnoreMethods :
        for Method in IgnoreMethods :
            if Method in methods :
                methods . remove ( Method )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == OPEN_NTBKM :
    return float ( Tm_ON_data . at [ CASRN , 'Tm' ] )
elif Method == CRC_INORG :
    return float ( CRC_inorganic_data . at [ CASRN , 'Tm' ] )
elif Method == CRC_ORG :
    return float ( CRC_organic_data . at [ CASRN , 'Tm' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def Clapeyron ( T , Tc , Pc , dZ = 1 , Psat = 101325 ) :
    r'''Calculates enthalpy of vaporization at arbitrary temperatures using the
 Clapeyron equation .
 The enthalpy of vaporization is given by :
 . . math : :
 \ Delta H _ { vap } = RT \ Delta Z \ frac { \ ln ( P _ c / Psat ) } { ( 1 - T _ { r } ) }
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 dZ : float
 Change in compressibility factor between liquid and gas , [ ]
 Psat : float
 Saturation pressure of fluid [ Pa ] , optional
 Returns
 Hvap : float
 Enthalpy of vaporization , [ J / mol ]
 Notes
 No original source is available for this equation .
 [1 ] _ claims this equation overpredicts enthalpy by several percent .
 Under Tr = 0.8 , dZ = 1 is a reasonable assumption .
 This equation is most accurate at the normal boiling point .
 Internal units are bar .
 WARNING : I believe it possible that the adjustment for pressure may be incorrect
 Examples
 Problem from Perry ' s examples .
 > > > Clapeyron ( T = 294.0 , Tc = 466.0 , Pc = 5.55E6)
 26512.354585061985
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''

implementation:
Tr = T / Tc
return R * T * dZ * log ( Pc / Psat ) / ( 1. - Tr )


signature:
def Pitzer ( T , Tc , omega ) :
    r'''Calculates enthalpy of vaporization at arbitrary temperatures using a
 fit by [ 2 ] _ to the work of Pitzer [ 1 ] _ ; requires a chemical ' s critical
 temperature and acentric factor .
 The enthalpy of vaporization is given by :
 . . math : :
 \ frac { \ Delta _ { vap } H } { RT _ c } = 7.08(1 - T _ r ) ^ { 0.354 } + 10.95 \ omega ( 1 - T _ r ) ^ { 0.456}
 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
 This equation is listed in [ 3 ] _ , page 2-487 as method # 2 for estimating
 Hvap . This cites [ 2 ] _ .
 The recommended range is 0.6 to 1 Tr . Users should expect up to 5 % error .
 T must be under Tc , or an exception is raised .
 The original article has been reviewed and found to have a set of tabulated
 values which could be used instead of the fit function to provide additional
 accuracy .
 Examples
 Example as in [ 3 ] _ , p2-487 ; exp : 37.51 kJ / mol
 > > > Pitzer ( 452 , 645.6 , 0.35017)
 36696.736640106414
 References
 . . [ 1 ] Pitzer , Kenneth S . " The Volumetric and Thermodynamic Properties of
 Fluids . I . Theoretical Basis and Virial Coefficients . "
 Journal of the American Chemical Society 77 , no . 13 ( July 1 , 1955 ) :
 3427-33 . doi : 10.1021 / ja01618a001
 . . [ 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.'''