signature:
def molecular_diameter ( Tc = None , Pc = None , Vc = None , Zc = None , omega = None , Vm = None , Vb = None , CASRN = '' , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval or calculation a chemical ' s
 L - J molecular diameter . Values are available from one source with lookup
 based on CASRNs , or can be estimated from 9 CSP methods .
 Will automatically select a data source to use if no Method is provided ;
 returns None if the data is not available .
 Prefered sources are ' Magalhães , Lito , Da Silva , and Silva ( 2013 ) ' for
 common chemicals which had valies listed in that source , and the CSP method
 ` Tee , Gotoh , and Stewart CSP with Tc , Pc , omega ( 1966 ) ` for chemicals which
 don ' t .
 Examples
 > > > molecular _ diameter ( CASRN = ' 64-17-5 ' )
 4.23738
 Parameters
 Tc : float , optional
 Critical temperature , [ K ]
 Pc : float , optional
 Critical pressure , [ Pa ]
 Vc : float , optional
 Critical volume , [ m ^ 3 / mol ]
 Zc : float , optional
 Critical compressibility , [ - ]
 omega : float , optional
 Acentric factor of compound , [ - ]
 Vm : float , optional
 Molar volume of liquid at the melting point of the fluid [ K ]
 Vb : float , optional
 Molar volume of liquid at the boiling point of the fluid [ K ]
 CASRN : string , optional
 CASRN [ - ]
 Returns
 sigma : float
 Lennard - Jones molecular diameter , [ Angstrom ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain epsilon with the given
 inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 molecular _ diameter _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 sigma for the desired chemical , and will return methods instead of
 sigma
 Notes
 These values are somewhat rough , as they attempt to pigeonhole a chemical
 into L - J behavior .
 The tabulated data is from [ 2 ] _ , for 322 chemicals .
 References
 . . [ 1 ] Bird , R . Byron , Warren E . Stewart , and Edwin N . Lightfoot .
 Transport Phenomena , Revised 2nd Edition . New York :
 John Wiley & Sons , Inc . , 2006
 . . [ 2 ] Magalhães , Ana L . , Patrícia F . Lito , Francisco A . Da Silva , and
 Carlos M . Silva . " Simple and Accurate Correlations for Diffusion
 Coefficients of Solutes in Liquids and Supercritical Fluids over Wide
 Ranges of Temperature and Density . " The Journal of Supercritical Fluids
 76 ( April 2013 ) : 94-114 . doi : 10.1016 / j . supflu . 2013.02.002.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in MagalhaesLJ_data . index :
        methods . append ( MAGALHAES )
    if Tc and Pc and omega :
        methods . append ( TEEGOTOSTEWARD4 )
    if Tc and Pc :
        methods . append ( SILVALIUMACEDO )
        methods . append ( BSLC2 )
        methods . append ( TEEGOTOSTEWARD3 )
    if Vc and Zc :
        methods . append ( STIELTHODOSMD )
    if Vc :
        methods . append ( FLYNN )
        methods . append ( BSLC1 )
    if Vb :
        methods . append ( BSLB )
    if Vm :
        methods . append ( BSLM )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == FLYNN :
    sigma = sigma_Flynn ( Vc )
elif Method == BSLC1 :
    sigma = sigma_Bird_Stewart_Lightfoot_critical_1 ( Vc )
elif Method == BSLC2 :
    sigma = sigma_Bird_Stewart_Lightfoot_critical_2 ( Tc , Pc )
elif Method == TEEGOTOSTEWARD3 :
    sigma = sigma_Tee_Gotoh_Steward_1 ( Tc , Pc )
elif Method == SILVALIUMACEDO :
    sigma = sigma_Silva_Liu_Macedo ( Tc , Pc )
elif Method == BSLB :
    sigma = sigma_Bird_Stewart_Lightfoot_boiling ( Vb )
elif Method == BSLM :
    sigma = sigma_Bird_Stewart_Lightfoot_melting ( Vm )
elif Method == STIELTHODOSMD :
    sigma = sigma_Stiel_Thodos ( Vc , Zc )
elif Method == TEEGOTOSTEWARD4 :
    sigma = sigma_Tee_Gotoh_Steward_2 ( Tc , Pc , omega )
elif Method == MAGALHAES :
    sigma = float ( MagalhaesLJ_data . at [ CASRN , "sigma" ] )
elif Method == NONE :
    sigma = None
else :
    raise Exception ( 'Failure in in function' )
return sigma


signature:
def sigma_Tee_Gotoh_Steward_2 ( Tc , Pc , omega ) :
    r'''Calculates Lennard - Jones molecular diameter .
 Uses critical temperature , pressure , and acentric factor . CSP method by
 [1 ] _ .
 . . math : :
 \ sigma = ( 2.3551 - 0.0874 \ omega ) \ left ( \ frac { T _ c } { P _ c } \ right ) ^ { 1/3}
 Parameters
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 omega : float
 Acentric factor for fluid , [ - ]
 Returns
 sigma : float
 Lennard - Jones molecular diameter , [ Angstrom ]
 Notes
 Original units of Pc are atm . Further regressions with other parameters
 were performed in [ 1 ] _ but are not included here , except for
 ` sigma _ Tee _ Gotoh _ Steward _ 1 ` .
 Examples
 > > > sigma _ Tee _ Gotoh _ Steward _ 2(560.1 , 4550000 , 0.245)
 5.412104867264477
 References
 . . [ 1 ] Tee , L . S . , Sukehiro Gotoh , and W . E . Stewart . " Molecular Parameters
 for Normal Fluids . Lennard - Jones 12-6 Potential . " Industrial
 & Engineering Chemistry Fundamentals 5 , no . 3 ( August 1 , 1966 ) : 356-63.
 doi : 10.1021 / i160019a011'''


signature:
def sigma_Silva_Liu_Macedo ( Tc , Pc ) :
    r'''Calculates Lennard - Jones molecular diameter .
 Uses critical temperature and pressure . CSP method by [ 1 ] _ .
 . . math : :
 \ sigma _ { LJ } ^ 3 = 0.17791 + 11.779 \ left ( \ frac { T _ c } { P _ c } \ right )
 - 0.049029 \ left ( \ frac { T _ c } { P _ c } \ right ) ^ 2
 Parameters
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 Returns
 sigma : float
 Lennard - Jones molecular diameter , [ Angstrom ]
 Notes
 Pc is originally in bar . An excellent paper . None is
 returned if the polynomial returns a negative number , as in the case of
 1029.13 K and 3.83 bar .
 Examples
 > > > sigma _ Silva _ Liu _ Macedo ( 560.1 , 4550000)
 5.164483998730177
 References
 . . [ 1 ] Silva , Carlos M . , Hongqin Liu , and Eugenia A . Macedo . " Models for
 Self - Diffusion Coefficients of Dense Fluids , Including Hydrogen - Bonding
 Substances . " Chemical Engineering Science 53 , no . 13 ( July 1 , 1998 ) :
 2423-29 . doi : 10.1016 / S0009-2509(98)00037-2'''

implementation:
Pc = Pc / 1E5
# Pa to bar
term = 0.17791 + 11.779 * ( Tc / Pc ) - 0.049029 * ( Tc / Pc ) ** 2
if term < 0 :
    sigma = None
else :
    sigma = ( term ) ** ( 1 / 3. )
return sigma


signature:
def collision_integral_Neufeld_Janzen_Aziz ( Tstar , l = 1 , s = 1 ) :
    r'''Calculates Lennard - Jones collision integral for any of 16 values of
 ( l , j ) for the wide range of 0.3 < Tstar < 100 . Values are accurate to
 0.1 % of actual values , but the calculation of actual values is
 computationally intensive and so these simplifications are used , developed
 in [ 1 ] _ .
 . . math : :
 \ Omega _ D = \ frac { A } { T ^ { * B } } + \ frac { C } { \ exp ( DT ^ * ) } +
 \ frac { E } { \ exp ( FT ^ { * } ) } + \ frac { G } { \ exp ( HT ^ * ) } + RT ^ { * B } \ sin ( ST ^ { * W } - P )
 Parameters
 Tstar : float
 Reduced temperature of the fluid [ - ]
 l : int
 term
 s : int
 term
 Returns
 Omega : float
 Collision integral of A and B
 Notes
 Acceptable pairs of ( l , s ) are ( 1 , 1 ) , ( 1 , 2 ) , ( 1 , 3 ) , ( 1 , 4 ) , ( 1 , 5 ) ,
 (1 , 6 ) , ( 1 , 7 ) , ( 2 , 2 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 2 , 5 ) , ( 2 , 6 ) , ( 3 , 3 ) , ( 3 , 4 ) ,
 (3 , 5 ) , and ( 4 , 4 ) .
 . . math : :
 T ^ * = \ frac { k _ b T } { \ epsilon }
 Results are very similar to those of the more modern formulation ,
 ` collision _ integral _ Kim _ Monroe ` .
 Calculations begin to yield overflow errors in some values of ( l , 2 ) after
 Tstar = 75 , beginning with ( 1 , 7 ) . Also susceptible are ( 1 , 5 ) and ( 1 , 6 ) .
 Examples
 > > > collision _ integral _ Neufeld _ Janzen _ Aziz ( 100 , 1 , 1)
 0.516717697672334
 References
 . . [ 1 ] Neufeld , Philip D . , A . R . Janzen , and R . A . Aziz . " Empirical
 Equations to Calculate 16 of the Transport Collision Integrals
 Omega ( l , S ) * for the Lennard - Jones ( 12-6 ) Potential . " The Journal of
 Chemical Physics 57 , no . 3 ( August 1 , 1972 ) : 1100-1102.
 doi : 10.1063/1.1678363'''

implementation:
if ( l , s ) not in Neufeld_collision :
    raise Exception ( 'Input values of l and s are not supported' )
A , B , C , D , E , F , G , H , R , S , W , P = Neufeld_collision [ ( l , s ) ]
omega = A / Tstar ** B + C / exp ( D * Tstar ) + E / exp ( F * Tstar )
if ( l , s ) in [ ( 1 , 1 ) , ( 1 , 2 ) , ( 3 , 3 ) ] :
    omega += G / exp ( H * Tstar )
if ( l , s ) not in [ ( 1 , 1 ) , ( 1 , 2 ) ] :
    omega += R * Tstar ** B * sin ( S * Tstar ** W - P )
return omega


signature:
def collision_integral_Kim_Monroe ( Tstar , l = 1 , s = 1 ) :
    r'''Calculates Lennard - Jones collision integral for any of 16 values of
 ( l , j ) for the wide range of 0.3 < Tstar < 400 . Values are accurate to
 0.007 % of actual values , but the calculation of actual values is
 computationally intensive and so these simplifications are used , developed
 in [ 1 ] _ .
 . . math : :
 \ Omega ^ { ( l , s ) * } = A ^ { ( l , s ) } + \ sum _ { k = 1 } ^ 6 \ left [ \ frac { B _ k ^ { ( l , s ) } }
 { ( T ^ * ) ^ k } + C _ k ^ { ( l , s ) } ( \ ln T ^ * ) ^ k \ right ]
 Parameters
 Tstar : float
 Reduced temperature of the fluid [ - ]
 l : int
 term
 s : int
 term
 Returns
 Omega : float
 Collision integral of A and B
 Notes
 Acceptable pairs of ( l , s ) are ( 1 , 1 ) , ( 1 , 2 ) , ( 1 , 3 ) , ( 1 , 4 ) , ( 1 , 5 ) ,
 (1 , 6 ) , ( 1 , 7 ) , ( 2 , 2 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 2 , 5 ) , ( 2 , 6 ) , ( 3 , 3 ) , ( 3 , 4 ) ,
 (3 , 5 ) , and ( 4 , 4 ) .
 . . math : :
 T ^ * = \ frac { k _ b T } { \ epsilon }
 Examples
 > > > collision _ integral _ Kim _ Monroe ( 400 , 1 , 1)
 0.4141818082392228
 References
 . . [ 1 ] Kim , Sun Ung , and Charles W . Monroe . " High - Accuracy Calculations of
 Sixteen Collision Integrals for Lennard - Jones ( 12-6 ) Gases and Their
 Interpolation to Parameterize Neon , Argon , and Krypton . " Journal of
 Computational Physics 273 ( September 15 , 2014 ) : 358-73.
 doi : 10.1016 / j . jcp . 2014.05.018.'''

implementation:
if ( l , s ) not in As_collision :
    raise Exception ( 'Input values of l and s are not supported' )
omega = As_collision [ ( l , s ) ]
for ki in range ( 6 ) :
    Bs = Bs_collision [ ( l , s ) ]
    Cs = Cs_collision [ ( l , s ) ]
    omega += Bs [ ki ] / Tstar ** ( ki + 1 ) + Cs [ ki ] * log ( Tstar ) ** ( ki + 1 )
return omega


signature:
def Tstar ( T , epsilon_k = None , epsilon = None ) :
    r'''This function calculates the parameter ` Tstar ` as needed in performing
 collision integral calculations .
 . . math : :
 T ^ * = \ frac { kT } { \ epsilon }
 Examples
 > > > Tstar ( T = 318.2 , epsilon _ k = 308.43)
 1.0316765554582887
 Parameters
 epsilon _ k : float , optional
 Lennard - Jones depth of potential - energy minimum over k , [ K ]
 epsilon : float , optional
 Lennard - Jones depth of potential - energy minimum [ J ]
 Returns
 Tstar : float
 Dimentionless temperature for calculating collision integral , [ - ]
 Notes
 Tabulated values are normally listed as epsilon / k . k is the Boltzman
 constant , with units of J / K .
 References
 . . [ 1 ] Bird , R . Byron , Warren E . Stewart , and Edwin N . Lightfoot .
 Transport Phenomena , Revised 2nd Edition . New York :
 John Wiley & Sons , Inc . , 2006'''

implementation:
if epsilon_k :
    _Tstar = T / ( epsilon_k )
elif epsilon :
    _Tstar = k * T / epsilon
else :
    raise Exception ( 'Either epsilon/k or epsilon must be provided' )
return _Tstar


signature:
def Hf ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s standard - phase
 heat of formation . The lookup is based on CASRNs . Selects the only
 data source available ( ' API TDB ' ) if the chemical is in it .
 Returns None if the data is not available .
 Function has data for 571 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 Hf : float
 Standard - state heat of formation , [ J / mol ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Hf with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Hf _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Hf for the desired chemical , and will return methods instead of Hf
 Notes
 Only one source of information is available to this function . it is :
 * ' API _ TDB ' , a compilation of heats of formation of unspecified phase .
 Not the original data , but as reproduced in [ 1 ] _ . Some chemicals with
 duplicated CAS numbers were removed .
 Examples
 > > > Hf ( CASRN = ' 7732-18-5 ' )
 -241820.0
 References
 . . [ 1 ] Albahri , Tareq A . , and Abdulla F . Aljasmi . " SGC Method for
 Predicting the Standard Enthalpy of Formation of Pure Compounds from
 Their Molecular Structures . " Thermochimica Acta 568
 ( September 20 , 2013 ) : 46-60 . doi : 10.1016 / j . tca . 2013.06.020.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in API_TDB_data . index :
        methods . append ( API_TDB )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == API_TDB :
    _Hf = float ( API_TDB_data . at [ CASRN , 'Hf' ] )
elif Method == NONE :
    _Hf = None
else :
    raise Exception ( 'Failure in in function' )
return _Hf


signature:
def Hf_l ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s liquid standard
 phase heat of formation . The lookup is based on CASRNs . Selects the only
 data source available , Active Thermochemical Tables ( l ) , if the chemical is
 in it . Returns None if the data is not available .
 Function has data for 34 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 Hfl : float
 Liquid standard - state heat of formation , [ J / mol ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Hf ( l ) with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Hf _ l _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Hf ( l ) for the desired chemical , and will return methods instead of Hf ( l )
 Notes
 Only one source of information is available to this function . It is :
 * ' ATCT _ L ' , the Active Thermochemical Tables version 1.112.
 Examples
 > > > Hf _ l ( ' 67-56-1 ' )
 -238400.0
 References
 . . [ 1 ] Ruscic , Branko , Reinhardt E . Pinzon , Gregor von Laszewski , Deepti
 Kodeboyina , Alexander Burcat , David Leahy , David Montoy , and Albert F .
 Wagner . " Active Thermochemical Tables : Thermochemistry for the 21st
 Century . " Journal of Physics : Conference Series 16 , no . 1
 ( January 1 , 2005 ) : 561 . doi : 10.1088/1742-6596/16/1/078.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in ATcT_l . index :
        methods . append ( ATCT_L )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ATCT_L :
    _Hfl = float ( ATcT_l . at [ CASRN , 'Hf_298K' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )
return _Hfl


signature:
def Hf_g ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval of a chemical ' s gas heat of
 formation . 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 ' Active Thermochemical Tables ( g ) ' for high accuracy ,
 and ' TRC ' for less accuracy but more chemicals .
 Function has data for approximately 2000 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 _ Hfg : float
 Gas phase heat of formation , [ J / mol ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Hf ( g ) with the given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Hf _ g _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Hf ( g ) for the desired chemical , and will return methods instead of Hf ( g )
 Notes
 Sources are :
 * ' ATCT _ G ' , the Active Thermochemical Tables version 1.112.
 * ' TRC ' , from a 1994 compilation .
 Examples
 > > > Hf _ g ( ' 67-56-1 ' )
 -200700.0
 References
 . . [ 1 ] Ruscic , Branko , Reinhardt E . Pinzon , Gregor von Laszewski , Deepti
 Kodeboyina , Alexander Burcat , David Leahy , David Montoy , and Albert F .
 Wagner . " Active Thermochemical Tables : Thermochemistry for the 21st
 Century . " Journal of Physics : Conference Series 16 , no . 1
 ( January 1 , 2005 ) : 561 . doi : 10.1088/1742-6596/16/1/078.
 . . [ 2 ] Frenkelʹ , M . L , Texas Engineering Experiment Station , and
 Thermodynamics Research Center . Thermodynamics of Organic Compounds in
 the Gas State . College Station , Tex . : Thermodynamics Research Center ,
 1994.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in ATcT_g . index :
        methods . append ( ATCT_G )
    if CASRN in TRC_gas_data . index and not np . isnan ( TRC_gas_data . at [ CASRN , 'Hf' ] ) :
        methods . append ( TRC )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ATCT_G :
    _Hfg = float ( ATcT_g . at [ CASRN , 'Hf_298K' ] )
elif Method == TRC :
    _Hfg = float ( TRC_gas_data . at [ CASRN , 'Hf' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )
return _Hfg


signature:
def omega ( CASRN , AvailableMethods = False , Method = None , IgnoreMethods = [ 'LK' , 'DEFINITION' ] ) :
    r'''This function handles the retrieval of a chemical ' s acentric factor ,
 ` omega ` , or its calculation from correlations or directly through the
 definition of acentric factor if possible . Requires a known boiling point ,
 critical temperature and pressure for use of the correlations . Requires
 accurate vapor pressure data for direct calculation .
 Will automatically select a method to use if no Method is provided ;
 returns None if the data is not available and cannot be calculated .
 . . math : :
 \ omega \ equiv - \ log _ { 10 } \ left [ \ lim _ { T / T _ c = 0.7 } ( P ^ { sat } / P _ c ) \ right ] - 1.0
 Examples
 > > > omega ( CASRN = ' 64-17-5 ' )
 0.635
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 omega : float
 Acentric factor of compound
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain omega with the given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Accepted methods are ' PSRK ' , ' PD ' , ' YAWS ' ,
 ' LK ' , and ' DEFINITION ' . All valid values are also held in the list
 omega _ methods .
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 omega for the desired chemical , and will return methods instead of
 omega
 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 five sources are available for this function . They are :
 * ' PSRK ' , a compillation of experimental and estimated data published
 in the Appendix of [ 15 ] _ , the fourth revision of the PSRK model .
 * ' PD ' , an older compillation of
 data published in ( Passut & Danner , 1973 ) [ 16 ] _ .
 * ' YAWS ' , a large compillation of data from a
 variety of sources ; no data points are sourced in the work of [ 17 ] _ .
 * ' LK ' , a estimation method for hydrocarbons .
 * ' DEFINITION ' , based on the definition of omega as
 presented in [ 1 ] _ , using vapor pressure data .
 References
 . . [ 1 ] Pitzer , K . S . , D . Z . Lippmann , R . F . Curl , C . M . Huggins , and
 D . E . Petersen : The Volumetric and Thermodynamic Properties of Fluids .
 II . Compressibility Factor , Vapor Pressure and Entropy of Vaporization .
 J . Am . Chem . Soc . , 77 : 3433 ( 1955 ) .
 . . [ 2 ] Horstmann , Sven , Anna Jabłoniec , Jörg Krafczyk , Kai Fischer , and
 Jürgen Gmehling . " PSRK Group Contribution Equation of State :
 Comprehensive Revision and Extension IV , Including Critical Constants
 and Α - Function Parameters for 1000 Components . " Fluid Phase Equilibria
 227 , no . 2 ( January 25 , 2005 ) : 157-64 . doi : 10.1016 / j . fluid . 2004.11.002.
 . . [ 3 ] Passut , Charles A . , and Ronald P . Danner . " Acentric Factor . A
 Valuable Correlating Parameter for the Properties of Hydrocarbons . "
 Industrial & Engineering Chemistry Process Design and Development 12,
 no . 3 ( July 1 , 1973 ) : 365-68 . doi : 10.1021 / i260047a026.
 . . [ 4 ] 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 _crit_PSRKR4 . index and not np . isnan ( _crit_PSRKR4 . at [ CASRN , 'omega' ] ) :
        methods . append ( 'PSRK' )
    if CASRN in _crit_PassutDanner . index and not np . isnan ( _crit_PassutDanner . at [ CASRN , 'omega' ] ) :
        methods . append ( 'PD' )
    if CASRN in _crit_Yaws . index and not np . isnan ( _crit_Yaws . at [ CASRN , 'omega' ] ) :
        methods . append ( 'YAWS' )
    Tcrit , Pcrit = Tc ( CASRN ) , Pc ( CASRN )
    if Tcrit and Pcrit :
        if Tb ( CASRN ) :
            methods . append ( 'LK' )
        if VaporPressure ( CASRN = CASRN ) . T_dependent_property ( Tcrit * 0.7 ) :
            methods . append ( 'DEFINITION' )
            # TODO : better integration
    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 ]
# This is the calculate , given the method section
if Method == 'PSRK' :
    _omega = float ( _crit_PSRKR4 . at [ CASRN , 'omega' ] )
elif Method == 'PD' :
    _omega = float ( _crit_PassutDanner . at [ CASRN , 'omega' ] )
elif Method == 'YAWS' :
    _omega = float ( _crit_Yaws . at [ CASRN , 'omega' ] )
elif Method == 'LK' :
    _omega = LK_omega ( Tb ( CASRN ) , Tc ( CASRN ) , Pc ( CASRN ) )
elif Method == 'DEFINITION' :
    P = VaporPressure ( CASRN = CASRN ) . T_dependent_property ( Tc ( CASRN ) * 0.7 )
    _omega = - log10 ( P / Pc ( CASRN ) ) - 1.0
elif Method == 'NONE' :
    _omega = None
else :
    raise Exception ( 'Failure in in function' )
return _omega


signature:
def LK_omega ( Tb , Tc , Pc ) :
    r'''Estimates the acentric factor of a fluid using a correlation in [ 1 ] _ .
 . . math : :
 \ omega = \ frac { \ ln P _ { br } ^ { sat } - 5.92714 + 6.09648 / T _ { br } + 1.28862
 \ ln T _ { br } - 0.169347T _ { br } ^ 6}
 {15.2518 - 15.6875 / T _ { br } - 13.4721 \ ln T _ { br } + 0.43577 T _ { br } ^ 6}
 Parameters
 Tb : float
 Boiling temperature of the fluid [ K ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 Returns
 omega : float
 Acentric factor of the fluid [ - ]
 Notes
 Internal units are atmosphere and Kelvin .
 Example value from Reid ( 1987 ) . Using ASPEN V8.4 , LK method gives 0.325595.
 Examples
 Isopropylbenzene
 > > > LK _ omega ( 425.6 , 631.1 , 32.1E5)
 0.32544249926397856
 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.'''


signature:
def omega_mixture ( omegas , zs , CASRNs = None , Method = None , AvailableMethods = False ) :
    r'''This function handles the calculation of a mixture ' s acentric factor .
 Calculation is based on the omegas provided for each pure component . Will
 automatically select a method to use if no Method is provided ;
 returns None if insufficient data is available .
 Examples
 > > > omega _ mixture ( [ 0.025 , 0.12 ] , [ 0.3 , 0.7 ] )
 0.0915
 Parameters
 omegas : array - like
 acentric factors of each component , [ - ]
 zs : array - like
 mole fractions of each component , [ - ]
 CASRNs : list of strings
 CASRNs , not currently used [ - ]
 Returns
 omega : float
 acentric factor of the mixture , [ - ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain omega with the given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Only ' SIMPLE ' is accepted so far .
 All valid values are also held in the list omega _ mixture _ methods .
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 omega for the desired chemical , and will return methods instead of
 omega
 Notes
 The only data used in the methods implemented to date are mole fractions
 and pure - component omegas . An alternate definition could be based on
 the dew point or bubble point of a multicomponent mixture , but this has
 not been done to date .
 References
 . . [ 1 ] Poling , Bruce E . The Properties of Gases and Liquids . 5th edition .
 New York : McGraw - Hill Professional , 2000.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if none_and_length_check ( [ zs , omegas ] ) :
        methods . append ( 'SIMPLE' )
    methods . append ( 'NONE' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == 'SIMPLE' :
    _omega = mixing_simple ( zs , omegas )
elif Method == 'NONE' :
    _omega = None
else :
    raise Exception ( 'Failure in in function' )
return _omega


signature:
def StielPolar ( Tc = None , Pc = None , omega = None , CASRN = '' , Method = None , AvailableMethods = False ) :
    r'''This function handles the calculation of a chemical ' s Stiel Polar
 factor , directly through the definition of Stiel - polar factor if possible .
 Requires Tc , Pc , acentric factor , and a vapor pressure datum at Tr = 0.6.
 Will automatically select a method to use if no Method is provided ;
 returns None if the data is not available and cannot be calculated .
 . . math : :
 x = \ log P _ r | _ { T _ r = 0.6 } + 1.70 \ omega + 1.552
 Parameters
 Tc : float
 Critical temperature of fluid [ K ]
 Pc : float
 Critical pressure of fluid [ Pa ]
 omega : float
 Acentric factor of the fluid [ - ]
 CASRN : string
 CASRN [ - ]
 Returns
 factor : float
 Stiel polar factor of compound
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Stiel polar factor with the
 given inputs
 Other Parameters
 Method : string , optional
 The method name to use . Only ' DEFINITION ' is accepted so far .
 All valid values are also held in the list Stiel _ polar _ methods .
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Stiel - polar factor for the desired chemical , and will return methods
 instead of stiel - polar factor
 Notes
 Only one source is available for this function . It is :
 * ' DEFINITION ' , based on the definition of
 Stiel Polar Factor presented in [ 1 ] _ , using vapor pressure data .
 A few points have also been published in [ 2 ] _ , which may be used for
 comparison . Currently this is only used for a surface tension correlation .
 Examples
 > > > StielPolar ( 647.3 , 22048321.0 , 0.344 , CASRN = ' 7732-18-5 ' )
 0.024581140348734376
 References
 . . [ 1 ] Halm , Roland L . , and Leonard I . Stiel . " A Fourth Parameter for the
 Vapor Pressure and Entropy of Vaporization of Polar Fluids . " AIChE
 Journal 13 , no . 2 ( 1967 ) : 351-355 . doi : 10.1002 / aic . 690130228.
 . . [ 2 ] D , Kukoljac Miloš , and Grozdanić Dušan K . " New Values of the
 Polarity Factor . " Journal of the Serbian Chemical Society 65 , no . 12
 ( January 1 , 2000 ) . http : / / www . shd . org . rs / JSCS / Vol65 / No12 - Pdf / JSCS12-07 . pdf'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if Tc and Pc and omega :
        methods . append ( 'DEFINITION' )
    methods . append ( 'NONE' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == 'DEFINITION' :
    P = VaporPressure ( CASRN = CASRN ) . T_dependent_property ( Tc * 0.6 )
    if not P :
        factor = None
    else :
        Pr = P / Pc
        factor = log10 ( Pr ) + 1.70 * omega + 1.552
elif Method == 'NONE' :
    factor = None
else :
    raise Exception ( 'Failure in in function' )
return factor


signature:
def VDI_tabular_data ( CASRN , prop ) :
    r'''This function retrieves the tabular data available for a given chemical
 and a given property . Lookup is based on CASRNs . Length of data returned
 varies between chemicals . All data is at saturation condition from [ 1 ] _ .
 Function has data for 58 chemicals .
 Parameters
 CASRN : string
 CASRN [ - ]
 prop : string
 Property [ - ]
 Returns
 Ts : list
 Temperatures where property data is available , [ K ]
 props : list
 Properties at each temperature , [ various ]
 Notes
 The available properties are ' P ' , ' Density ( l ) ' , ' Density ( g ) ' , ' Hvap ' ,
 ' Cp ( l ) ' , ' Cp ( g ) ' , ' Mu ( l ) ' , ' Mu ( g ) ' , ' K ( l ) ' , ' K ( g ) ' , ' Pr ( l ) ' ,
 ' Pr ( g ) ' , ' sigma ' , ' Beta ' , ' Volume ( l ) ' , and ' Volume ( g ) ' .
 Data is available for all properties and all chemicals ; surface tension
 data was missing for mercury , but added as estimated from the a / b
 coefficients listed in Jasper ( 1972 ) to simplify the function .
 Examples
 > > > VDI _ tabular _ data ( ' 67-56-1 ' , ' Mu ( g ) ' )
 ( [ 337.63 , 360.0 , 385.0 , 410.0 , 435.0 , 460.0 , 500.0 ] , [ 1.11e - 05 , 1.18e - 05 , 1.27e - 05 , 1.36e - 05 , 1.46e - 05 , 1.59e - 05 , 2.04e - 05 ] )
 References
 . . [ 1 ] Gesellschaft , VDI , ed . VDI Heat Atlas . 2E . Berlin : Springer , 2010.'''

implementation:
try :
    d = _VDISaturationDict [ CASRN ]
except KeyError :
    raise Exception ( 'CASRN not in VDI tabulation' )
try :
    props , Ts = d [ prop ] , d [ 'T' ]
except :
    raise Exception ( 'Proprty not specified correctly' )
Ts = [ T for p , T in zip ( props , Ts ) if p ]
props = [ p for p in props if p ]
# Not all data series convererge to correct values
if prop == 'sigma' :
    Ts . append ( d [ 'Tc' ] )
    props . append ( 0 )
return Ts , props


signature:
def ViswanathNatarajan2 ( T , A , B ) :
    '''This function is known to produce values 10 times too low .
 The author ' s data must have an error .
 I have adjusted it to fix this .
 # DDBST has 0.0004580 as a value at this temperature
 > > > ViswanathNatarajan2(348.15 , - 5.9719 , 1007.0)
 0.00045983686956829517'''

implementation:
mu = exp ( A + B / T )
mu = mu / 1000.
mu = mu * 10
return mu


signature:
def ViswanathNatarajan3 ( T , A , B , C ) :
    r'''Calculate the viscosity of a liquid using the 3 - term Antoine form
 representation developed in [ 1 ] _ . Requires input coefficients . The ` A `
 coefficient is assumed to yield coefficients in centipoise , as all
 coefficients found so far have been .
 . . math : :
 \ log _ { 10 } \ mu = A + B / ( T + C )
 Parameters
 T : float
 Temperature of fluid [ K ]
 Returns
 mu : float
 Liquid viscosity , [ Pa * s ]
 Notes
 No other source for these coefficients has been found .
 Examples
 > > > ViswanathNatarajan3(298.15 , - 2.7173 , - 1071.18 , - 129.51)
 0.0006129806445142112
 References
 . . [ 1 ] Viswanath , Dabir S . , and G . Natarajan . Databook On The Viscosity Of
 Liquids . New York : Taylor & Francis , 1989'''


signature:
def Letsou_Stiel ( T , MW , Tc , Pc , omega ) :
    r'''Calculates the viscosity of a liquid using an emperical model
 developed in [ 1 ] _ . However . the fitting parameters for tabulated values
 in the original article are found in ChemSep .
 . . math : :
 \ xi = \ frac { 2173.424 T _ c ^ { 1/6 } } { \ sqrt { MW } P _ c ^ { 2/3 } }
 \ xi ^ { ( 0 ) } = ( 1.5174 - 2.135T _ r + 0.75T _ r ^ 2 ) \ cdot 10 ^ { - 5}
 \ xi ^ { ( 1 ) } = ( 4.2552 - 7.674 T _ r + 3.4 T _ r ^ 2 ) \ cdot 10 ^ { - 5}
 \ mu = ( \ xi ^ { ( 0 ) } + \ omega \ xi ^ { ( 1 ) } ) / \ xi
 Parameters
 T : float
 Temperature of fluid [ K ]
 MW : float
 Molwcular weight of fluid [ g / mol ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 omega : float
 Acentric factor of compound
 Returns
 mu _ l : float
 Viscosity of liquid , [ Pa * S ]
 Notes
 The form of this equation is a polynomial fit to tabulated data .
 The fitting was performed by the DIPPR . This is DIPPR Procedure 8G : Method
 for the viscosity of pure , nonhydrocarbon liquids at high temperatures
 internal units are SI standard . [ 1 ] _ ' s units were different .
 DIPPR test value for ethanol is used .
 Average error 34 % . Range of applicability is 0.76 < Tr < 0.98.
 Examples
 > > > Letsou _ Stiel ( 400 . , 46.07 , 516.25 , 6.383E6 , 0.6371)
 0.0002036150875308151
 References
 . . [ 1 ] Letsou , Athena , and Leonard I . Stiel . " Viscosity of Saturated
 Nonpolar Liquids at Elevated Pressures . " AIChE Journal 19 , no . 2 ( 1973 ) :
 409-11 . doi : 10.1002 / aic . 690190241.'''


signature:
def Przedziecki_Sridhar ( T , Tm , Tc , Pc , Vc , Vm , omega , MW ) :
    r'''Calculates the viscosity of a liquid using an emperical formula
 developed in [ 1 ] _ .
 . . math : :
 \ mu = \ frac { V _ o } { E ( V - V _ o ) }
 E = - 1.12 + \ frac { V _ c } { 12.94 + 0.10MW - 0.23P _ c + 0.0424T _ { m } - 11.58 ( T _ { m } / T _ c ) }
 V _ o = 0.0085 \ omega T _ c - 2.02 + \ frac { V _ { m } } { 0.342 ( T _ m / T _ c ) + 0.894}
 Parameters
 T : float
 Temperature of the fluid [ K ]
 Tm : float
 Melting point of fluid [ K ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 Vc : float
 Critical volume of the fluid [ m ^ 3 / mol ]
 Vm : float
 Molar volume of the fluid at temperature [ K ]
 omega : float
 Acentric factor of compound
 MW : float
 Molwcular weight of fluid [ g / mol ]
 Returns
 mu _ l : float
 Viscosity of liquid , [ Pa * S ]
 Notes
 A test by Reid ( 1983 ) is used , but only mostly correct .
 This function is not recommended . Its use has been removed from the Liquid Viscosity function .
 Internal units are bar and mL / mol .
 TODO : Test again with data from 5th ed table .
 Examples
 > > > Przedziecki _ Sridhar ( 383 . , 178 . , 591.8 , 41E5 , 316E - 6 , 95E - 6 , . 263 , 92.14)
 0.0002198147995603383
 References
 . . [ 1 ] Przedziecki , J . W . , and T . Sridhar . " Prediction of Liquid
 Viscosities . " AIChE Journal 31 , no . 2 ( February 1 , 1985 ) : 333-35.
 doi : 10.1002 / aic . 690310225.'''


signature:
def Lucas ( T , P , Tc , Pc , omega , P_sat , mu_l ) :
    r'''Adjustes for pressure the viscosity of a liquid using an emperical
 formula developed in [ 1 ] _ , but as discussed in [ 2 ] _ as the original source
 is in German .
 . . math : :
 \ frac { \ mu } { \ mu _ { sat } } = \ frac { 1 + D ( \ Delta P _ r / 2.118 ) ^ A } { 1 + C \ omega \ Delta P _ r }
 \ Delta P _ r = \ frac { P - P ^ { sat } } { P _ c }
 A = 0.9991 - \ frac { 4.674 \ times 10 ^ { - 4 } } { 1.0523T _ r ^ { - 0.03877 } - 1.0513}
 D = \ frac { 0.3257 } { ( 1.0039 - T _ r ^ { 2.573 } ) ^ { 0.2906 } } - 0.2086
 C = - 0.07921 + 2.1616T _ r - 13.4040T _ r ^ 2 + 44.1706T _ r ^ 3-84.8291T _ r ^ 4 +
 96.1209T _ r ^ 5-59.8127T _ r ^ 6 + 15.6719T _ r ^ 7
 Parameters
 T : float
 Temperature of fluid [ K ]
 P : float
 Pressure of fluid [ Pa ]
 Tc : float
 Critical point of fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 omega : float
 Acentric factor of compound
 P _ sat : float
 Saturation pressure of the fluid [ Pa ]
 mu _ l : float
 Viscosity of liquid at 1 atm or saturation , [ Pa * S ]
 Returns
 mu _ l _ dense : float
 Viscosity of liquid , [ Pa * s ]
 Notes
 This equation is entirely dimensionless ; all dimensions cancel .
 The example is from Reid ( 1987 ) ; all results agree .
 Above several thousand bar , this equation does not represent true behavior .
 If Psat is larger than P , the fluid may not be liquid ; dPr is set to 0.
 Examples
 > > > Lucas ( 300 . , 500E5 , 572.2 , 34.7E5 , 0.236 , 0 , 0.00068 ) # methylcyclohexane
 0.0010683738499316518
 References
 . . [ 1 ] Lucas , Klaus . " Ein Einfaches Verfahren Zur Berechnung Der
 Viskositat von Gasen Und Gasgemischen . " Chemie Ingenieur Technik 46 , no . 4
 ( February 1 , 1974 ) : 157-157 . doi : 10.1002 / cite . 330460413.
 . . [ 2 ] Reid , Robert C . ; Prausnitz , John M . ; Poling , Bruce E .
 Properties of Gases and Liquids . McGraw - Hill Companies , 1987.'''


signature:
def Yoon_Thodos ( T , Tc , Pc , MW ) :
    r'''Calculates the viscosity of a gas using an emperical formula
 developed in [ 1 ] _ .
 . . math : :
 \ eta \ xi \ times 10 ^ 8 = 46.10 T _ r ^ { 0.618 } - 20.40 \ exp ( - 0.449T _ r ) + 1
 9.40 \ exp ( - 4.058T _ r ) + 1
 \ xi = 2173.424 T _ c ^ { 1/6 } MW ^ { - 1/2 } P _ c ^ { - 2/3}
 Parameters
 T : float
 Temperature of the fluid [ K ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 MW : float
 Molwcular weight of fluid [ g / mol ]
 Returns
 mu _ g : float
 Viscosity of gas , [ Pa * S ]
 Notes
 This equation has been tested . The equation uses SI units only internally .
 The constant 2173.424 is an adjustment factor for units .
 Average deviation within 3 % for most compounds .
 Greatest accuracy with dipole moments close to 0.
 Hydrogen and helium have different coefficients , not implemented .
 This is DIPPR Procedure 8B : Method for the Viscosity of Pure ,
 non hydrocarbon , nonpolar gases at low pressures
 Examples
 > > > Yoon _ Thodos ( 300 . , 556.35 , 4.5596E6 , 153.8)
 1.0194885727776819e - 05
 References
 . . [ 1 ] Yoon , Poong , and George Thodos . " Viscosity of Nonpolar Gaseous
 Mixtures at Normal Pressures . " AIChE Journal 16 , no . 2 ( 1970 ) : 300-304.
 doi : 10.1002 / aic . 690160225.'''


signature:
def Stiel_Thodos ( T , Tc , Pc , MW ) :
    r'''Calculates the viscosity of a gas using an emperical formula
 developed in [ 1 ] _ .
 . . math : :
 TODO
 Parameters
 T : float
 Temperature of the fluid [ K ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 MW : float
 Molwcular weight of fluid [ g / mol ]
 Returns
 mu _ g : float
 Viscosity of gas , [ Pa * S ]
 Notes
 Untested .
 Claimed applicability from 0.2 to 5 atm .
 Developed with data from 52 nonpolar , and 53 polar gases .
 internal units are poise and atm .
 Seems to give reasonable results .
 Examples
 > > > Stiel _ Thodos ( 300 . , 556.35 , 4.5596E6 , 153.8 ) # CCl4
 1.0408926223608723e - 05
 References
 . . [ 1 ] Stiel , Leonard I . , and George Thodos . " The Viscosity of Nonpolar
 Gases at Normal Pressures . " AIChE Journal 7 , no . 4 ( 1961 ) : 611-15.
 doi : 10.1002 / aic . 690070416.'''


signature:
def lucas_gas ( T , Tc , Pc , Zc , MW , dipole = 0 , CASRN = None ) :
    r'''Estimate the viscosity of a gas using an emperical
 formula developed in several sources , but as discussed in [ 1 ] _ as the
 original sources are in German or merely personal communications with the
 authors of [ 1 ] _ .
 . . math : :
 \ eta = \ left [ 0.807T _ r ^ { 0.618 } - 0.357 \ exp ( - 0.449T _ r ) + 0.340 \ exp ( - 4.058
 T _ r ) + 0.018 \ right ] F _ p ^ \ circ F _ Q ^ \ circ / \ xi
 F _ p ^ \ circ = 1 , 0 \ le \ mu _ { r } < 0.022
 F _ p ^ \ circ = 1 + 30.55(0.292 - Z _ c ) ^ { 1.72 } , 0.022 \ le \ mu _ { r } < 0.075
 F _ p ^ \ circ = 1 + 30.55(0.292 - Z _ c ) ^ { 1.72 } | 0.96 + 0.1 ( T _ r - 0.7 ) | 0.075 < \ mu _ { r }
 F _ Q ^ \ circ = 1.22Q ^ { 0.15 } \ left \ { 1 + 0.00385 [ ( T _ r - 12 ) ^ 2 ] ^ { 1 / M } \ text { sign }
 ( T _ r - 12 ) \ right \ }
 \ mu _ r = 52.46 \ frac { \ mu ^ 2 P _ c } { T _ c ^ 2}
 \ xi = 0.176 \ left ( \ frac { T _ c } { MW ^ 3 P _ c ^ 4 } \ right ) ^ { 1/6}
 Parameters
 T : float
 Temperature of fluid [ K ]
 Tc : float
 Critical point of fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 Zc : float
 Critical compressibility of the fluid [ Pa ]
 dipole : float
 Dipole moment of fluid [ debye ]
 CASRN : str , optional
 CAS of the fluid
 Returns
 mu _ g : float
 Viscosity of gas , [ Pa * s ]
 Notes
 The example is from [ 1 ] _ ; all results agree .
 Viscosity is calculated in micropoise , and converted to SI internally ( 1E - 7 ) .
 Q for He = 1.38 ; Q for H2 = 0.76 ; Q for D2 = 0.52.
 Examples
 > > > lucas _ gas ( T = 550 . , Tc = 512.6 , Pc = 80.9E5 , Zc = 0.224 , MW = 32.042 , dipole = 1.7)
 1.7822676912698928e - 05
 References
 . . [ 1 ] Reid , Robert C . ; Prausnitz , John M . ; Poling , Bruce E .
 Properties of Gases and Liquids . McGraw - Hill Companies , 1987.'''


signature:
def Gharagheizi_gas_viscosity ( T , Tc , Pc , MW ) :
    r'''Calculates the viscosity of a gas using an emperical formula
 developed in [ 1 ] _ .
 . . math : :
 \ mu = 10 ^ { - 7 } | 10 ^ { - 5 } P _ cT _ r + \ left ( 0.091 - \ frac { 0.477 } { M } \ right ) T +
 M \ left ( 10 ^ { - 5 } P _ c - \ frac { 8M ^ 2 } { T ^ 2 } \ right )
 \ left ( \ frac { 10.7639 } { T _ c } - \ frac { 4.1929 } { T } \ right ) |
 Parameters
 T : float
 Temperature of the fluid [ K ]
 Tc : float
 Critical temperature of the fluid [ K ]
 Pc : float
 Critical pressure of the fluid [ Pa ]
 MW : float
 Molwcular weight of fluid [ g / mol ]
 Returns
 mu _ g : float
 Viscosity of gas , [ Pa * S ]
 Notes
 Example is first point in supporting information of article , for methane .
 This is the prefered function for gas viscosity .
 7 % average relative deviation . Deviation should never be above 30 % .
 Developed with the DIPPR database . It is believed theoretically predicted values
 are included in the correlation .
 Examples
 > > > Gharagheizi _ gas _ viscosity ( 120 . , 190.564 , 45.99E5 , 16.04246)
 5.215761625399613e - 06
 References
 . . [ 1 ] Gharagheizi , Farhad , Ali Eslamimanesh , Mehdi Sattari , Amir H .
 Mohammadi , and Dominique Richon . " Corresponding States Method for
 Determination of the Viscosity of Gases at Atmospheric Pressure . "
 Industrial & Engineering Chemistry Research 51 , no . 7
 ( February 22 , 2012 ) : 3179-85 . doi : 10.1021 / ie202591f .'''


signature:
def Herning_Zipperer ( zs , mus , MWs ) :
    r'''Calculates viscosity of a gas mixture according to
 mixing rules in [ 1 ] _ .
 . . math : :
 TODO
 Parameters
 zs : float
 Mole fractions of components
 mus : float
 Gas viscosities of all components , [ Pa * S ]
 MWs : float
 Molecular weights of all components , [ g / mol ]
 Returns
 mug : float
 Viscosity of gas mixture , Pa * S ]
 Notes
 This equation is entirely dimensionless ; all dimensions cancel .
 The original source has not been reviewed .
 Examples
 References
 . . [ 1 ] Herning , F . and Zipperer , L , : " Calculation of the Viscosity of
 Technical Gas Mixtures from the Viscosity of Individual Gases , german " ,
 Gas u . Wasserfach ( 1936 ) 79 , No . 49 , 69.'''

implementation:
if not none_and_length_check ( [ zs , mus , MWs ] ) : # check same - length inputs
    raise Exception ( 'Function inputs are incorrect format' )
MW_roots = [ MWi ** 0.5 for MWi in MWs ]
denominator = sum ( [ zi * MW_root_i for zi , MW_root_i in zip ( zs , MW_roots ) ] )
k = sum ( [ zi * mui * MW_root_i for zi , mui , MW_root_i in zip ( zs , mus , MW_roots ) ] )
return k / denominator


signature:
def Wilke ( ys , mus , MWs ) :
    r'''Calculates viscosity of a gas mixture according to
 mixing rules in [ 1 ] _ .
 . . math : :
 \ eta _ { mix } = \ sum _ { i = 1 } ^ n \ frac { y _ i \ eta _ i } { \ sum _ { j = 1 } ^ n y _ j \ phi _ { ij } }
 \ phi _ { ij } = \ frac { ( 1 + \ sqrt { \ eta _ i / \ eta _ j } ( MW _ j / MW _ i ) ^ { 0.25 } ) ^ 2}
 { \ sqrt { 8(1 + MW _ i / MW _ j ) } }
 Parameters
 ys : float
 Mole fractions of gas components
 mus : float
 Gas viscosities of all components , [ Pa * S ]
 MWs : float
 Molecular weights of all components , [ g / mol ]
 Returns
 mug : float
 Viscosity of gas mixture , Pa * S ]
 Notes
 This equation is entirely dimensionless ; all dimensions cancel .
 The original source has not been reviewed or found .
 Examples
 > > > Wilke ( [ 0.05 , 0.95 ] , [ 1.34E - 5 , 9.5029E - 6 ] , [ 64.06 , 46.07 ] )
 9.701614885866193e - 06
 References
 . . [ 1 ] TODO'''

implementation:
if not none_and_length_check ( [ ys , mus , MWs ] ) : # check same - length inputs
    raise Exception ( 'Function inputs are incorrect format' )
cmps = range ( len ( ys ) )
phis = [ [ ( 1 + ( mus [ i ] / mus [ j ] ) ** 0.5 * ( MWs [ j ] / MWs [ i ] ) ** 0.25 ) ** 2 / ( 8 * ( 1 + MWs [ i ] / MWs [ j ] ) ) ** 0.5 for j in cmps ] for i in cmps ]
return sum ( [ ys [ i ] * mus [ i ] / sum ( [ ys [ j ] * phis [ i ] [ j ] for j in cmps ] ) for i in cmps ] )


signature:
def Brokaw ( T , ys , mus , MWs , molecular_diameters , Stockmayers ) :
    r'''Calculates viscosity of a gas mixture according to
 mixing rules in [ 1 ] _ .
 . . math : :
 \ eta _ { mix } = \ sum _ { i = 1 } ^ n \ frac { y _ i \ eta _ i } { \ sum _ { j = 1 } ^ n y _ j \ phi _ { ij } }
 \ phi _ { ij } = \ left ( \ frac { \ eta _ i } { \ eta _ j } \ right ) ^ { 0.5 } S _ { ij } A _ { ij }
 A _ { ij } = m _ { ij } M _ { ij } ^ { - 0.5 } \ left [ 1 +
 \ frac { M _ { ij } - M _ { ij } ^ { 0.45 } }
 {2(1 + M _ { ij } ) + \ frac { ( 1 + M _ { ij } ^ { 0.45 } ) m _ { ij } ^ { - 0.5 } } { 1 + m _ { ij } } } \ right ]
 m _ { ij } = \ left [ \ frac { 4 } { ( 1 + M _ { ij } ^ { - 1 } ) ( 1 + M _ { ij } ) } \ right ] ^ { 0.25}
 M _ { ij } = \ frac { M _ i } { M _ j }
 S _ { ij } = \ frac { 1 + ( T _ i ^ * T _ j ^ * ) ^ { 0.5 } + ( \ delta _ i \ delta _ j / 4 ) }
 { [ 1 + T _ i ^ * + ( \ delta _ i ^ 2/4 ) ] ^ { 0.5 } [ 1 + T _ j ^ * + ( \ delta _ j ^ 2/4 ) ] ^ { 0.5 } }
 T ^ * = kT / \ epsilon
 Parameters
 T : float
 Temperature of fluid , [ K ]
 ys : float
 Mole fractions of gas components
 mus : float
 Gas viscosities of all components , [ Pa * S ]
 MWs : float
 Molecular weights of all components , [ g / mol ]
 molecular _ diameters : float
 L - J molecular diameter of all components , [ angstroms ]
 Stockmayers : float
 L - J Stockmayer energy parameters of all components , [ ]
 Returns
 mug : float
 Viscosity of gas mixture , [ Pa * S ]
 Notes
 This equation is entirely dimensionless ; all dimensions cancel .
 The original source has not been reviewed .
 This is DIPPR Procedure 8D : Method for the Viscosity of Nonhydrocarbon
 Vapor Mixtures at Low Pressure ( Polar and Nonpolar )
 Examples
 > > > Brokaw ( 308.2 , [ 0.05 , 0.95 ] , [ 1.34E - 5 , 9.5029E - 6 ] , [ 64.06 , 46.07 ] , [ 0.42 , 0.19 ] , [ 347 , 432 ] )
 9.699085099801568e - 06
 References
 . . [ 1 ] Brokaw , R . S . " Predicting Transport Properties of Dilute Gases . "
 Industrial & Engineering Chemistry Process Design and Development
 8 , no . 2 ( April 1 , 1969 ) : 240-53 . doi : 10.1021 / i260030a015.
 . . [ 2 ] Brokaw , R . S . Viscosity of Gas Mixtures , NASA - TN - D - 4496 , 1968.
 . . [ 3 ] Danner , Ronald P , and Design Institute for Physical Property Data .
 Manual for Predicting Chemical Process Design Data . New York , N . Y , 1982.'''

implementation:
cmps = range ( len ( ys ) )
MDs = molecular_diameters
if not none_and_length_check ( [ ys , mus , MWs , molecular_diameters , Stockmayers ] ) : # check same - length inputs
    raise Exception ( 'Function inputs are incorrect format' )
Tsts = [ T / Stockmayer_i for Stockmayer_i in Stockmayers ]
Sij = [ [ 0 for i in cmps ] for j in cmps ]
Mij = [ [ 0 for i in cmps ] for j in cmps ]
mij = [ [ 0 for i in cmps ] for j in cmps ]
Aij = [ [ 0 for i in cmps ] for j in cmps ]
phiij = [ [ 0 for i in cmps ] for j in cmps ]
for i in cmps :
    for j in cmps :
        Sij [ i ] [ j ] = ( 1 + ( Tsts [ i ] * Tsts [ j ] ) ** 0.5 + ( MDs [ i ] * MDs [ j ] ) / 4. ) / ( 1 + Tsts [ i ] + ( MDs [ i ] ** 2 / 4. ) ) ** 0.5 / ( 1 + Tsts [ j ] + ( MDs [ j ] ** 2 / 4. ) ) ** 0.5
        if MDs [ i ] <= 0.1 and MDs [ j ] <= 0.1 :
            Sij [ i ] [ j ] = 1
        Mij [ i ] [ j ] = MWs [ i ] / MWs [ j ]
        mij [ i ] [ j ] = ( 4. / ( 1 + Mij [ i ] [ j ] ** - 1 ) / ( 1 + Mij [ i ] [ j ] ) ) ** 0.25
        Aij [ i ] [ j ] = mij [ i ] [ j ] * Mij [ i ] [ j ] ** - 0.5 * ( 1 + ( Mij [ i ] [ j ] - Mij [ i ] [ j ] ** 0.45 ) / ( 2 * ( 1 + Mij [ i ] [ j ] ) + ( 1 + Mij [ i ] [ j ] ** 0.45 ) * mij [ i ] [ j ] ** - 0.5 / ( 1 + mij [ i ] [ j ] ) ) )
        phiij [ i ] [ j ] = ( mus [ i ] / mus [ j ] ) ** 0.5 * Sij [ i ] [ j ] * Aij [ i ] [ j ]
return sum ( [ ys [ i ] * mus [ i ] / sum ( [ ys [ j ] * phiij [ i ] [ j ] for j in cmps ] ) for i in cmps ] )


signature:
def _round_whole_even ( i ) :
    r'''Round a number to the nearest whole number . If the number is exactly
 between two numbers , round to the even whole number . Used by
 ` viscosity _ index ` .
 Parameters
 i : float
 Number , [ - ]
 Returns
 i : int
 Rounded number , [ - ]
 Notes
 Should never run with inputs from a practical function , as numbers on
 computers aren ' t really normally exactly between two numbers .
 Examples
 _ round _ whole _ even ( 116.5)
 116'''


signature:
def viscosity_index ( nu_40 , nu_100 , rounding = False ) :
    r'''Calculates the viscosity index of a liquid . Requires dynamic viscosity
 of a liquid at 40 ° C and 100 ° C . Value may either be returned with or
 without rounding . Rounding is performed per the standard .
 if nu _ 100 < 70:
 . . math : :
 L , H = interp ( nu _ 100)
 else :
 . . math : :
 L = 0.8353 \ nu _ { 100 } ^ 2 + 14.67 \ nu _ { 100 } - 216
 H = 0.1684 \ nu _ { 100 } ^ 2 + 11.85 \ nu _ { 100 } - 97
 if nu _ 40 > H :
 . . math : :
 VI = \ frac { L - nu _ { 40 } } { L - H } \ cdot 100
 else :
 . . math : :
 N = \ frac { \ log ( H ) - \ log ( \ nu _ { 40 } ) } { \ log ( \ nu _ { 100 } ) }
 VI = \ frac { 10 ^ N - 1 } { 0.00715 } + 100
 Parameters
 nu _ 40 : float
 Dynamic viscosity of fluid at 40 ° C , [ m ^ 2 / s ]
 nu _ 100 : float
 Dynamic viscosity of fluid at 100 ° C , [ m ^ 2 / s ]
 rounding : bool , optional
 Whether to round the value or not .
 Returns
 VI : float
 Viscosity index [ - ]
 Notes
 VI is undefined for nu _ 100 under 2 mm ^ 2 / s . None is returned if this is the
 case . Internal units are mm ^ 2 / s . Higher values of viscosity index suggest
 a lesser decrease in kinematic viscosity as temperature increases .
 Note that viscosity is a pressure - dependent property , and that the
 viscosity index is defined for a fluid at whatever pressure it is at .
 The viscosity index is thus also a function of pressure .
 Examples
 > > > viscosity _ index ( 73.3E - 6 , 8.86E - 6 , rounding = True )
 92
 References
 . . [ 1 ] ASTM D2270-10(2016 ) Standard Practice for Calculating Viscosity
 Index from Kinematic Viscosity at 40 ° C and 100 ° C , ASTM International ,
 West Conshohocken , PA , 2016 , http : / / dx . doi . org / 10.1520 / D2270-10R16'''


signature:
def viscosity_converter ( val , old_scale , new_scale , extrapolate = False ) :
    r'''Converts kinematic viscosity values from different scales which have
 historically been used . Though they may not be in use much , some standards
 still specify values in these scales .
 Parameters
 val : float
 Viscosity value in the specified scale ; [ m ^ 2 / s ] if
 ' kinematic viscosity ' ; [ degrees ] if Engler or Barbey ; [ s ] for the other
 scales .
 old _ scale : str
 String representing the scale that ` val ` is in originally .
 new _ scale : str
 String representing the scale that ` val ` should be converted to .
 extrapolate : bool
 If True , a conversion will be performed even if outside the limits of
 either scale ; if False , and either value is outside a limit , an
 exception will be raised .
 Returns
 result : float
 Viscosity value in the specified scale ; [ m ^ 2 / s ] if
 ' kinematic viscosity ' ; [ degrees ] if Engler or Barbey ; [ s ] for the other
 scales
 Notes
 The valid scales for this function are any of the following :
 [ ' a & w b ' , ' a & w crucible ' , ' american can ' , ' astm 0.07 ' , ' astm 0.10 ' ,
 ' astm 0.15 ' , ' astm 0.20 ' , ' astm 0.25 ' , ' barbey ' , ' caspers tin plate ' ,
 ' continental can ' , ' crown cork and seal ' , ' demmier # 1 ' , ' demmier # 10 ' ,
 ' engler ' , ' ford cup # 3 ' , ' ford cup # 4 ' , ' kinematic viscosity ' ,
 ' mac michael ' , ' murphy varnish ' , ' parlin cup # 10 ' , ' parlin cup # 15 ' ,
 ' parlin cup # 20 ' , ' parlin cup # 25 ' , ' parlin cup # 30 ' , ' parlin cup # 7 ' ,
 ' pratt lambert a ' , ' pratt lambert b ' , ' pratt lambert c ' , ' pratt lambert d ' ,
 ' pratt lambert e ' , ' pratt lambert f ' , ' pratt lambert g ' , ' pratt lambert h ' ,
 ' pratt lambert i ' , ' redwood admiralty ' , ' redwood standard ' ,
 ' saybolt furol ' , ' saybolt universal ' , ' scott ' , ' stormer 100g load ' ,
 ' westinghouse ' , ' zahn cup # 1 ' , ' zahn cup # 2 ' , ' zahn cup # 3 ' , ' zahn cup # 4 ' ,
 ' zahn cup # 5 ' ]
 Some of those scales are converted linearly ; the rest use tabulated data
 and splines .
 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 method ' Saybolt universal ' has a special formula implemented for its
 conversion , from [ 4 ] _ . It is designed for maximum backwards compatibility
 with prior experimental data . It is solved by newton ' s method when
 kinematic viscosity is desired as an output .
 . . math : :
 SUS _ { eq } = 4.6324 \ nu _ t + \ frac { [ 1.0 + 0.03264 \ nu _ t ] }
 { [ ( 3930.2 + 262.7 \ nu _ t + 23.97 \ nu _ t ^ 2 + 1.646 \ nu _ t ^ 3 ) \ times10 ^ { - 5 } ) ] }
 Examples
 > > > viscosity _ converter ( 8.79 , ' engler ' , ' parlin cup # 7 ' )
 52.5
 > > > viscosity _ converter ( 700 , ' Saybolt Universal Seconds ' , ' kinematic viscosity ' )
 0.00015108914751515542
 References
 . . [ 1 ] Hydraulic Institute . Hydraulic Institute Engineering Data Book .
 Cleveland , Ohio : Hydraulic Institute , 1990.
 . . [ 2 ] Gardner / Sward . Paint Testing Manual . Physical and Chemical
 Examination of Paints , Varnishes , Lacquers , and Colors . 13th Edition .
 ASTM , 1972.
 . . [ 3 ] Euverard , M . R . , The Efflux Type Viscosity Cup . National Paint ,
 Varnish , and Lacquer Association , 1948.
 . . [ 4 ] API Technical Data Book : General Properties & Characterization .
 American Petroleum Institute , 7E , 2005.
 . . [ 5 ] ASTM . Standard Practice for Conversion of Kinematic Viscosity to
 Saybolt Universal Viscosity or to Saybolt Furol Viscosity . D 2161 - 93.'''

implementation:
def range_check ( visc , scale ) :
    scale_min , scale_max , nu_min , nu_max = viscosity_converter_limits [ scale ]
    if visc < scale_min * ( 1. - 1E-7 ) or visc > scale_max * ( 1. + 1E-7 ) :
        raise Exception ( 'Viscosity conversion is outside the limits of the ' '%s scale; given value is %s, but the range of the ' 'scale is from %s to %s. Set `extrapolate` to True ' 'to perform the conversion anyway.' % ( scale , visc , scale_min , scale_max ) )
def range_check_linear ( val , c , tmin , scale ) :
    if val < tmin :
        raise Exception ( 'Viscosity conversion is outside the limits of the ' '%s scale; given value is %s, but the minimum time ' 'for this scale is %s s. Set `extrapolate` to True ' 'to perform the conversion anyway.' % ( scale , val , tmin ) )
old_scale = old_scale . lower ( ) . replace ( 'degrees' , '' ) . replace ( 'seconds' , '' ) . strip ( )
new_scale = new_scale . lower ( ) . replace ( 'degrees' , '' ) . replace ( 'seconds' , '' ) . strip ( )
def Saybolt_universal_eq ( nu ) :
    return ( 4.6324 * nu + ( 1E5 + 3264. * nu ) / ( nu * ( nu * ( 1.646 * nu + 23.97 ) + 262.7 ) + 3930.2 ) )
# Convert to kinematic viscosity
if old_scale == 'kinematic viscosity' :
    val = 1E6 * val
    # convert to centistokes , the basis of the functions
elif old_scale == 'saybolt universal' :
    if not extrapolate :
        range_check ( val , old_scale )
    to_solve = lambda nu : Saybolt_universal_eq ( nu ) - val
    val = newton ( to_solve , 1 )
elif old_scale in viscosity_converters_to_nu :
    if not extrapolate :
        range_check ( val , old_scale )
    val = exp ( viscosity_converters_to_nu [ old_scale ] ( log ( val ) ) )
elif old_scale in viscosity_scales_linear :
    c , tmin = viscosity_scales_linear [ old_scale ]
    if not extrapolate :
        range_check_linear ( val , c , tmin , old_scale )
    val = c * val
    # convert from seconds to centistokes
else :
    keys = sorted ( set ( list ( viscosity_scales . keys ( ) ) + list ( viscosity_scales_linear . keys ( ) ) ) )
    raise Exception ( 'Scale "%s" not recognized - allowable values are any of %s.' % ( old_scale , keys ) )
# Convert to desired scale
if new_scale == 'kinematic viscosity' :
    val = 1E-6 * val
    # convert to m ^ 2 / s
elif new_scale == 'saybolt universal' :
    val = Saybolt_universal_eq ( val )
elif new_scale in viscosity_converters_from_nu :
    val = exp ( viscosity_converters_from_nu [ new_scale ] ( log ( val ) ) )
    if not extrapolate :
        range_check ( val , new_scale )
elif new_scale in viscosity_scales_linear :
    c , tmin = viscosity_scales_linear [ new_scale ]
    val = val / c
    # convert from centistokes to seconds
    if not extrapolate :
        range_check_linear ( val , c , tmin , new_scale )
else :
    keys = sorted ( set ( list ( viscosity_scales . keys ( ) ) + list ( viscosity_scales_linear . keys ( ) ) ) )
    raise Exception ( 'Scale "%s" not recognized - allowable values are any of %s.' % ( new_scale , keys ) )
return float ( val )


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

implementation:
methods , methods_P = [ ] , [ ]
Tmins , Tmaxs = [ ] , [ ]
if has_CoolProp and self . CASRN in coolprop_dict :
    methods . append ( COOLPROP ) ;
    methods_P . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
    Tmins . append ( self . CP_f . Tmin ) ;
    Tmaxs . append ( self . CP_f . Tc )
if self . CASRN in _VDISaturationDict :
    methods . append ( VDI_TABULAR )
    Ts , props = VDI_tabular_data ( self . CASRN , 'Mu (l)' )
    self . VDI_Tmin = Ts [ 0 ]
    self . VDI_Tmax = Ts [ - 1 ]
    self . tabular_data [ VDI_TABULAR ] = ( Ts , props )
    Tmins . append ( self . VDI_Tmin ) ;
    Tmaxs . append ( self . VDI_Tmax )
if self . CASRN in Dutt_Prasad . index :
    methods . append ( DUTT_PRASAD )
    _ , A , B , C , self . DUTT_PRASAD_Tmin , self . DUTT_PRASAD_Tmax = _Dutt_Prasad_values [ Dutt_Prasad . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . DUTT_PRASAD_coeffs = [ A , B , C ]
    Tmins . append ( self . DUTT_PRASAD_Tmin ) ;
    Tmaxs . append ( self . DUTT_PRASAD_Tmax )
if self . CASRN in VN3_data . index :
    methods . append ( VISWANATH_NATARAJAN_3 )
    _ , _ , A , B , C , self . VISWANATH_NATARAJAN_3_Tmin , self . VISWANATH_NATARAJAN_3_Tmax = _VN3_data_values [ VN3_data . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VISWANATH_NATARAJAN_3_coeffs = [ A , B , C ]
    Tmins . append ( self . VISWANATH_NATARAJAN_3_Tmin ) ;
    Tmaxs . append ( self . VISWANATH_NATARAJAN_3_Tmax )
if self . CASRN in VN2_data . index :
    methods . append ( VISWANATH_NATARAJAN_2 )
    _ , _ , A , B , self . VISWANATH_NATARAJAN_2_Tmin , self . VISWANATH_NATARAJAN_2_Tmax = _VN2_data_values [ VN2_data . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VISWANATH_NATARAJAN_2_coeffs = [ A , B ]
    Tmins . append ( self . VISWANATH_NATARAJAN_2_Tmin ) ;
    Tmaxs . append ( self . VISWANATH_NATARAJAN_2_Tmax )
if self . CASRN in VN2E_data . index :
    methods . append ( VISWANATH_NATARAJAN_2E )
    _ , _ , C , D , self . VISWANATH_NATARAJAN_2E_Tmin , self . VISWANATH_NATARAJAN_2E_Tmax = _VN2E_data_values [ VN2E_data . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . VISWANATH_NATARAJAN_2E_coeffs = [ C , D ]
    Tmins . append ( self . VISWANATH_NATARAJAN_2E_Tmin ) ;
    Tmaxs . append ( self . VISWANATH_NATARAJAN_2E_Tmax )
if self . CASRN in Perrys2_313 . index :
    methods . append ( DIPPR_PERRY_8E )
    _ , C1 , C2 , C3 , C4 , C5 , self . Perrys2_313_Tmin , self . Perrys2_313_Tmax = _Perrys2_313_values [ Perrys2_313 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . Perrys2_313_coeffs = [ C1 , C2 , C3 , C4 , C5 ]
    Tmins . append ( self . Perrys2_313_Tmin ) ;
    Tmaxs . append ( self . Perrys2_313_Tmax )
if self . CASRN in VDI_PPDS_7 . index :
    methods . append ( VDI_PPDS )
    self . VDI_PPDS_coeffs = _VDI_PPDS_7_values [ VDI_PPDS_7 . index . get_loc ( self . CASRN ) ] . tolist ( ) [ 2 : ]
if all ( ( self . MW , self . Tc , self . Pc , self . omega ) ) :
    methods . append ( LETSOU_STIEL )
    Tmins . append ( self . Tc / 4 ) ;
    Tmaxs . append ( self . Tc )
    # TODO : test model at low T
if all ( ( self . MW , self . Tm , self . Tc , self . Pc , self . Vc , self . omega , self . Vml ) ) :
    methods . append ( PRZEDZIECKI_SRIDHAR )
    Tmins . append ( self . Tm ) ;
    Tmaxs . append ( self . Tc )
    # TODO : test model at Tm
if all ( [ self . Tc , self . Pc , self . omega ] ) :
    methods_P . append ( LUCAS )
self . all_methods = set ( methods )
self . all_methods_P = set ( methods_P )
if Tmins and Tmaxs :
    self . Tmin , self . Tmax = min ( Tmins ) , max ( Tmaxs )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate low - pressure liquid viscosity at tempearture
 ` T ` with a given method .
 This method has no exception handling ; see ` T _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate viscosity , [ K ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of the liquid at T and a low pressure , [ Pa * S ]'''

implementation:
if method == DUTT_PRASAD :
    A , B , C = self . DUTT_PRASAD_coeffs
    mu = ViswanathNatarajan3 ( T , A , B , C , )
elif method == VISWANATH_NATARAJAN_3 :
    A , B , C = self . VISWANATH_NATARAJAN_3_coeffs
    mu = ViswanathNatarajan3 ( T , A , B , C )
elif method == VISWANATH_NATARAJAN_2 :
    A , B = self . VISWANATH_NATARAJAN_2_coeffs
    mu = ViswanathNatarajan2 ( T , self . VISWANATH_NATARAJAN_2_coeffs [ 0 ] , self . VISWANATH_NATARAJAN_2_coeffs [ 1 ] )
elif method == VISWANATH_NATARAJAN_2E :
    C , D = self . VISWANATH_NATARAJAN_2E_coeffs
    mu = ViswanathNatarajan2Exponential ( T , C , D )
elif method == DIPPR_PERRY_8E :
    mu = EQ101 ( T , * self . Perrys2_313_coeffs )
elif method == COOLPROP :
    mu = CoolProp_T_dependent_property ( T , self . CASRN , 'V' , 'l' )
elif method == LETSOU_STIEL :
    mu = Letsou_Stiel ( T , self . MW , self . Tc , self . Pc , self . omega )
elif method == PRZEDZIECKI_SRIDHAR :
    Vml = self . Vml ( T ) if hasattr ( self . Vml , '__call__' ) else self . Vml
    mu = Przedziecki_Sridhar ( T , self . Tm , self . Tc , self . Pc , self . Vc , Vml , self . omega , self . MW )
elif method == VDI_PPDS :
    A , B , C , D , E = self . VDI_PPDS_coeffs
    term = ( C - T ) / ( T - D )
    if term < 0 :
        term1 = - ( ( T - C ) / ( T - D ) ) ** ( 1 / 3. )
    else :
        term1 = term ** ( 1 / 3. )
    term2 = term * term1
    mu = E * exp ( A * term1 + B * term2 )
elif method in self . tabular_data :
    mu = self . interpolate ( T , method )
return mu


signature:
def calculate_P ( self , T , P , method ) :
    r'''Method to calculate pressure - dependent liquid viscosity at
 temperature ` T ` and pressure ` P ` with a given method .
 This method has no exception handling ; see ` TP _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate viscosity , [ K ]
 P : float
 Pressure at which to calculate viscosity , [ K ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of the liquid at T and P , [ Pa * S ]'''

implementation:
if method == LUCAS :
    mu = self . T_dependent_property ( T )
    Psat = self . Psat ( T ) if hasattr ( self . Psat , '__call__' ) else self . Psat
    mu = Lucas ( T , P , self . Tc , self . Pc , self . omega , Psat , mu )
elif method == COOLPROP :
    mu = PropsSI ( 'V' , 'T' , T , 'P' , P , self . CASRN )
elif method in self . tabular_data :
    mu = self . interpolate_P ( T , P , method )
return mu


signature:
def load_all_methods ( self ) :
    r'''Method to initialize the object by precomputing any values which
 may be used repeatedly and by retrieving mixture - specific variables .
 All data are stored as attributes . This method also sets : obj : ` Tmin ` ,
 : obj : ` Tmax ` , and : obj : ` all _ methods ` as a set of methods which should
 work to calculate the property .
 Called on initialization only . See the source code for the variables at
 which the coefficients are stored . The coefficients can safely be
 altered once the class is initialized . This method can be called again
 to reset the parameters .'''

implementation:
methods = [ MIXING_LOG_MOLAR , MIXING_LOG_MASS ]
if len ( self . CASs ) > 1 and '7732-18-5' in self . CASs :
    wCASs = [ i for i in self . CASs if i != '7732-18-5' ]
    if all ( [ i in _Laliberte_Viscosity_ParametersDict for i in wCASs ] ) :
        methods . append ( LALIBERTE_MU )
        self . wCASs = wCASs
        self . index_w = self . CASs . index ( '7732-18-5' )
self . all_methods = set ( methods )
Tmins = [ i . Tmin for i in self . ViscosityLiquids if i . Tmin ]
Tmaxs = [ i . Tmax for i in self . ViscosityLiquids if i . Tmax ]
if Tmins :
    self . Tmin = max ( Tmins )
if Tmaxs :
    self . Tmax = max ( Tmaxs )


signature:
def calculate ( self , T , P , zs , ws , method ) :
    r'''Method to calculate viscosity of a liquid mixture at
 temperature ` T ` , pressure ` P ` , mole fractions ` zs ` and weight fractions
 ` ws ` with a given method .
 This method has no exception handling ; see ` mixture _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate the property , [ K ]
 P : float
 Pressure at which to calculate the property , [ Pa ]
 zs : list [ float ]
 Mole fractions of all species in the mixture , [ - ]
 ws : list [ float ]
 Weight fractions of all species in the mixture , [ - ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of the liquid mixture , [ Pa * s ]'''

implementation:
if method == MIXING_LOG_MOLAR :
    mus = [ i ( T , P ) for i in self . ViscosityLiquids ]
    return mixing_logarithmic ( zs , mus )
elif method == MIXING_LOG_MASS :
    mus = [ i ( T , P ) for i in self . ViscosityLiquids ]
    return mixing_logarithmic ( ws , mus )
elif method == LALIBERTE_MU :
    ws = list ( ws ) ;
    ws . pop ( self . index_w )
    return Laliberte_viscosity ( T , ws , self . wCASs )
else :
    raise Exception ( 'Method not valid' )


implementation:
methods , methods_P = [ ] , [ ]
Tmins , Tmaxs = [ ] , [ ]
if self . CASRN in _VDISaturationDict :
    methods . append ( VDI_TABULAR )
    Ts , props = VDI_tabular_data ( self . CASRN , 'Mu (g)' )
    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 has_CoolProp and self . CASRN in coolprop_dict :
    methods . append ( COOLPROP ) ;
    methods_P . append ( COOLPROP )
    self . CP_f = coolprop_fluids [ self . CASRN ]
    Tmins . append ( self . CP_f . Tmin ) ;
    Tmaxs . append ( self . CP_f . Tmax )
if self . CASRN in Perrys2_312 . index :
    methods . append ( DIPPR_PERRY_8E )
    _ , C1 , C2 , C3 , C4 , self . Perrys2_312_Tmin , self . Perrys2_312_Tmax = _Perrys2_312_values [ Perrys2_312 . index . get_loc ( self . CASRN ) ] . tolist ( )
    self . Perrys2_312_coeffs = [ C1 , C2 , C3 , C4 ]
    Tmins . append ( self . Perrys2_312_Tmin ) ;
    Tmaxs . append ( self . Perrys2_312_Tmax )
if self . CASRN in VDI_PPDS_8 . index :
    methods . append ( VDI_PPDS )
    self . VDI_PPDS_coeffs = _VDI_PPDS_8_values [ VDI_PPDS_8 . index . get_loc ( self . CASRN ) ] . tolist ( ) [ 1 : ]
    self . VDI_PPDS_coeffs . reverse ( )
    # in format for horner ' s scheme
if all ( [ self . Tc , self . Pc , self . MW ] ) :
    methods . append ( GHARAGHEIZI )
    methods . append ( YOON_THODOS )
    methods . append ( STIEL_THODOS )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( 5E3 )
    # Intelligently set limit
    # GHARAGHEIZI turns nonsesical at ~ 15 K , YOON _ THODOS fine to 0 K ,
    # same as STIEL _ THODOS
if all ( [ self . Tc , self . Pc , self . Zc , self . MW ] ) :
    methods . append ( LUCAS_GAS )
    Tmins . append ( 0 ) ;
    Tmaxs . append ( 1E3 )
self . all_methods = set ( methods )
self . all_methods_P = set ( methods_P )
if Tmins and Tmaxs :
    self . Tmin , self . Tmax = min ( Tmins ) , max ( Tmaxs )


signature:
def calculate ( self , T , method ) :
    r'''Method to calculate low - pressure gas viscosity at
 tempearture ` T ` with a given method .
 This method has no exception handling ; see ` T _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature of the gas , [ K ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of the gas at T and a low pressure , [ Pa * S ]'''

implementation:
if method == GHARAGHEIZI :
    mu = Gharagheizi_gas_viscosity ( T , self . Tc , self . Pc , self . MW )
elif method == COOLPROP :
    mu = CoolProp_T_dependent_property ( T , self . CASRN , 'V' , 'g' )
elif method == DIPPR_PERRY_8E :
    mu = EQ102 ( T , * self . Perrys2_312_coeffs )
elif method == VDI_PPDS :
    mu = horner ( self . VDI_PPDS_coeffs , T )
elif method == YOON_THODOS :
    mu = Yoon_Thodos ( T , self . Tc , self . Pc , self . MW )
elif method == STIEL_THODOS :
    mu = Stiel_Thodos ( T , self . Tc , self . Pc , self . MW )
elif method == LUCAS_GAS :
    mu = lucas_gas ( T , self . Tc , self . Pc , self . Zc , self . MW , self . dipole , CASRN = self . CASRN )
elif method in self . tabular_data :
    mu = self . interpolate ( T , method )
return mu


signature:
def calculate_P ( self , T , P , method ) :
    r'''Method to calculate pressure - dependent gas viscosity
 at temperature ` T ` and pressure ` P ` with a given method .
 This method has no exception handling ; see ` TP _ dependent _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate gas viscosity , [ K ]
 P : float
 Pressure at which to calculate gas viscosity , [ K ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of the gas at T and P , [ Pa * ]'''

implementation:
if method == COOLPROP :
    mu = PropsSI ( 'V' , 'T' , T , 'P' , P , self . CASRN )
elif method in self . tabular_data :
    mu = self . interpolate_P ( T , P , method )
return mu


implementation:
methods = [ SIMPLE ]
if none_and_length_check ( ( self . MWs , self . molecular_diameters , self . Stockmayers ) ) :
    methods . append ( BROKAW )
if none_and_length_check ( [ self . MWs ] ) :
    methods . extend ( [ WILKE , HERNING_ZIPPERER ] )
self . all_methods = set ( methods )
Tmins = [ i . Tmin for i in self . ViscosityGases if i . Tmin ]
Tmaxs = [ i . Tmax for i in self . ViscosityGases if i . Tmax ]
if Tmins :
    self . Tmin = max ( Tmins )
if Tmaxs :
    self . Tmax = max ( Tmaxs )


signature:
def calculate ( self , T , P , zs , ws , method ) :
    r'''Method to calculate viscosity of a gas mixture at
 temperature ` T ` , pressure ` P ` , mole fractions ` zs ` and weight fractions
 ` ws ` with a given method .
 This method has no exception handling ; see ` mixture _ property `
 for that .
 Parameters
 T : float
 Temperature at which to calculate the property , [ K ]
 P : float
 Pressure at which to calculate the property , [ Pa ]
 zs : list [ float ]
 Mole fractions of all species in the mixture , [ - ]
 ws : list [ float ]
 Weight fractions of all species in the mixture , [ - ]
 method : str
 Name of the method to use
 Returns
 mu : float
 Viscosity of gas mixture , [ Pa * s ]'''

implementation:
if method == SIMPLE :
    mus = [ i ( T , P ) for i in self . ViscosityGases ]
    return mixing_simple ( zs , mus )
elif method == HERNING_ZIPPERER :
    mus = [ i ( T , P ) for i in self . ViscosityGases ]
    return Herning_Zipperer ( zs , mus , self . MWs )
elif method == WILKE :
    mus = [ i ( T , P ) for i in self . ViscosityGases ]
    return Wilke ( zs , mus , self . MWs )
elif method == BROKAW :
    mus = [ i ( T , P ) for i in self . ViscosityGases ]
    return Brokaw ( T , zs , mus , self . MWs , self . molecular_diameters , self . Stockmayers )
else :
    raise Exception ( 'Method not valid' )


signature:
def ppmv_to_mgm3 ( ppmv , MW , T = 298.15 , P = 101325. ) :
    r'''Converts a concentration in ppmv to units of mg / m ^ 3 . Used in
 industrial toxicology .
 . . math : :
 \ frac { mg } { m ^ 3 } = \ frac { ppmv \ cdot P } { RT } \ cdot \ frac { MW } { 1000}
 Parameters
 ppmv : float
 Concentratoin of a component in a gas mixure [ parts per million ,
 volumetric ]
 MW : float
 Molecular weight of the trace gas [ g / mol ]
 T : float , optional
 Temperature of the gas at which the ppmv is reported
 P : float , optional
 Pressure of the gas at which the ppmv is reported
 Returns
 mgm3 : float
 Concentration of a substance in an ideal gas mixture [ mg / m ^ 3]
 Notes
 The term P / ( RT ) / 1000 converts to 0.040874 at STP . Its inverse is reported
 as 24.45 in [ 1 ] _ .
 Examples
 > > > ppmv _ to _ mgm3(1 , 40)
 1.6349623351068687
 References
 . . [ 1 ] ACGIH . Industrial Ventilation : A Manual of Recommended Practice ,
 23rd Edition . American Conference of Governmental and Industrial
 Hygenists , 2004.'''

implementation:
parts = ppmv * 1E-6
n = parts * P / ( R * T )
mgm3 = MW * n * 1000
# mol toxin / m ^ 3 * g / mol toxis * 1000 mg / g
return mgm3


signature:
def mgm3_to_ppmv ( mgm3 , MW , T = 298.15 , P = 101325. ) :
    r'''Converts a concentration in mg / m ^ 3 to units of ppmv . Used in
 industrial toxicology .
 . . math : :
 ppmv = \ frac { 1000RT } { MW \ cdot P } \ cdot \ frac { mg } { m ^ 3}
 Parameters
 mgm3 : float
 Concentration of a substance in an ideal gas mixture [ mg / m ^ 3]
 MW : float
 Molecular weight of the trace gas [ g / mol ]
 T : float , optional
 Temperature of the gas at which the ppmv is reported
 P : float , optional
 Pressure of the gas at which the ppmv is reported
 Returns
 ppmv : float
 Concentration of a component in a gas mixure [ parts per million ,
 volumetric ]
 Notes
 The term P / ( RT ) / 1000 converts to 0.040874 at STP . Its inverse is reported
 as 24.45 in [ 1 ] _ .
 Examples
 > > > mgm3 _ to _ ppmv ( 1.635 , 40)
 1.0000230371625833
 References
 . . [ 1 ] ACGIH . Industrial Ventilation : A Manual of Recommended Practice ,
 23rd Edition . American Conference of Governmental and Industrial
 Hygenists , 2004.'''

implementation:
n = mgm3 / MW / 1000.
parts = n * R * T / P
ppm = parts / 1E-6
return ppm


signature:
def TWA ( CASRN , AvailableMethods = False , Method = None ) : # pragma : no cover
    '''This function handles the retrieval of Time - Weighted Average limits on worker
 exposure to dangerous chemicals .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > TWA ( ' 98-00-0 ' )
 (10.0 , ' ppm ' )
 > > > TWA ( ' 1303-00-0 ' )
 (5.0742430905659505e - 05 , ' ppm ' )
 > > > TWA ( ' 7782-42-5 ' , AvailableMethods = True )
 [ ' Ontario Limits ' , ' None ' ]'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in _OntarioExposureLimits and ( _OntarioExposureLimits [ CASRN ] [ "TWA (ppm)" ] or _OntarioExposureLimits [ CASRN ] [ "TWA (mg/m^3)" ] ) :
        methods . append ( ONTARIO )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ONTARIO :
    if _OntarioExposureLimits [ CASRN ] [ "TWA (ppm)" ] :
        _TWA = ( _OntarioExposureLimits [ CASRN ] [ "TWA (ppm)" ] , 'ppm' )
    elif _OntarioExposureLimits [ CASRN ] [ "TWA (mg/m^3)" ] :
        _TWA = ( _OntarioExposureLimits [ CASRN ] [ "TWA (mg/m^3)" ] , 'mg/m^3' )
elif Method == NONE :
    _TWA = None
else :
    raise Exception ( 'Failure in in function' )
return _TWA


signature:
def STEL ( CASRN , AvailableMethods = False , Method = None ) : # pragma : no cover
    '''This function handles the retrieval of Short - term Exposure Limit on
 worker exposure to dangerous chemicals .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > STEL ( ' 67-64-1 ' )
 (750.0 , ' ppm ' )
 > > > STEL ( ' 7664-38-2 ' )
 (0.7489774978301237 , ' ppm ' )
 > > > STEL ( ' 55720-99-5 ' )
 (2.0 , ' mg / m ^ 3 ' )
 > > > STEL ( ' 86290-81-5 ' , AvailableMethods = True )
 [ ' Ontario Limits ' , ' None ' ]'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in _OntarioExposureLimits and ( _OntarioExposureLimits [ CASRN ] [ "STEL (ppm)" ] or _OntarioExposureLimits [ CASRN ] [ "STEL (mg/m^3)" ] ) :
        methods . append ( ONTARIO )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ONTARIO :
    if _OntarioExposureLimits [ CASRN ] [ "STEL (ppm)" ] :
        _STEL = ( _OntarioExposureLimits [ CASRN ] [ "STEL (ppm)" ] , 'ppm' )
    elif _OntarioExposureLimits [ CASRN ] [ "STEL (mg/m^3)" ] :
        _STEL = ( _OntarioExposureLimits [ CASRN ] [ "STEL (mg/m^3)" ] , 'mg/m^3' )
elif Method == NONE :
    _STEL = None
else :
    raise Exception ( 'Failure in in function' )
return _STEL


signature:
def Ceiling ( CASRN , AvailableMethods = False , Method = None ) : # pragma : no cover
    '''This function handles the retrieval of Ceiling limits on worker
 exposure to dangerous chemicals .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > Ceiling ( ' 75-07-0 ' )
 (25.0 , ' ppm ' )
 > > > Ceiling ( ' 1395-21-7 ' )
 (6e - 05 , ' mg / m ^ 3 ' )
 > > > Ceiling ( ' 7572-29-4 ' , AvailableMethods = True )
 [ ' Ontario Limits ' , ' None ' ]'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in _OntarioExposureLimits and ( _OntarioExposureLimits [ CASRN ] [ "Ceiling (ppm)" ] or _OntarioExposureLimits [ CASRN ] [ "Ceiling (mg/m^3)" ] ) :
        methods . append ( ONTARIO )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ONTARIO :
    if _OntarioExposureLimits [ CASRN ] [ "Ceiling (ppm)" ] :
        _Ceiling = ( _OntarioExposureLimits [ CASRN ] [ "Ceiling (ppm)" ] , 'ppm' )
    elif _OntarioExposureLimits [ CASRN ] [ "Ceiling (mg/m^3)" ] :
        _Ceiling = ( _OntarioExposureLimits [ CASRN ] [ "Ceiling (mg/m^3)" ] , 'mg/m^3' )
elif Method == NONE :
    _Ceiling = None
else :
    raise Exception ( 'Failure in in function' )
return _Ceiling


signature:
def Skin ( CASRN , AvailableMethods = False , Method = None ) : # pragma : no cover
    '''This function handles the retrieval of whether or not a chemical can
 be absorbed through the skin , relevant to chemical safety calculations .
 This API is considered experimental , and is expected to be removed in a
 future release in favor of a more complete object - oriented interface .
 > > > Skin ( ' 108-94-1 ' )
 True
 > > > Skin ( ' 1395-21-7 ' )
 False
 > > > Skin ( ' 7572-29-4 ' , AvailableMethods = True )
 [ ' Ontario Limits ' , ' None ' ]'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in _OntarioExposureLimits :
        methods . append ( ONTARIO )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == ONTARIO :
    _Skin = ( _OntarioExposureLimits [ CASRN ] [ "Skin" ] )
elif Method == NONE :
    _Skin = None
else :
    raise Exception ( 'Failure in in function' )
return _Skin


signature:
def Carcinogen ( CASRN , AvailableMethods = False , Method = None ) :
    r'''Looks up if a chemical is listed as a carcinogen or not according to
 either a specifc method or with all methods .
 Returns either the status as a string for a specified method , or the
 status of the chemical in all available data sources , in the format
 { source : status } .
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 status : str or dict
 Carcinogen status information [ - ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain carcinogen status with the
 given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Carcinogen _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 if a chemical is listed as carcinogenic , and will return methods
 instead of the status
 Notes
 Supported methods are :
 * * * IARC * * : International Agency for Research on Cancer , [ 1 ] _ . As
 extracted with a last update of February 22 , 2016 . Has listing
 information of 843 chemicals with CAS numbers . Chemicals without
 CAS numbers not included here . If two listings for the same CAS
 were available , that closest to the CAS number was used . If two
 listings were available published at different times , the latest
 value was used . All else equal , the most pessimistic value was used .
 * * * NTP * * : National Toxicology Program , [ 2 ] _ . Has data on 226
 chemicals .
 Examples
 > > > Carcinogen ( ' 61-82-5 ' )
 { ' National Toxicology Program 13th Report on Carcinogens ' : ' Reasonably Anticipated ' , ' International Agency for Research on Cancer ' : ' Not classifiable as to its carcinogenicity to humans ( 3 ) ' }
 References
 . . [ 1 ] International Agency for Research on Cancer . Agents Classified by
 the IARC Monographs , Volumes 1-115 . Lyon , France : IARC ; 2016 Available
 from : http : / / monographs . iarc . fr / ENG / Classification /
 . . [ 2 ] NTP ( National Toxicology Program ) . 2014 . Report on Carcinogens ,
 Thirteenth Edition . Research Triangle Park , NC : U . S . Department of
 Health and Human Services , Public Health Service .
 http : / / ntp . niehs . nih . gov / pubhealth / roc / roc13/'''

implementation:
methods = [ COMBINED , IARC , NTP ]
if AvailableMethods :
    return methods
if not Method :
    Method = methods [ 0 ]
if Method == IARC :
    if CASRN in IARC_data . index :
        status = IARC_codes [ IARC_data . at [ CASRN , 'group' ] ]
    else :
        status = UNLISTED
elif Method == NTP :
    if CASRN in NTP_data . index :
        status = NTP_codes [ NTP_data . at [ CASRN , 'Listing' ] ]
    else :
        status = UNLISTED
elif Method == COMBINED :
    status = { }
    for method in methods [ 1 : ] :
        status [ method ] = Carcinogen ( CASRN , Method = method )
else :
    raise Exception ( 'Failure in in function' )
return status


signature:
def Tautoignition ( CASRN , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval or calculation of a chemical ' s
 autoifnition temperature . Lookup is based on CASRNs . No predictive methods
 are currently implemented . Will automatically select a data source to use
 if no Method is provided ; returns None if the data is not available .
 Prefered source is ' IEC 60079-20-1 ( 2010 ) ' [ 1 ] _ , with the secondary source
 ' NFPA 497 ( 2008 ) ' [ 2 ] _ having very similar data .
 Examples
 > > > Tautoignition ( CASRN = ' 71-43-2 ' )
 771.15
 Parameters
 CASRN : string
 CASRN [ - ]
 Returns
 Tautoignition : float
 Autoignition point of the chemical , [ K ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain Tautoignition with the
 given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 Tautoignition _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 Tautoignition for the desired chemical , and will return methods
 instead of Tautoignition
 Notes
 References
 . . [ 1 ] IEC . “ IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
 Material characteristics for gas and vapour classification - Test
 methods and data . ” https : / / webstore . iec . ch / publication / 635 . See also
 https : / / law . resource . org / pub / in / bis / S05 / is . iec . 60079.20.1.2010 . pdf
 . . [ 2 ] National Fire Protection Association . NFPA 497 : Recommended
 Practice for the Classification of Flammable Liquids , Gases , or Vapors
 and of Hazardous . NFPA , 2008.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in IEC_2010 . index and not np . isnan ( IEC_2010 . at [ CASRN , 'Tautoignition' ] ) :
        methods . append ( IEC )
    if CASRN in NFPA_2008 . index and not np . isnan ( NFPA_2008 . at [ CASRN , 'Tautoignition' ] ) :
        methods . append ( NFPA )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == IEC :
    return float ( IEC_2010 . at [ CASRN , 'Tautoignition' ] )
elif Method == NFPA :
    return float ( NFPA_2008 . at [ CASRN , 'Tautoignition' ] )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def LFL ( Hc = None , atoms = { } , CASRN = '' , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval or calculation of a chemical ' s
 Lower Flammability Limit . Lookup is based on CASRNs . Two predictive methods
 are currently implemented . Will automatically select a data source to use
 if no Method is provided ; returns None if the data is not available .
 Prefered source is ' IEC 60079-20-1 ( 2010 ) ' [ 1 ] _ , with the secondary source
 ' NFPA 497 ( 2008 ) ' [ 2 ] _ having very similar data . If the heat of combustion
 is provided , the estimation method ` Suzuki _ LFL ` can be used . If the atoms
 of the molecule are available , the method ` Crowl _ Louvar _ LFL ` can be used .
 Examples
 > > > LFL ( CASRN = ' 71-43-2 ' )
 0.012
 Parameters
 Hc : float , optional
 Heat of combustion of gas [ J / mol ]
 atoms : dict , optional
 Dictionary of atoms and atom counts
 CASRN : string , optional
 CASRN [ - ]
 Returns
 LFL : float
 Lower flammability limit of the gas in an atmosphere at STP , [ mole fraction ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain LFL with the
 given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 LFL _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the Lower Flammability Limit for the desired chemical , and will return
 methods instead of Lower Flammability Limit .
 Notes
 References
 . . [ 1 ] IEC . “ IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
 Material characteristics for gas and vapour classification - Test
 methods and data . ” https : / / webstore . iec . ch / publication / 635 . See also
 https : / / law . resource . org / pub / in / bis / S05 / is . iec . 60079.20.1.2010 . pdf
 . . [ 2 ] National Fire Protection Association . NFPA 497 : Recommended
 Practice for the Classification of Flammable Liquids , Gases , or Vapors
 and of Hazardous . NFPA , 2008.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in IEC_2010 . index and not np . isnan ( IEC_2010 . at [ CASRN , 'LFL' ] ) :
        methods . append ( IEC )
    if CASRN in NFPA_2008 . index and not np . isnan ( NFPA_2008 . at [ CASRN , 'LFL' ] ) :
        methods . append ( NFPA )
    if Hc :
        methods . append ( SUZUKI )
    if atoms :
        methods . append ( CROWLLOUVAR )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == IEC :
    return float ( IEC_2010 . at [ CASRN , 'LFL' ] )
elif Method == NFPA :
    return float ( NFPA_2008 . at [ CASRN , 'LFL' ] )
elif Method == SUZUKI :
    return Suzuki_LFL ( Hc = Hc )
elif Method == CROWLLOUVAR :
    return Crowl_Louvar_LFL ( atoms = atoms )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def UFL ( Hc = None , atoms = { } , CASRN = '' , AvailableMethods = False , Method = None ) :
    r'''This function handles the retrieval or calculation of a chemical ' s
 Upper Flammability Limit . Lookup is based on CASRNs . Two predictive methods
 are currently implemented . Will automatically select a data source to use
 if no Method is provided ; returns None if the data is not available .
 Prefered source is ' IEC 60079-20-1 ( 2010 ) ' [ 1 ] _ , with the secondary source
 ' NFPA 497 ( 2008 ) ' [ 2 ] _ having very similar data . If the heat of combustion
 is provided , the estimation method ` Suzuki _ UFL ` can be used . If the atoms
 of the molecule are available , the method ` Crowl _ Louvar _ UFL ` can be used .
 Examples
 > > > UFL ( CASRN = ' 71-43-2 ' )
 0.086
 Parameters
 Hc : float , optional
 Heat of combustion of gas [ J / mol ]
 atoms : dict , optional
 Dictionary of atoms and atom counts
 CASRN : string , optional
 CASRN [ - ]
 Returns
 UFL : float
 Upper flammability limit of the gas in an atmosphere at STP , [ mole fraction ]
 methods : list , only returned if AvailableMethods = = True
 List of methods which can be used to obtain UFL with the
 given inputs
 Other Parameters
 Method : string , optional
 A string for the method name to use , as defined by constants in
 UFL _ methods
 AvailableMethods : bool , optional
 If True , function will determine which methods can be used to obtain
 the Upper Flammability Limit for the desired chemical , and will return
 methods instead of Upper Flammability Limit .
 Notes
 References
 . . [ 1 ] IEC . “ IEC 60079-20-1:2010 Explosive atmospheres - Part 20-1:
 Material characteristics for gas and vapour classification - Test
 methods and data . ” https : / / webstore . iec . ch / publication / 635 . See also
 https : / / law . resource . org / pub / in / bis / S05 / is . iec . 60079.20.1.2010 . pdf
 . . [ 2 ] National Fire Protection Association . NFPA 497 : Recommended
 Practice for the Classification of Flammable Liquids , Gases , or Vapors
 and of Hazardous . NFPA , 2008.'''

implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRN in IEC_2010 . index and not np . isnan ( IEC_2010 . at [ CASRN , 'UFL' ] ) :
        methods . append ( IEC )
    if CASRN in NFPA_2008 . index and not np . isnan ( NFPA_2008 . at [ CASRN , 'UFL' ] ) :
        methods . append ( NFPA )
    if Hc :
        methods . append ( SUZUKI )
    if atoms :
        methods . append ( CROWLLOUVAR )
    methods . append ( NONE )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
if Method == IEC :
    return float ( IEC_2010 . at [ CASRN , 'UFL' ] )
elif Method == NFPA :
    return float ( NFPA_2008 . at [ CASRN , 'UFL' ] )
elif Method == SUZUKI :
    return Suzuki_UFL ( Hc = Hc )
elif Method == CROWLLOUVAR :
    return Crowl_Louvar_UFL ( atoms = atoms )
elif Method == NONE :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def fire_mixing ( ys = None , FLs = None ) : # pragma : no cover
    '''Crowl , Daniel A . , and Joseph F . Louvar . Chemical Process Safety :
 Fundamentals with Applications . 2E . Upper Saddle River , N . J :
 Prentice Hall , 2001.
 > > > fire _ mixing ( ys = normalize ( [ 0.0024 , 0.0061 , 0.0015 ] ) , FLs = [ . 012 , . 053 , . 031 ] )
 0.02751172136637643
 > > > fire _ mixing ( ys = normalize ( [ 0.0024 , 0.0061 , 0.0015 ] ) , FLs = [ . 075 , . 15 , . 32 ] )
 0.12927551844869378'''

implementation: return 1. / sum ( [ yi / FLi for yi , FLi in zip ( ys , FLs ) ] )


implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRNs :
        CASRNs2 = list ( CASRNs )
        LFLs2 = list ( LFLs )
        for i in inerts :
            if i in CASRNs2 :
                ind = CASRNs . index ( i )
                CASRNs2 . remove ( i )
                LFLs2 . remove ( LFLs [ ind ] )
        if none_and_length_check ( [ LFLs2 ] ) :
            methods . append ( 'Summed Inverse, inerts removed' )
    else :
        if none_and_length_check ( [ LFLs ] ) :
            methods . append ( 'Summed Inverse' )
    methods . append ( 'None' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
# if not none _ and _ length _ check ( [ LFLs , ys ] ) :
# raise Exception ( ' Function inputs are incorrect format ' )
if Method == 'Summed Inverse' :
    return fire_mixing ( ys , LFLs )
elif Method == 'Summed Inverse, inerts removed' :
    CASRNs2 = list ( CASRNs )
    LFLs2 = list ( LFLs )
    ys2 = list ( ys )
    for i in inerts :
        if i in CASRNs2 :
            ind = CASRNs2 . index ( i )
            CASRNs2 . remove ( i )
            LFLs2 . pop ( ind )
            ys2 . pop ( ind )
    return fire_mixing ( normalize ( ys2 ) , LFLs2 )
elif Method == 'None' :
    return None
else :
    raise Exception ( 'Failure in in function' )


implementation:
def list_methods ( ) :
    methods = [ ]
    if CASRNs :
        CASRNs2 = list ( CASRNs )
        UFLs2 = list ( UFLs )
        for i in inerts :
            if i in CASRNs2 :
                ind = CASRNs . index ( i )
                CASRNs2 . remove ( i )
                UFLs2 . remove ( UFLs [ ind ] )
        if none_and_length_check ( [ UFLs2 ] ) :
            methods . append ( 'Summed Inverse, inerts removed' )
    if none_and_length_check ( [ UFLs , ys ] ) :
        methods . append ( 'Summed Inverse' )
    methods . append ( 'None' )
    return methods
if AvailableMethods :
    return list_methods ( )
if not Method :
    Method = list_methods ( ) [ 0 ]
# This is the calculate , given the method section
# if not none _ and _ length _ check ( [ UFLs , ys ] ) : # check same - length inputs
# raise Exception ( ' Function inputs are incorrect format ' )
if Method == 'Summed Inverse' :
    return fire_mixing ( ys , UFLs )
elif Method == 'Summed Inverse, inerts removed' :
    CASRNs2 = list ( CASRNs )
    UFLs2 = list ( UFLs )
    ys2 = list ( ys )
    for i in inerts :
        if i in CASRNs2 :
            ind = CASRNs2 . index ( i )
            CASRNs2 . remove ( i )
            UFLs2 . pop ( ind )
            ys2 . pop ( ind )
    return fire_mixing ( normalize ( ys2 ) , UFLs2 )
elif Method == 'None' :
    return None
else :
    raise Exception ( 'Failure in in function' )


signature:
def Suzuki_LFL ( Hc = None ) :
    r'''Calculates lower flammability limit , using the Suzuki [ 1 ] _ correlation .
 Uses heat of combustion only .
 The lower flammability limit of a gas is air is :
 . . math : :
 \ text { LFL } = \ frac { - 3.42 } { \ Delta H _ c ^ { \ circ } } + 0.569
 \ Delta H _ c ^ { \ circ } + 0.0538 \ Delta H _ c ^ { \ circ 2 } + 1.80
 Parameters
 Hc : float
 Heat of combustion of gas [ J / mol ]
 Returns
 LFL : float
 Lower flammability limit , mole fraction [ - ]
 Notes
 Fit performed with 112 compounds , r ^ 2 was 0.977.
 LFL in percent volume in air . Hc is at standard conditions , in MJ / mol .
 11 compounds left out as they were outliers .
 Equation does not apply for molecules with halogen atoms , only hydrocarbons
 with oxygen or nitrogen or sulfur .
 No sample calculation provided with the article . However , the equation is
 straightforward .
 Limits of equations ' s validity are - 6135596 J where it predicts a
 LFL of 0 , and - 48322129 J where it predicts a LFL of 1.
 Examples
 Pentane , 1.5 % LFL in literature
 > > > Suzuki _ LFL ( - 3536600)
 0.014276107095811815
 References
 . . [ 1 ] Suzuki , Takahiro . " Note : Empirical Relationship between Lower
 Flammability Limits and Standard Enthalpies of Combustion of Organic
 Compounds . " Fire and Materials 18 , no . 5 ( September 1 , 1994 ) : 333-36.
 doi : 10.1002 / fam . 810180509.'''


signature:
def Crowl_Louvar_LFL ( atoms ) :
    r'''Calculates lower flammability limit , using the Crowl - Louvar [ 1 ] _
 correlation . Uses molecular formula only .
 The lower flammability limit of a gas is air is :
 . . math : :
 C _ mH _ xO _ y + zO _ 2 \ to mCO _ 2 + \ frac { x } { 2 } H _ 2O
 \ text { LFL } = \ frac { 0.55 } { 4.76m + 1.19x - 2.38y + 1}
 Parameters
 atoms : dict
 Dictionary of atoms and atom counts
 Returns
 LFL : float
 Lower flammability limit , mole fraction
 Notes
 Coefficient of 0.55 taken from [ 2 ] _
 Examples
 Hexane , example from [ 1 ] _ , lit . 1.2 %
 > > > Crowl _ Louvar _ LFL ( { ' H ' : 14 , ' C ' : 6 } )
 0.011899610558199915
 References
 . . [ 1 ] Crowl , Daniel A . , and Joseph F . Louvar . Chemical Process Safety :
 Fundamentals with Applications . 2E . Upper Saddle River , N . J :
 Prentice Hall , 2001.
 . . [ 2 ] Jones , G . W . " Inflammation Limits and Their Practical Application
 in Hazardous Industrial Operations . " Chemical Reviews 22 , no . 1
 ( February 1 , 1938 ) : 1-26 . doi : 10.1021 / cr60071a001'''

implementation:
nC , nH , nO = 0 , 0 , 0
if 'C' in atoms and atoms [ 'C' ] :
    nC = atoms [ 'C' ]
else :
    return None
if 'H' in atoms :
    nH = atoms [ 'H' ]
if 'O' in atoms :
    nO = atoms [ 'O' ]
return 0.55 / ( 4.76 * nC + 1.19 * nH - 2.38 * nO + 1. )