things = dict()<EOL>for zi, atoms in zip(self.zs, self.atomss):<EOL><INDENT>for atom, count in atoms.iteritems():<EOL><INDENT>if atom in things:<EOL><INDENT>things[atom] += zi*count<EOL><DEDENT>else:<EOL><INDENT>things[atom] = zi*count<EOL><DEDENT><DEDENT><DEDENT>tot = sum(things.values())<EOL>return {atom : value/tot for atom, value in things.iteritems()}<EOL>

r'''Dictionary of atomic fractions for each atom in the mixture.

        Examples
        --------
        >>> Mixture(['CO2', 'O2'], zs=[0.5, 0.5]).atom_fractions
        {'C': 0.2, 'O': 0.8}


kg, rhog, Cpg = self.kg, self.rhog, self.Cpg<EOL>if all([kg, rhog, Cpg]):<EOL><INDENT>return thermal_diffusivity(k=kg, rho=rhog, Cp=Cpg)<EOL><DEDENT>return None<EOL>

r'''Thermal diffusivity of the gas phase of the mixture if one exists
        at its current temperature and pressure, in units of [m^2/s].

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Examples
        --------
        >>> Mixture(['ammonia'], ws=[1]).alphag
        1.6968517002221566e-05


return [i.rholm for i in self.Chemicals]<EOL>

r'''Pure component molar densities of the chemicals in the mixture in
        the liquid phase at the current temperature and pressure, in units of
        [mol/m^3].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).rholms
        [10882.699301520635, 9135.590853014008]


return [i.similarity_variable for i in self.Chemicals]<EOL>

r'''Similarity variables for all chemicals in the mixture, see
        :obj:`thermo.elements.similarity_variable` for the definition, [mol/g]

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5]).similarity_variables
        [0.15362587797189262, 0.16279853724428964]


return [i.nul for i in self.Chemicals]<EOL>

r'''Pure component kinematic viscosities of the liquid phase of the
        chemicals in the mixture at its current temperature and pressure, in
        units of [m^2/s].

        .. math::
            \nu = \frac{\mu}{\rho}

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).nuls
        [5.357870271650772e-07, 3.8127962283230277e-07]


return [i.rings for i in self.Chemicals]<EOL>

r'''List of ring counts for all chemicals in the mixture.

        Examples
        --------
        >>> Mixture(['Docetaxel', 'Paclitaxel'], zs=[.5, .5]).ringss
        [6, 7]


return [i.InChI_Key for i in self.Chemicals]<EOL>

r'''InChI keys for all chemicals in the mixture.

        Examples
        --------
        >>> Mixture(['1-nonene'], zs=[1]).InChI_Keys
        ['JRZJOMJEPLMPRA-UHFFFAOYSA-N']


return [i.rhog for i in self.Chemicals]<EOL>

r'''Pure-component gas-phase mass densities of the chemicals in the
        mixture at its current temperature and pressure, in units of [kg/m^3].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).rhogs
        [3.1333721283939258, 3.8152260283954584]


return phase_select_property(phase=self.phase, s=None, l=self.rholm, g=self.rhogm)<EOL>

r'''Molar density of the mixture at its current phase and
        temperature and pressure, in units of [mol/m^3].
        Available only if single phase.

        Examples
        --------
        >>> Mixture(['1-hexanol'], ws=[1]).rhom
        7983.414573003429


return [i.alphag for i in self.Chemicals]<EOL>

r'''Pure component thermal diffusivities of the chemicals in the
        mixture in the gas phase at the current temperature and pressure, in
        units of [m^2/s].

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).alphags
        [3.3028044028118324e-06, 2.4412958544059014e-06]


Vmg = self.VolumeGasMixture(T=<NUM_LIT>, P=<NUM_LIT>, zs=self.zs, ws=self.ws)<EOL>if Vmg:<EOL><INDENT>rho = Vm_to_rho(Vmg, self.MW)<EOL>return SG(rho, rho_ref=<NUM_LIT>) <EOL><DEDENT>return None<EOL>

r'''Specific gravity of a hypothetical gas phase of the mixture, .
        [dimensionless]. The reference condition is air at 15.6 °C (60 °F) and
        1 atm (rho=1.223 kg/m^3). The definition for gases uses the
        compressibility factor of the reference gas and the mixture both at the
        reference conditions, not the conditions of the mixture.

        Examples
        --------
        >>> Mixture('argon').SGg
        1.3800407778218216


return [i.alphal for i in self.Chemicals]<EOL>

r'''Pure component thermal diffusivities of the chemicals in the
        mixture in the liquid phase at the current temperature and pressure, in
        units of [m^2/s].

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).alphals
        [8.732683564481583e-08, 7.57355434073289e-08]


Vml = self.Vml_STP<EOL>if Vml:<EOL><INDENT>return <NUM_LIT:1.>/Vml<EOL><DEDENT>return None<EOL>

r'''Molar density of the mixture in the liquid phase at 298.15 K and 101.325 kPa,
        and the current composition, in units of [mol/m^3].

        Examples
        --------
        >>> Mixture(['water'], ws=[1]).rholm_STP
        55344.59086372442


return phase_select_property(phase=self.phase, s=None, l=self.kl, g=self.kg)<EOL>

r'''Thermal conductivity of the mixture at its current phase,
        temperature, and pressure in units of [W/m/K].
        Available only if single phase.

        Examples
        --------
        >>> Mixture(['ethanol'], ws=[1], T=300).kl
        0.16313594741877802


return phase_select_property(phase=self.phase, s=self.Cps, l=self.Cpl, g=self.Cpg)<EOL>

r'''Mass heat capacity of the mixture at its current phase and
        temperature, in units of [J/kg/K].

        Examples
        --------
        >>> w = Mixture(['water'], ws=[1])
        >>> w.Cp, w.phase
        (4180.597021827336, 'l')
        >>> Pd = Mixture(['palladium'], ws=[1])
        >>> Pd.Cp, Pd.phase
        (234.26767209171211, 's')


Vmg = self.Vmg_STP<EOL>if Vmg:<EOL><INDENT>return Vm_to_rho(Vmg, self.MW)<EOL><DEDENT>return None<EOL>

r'''Gas-phase mass density of the mixture at 298.15 K and 101.325 kPa,
        and the current composition in units of [kg/m^3].

        Examples
        --------
        >>> Mixture(['nitrogen'], ws=[1]).rhog_STP
        1.145534453639403


mug, rhog = self.mug, self.rhog<EOL>if all([mug, rhog]):<EOL><INDENT>return nu_mu_converter(mu=mug, rho=rhog)<EOL><DEDENT>return None<EOL>

r'''Kinematic viscosity of the gas phase of the mixture if one exists
        at its current temperature and pressure, in units of [m^2/s].

        .. math::
            \nu = \frac{\mu}{\rho}

        Examples
        --------
        >>> Mixture(['methane'], ws=[1], T=115).nug
        2.5118460023343146e-06


return self.ThermalConductivityGasMixture(self.T, self.P, self.zs, self.ws)<EOL>

r'''Thermal conductivity of the mixture in the gas phase at its current
        temperature, pressure, and composition in units of [Pa*s].

        For calculation of this property at other temperatures and pressures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface
        :obj:`thermo.thermal_conductivity.ThermalConductivityGasMixture`;
        each Mixture instance creates one to actually perform the calculations.

        Examples
        --------
        >>> Mixture(['water'], ws=[1], T=500).kg
        0.036035173297862676


return [i.sigma for i in self.Chemicals]<EOL>

r'''Pure component surface tensions of the chemicals in the mixture at
        its current temperature, in units of [N/m].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).sigmas
        [0.02533469712937521, 0.025254723406585546]


return [i.legal_status for i in self.Chemicals]<EOL>

r'''List of dictionaries of the legal status for all chemicals in the
        mixture.

        Examples
        --------
        >>> pprint(Mixture(['oxygen', 'nitrogen'], zs=[.5, .5]).legal_statuses)
        [{'DSL': 'LISTED',
          'EINECS': 'LISTED',
          'NLP': 'UNLISTED',
          'SPIN': 'LISTED',
          'TSCA': 'LISTED'},
         {'DSL': 'LISTED',
          'EINECS': 'LISTED',
          'NLP': 'UNLISTED',
          'SPIN': 'LISTED',
          'TSCA': 'LISTED'}]


mul, rhol = self.mul, self.rhol<EOL>if all([mul, rhol]):<EOL><INDENT>return nu_mu_converter(mu=mul, rho=rhol)<EOL><DEDENT>return None<EOL>

r'''Kinematic viscosity of the liquid phase of the mixture if one
        exists at its current temperature and pressure, in units of [m^2/s].

        .. math::
            \nu = \frac{\mu}{\rho}

        Examples
        --------
        >>> Mixture(['methane'], ws=[1], T=110).nul
        2.858088468937333e-07


Vm = self.Vm<EOL>if Vm:<EOL><INDENT>return Z(self.T, self.P, Vm)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the mixture at its current phase and
        temperature and pressure, [dimensionless].
        Available only if single phase.

        Examples
        --------
        >>> Mixture(['MTBE'], ws=[1], T=900, P=1E-2).Z
        0.9999999999056374


Cpl, mul, kl = self.Cpl, self.mul, self.kl<EOL>if all([Cpl, mul, kl]):<EOL><INDENT>return Prandtl(Cp=Cpl, mu=mul, k=kl)<EOL><DEDENT>return None<EOL>

r'''Prandtl number of the liquid phase of the mixture if one exists at
        its current temperature and pressure, [dimensionless].

        .. math::
            Pr = \frac{C_p \mu}{k}

        Examples
        --------
        >>> Mixture(['nitrogen'], ws=[1], T=70).Prl
        2.782821450148889


Vmg = self.Vmg<EOL>if Vmg:<EOL><INDENT>return Z(self.T, self.P, Vmg)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the mixture in the gas phase at the
        current temperature, pressure, and composition, [dimensionless].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeGasMixture` to perform the actual calculation
        of molar volume.

        Examples
        --------
        >>> Mixture(['hexane'], ws=[1], T=300, P=1E5).Zg
        0.9403859376888885


rhol = self.rhol<EOL>if rhol is not None:<EOL><INDENT>return SG(rhol)<EOL><DEDENT>return None<EOL>

r'''Specific gravity of a hypothetical liquid phase of the mixture at
        the specified temperature and pressure, [dimensionless].
        The reference condition is water at 4 °C and 1 atm
        (rho=999.017 kg/m^3). For liquids, SG is defined that the reference
        chemical's T and P are fixed, but the chemical itself varies with
        the specified T and P.

        Examples
        --------
        >>> Mixture('water', ws=[1], T=365).SGl
        0.9650065522428539


return [i.mul for i in self.Chemicals]<EOL>

r'''Pure component viscosities of the chemicals in the mixture in the
        liquid phase at its current temperature and pressure, in units of
        [Pa*s].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).muls
        [0.00045545522798131764, 0.00043274394349114754]


return [i.Psat for i in self.Chemicals]<EOL>

r'''Pure component vapor pressures of the chemicals in the mixture at
        its current temperature, in units of [Pa].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Psats
        [32029.25774454549, 10724.419010511821]


return self.VolumeGasMixture(T=<NUM_LIT>, P=<NUM_LIT>, zs=self.zs, ws=self.ws)<EOL>

r'''Gas-phase molar volume of the mixture at 298.15 K and 101.325 kPa,
        and the current composition in units of [m^3/mol].

        Examples
        --------
        >>> Mixture(['nitrogen'], ws=[1]).Vmg_STP
        0.02445443688838904


return [i.formula for i in self.Chemicals]<EOL>

r'''Chemical formulas for all chemicals in the mixture.

        Examples
        --------
        >>> Mixture(['ethanol', 'trichloroethylene', 'furfuryl alcohol'],
        ... ws=[0.5, 0.2, 0.3]).formulas
        ['C2H6O', 'C2HCl3', 'C5H6O2']


return [i.Cps for i in self.Chemicals]<EOL>

r'''Solid-phase pure component heat capacity of the chemicals in the
        mixture at its current temperature, in units of [J/kg/K].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Cpss
        [1405.341925822248, 1467.6412627521154]


return [i.isentropic_exponent for i in self.Chemicals]<EOL>

r'''Gas-phase pure component ideal-gas isentropic exponent of the
        chemicals in the  mixture at its current temperature, [dimensionless].
         Does not include pressure-compensation from an equation of state.

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).isentropic_exponents
        [1.1023398979313739, 1.080418846592871]


return [i.atoms for i in self.Chemicals]<EOL>

r'''List of dictionaries of atom counts for all chemicals in the mixture.

        Examples
        --------
        >>> Mixture(['nitrogen', 'oxygen'], zs=[.01, .99]).atomss
        [{'N': 2}, {'O': 2}]


return [i.Cpg for i in self.Chemicals]<EOL>

r'''Gas-phase pure component heat capacity of the chemicals in the
        mixture at its current temperature, in units of [J/kg/K].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Cpgs
        [1146.5360555565146, 1212.3488046342566]


return [i.Hvap for i in self.Chemicals]<EOL>

r'''Enthalpy of vaporization of the chemicals in the mixture at its
        current temperature, in units of [J/kg].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Hvaps
        [417859.9144942896, 399961.16950519773]


Vmg, Cpgm, isobaric_expansion_g = self.Vmg, self.Cpgm, self.isobaric_expansion_g<EOL>if all((Vmg, Cpgm, isobaric_expansion_g)):<EOL><INDENT>return Joule_Thomson(T=self.T, V=Vmg, Cp=Cpgm, beta=isobaric_expansion_g)<EOL><DEDENT>return None<EOL>

r'''Joule Thomson coefficient of the gas phase of the mixture if one
        exists at its current temperature and pressure, in units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Mixture(['dodecane'], ws=[1], T=400, P=1000).JTg
        5.4089897835384913e-05


Vml, Cplm, isobaric_expansion_l = self.Vml, self.Cplm, self.isobaric_expansion_l<EOL>if all((Vml, Cplm, isobaric_expansion_l)):<EOL><INDENT>return Joule_Thomson(T=self.T, V=Vml, Cp=Cplm, beta=isobaric_expansion_l)<EOL><DEDENT>return None<EOL>

r'''Joule Thomson coefficient of the liquid phase of the mixture if one
        exists at its current temperature and pressure, in units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Mixture(['dodecane'], ws=[1], T=400).JTl
        -3.193910574559279e-07


return phase_select_property(phase=self.phase, s=self.rhos, l=self.rhol, g=self.rhog)<EOL>

r'''Mass density of the mixture at its current phase and
        temperature and pressure, in units of [kg/m^3].
        Available only if single phase.

        Examples
        --------
        >>> Mixture(['decane'], ws=[1], T=550, P=2E6).rho
        498.67008448640604


return [i.mug for i in self.Chemicals]<EOL>

r'''Pure component viscosities of the chemicals in the mixture in the
        gas phase at its current temperature and pressure, in units of [Pa*s].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).mugs
        [8.082880451060605e-06, 7.442602145854158e-06]


return phase_select_property(phase=self.phase, l=self.JTl, g=self.JTg)<EOL>

r'''Joule Thomson coefficient of the mixture at its
        current phase, temperature, and pressure in units of [K/Pa].
        Available only if single phase.

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Mixture(['water'], ws=[1]).JT
        -2.2150394958666412e-07


return [i.JTg for i in self.Chemicals]<EOL>

r'''Pure component Joule Thomson coefficients of the chemicals in the
        mixture in the gas phase at its current temperature and pressure, in
        units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).JTgs
        [6.0940046688790938e-05, 4.1290005523287549e-05]


return [i.solubility_parameter for i in self.Chemicals]<EOL>

r'''Pure component solubility parameters of the chemicals in the
        mixture at its current temperature and pressure, in units of [Pa^0.5].

        .. math::
            \delta = \sqrt{\frac{\Delta H_{vap} - RT}{V_m}}

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).solubility_parameters
        [18062.51359608708, 14244.12852702228]


return [i.Cpgm for i in self.Chemicals]<EOL>

r'''Gas-phase ideal gas heat capacity of the chemicals at its current
        temperature, in units of [J/mol/K].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Cpgms
        [89.55804092586159, 111.70390334788907]


return [i.PubChem for i in self.Chemicals]<EOL>

r'''PubChem Component ID numbers for all chemicals in the mixture.

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5]).PubChems
        [241, 1140]


return self.VolumeLiquidMixture(T=<NUM_LIT>, P=<NUM_LIT>, zs=self.zs, ws=self.ws)<EOL>

r'''Liquid-phase molar volume of the mixture at 298.15 K and 101.325 kPa,
        and the current composition in units of [m^3/mol].

        Examples
        --------
        >>> Mixture(['cyclobutane'], ws=[1]).Vml_STP
        8.143327329133706e-05


return [i.rhosm for i in self.Chemicals]<EOL>

r'''Pure component molar densities of the chemicals in the solid phase
        at the current temperature and pressure, in units of [mol/m^3].

        Examples
        --------
        >>> Mixture(['iron'], ws=[1], T=320).rhosms
        [140925.7767033753]


return [i.Prl for i in self.Chemicals]<EOL>

r'''Pure component Prandtl numbers of the liquid phase of the chemicals
        in the mixture at its current temperature and pressure, [dimensionless].

        .. math::
            Pr = \frac{C_p \mu}{k}

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).Prls
        [6.13542244155373, 5.034355147908088]


things = dict()<EOL>for zi, atoms in zip(self.zs, self.atomss):<EOL><INDENT>for atom, count in atoms.iteritems():<EOL><INDENT>if atom in things:<EOL><INDENT>things[atom] += zi*count<EOL><DEDENT>else:<EOL><INDENT>things[atom] = zi*count<EOL><DEDENT><DEDENT><DEDENT>return mass_fractions(things)<EOL>


return [i.Cvgm for i in self.Chemicals]<EOL>

r'''Gas-phase pure component ideal-gas contant-volume heat capacities
        of the chemicals in the mixture at its current temperature, in units
        of [J/mol/K].  Subtracts R from the ideal-gas heat capacities; does not
        include pressure-compensation from an equation of state.

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).Cvgms
        [81.2435811258616, 103.38944354788907]


return [i.PSRK_groups for i in self.Chemicals]<EOL>

r'''List of dictionaries of PSRK subgroup: count groups for each chemical in the mixture. Uses the PSRK subgroups,
        as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.

        Examples
        --------
        >>> pprint(Mixture(['1-pentanol', 'decane'], ws=[0.5, 0.5]).PSRK_groups)
        [{1: 1, 2: 4, 14: 1}, {1: 2, 2: 8}]


return phase_select_property(phase=self.phase, l=self.alphal, g=self.alphag)<EOL>

r'''Thermal diffusivity of the mixture at its current temperature,
        pressure, and phase in units of [m^2/s].
        Available only if single phase.

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Examples
        --------
        >>> Mixture(['furfural'], ws=[1]).alpha
        8.696537158635412e-08


Vml = self.Vml<EOL>if Vml:<EOL><INDENT>return Z(self.T, self.P, Vml)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the mixture in the liquid phase at the
        current temperature, pressure, and composition, [dimensionless].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeLiquidMixture` to perform the actual
        calculation of molar volume.

        Examples
        --------
        >>> Mixture(['water'], ws=[1]).Zl
        0.0007385375470263454


return property_molar_to_mass(R, self.MW)<EOL>

r'''Specific gas constant of the mixture, in units of [J/kg/K].

        Examples
        --------
        >>> Mixture(['N2', 'O2'], zs=[0.79, .21]).R_specific
        288.1928437986195


return self.VolumeLiquidMixture(T=self.T, P=self.P, zs=self.zs, ws=self.ws)<EOL>

r'''Liquid-phase molar volume of the mixture at its current
        temperature, pressure, and composition in units of [m^3/mol]. For
        calculation of this property at other temperatures or pressures or
        compositions, or specifying manually the method used to calculate it,
        and more - see the object oriented interface
        :obj:`thermo.volume.VolumeLiquidMixture`; each Mixture instance
        creates one to actually perform the calculations.

        Examples
        --------
        >>> Mixture(['cyclobutane'], ws=[1], T=225).Vml
        7.42395423425395e-05


return [i.UNIFAC_groups for i in self.Chemicals]<EOL>

r'''List of dictionaries of UNIFAC subgroup: count groups for each chemical in the mixture. Uses the original
        UNIFAC subgroups, as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.

        Examples
        --------
        >>> pprint(Mixture(['1-pentanol', 'decane'], ws=[0.5, 0.5]).UNIFAC_groups)
        [{1: 1, 2: 4, 14: 1}, {1: 2, 2: 8}]


return phase_select_property(phase=self.phase, l=self.nul, g=self.nug)<EOL>

r'''Kinematic viscosity of the the mixture at its current temperature,
        pressure, and phase in units of [m^2/s].
        Available only if single phase.

        .. math::
            \nu = \frac{\mu}{\rho}

        Examples
        --------
        >>> Mixture(['argon'], ws=[1]).nu
        1.3842643382482236e-05


Cpsm = self.HeatCapacitySolidMixture(self.T, self.P, self.zs, self.ws)<EOL>if Cpsm:<EOL><INDENT>return property_molar_to_mass(Cpsm, self.MW)<EOL><DEDENT>return None<EOL>

r'''Solid-phase heat capacity of the mixture at its current temperature
        and composition, in units of [J/kg/K]. For calculation of this property
        at other temperatures or compositions, or specifying manually the
        method used to calculate it,  and more - see the object oriented
        interface :obj:`thermo.heat_capacity.HeatCapacitySolidMixture`; each
        Mixture instance creates one to actually perform the calculations. Note
        that that interface provides output in molar units.

        Examples
        --------
        >>> Mixture(['silver', 'platinum'], ws=[0.95, 0.05]).Cps
        229.55166388430328


return [i.kg for i in self.Chemicals]<EOL>

r'''Pure component thermal conductivies of the chemicals in the mixture
        in the gas phase at its current temperature and pressure, in units of
        [W/m/K].

        Examples
        --------
        >>> Mixture(['benzene', 'toluene'], ws=[0.5, 0.5], T=320).kgs
        [0.011865404482987936, 0.010981336502491088]


return [i.JTl for i in self.Chemicals]<EOL>

r'''Pure component Joule Thomson coefficients of the chemicals in the
        mixture in the liquid phase at its current temperature and pressure, in
        units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Mixture(['benzene', 'hexane'], ws=[0.5, 0.5], T=320).JTls
        [-3.8633730709853161e-07, -3.464395792560331e-07]


return phase_select_property(phase=self.phase, l=self.Prl, g=self.Prg)<EOL>

r'''Prandtl number of the mixture at its current temperature,
        pressure, and phase; [dimensionless].
        Available only if single phase.

        .. math::
            Pr = \frac{C_p \mu}{k}

        Examples
        --------
        >>> Mixture(['acetone'], ws=[1]).Pr
        4.183039103542711


Vmg = self.Vmg<EOL>if Vmg:<EOL><INDENT>return <NUM_LIT:1.>/Vmg<EOL><DEDENT>return None<EOL>

r'''Molar density of the chemical in the gas phase at the
        current temperature and pressure, in units of [mol/m^3].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeGas` to perform the actual calculation of
        molar volume.

        Examples
        --------
        >>> Chemical('tungsten hexafluoride').rhogm
        42.01349946063116


if self.__Hill:<EOL><INDENT>return self.__Hill<EOL><DEDENT>else:<EOL><INDENT>self.__Hill = atoms_to_Hill(self.atoms)<EOL>return self.__Hill<EOL><DEDENT>

r'''Hill formula of a compound. For a description of the Hill system,
        see :obj:`thermo.elements.atoms_to_Hill`.

        Examples
        --------
        >>> Chemical('furfuryl alcohol').Hill
        'C5H6O2'


return self.VaporPressure(self.T)<EOL>

r'''Vapor pressure of the chemical at its current temperature, in units
        of [Pa]. For calculation of this property at other temperatures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface :obj:`thermo.vapor_pressure.VaporPressure`;
        each Chemical instance creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('water', T=320).Psat
        10533.614271198725
        >>> Chemical('water').VaporPressure.T_dependent_property(320)
        10533.614271198725
        >>> Chemical('water').VaporPressure.all_methods
        set(['VDI_PPDS', 'BOILING_CRITICAL', 'WAGNER_MCGARRY', 'AMBROSE_WALTON', 'COOLPROP', 'LEE_KESLER_PSAT', 'EOS', 'ANTOINE_POLING', 'SANJARI', 'DIPPR_PERRY_8E', 'Edalat'])


Vml, Cplm, isobaric_expansion_l = self.Vml, self.Cplm, self.isobaric_expansion_l<EOL>if all((Vml, Cplm, isobaric_expansion_l)):<EOL><INDENT>return Joule_Thomson(T=self.T, V=Vml, Cp=Cplm, beta=isobaric_expansion_l)<EOL><DEDENT>return None<EOL>

r'''Joule Thomson coefficient of the chemical in the liquid phase at
        its current temperature and pressure, in units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Utilizes the temperature-derivative method of
        :obj:`thermo.volume.VolumeLiquid` and the temperature-dependent heat
        capacity method :obj:`thermo.heat_capacity.HeatCapacityLiquid` to
        obtain the properties required for the actual calculation.

        Examples
        --------
        >>> Chemical('dodecane', T=400).JTl
        -3.0827160465192742e-07


def draw_3d(self, width=<NUM_LIT>, height=<NUM_LIT>, style='<STR_LIT>', Hs=True):

try:<EOL><INDENT>import py3Dmol<EOL>from IPython.display import display<EOL>if Hs:<EOL><INDENT>mol = self.rdkitmol_Hs<EOL><DEDENT>else:<EOL><INDENT>mol = self.rdkitmol<EOL><DEDENT>AllChem.EmbedMultipleConfs(mol)<EOL>mb = Chem.MolToMolBlock(mol)<EOL>p = py3Dmol.view(width=width,height=height)<EOL>p.addModel(mb,'<STR_LIT>')<EOL>p.setStyle({style:{}})<EOL>p.zoomTo()<EOL>display(p.show())<EOL><DEDENT>except:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>

r'''Interface for drawing an interactive 3D view of the molecule.
        Requires an HTML5 browser, and the libraries RDKit, pymol3D, and
        IPython. An exception is raised if all three of these libraries are
        not installed.

        Parameters
        ----------
        width : int
            Number of pixels wide for the view
        height : int
            Number of pixels tall for the view
        style : str
            One of 'stick', 'line', 'cross', or 'sphere'
        Hs : bool
            Whether or not to show hydrogen

        Examples
        --------
        >>> Chemical('cubane').draw_3d()
        <IPython.core.display.HTML object>


Cpg, mug, kg = self.Cpg, self.mug, self.kg<EOL>if all([Cpg, mug, kg]):<EOL><INDENT>return Prandtl(Cp=Cpg, mu=mug, k=kg)<EOL><DEDENT>return None<EOL>

r'''Prandtl number of the gas phase of the chemical at its
        current temperature and pressure, [dimensionless].

        .. math::
            Pr = \frac{C_p \mu}{k}

        Utilizes the temperature and pressure dependent object oriented
        interfaces :obj:`thermo.viscosity.ViscosityGas`,
        :obj:`thermo.thermal_conductivity.ThermalConductivityGas`,
        and :obj:`thermo.heat_capacity.HeatCapacityGas` to calculate the
        actual properties.

        Examples
        --------
        >>> Chemical('NH3').Prg
        0.847263731933008


Vml = self.Vml<EOL>if Vml:<EOL><INDENT>return <NUM_LIT:1.>/Vml<EOL><DEDENT>return None<EOL>

r'''Molar density of the chemical in the liquid phase at the
        current temperature and pressure, in units of [mol/m^3].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeLiquid` to perform the actual calculation of
        molar volume.

        Examples
        --------
        >>> Chemical('nitrogen', T=70).rholm
        29937.20179186975


return self.eos_in_a_box[<NUM_LIT:0>]<EOL>

r'''Equation of state object held by the chemical; used to calculate
        excess thermodynamic quantities, and also provides a vapor pressure
        curve, enthalpy of vaporization curve, fugacity, thermodynamic partial
        derivatives, and more; see :obj:`thermo.eos` for a full listing.

        Examples
        --------
        >>> Chemical('methane').eos.V_g
        0.02441019502181826


Cpgm = self.HeatCapacityGas(self.T)<EOL>if Cpgm:<EOL><INDENT>return property_molar_to_mass(Cpgm, self.MW)<EOL><DEDENT>return None<EOL>

r'''Gas-phase heat capacity of the chemical at its current temperature,
        in units of [J/kg/K]. For calculation of this property at other
        temperatures, or specifying manually the method used to calculate it,
        and more - see the object oriented interface
        :obj:`thermo.heat_capacity.HeatCapacityGas`; each Chemical instance
        creates one to actually perform the calculations. Note that that
        interface provides output in molar units.

        Examples
        --------
        >>> w = Chemical('water', T=520)
        >>> w.Cpg
        1967.6698314620658


try:<EOL><INDENT>if not self.rdkitmol:<EOL><INDENT>return charge_from_formula(self.formula)<EOL><DEDENT>else:<EOL><INDENT>return Chem.GetFormalCharge(self.rdkitmol)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>return charge_from_formula(self.formula)<EOL><DEDENT>

r'''Charge of a chemical, computed with RDKit from a chemical's SMILES.
        If RDKit is not available, holds None.

        Examples
        --------
        >>> Chemical('sodium ion').charge
        1


return self.ViscosityGas(self.T, self.P)<EOL>

r'''Viscosity of the chemical in the gas phase at its current
        temperature and pressure, in units of [Pa*s].

        For calculation of this property at other temperatures and pressures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface
        :obj:`thermo.viscosity.ViscosityGas`; each Chemical instance
        creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('water', T=320, P=100).mug
        1.0431450856297212e-05


return property_molar_to_mass(self.Um, self.MW) if (self.Um is not None) else None<EOL>

r'''Internal energy of the chemical at its current temperature and
        pressure, in units of [J/kg].

        This property requires that :obj:`thermo.chemical.set_thermo` ran
        successfully to be accurate.
        It also depends on the molar volume of the chemical at its current
        conditions.


return phase_select_property(phase=self.phase, s=self.Cps, l=self.Cpl, g=self.Cpg)<EOL>

r'''Mass heat capacity of the chemical at its current phase and
        temperature, in units of [J/kg/K].

        Utilizes the object oriented interfaces
        :obj:`thermo.heat_capacity.HeatCapacitySolid`,
        :obj:`thermo.heat_capacity.HeatCapacityLiquid`,
        and :obj:`thermo.heat_capacity.HeatCapacityGas` to perform the
        actual calculation of each property. Note that those interfaces provide
        output in molar units (J/mol/K).

        Examples
        --------
        >>> w = Chemical('water')
        >>> w.Cp, w.phase
        (4180.597021827336, 'l')
        >>> Chemical('palladium').Cp
        234.26767209171211


return self.Hm - self.P*self.Vm if (self.Vm and self.Hm is not None) else None<EOL>

r'''Internal energy of the chemical at its current temperature and
        pressure, in units of [J/mol].

        This property requires that :obj:`thermo.chemical.set_thermo` ran
        successfully to be accurate.
        It also depends on the molar volume of the chemical at its current
        conditions.


return self.HeatCapacityGas(self.T)<EOL>

r'''Gas-phase ideal gas heat capacity of the chemical at its current
        temperature, in units of [J/mol/K]. For calculation of this property at
        other temperatures, or specifying manually the method used to calculate
        it, and more - see the object oriented interface
        :obj:`thermo.heat_capacity.HeatCapacityGas`; each Chemical instance
        creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('water').Cpgm
        33.583577868850675
        >>> Chemical('water').HeatCapacityGas.T_dependent_property(320)
        33.67865044005934
        >>> Chemical('water').HeatCapacityGas.T_dependent_property_integral(300, 320)
        672.6480417835064


return self.ThermalConductivityGas(self.T, self.P)<EOL>

r'''Thermal conductivity of the chemical in the gas phase at its
        current temperature and pressure, in units of [W/m/K].

        For calculation of this property at other temperatures and pressures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface
        :obj:`thermo.thermal_conductivity.ThermalConductivityGas`; each
        Chemical instance creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('water', T=320).kg
        0.021273128263091207


if self.__economic_status:<EOL><INDENT>return self.__economic_status<EOL><DEDENT>else:<EOL><INDENT>self.__economic_status = economic_status(self.CAS, Method='<STR_LIT>')<EOL>return self.__economic_status<EOL><DEDENT>

r'''Dictionary of economic status indicators for the chemical.

        Examples
        --------
        >>> pprint(Chemical('benzene').economic_status)
        ["US public: {'Manufactured': 6165232.1, 'Imported': 463146.474, 'Exported': 271908.252}",
         u'1,000,000 - 10,000,000 tonnes per annum',
         u'Intermediate Use Only',
         'OECD HPV Chemicals']


Cpgm = self.HeatCapacityGas(self.T)<EOL>if Cpgm:<EOL><INDENT>return Cpgm - R<EOL><DEDENT>return None<EOL>

r'''Gas-phase ideal-gas contant-volume heat capacity of the chemical at
        its current temperature, in units of [J/mol/K]. Subtracts R from
        the ideal-gas heat capacity; does not include pressure-compensation
        from an equation of state.

        Examples
        --------
        >>> w = Chemical('water', T=520)
        >>> w.Cvgm
        27.13366316134193


Vml, Psat = self.Vml, self.Psat<EOL>if Vml and Psat:<EOL><INDENT>return exp(Vml*(self.P-Psat)/R/self.T)<EOL><DEDENT>return None<EOL>

r'''Poynting correction factor [dimensionless] for use in phase
        equilibria methods based on activity coefficients or other reference
        states. Performs the shortcut calculation assuming molar volume is
        independent of pressure.

        .. math::
            \text{Poy} =  \exp\left[\frac{V_l (P-P^{sat})}{RT}\right]

        The full calculation normally returns values very close to the
        approximate ones. This property is defined in terms of
        pure components only.

        Examples
        --------
        >>> Chemical('pentane', T=300, P=1E7).Poynting
        1.5743051250679803

        Notes
        -----
        The full equation shown below can be used as follows:

        .. math::
            \text{Poy} = \exp\left[\frac{\int_{P_i^{sat}}^P V_i^l dP}{RT}\right]

        >>> from scipy.integrate import quad
        >>> c = Chemical('pentane', T=300, P=1E7)
        >>> exp(quad(lambda P : c.VolumeLiquid(c.T, P), c.Psat, c.P)[0]/R/c.T)
        1.5821826990975127


Vml = self.Vml<EOL>if Vml:<EOL><INDENT>return Z(self.T, self.P, Vml)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the chemical in the liquid phase at the
        current temperature and pressure, [dimensionless].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeLiquid` to perform the actual calculation of
        molar volume.

        Examples
        --------
        >>> Chemical('water').Zl
        0.0007385375470263454


if self.__legal_status:<EOL><INDENT>return self.__legal_status<EOL><DEDENT>else:<EOL><INDENT>self.__legal_status = legal_status(self.CAS, Method='<STR_LIT>')<EOL>return self.__legal_status<EOL><DEDENT>

r'''Dictionary of legal status indicators for the chemical.

        Examples
        --------
        >>> pprint(Chemical('benzene').legal_status)
        {'DSL': 'LISTED',
         'EINECS': 'LISTED',
         'NLP': 'UNLISTED',
         'SPIN': 'LISTED',
         'TSCA': 'LISTED'}


if self.__mass_fractions:<EOL><INDENT>return self.__mass_fractions<EOL><DEDENT>else:<EOL><INDENT>self.__mass_fractions =  mass_fractions(self.atoms, self.MW)<EOL>return self.__mass_fractions<EOL><DEDENT>

r'''Dictionary of atom:mass-weighted fractional occurence of elements.
        Useful when performing mass balances. For atom-fraction occurences, see
        :obj:`atom_fractions`.

        Examples
        --------
        >>> Chemical('water').mass_fractions
        {'H': 0.11189834407236524, 'O': 0.8881016559276347}


return self.HeatCapacityLiquid(self.T)<EOL>

r'''Liquid-phase heat capacity of the chemical at its current temperature,
        in units of [J/mol/K]. For calculation of this property at other
        temperatures, or specifying manually the method used to calculate it,
        and more - see the object oriented interface
        :obj:`thermo.heat_capacity.HeatCapacityLiquid`; each Chemical instance
        creates one to actually perform the calculations.

        Notes
        -----
        Some methods give heat capacity along the saturation line, some at
        1 atm but only up to the normal boiling point, and some give heat
        capacity at 1 atm up to the normal boiling point and then along the
        saturation line. Real-liquid heat capacity is pressure dependent, but
        this interface is not.

        Examples
        --------
        >>> Chemical('water').Cplm
        75.31462591538556
        >>> Chemical('water').HeatCapacityLiquid.T_dependent_property(320)
        75.2591744360631
        >>> Chemical('water').HeatCapacityLiquid.T_dependent_property_integral(300, 320)
        1505.0619005000553


Vms = self.Vms<EOL>if Vms:<EOL><INDENT>return Z(self.T, self.P, Vms)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the chemical in the solid phase at the
        current temperature and pressure, [dimensionless].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeSolid` to perform the actual calculation of
        molar volume.

        Examples
        --------
        >>> Chemical('palladium').Z
        0.00036248477437931853


return phase_select_property(phase=self.phase, l=self.alphal, g=self.alphag)<EOL>

r'''Thermal diffusivity of the chemical at its current temperature,
        pressure, and phase in units of [m^2/s].

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Examples
        --------
        >>> Chemical('furfural').alpha
        8.696537158635412e-08


return self.ThermalConductivityLiquid(self.T, self.P)<EOL>

r'''Thermal conductivity of the chemical in the liquid phase at its
        current temperature and pressure, in units of [W/m/K].

        For calculation of this property at other temperatures and pressures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface
        :obj:`thermo.thermal_conductivity.ThermalConductivityLiquid`; each
        Chemical instance creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('water', T=320).kl
        0.6369957248212118


Vmg = self.Vmg<EOL>if Vmg:<EOL><INDENT>return Z(self.T, self.P, Vmg)<EOL><DEDENT>return None<EOL>

r'''Compressibility factor of the chemical in the gas phase at the
        current temperature and pressure, [dimensionless].

        Utilizes the object oriented interface and
        :obj:`thermo.volume.VolumeGas` to perform the actual calculation of
        molar volume.

        Examples
        --------
        >>> Chemical('sulfur hexafluoride', T=700, P=1E9).Zg
        11.140084184207813


if self.__rdkitmol_Hs:<EOL><INDENT>return self.__rdkitmol_Hs<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>self.__rdkitmol_Hs = Chem.AddHs(self.rdkitmol)<EOL>return self.__rdkitmol_Hs<EOL><DEDENT>except:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>

r'''RDKit object of the chemical, with hydrogen. If RDKit is not
        available, holds None.

        For examples of what can be done with RDKit, see
        `their website <http://www.rdkit.org/docs/GettingStartedInPython.html>`_.


Vms = self.Vms<EOL>if Vms:<EOL><INDENT>return Vm_to_rho(Vms, self.MW)<EOL><DEDENT>return None<EOL>

r'''Solid-phase mass density of the chemical at its current temperature,
        in units of [kg/m^3]. For calculation of this property at
        other temperatures, or specifying manually the method used
        to calculate it, and more - see the object oriented interface
        :obj:`thermo.volume.VolumeSolid`; each Chemical instance
        creates one to actually perform the calculations. Note that that
        interface provides output in molar units.

        Examples
        --------
        >>> Chemical('iron').rhos
        7869.999999999994


if self.__atom_fractions:<EOL><INDENT>return self.__atom_fractions<EOL><DEDENT>else:<EOL><INDENT>self.__atom_fractions = atom_fractions(self.atoms)<EOL>return self.__atom_fractions<EOL><DEDENT>

r'''Dictionary of atom:fractional occurence of the elements in a
        chemical. Useful when performing element balances. For mass-fraction
        occurences, see :obj:`mass_fractions`.

        Examples
        --------
        >>> Chemical('Ammonium aluminium sulfate').atom_fractions
        {'H': 0.25, 'S': 0.125, 'Al': 0.0625, 'O': 0.5, 'N': 0.0625}


return self.Permittivity(self.T)<EOL>

r'''Relative permittivity (dielectric constant) of the chemical at its
        current temperature, [dimensionless].

        For calculation of this property at other temperatures,
        or specifying manually the method used to calculate it, and more - see
        the object oriented interface :obj:`thermo.permittivity.Permittivity`;
        each Chemical instance creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('toluene', T=250).permittivity
        2.49775625


mug, rhog = self.mug, self.rhog<EOL>if all([mug, rhog]):<EOL><INDENT>return nu_mu_converter(mu=mug, rho=rhog)<EOL><DEDENT>return None<EOL>

r'''Kinematic viscosity of the gas phase of the chemical at its
        current temperature and pressure, in units of [m^2/s].

        .. math::
            \nu = \frac{\mu}{\rho}

        Utilizes the temperature and pressure dependent object oriented
        interfaces :obj:`thermo.volume.VolumeGas`,
        :obj:`thermo.viscosity.ViscosityGas`  to calculate the
        actual properties.

        Examples
        --------
        >>> Chemical('methane', T=115).nug
        2.5056924327995865e-06


Vmg = self.VolumeGas(T=<NUM_LIT>, P=<NUM_LIT>)<EOL>if Vmg:<EOL><INDENT>rho = Vm_to_rho(Vmg, self.MW)<EOL>return SG(rho, rho_ref=<NUM_LIT>) <EOL><DEDENT>return None<EOL>

r'''Specific gravity of the gas phase of the chemical, [dimensionless].
        The reference condition is air at 15.6 °C (60 °F) and 1 atm
        (rho=1.223 kg/m^3). The definition for gases uses the compressibility
        factor of the reference gas and the chemical both at the reference
        conditions, not the conditions of the chemical.

        Examples
        --------
        >>> Chemical('argon').SGg
        1.3795835970877504


if self.UNIFAC_Q:<EOL><INDENT>return Van_der_Waals_area(self.UNIFAC_Q)<EOL><DEDENT>return None<EOL>

r'''Unnormalized Van der Waals area, in units of [m^2/mol].

        Examples
        --------
        >>> Chemical('hexane').Van_der_Waals_area
        964000.0


rhos = self.rhos<EOL>if rhos is not None:<EOL><INDENT>return SG(rhos)<EOL><DEDENT>return None<EOL>

r'''Specific gravity of the solid phase of the chemical at the
        specified temperature and pressure, [dimensionless].
        The reference condition is water at 4 °C and 1 atm
        (rho=999.017 kg/m^3). The SG varries with temperature and pressure
        but only very slightly.

        Examples
        --------
        >>> Chemical('iron').SGs
        7.87774317235069


Vmg = self.Vmg<EOL>if Vmg:<EOL><INDENT>return Vm_to_rho(Vmg, self.MW)<EOL><DEDENT>return None<EOL>

r'''Gas-phase mass density of the chemical at its current temperature
        and pressure, in units of [kg/m^3]. For calculation of this property at
        other temperatures or pressures, or specifying manually the method used
        to calculate it, and more - see the object oriented interface
        :obj:`thermo.volume.VolumeGas`; each Chemical instance
        creates one to actually perform the calculations. Note that that
        interface provides output in molar units.

        Examples
        --------
        Estimate the density of the core of the sun, at 15 million K and
        26.5 PetaPascals, assuming pure helium (actually 68% helium):

        >>> Chemical('helium', T=15E6, P=26.5E15).rhog
        8329.27226509739

        Compared to a result on
        `Wikipedia <https://en.wikipedia.org/wiki/Solar_core>`_ of 150000
        kg/m^3, the fundamental equation of state performs poorly.

        >>> He = Chemical('helium', T=15E6, P=26.5E15)
        >>> He.VolumeGas.set_user_methods_P(['IDEAL']); He.rhog
        850477.8065477367

        The ideal-gas law performs somewhat better, but vastly overshoots
        the density prediction.


return phase_select_property(phase=self.phase, s=self.rhos, l=self.rhol, g=self.rhog)<EOL>

r'''Mass density of the chemical at its current phase and
        temperature and pressure, in units of [kg/m^3].

        Utilizes the object oriented interfaces
        :obj:`thermo.volume.VolumeSolid`,
        :obj:`thermo.volume.VolumeLiquid`,
        and :obj:`thermo.volume.VolumeGas` to perform the
        actual calculation of each property. Note that those interfaces provide
        output in units of m^3/mol.

        Examples
        --------
        >>> Chemical('decane', T=550, P=2E6).rho
        498.67008448640604


return self.VolumeSolid(self.T)<EOL>

r'''Solid-phase molar volume of the chemical at its current
        temperature, in units of [m^3/mol]. For calculation of this property at
        other temperatures, or specifying manually the method used to calculate
        it, and more - see the object oriented interface
        :obj:`thermo.volume.VolumeSolid`; each Chemical instance
        creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('iron').Vms
        7.09593392630242e-06


if self.UNIFAC_groups:<EOL><INDENT>return UNIFAC_RQ(self.UNIFAC_groups)[<NUM_LIT:1>]<EOL><DEDENT>return None<EOL>

r'''UNIFAC `Q` (normalized Van der Waals area), dimensionless.
        Used in the UNIFAC model.

        Examples
        --------
        >>> Chemical('decane').UNIFAC_Q
        6.016


if self.__rdkitmol:<EOL><INDENT>return self.__rdkitmol<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>self.__rdkitmol = Chem.MolFromSmiles(self.smiles)<EOL>return self.__rdkitmol<EOL><DEDENT>except:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>

r'''RDKit object of the chemical, without hydrogen. If RDKit is not
        available, holds None.

        For examples of what can be done with RDKit, see
        `their website <http://www.rdkit.org/docs/GettingStartedInPython.html>`_.


return self.Um - self.T*self.Sm if (self.Um is not None and self.Sm is not None) else None<EOL>

r'''Helmholtz energy of the chemical at its current temperature and
        pressure, in units of [J/mol].

        This property requires that :obj:`thermo.chemical.set_thermo` ran
        successfully to be accurate.
        It also depends on the molar volume of the chemical at its current
        conditions.


return phase_select_property(phase=self.phase, l=self.mul, g=self.mug)<EOL>

r'''Viscosity of the chemical at its current phase, temperature, and
        pressure in units of [Pa*s].

        Utilizes the object oriented interfaces
        :obj:`thermo.viscosity.ViscosityLiquid` and
        :obj:`thermo.viscosity.ViscosityGas` to perform the
        actual calculation of each property.

        Examples
        --------
        >>> Chemical('ethanol', T=300).mu
        0.001044526538460911
        >>> Chemical('ethanol', T=400).mu
        1.1853097849748217e-05


sigma, rhol, rhog = self.sigma, self.rhol, self.rhog<EOL>if all((sigma, rhol, rhog, self.MW)):<EOL><INDENT>return Parachor(sigma=sigma, MW=self.MW, rhol=rhol, rhog=rhog)<EOL><DEDENT>return None<EOL>

r'''Parachor of the chemical at its
        current temperature and pressure, in units of [N^0.25*m^2.75/mol].

        .. math::
            P = \frac{\sigma^{0.25} MW}{\rho_L - \rho_V}

        Calculated based on surface tension, density of the liquid and gas
        phase, and molecular weight. For uses of this property, see
        :obj:`thermo.utils.Parachor`.

        Examples
        --------
        >>> Chemical('octane').Parachor
        6.291693072841486e-05


return phase_select_property(phase=self.phase, l=self.JTl, g=self.JTg)<EOL>

r'''Joule Thomson coefficient of the chemical at its
        current phase and temperature, in units of [K/Pa].

        .. math::
            \mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}
            \left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]
            = \frac{V}{C_p}\left(\beta T-1\right)

        Examples
        --------
        >>> Chemical('water').JT
        -2.2150394958666407e-07


Vml = self.Vml<EOL>if Vml:<EOL><INDENT>return Vm_to_rho(Vml, self.MW)<EOL><DEDENT>return None<EOL>

r'''Liquid-phase mass density of the chemical at its current
        temperature and pressure, in units of [kg/m^3]. For calculation of this
        property at other temperatures and pressures, or specifying manually
        the method used to calculate it, and more - see the object oriented
        interface :obj:`thermo.volume.VolumeLiquid`; each Chemical instance
        creates one to actually perform the calculations. Note that that
        interface provides output in molar units.

        Examples
        --------
        >>> Chemical('o-xylene', T=297).rhol
        876.9946785618097


kg, rhog, Cpg = self.kg, self.rhog, self.Cpg<EOL>if all([kg, rhog, Cpg]):<EOL><INDENT>return thermal_diffusivity(k=kg, rho=rhog, Cp=Cpg)<EOL><DEDENT>return None<EOL>

r'''Thermal diffusivity of the gas phase of the chemical at its
        current temperature and pressure, in units of [m^2/s].

        .. math::
            \alpha = \frac{k}{\rho Cp}

        Utilizes the temperature and pressure dependent object oriented
        interfaces :obj:`thermo.volume.VolumeGas`,
        :obj:`thermo.thermal_conductivity.ThermalConductivityGas`,
        and :obj:`thermo.heat_capacity.HeatCapacityGas` to calculate the
        actual properties.

        Examples
        --------
        >>> Chemical('ammonia').alphag
        1.6931865425158556e-05


return self.VolumeGas(self.T, self.P)<EOL>

r'''Gas-phase molar volume of the chemical at its current
        temperature and pressure, in units of [m^3/mol]. For calculation of this
        property at other temperatures or pressures, or specifying manually the
        method used to calculate it, and more - see the object oriented interface
        :obj:`thermo.volume.VolumeGas`; each Chemical instance
        creates one to actually perform the calculations.

        Examples
        --------
        Estimate the molar volume of the core of the sun, at 15 million K and
        26.5 PetaPascals, assuming pure helium (actually 68% helium):

        >>> Chemical('helium', T=15E6, P=26.5E15).Vmg
        4.805464238181197e-07


Cp, Cv = self.Cpg, self.Cvg<EOL>if all((Cp, Cv)):<EOL><INDENT>return isentropic_exponent(Cp, Cv)<EOL><DEDENT>return None<EOL>

r'''Gas-phase ideal-gas isentropic exponent of the chemical at its
        current temperature, [dimensionless]. Does not include
        pressure-compensation from an equation of state.

        Examples
        --------
        >>> Chemical('hydrogen').isentropic_exponent
        1.405237786321222


return phase_select_property(phase=self.phase, l=self.nul, g=self.nug)<EOL>

r'''Kinematic viscosity of the the chemical at its current temperature,
        pressure, and phase in units of [m^2/s].

        .. math::
            \nu = \frac{\mu}{\rho}

        Examples
        --------
        >>> Chemical('argon').nu
        1.3846930410865003e-05


return self.HeatCapacitySolid(self.T)<EOL>

r'''Solid-phase heat capacity of the chemical at its current temperature,
        in units of [J/mol/K]. For calculation of this property at other
        temperatures, or specifying manually the method used to calculate it,
        and more - see the object oriented interface
        :obj:`thermo.heat_capacity.HeatCapacitySolid`; each Chemical instance
        creates one to actually perform the calculations.

        Examples
        --------
        >>> Chemical('palladium').Cpsm
        24.930765664000003
        >>> Chemical('palladium').HeatCapacitySolid.T_dependent_property(320)
        25.098979200000002
        >>> Chemical('palladium').HeatCapacitySolid.all_methods
        set(["Perry's Table 2-151", 'CRC Standard Thermodynamic Properties of Chemical Substances', 'Lastovka, Fulem, Becerra and Shaw (2008)'])


result = []<EOL>for child in account.accounts:<EOL><INDENT>self._get_account_and_descendants_(child, result)<EOL><DEDENT>return result<EOL>

Retrieves an account's descendants from the general ledger structure
given the account name.

:param account_name: The account name.

:returns: The decendants of the account.


def _get_account_and_descendants_(self, account, result):

result.append(account)<EOL>for child in account.accounts:<EOL><INDENT>self._get_account_and_descendants_(child, result)<EOL><DEDENT>

Returns the account and all of it's sub accounts.

:param account: The account.
:param result: The list to add all the accounts to.


self._parent_path = value<EOL>self.path = value + r'<STR_LIT:/>' + self.name<EOL>self._update_childrens_parent_path()<EOL>

Set the parent path and the path from the new parent path.

:param value: The path to the object's parent


def report(self, format=ReportFormat.printout, output_path=None):

rpt = GlsRpt(self, output_path)<EOL>return rpt.render(format)<EOL>

Returns a report of this class.

:param format: The format of the report.
:param output_path: The path to the file the report is written to.
  If None, then the report is not written to a file.

:returns: The descendants of the account.


def create_transaction(self, name, description=None,<EOL>tx_date=datetime.min.date(),<EOL>dt_account=None, cr_account=None,<EOL>source=None, amount=<NUM_LIT>):

new_tx = Transaction(name, description, tx_date,<EOL>dt_account, cr_account, source, amount)<EOL>self.transactions.append(new_tx)<EOL>return new_tx<EOL>

Create a transaction in the general ledger.

:param name: The transaction's name.
:param description: The transaction's description.
:param tx_date: The date of the transaction.
:param cr_account: The transaction's credit account's name.
:param dt_account: The transaction's debit account's name.
:param source: The name of source the transaction originated from.
:param amount: The transaction amount.

:returns: The created transaction.


def _create_account_(self, name, number, account_type):

new_acc = GeneralLedgerAccount(name, None, number, account_type)<EOL>self.accounts.append(new_acc)<EOL>return new_acc<EOL>

Create an account in the general ledger structure.

:param name: The account name.
:param number: The account number.
:param account_type: The account type.

:returns: The created account.


for name in names:<EOL><INDENT>if self.get_account(name) is None:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(name))<EOL><DEDENT><DEDENT>

Validates whether the accounts in a list of account names exists.

:param names: The names of the accounts.

:returns: The descendants of the account.


if r'<STR_LIT:/>' in account_name:<EOL><INDENT>accs_in_path = account_name.split(r'<STR_LIT:/>', <NUM_LIT:1>)<EOL>curr_acc = self[accs_in_path[<NUM_LIT:0>]]<EOL>if curr_acc is None:<EOL><INDENT>return None<EOL><DEDENT>return curr_acc.get_child_account(accs_in_path[<NUM_LIT:1>])<EOL>pass<EOL><DEDENT>else:<EOL><INDENT>return self[account_name]<EOL><DEDENT>

Retrieves a child account.
This could be a descendant nested at any level.

:param account_name: The name of the account to retrieve.

:returns: The child account, if found, else None.


rpt = IncomeStatement(self, start, end, component_path, output_path)<EOL>return rpt.render(format)<EOL>

Generate a transaction list report.

:param start: The start date to generate the report for.
:param end: The end date to generate the report for.
:param format: The format of the report.
:param component_path: The path of the component to filter the report's
  transactions by.
:param output_path: The path to the file the report is written to.
  If None, then the report is not written to a file.

:returns: The generated report.


return self._HHV<EOL>

Get the higher heating value of the stream.

:returns: MJ/kg coal, higher heating value


<EOL>if type(other) is MaterialPackage:<EOL><INDENT>if self.material == other.material:  <EOL><INDENT>result = MaterialPackage(self.material,<EOL>self._compound_masses +<EOL>other._compound_masses)<EOL>result.H = self._H + other._H<EOL>result.P = self.P<EOL>return result<EOL><DEDENT>else:  <EOL><INDENT>H = self.H + other.H<EOL>result = self.clone()<EOL>for compound in other.material.compounds:<EOL><INDENT>if compound not in self.material.compounds:<EOL><INDENT>raise Exception("<STR_LIT>" + other.material.name +<EOL>"<STR_LIT>" +<EOL>self.material.name +<EOL>"<STR_LIT>" + compound +<EOL>"<STR_LIT>" +<EOL>self.material.name + "<STR_LIT>")<EOL><DEDENT>result = result + (compound,<EOL>other.get_compound_mass(compound))<EOL><DEDENT>result.H = H<EOL>return result<EOL><DEDENT><DEDENT>elif self._is_compound_mass_tuple(other):<EOL><INDENT>compound = other[<NUM_LIT:0>]<EOL>index = self.material.get_compound_index(compound)<EOL>mass = other[<NUM_LIT:1>]<EOL>enthalpy = thermo.H(compound, self._T, mass)<EOL>result = self.clone()<EOL>result._compound_masses[index] = result._compound_masses[index] +mass<EOL>result._H += enthalpy<EOL>result._P = self._P<EOL>return result<EOL><DEDENT>elif self._is_compound_mass_temperature_tuple(other):<EOL><INDENT>compound = other[<NUM_LIT:0>]<EOL>index = self.material.get_compound_index(compound)<EOL>mass = other[<NUM_LIT:1>]<EOL>temperature = other[<NUM_LIT:2>]<EOL>enthalpy = thermo.H(compound, temperature, mass)<EOL>result = self * <NUM_LIT:1.0><EOL>result._compound_masses[index] = result._compound_masses[index] +mass<EOL>result.H = self._H + enthalpy<EOL>result._P = self._P<EOL>return result<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

Addition operator (+).

Add this package (self) and 'other' together, return the result as a
new package, and leave self unchanged.

:param other: Can can be one of the following:
         1. MaterialPackage
            'other' is added to self to create a new package.
         2. tuple: (compound, mass)
            The specified mass of the specified compound is added to \
            self, assuming the added material has the same \
            temperature as self.
         3. tuple: (compound, mass, temperature)
            The specified mass of the specified compound at the \
            specified temperature is added to self.

:returns: A new Material package that is the sum of self and 'other'.


if compound in self.material.compounds:<EOL><INDENT>return self._compound_mfrs[<EOL>self.material.get_compound_index(compound)]<EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:0.0><EOL><DEDENT>

Determine the mass flow rate of the specified compound in the stream.

:param compound: Formula and phase of a compound, e.g. "Fe2O3[S1]".

:returns: Mass flow rate. [kg/h]


index = self.material.get_compound_index(compound)<EOL>return stoich.amount(compound, self._compound_mfrs[index])<EOL>

Determine the amount flow rate of the specified compound.

:returns: Amount flow rate. [kmol/h]


return self._P<EOL>

Determine the pressure of the package.

        :returns: Pressure. [atm]


self._Hfr = Hfr<EOL>self._T = self._calculate_T(Hfr)<EOL>

Set the enthalpy flow rate of the stream to the specified value, and
recalculate it's temperature.

:param H: The new enthalpy flow rate value. [kWh/h]


if not type(value) is tuple:<EOL><INDENT>return False<EOL><DEDENT>elif not len(value) == <NUM_LIT:3>:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:0>]) is str:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float andnot type(value[<NUM_LIT:1>]) is numpy.float64 andnot type(value[<NUM_LIT:1>]) is numpy.float32:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float andnot type(value[<NUM_LIT:1>]) is numpy.float64 andnot type(value[<NUM_LIT:1>]) is numpy.float32:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>

Determines whether value is a tuple of the format
        (compound(str), mfr(float), temperature(float)).

        :param value: The value to be tested.

        :returns: True or False


return self._compound_mfrs.sum()<EOL>

Get the mass flow rate of the stream.

:returns: Mass flow rate. [kg/h]


<EOL>if type(other) is float ortype(other) is numpy.float64 ortype(other) is numpy.float32:<EOL><INDENT>return self._extract_mfr(other)<EOL><DEDENT>elif self._is_compound_mfr_tuple(other):<EOL><INDENT>return self._extract_compound_mfr(other[<NUM_LIT:0>], other[<NUM_LIT:1>])<EOL><DEDENT>elif type(other) is str:<EOL><INDENT>return self._extract_compound(other)<EOL><DEDENT>elif type(other) is Material:<EOL><INDENT>return self._extract_material(other)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

Extract 'other' from this stream, modifying this stream and returning
the extracted material as a new stream.

:param other: Can be one of the following:

  * float: A mass flow rate equal to other is extracted from self. Self
    is reduced by other and the extracted stream is returned as
    a new stream.
  * tuple (compound, mass): The other tuple specifies the mass flow
    rate of a compound to be extracted. It is extracted from self and
    the extracted mass flow rate is returned as a new stream.
  * string: The 'other' string specifies the compound to be
    extracted. All of the mass flow rate of that compound will be
    removed from self and a new stream created with it.
  * Material: The 'other' material specifies the list of
    compounds to extract.

:returns: New MaterialStream object.


<EOL>if type(other) is float ortype(other) is numpy.float64 ortype(other) is numpy.float32:<EOL><INDENT>return self._extract_mass(other)<EOL><DEDENT>elif self._is_compound_mass_tuple(other):<EOL><INDENT>return self._extract_compound_mass(other[<NUM_LIT:0>], other[<NUM_LIT:1>])<EOL><DEDENT>elif type(other) is str:<EOL><INDENT>return self._extract_compound(other)<EOL><DEDENT>elif type(other) is Material:<EOL><INDENT>return self._extract_material(other)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

Extract 'other' from this package, modifying this package and
returning the extracted material as a new package.

:param other: Can be one of the following:

  * float: A mass equal to other is extracted from self. Self is
    reduced by other and the extracted package is returned as
    a new package.
  * tuple (compound, mass): The other tuple specifies the mass
    of a compound to be extracted. It is extracted from self and
    the extracted mass is returned as a new package.
  * string: The 'other' string specifies the compound to be
    extracted. All of the mass of that compound will be removed
    from self and a new package created with it.
  * Material: The 'other' material specifies the list of
    compounds to extract.

:returns: New MaterialPackage object.


m_C = <NUM_LIT:0>  <EOL>m_H = <NUM_LIT:0>  <EOL>m_O = <NUM_LIT:0>  <EOL>m_N = <NUM_LIT:0>  <EOL>m_S = <NUM_LIT:0>  <EOL>T = <NUM_LIT>  <EOL>Hin = <NUM_LIT:0.0>  <EOL>for compound in self.material.compounds:<EOL><INDENT>index = self.material.get_compound_index(compound)<EOL>if stoich.element_mass_fraction(compound, '<STR_LIT:C>') == <NUM_LIT:1.0>:<EOL><INDENT>m_C += self._compound_masses[index]<EOL>Hin = thermo.H(compound, T, self._compound_masses[index])<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:H>') == <NUM_LIT:1.0>:<EOL><INDENT>m_H += self._compound_masses[index]<EOL>Hin = thermo.H(compound, T, self._compound_masses[index])<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:O>') == <NUM_LIT:1.0>:<EOL><INDENT>m_O += self._compound_masses[index]<EOL>Hin = thermo.H(compound, T, self._compound_masses[index])<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:N>') == <NUM_LIT:1.0>:<EOL><INDENT>m_N += self._compound_masses[index]<EOL>Hin = thermo.H(compound, T, self._compound_masses[index])<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:S>') == <NUM_LIT:1.0>:<EOL><INDENT>m_S += self._compound_masses[index]<EOL>Hin = thermo.H(compound, T, self._compound_masses[index])<EOL><DEDENT><DEDENT>m_total = m_C + m_H + m_O + m_N + m_S  <EOL>Hout = <NUM_LIT:0.0>  <EOL>Hout += thermo.H('<STR_LIT>', T, cc(m_C, '<STR_LIT:C>', '<STR_LIT>', '<STR_LIT:C>'))<EOL>Hout += thermo.H('<STR_LIT>', T, cc(m_H, '<STR_LIT:H>', '<STR_LIT>', '<STR_LIT:H>'))<EOL>Hout += thermo.H('<STR_LIT>', T, m_O)<EOL>Hout += thermo.H('<STR_LIT>', T, m_N)<EOL>Hout += thermo.H('<STR_LIT>', T, cc(m_S, '<STR_LIT:S>', '<STR_LIT>', '<STR_LIT:S>'))<EOL>if self.HHV is None:<EOL><INDENT>HHV = Hout - Hin / m_total  <EOL><DEDENT>else:<EOL><INDENT>HHV = self.HHV / <NUM_LIT>  <EOL><DEDENT>return HHV + Hout / m_total<EOL>

Calculate the enthalpy of formation of the package at the specified temperature, in
case the material is coal.

:returns: [kWh/kg] enthalpy of formation of daf coal


if elements is None:<EOL><INDENT>elements = self.material.elements<EOL><DEDENT>result = numpy.zeros(len(elements))<EOL>for compound in self.material.compounds:<EOL><INDENT>result += self.get_compound_mfr(compound) *stoich.element_mass_fractions(compound, elements)<EOL><DEDENT>return result<EOL>

Determine the mass flow rates of elements in the stream.

:returns: Array of element mass flow rates. [kg/h]


return self._T<EOL>

Get the temperature of the stream.

:returns: Temperature. [°C]


if elements is None:<EOL><INDENT>elements = self.material.elements<EOL><DEDENT>result = numpy.zeros(len(elements))<EOL>for compound in self.material.compounds:<EOL><INDENT>result += self.get_compound_mass(compound) *numpy.array(stoich.element_mass_fractions(compound, elements))<EOL><DEDENT>return result<EOL>

Determine the masses of elements in the package.

:returns: Array of element masses. [kg]


result = self._compound_mfrs * <NUM_LIT:1.0><EOL>for compound in self.material.compounds:<EOL><INDENT>index = self.material.get_compound_index(compound)<EOL>result[index] = stoich.amount(compound, result[index])<EOL><DEDENT>return result<EOL>

Determine the amount flow rates of all the compounds.

:returns: List of amount flow rates. [kmol/h]


<EOL>if type(scalar) is float or type(scalar) is numpy.float64 ortype(scalar) is numpy.float32:<EOL><INDENT>if scalar < <NUM_LIT:0.0>:<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>result = MaterialPackage(self.material, self._compound_masses *<EOL>scalar, self._P, self._T)<EOL>return result<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

The multiplication operator (*).

Create a new package by multiplying self with scalar.

:param scalar: The result is a new package with its content equal to
  self multiplied by a scalar, leaving self unchanged.

:returns: New MaterialPackage object.


result = numpy.zeros(<NUM_LIT:1>)<EOL>for compound in self.material.compounds:<EOL><INDENT>result += self.get_compound_mass(compound) *numpy.array(stoich.element_mass_fractions(compound, [element]))<EOL><DEDENT>return result[<NUM_LIT:0>]<EOL>

Determine the mass of the specified elements in the package.

:returns: Masses. [kg]


self._HHV = HHV  <EOL>if self.isCoal:<EOL><INDENT>self._DH298 = self._calculate_DH298_coal()<EOL><DEDENT>

Set the higher heating value of the stream to the specified value, and
recalculate the formation enthalpy of the daf coal.

:param HHV: MJ/kg coal, higher heating value


m_C = <NUM_LIT:0>  <EOL>m_H = <NUM_LIT:0>  <EOL>m_O = <NUM_LIT:0>  <EOL>m_N = <NUM_LIT:0>  <EOL>m_S = <NUM_LIT:0>  <EOL>H = <NUM_LIT:0.0>  <EOL>for compound in self.material.compounds:<EOL><INDENT>index = self.material.get_compound_index(compound)<EOL>if stoich.element_mass_fraction(compound, '<STR_LIT:C>') == <NUM_LIT:1.0>:<EOL><INDENT>m_C += self._compound_masses[index]<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:H>') == <NUM_LIT:1.0>:<EOL><INDENT>m_H += self._compound_masses[index]<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:O>') == <NUM_LIT:1.0>:<EOL><INDENT>m_O += self._compound_masses[index]<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:N>') == <NUM_LIT:1.0>:<EOL><INDENT>m_N += self._compound_masses[index]<EOL><DEDENT>elif stoich.element_mass_fraction(compound, '<STR_LIT:S>') == <NUM_LIT:1.0>:<EOL><INDENT>m_S += self._compound_masses[index]<EOL><DEDENT>else:<EOL><INDENT>dH = thermo.H(compound, T, self._compound_masses[index])<EOL>H += dH<EOL><DEDENT><DEDENT>m_total = y_C + y_H + y_O + y_N + y_S  <EOL>y_C = m_C / m_total<EOL>y_H = m_H / m_total<EOL>y_O = m_O / m_total<EOL>y_N = m_N / m_total<EOL>y_S = m_S / m_total<EOL>hmodel = coals.DafHTy()<EOL>H = hmodel.calculate(T=T+<NUM_LIT>, y_C=y_C, y_H=y_H, y_O=y_O, y_N=y_N,<EOL>y_S=y_S) / <NUM_LIT>  <EOL>H298 = hmodel.calculate(T=<NUM_LIT>, y_C=y_C, y_H=y_H, y_O=y_O, y_N=y_N,<EOL>y_S=y_S) / <NUM_LIT>  <EOL>Hdaf = H - H298 + self._DH298  <EOL>Hdaf *= m_total  <EOL>H += Hdaf<EOL>return H<EOL>

Calculate the enthalpy of the package at the specified temperature, in
case the material is coal.

:param T: [°C] temperature

:returns: [kWh] enthalpy


result = list()<EOL>for line in lines:<EOL><INDENT>line = line.strip()<EOL>line = line.replace("<STR_LIT:\t>", "<STR_LIT:U+0020>")<EOL>while line.find("<STR_LIT:U+0020>") > -<NUM_LIT:1>:<EOL><INDENT>line = line.replace("<STR_LIT:U+0020>", "<STR_LIT:U+0020>")<EOL><DEDENT>result.append(line)<EOL><DEDENT>return result<EOL>

Prepare the lines read from the text file before starting to
process it.

:param lines: The lines to prepare.


<EOL>x = list()<EOL>x.append(self._T)<EOL>x.append(self._T + <NUM_LIT>)<EOL>y = list()<EOL>y.append(self._calculate_H(x[<NUM_LIT:0>]) - H)<EOL>y.append(self._calculate_H(x[<NUM_LIT:1>]) - H)<EOL>for i in range(<NUM_LIT:2>, <NUM_LIT:50>):<EOL><INDENT>x.append(x[i-<NUM_LIT:1>] - y[i-<NUM_LIT:1>]*((x[i-<NUM_LIT:1>] - x[i-<NUM_LIT:2>])/(y[i-<NUM_LIT:1>] - y[i-<NUM_LIT:2>])))<EOL>y.append(self._calculate_H(x[i]) - H)<EOL>if abs(y[i-<NUM_LIT:1>]) < <NUM_LIT>:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return x[len(x) - <NUM_LIT:1>]<EOL>

Calculate the temperature of the package given the specified
enthalpy using a secant algorithm.

:param H: Enthalpy. [kWh]

:returns: Temperature. [°C]


if not type(assay) is numpy.ndarray:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>elif not assay.shape == (self.compound_count,):<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>elif name in self.raw_assays.keys():<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>self.raw_assays[name] = assay<EOL>self.converted_assays[name] = assay<EOL>

Add an assay to the material.

:param name:  Assay name.
:param assay: Numpy array containing the compound mass fractions for
  the assay. The sequence of the assay's elements must correspond to
  the sequence of the material's compounds.


if self.isCoal:<EOL><INDENT>return self._calculate_Hfr_coal(T)<EOL><DEDENT>H = <NUM_LIT:0.0><EOL>for compound in self.material.compounds:<EOL><INDENT>index = self.material.get_compound_index(compound)<EOL>dH = thermo.H(compound, T, self._compound_masses[index])<EOL>H = H + dH<EOL><DEDENT>return H<EOL>

Calculate the enthalpy of the package at the specified temperature.

:param T: Temperature. [°C]

:returns: Enthalpy. [kWh]


return self._H<EOL>

Get the enthalpy of the package.

:returns: Enthalpy. [kWh]


self._P = P<EOL>

Set the pressure of the stream to the specified value.

        :param P: Pressure. [atm]


return self._compound_masses.sum()<EOL>

Get the mass of the package.

:returns: [kg]


return self._Hfr<EOL>

Get the enthalpy flow rate of the stream.

:returns: Enthalpy flow rate. [kWh/h]


return self._compound_masses / self._compound_masses.sum()<EOL>

Determine the assay of the package.

:returns: Array of mass fractions.


Determines whether value is a tuple of the format
        (compound(str), mass(float), temperature(float)).

        :param value: The value to be tested.

        :returns: True or False


self._compound_mfrs = self._compound_mfrs * <NUM_LIT:0.0><EOL>self._P = <NUM_LIT:1.0><EOL>self._T = <NUM_LIT><EOL>self._H = <NUM_LIT:0.0><EOL>

Set all the compound mass flow rates in the stream to zero.
Set the pressure to 1, the temperature to 25 and the enthalpy to zero.


result = copy.copy(self)<EOL>result._compound_mfrs = copy.deepcopy(self._compound_mfrs)<EOL>return result<EOL>

Create a complete copy of the stream.

        :returns: A new MaterialStream object.


return self._P<EOL>

Determine the pressure of the stream.

        :returns: Pressure. [atm]


if not type(value) is tuple:<EOL><INDENT>return False<EOL><DEDENT>elif not len(value) == <NUM_LIT:2>:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:0>]) is str:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float andnot type(value[<NUM_LIT:1>]) is numpy.float64 andnot type(value[<NUM_LIT:1>]) is numpy.float32:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>

Determines whether value is a tuple of the format
(compound(str), mfr(float)).

:param value: The value to be tested.

:returns: True or False


def create_package(self, assay=None, mass=<NUM_LIT:0.0>, P=<NUM_LIT:1.0>, T=<NUM_LIT>,<EOL>normalise=True):

if assay is None:<EOL><INDENT>return MaterialPackage(self, self.create_empty_assay(), P, T)<EOL><DEDENT>if normalise:<EOL><INDENT>assay_total = self.get_assay_total(assay)<EOL><DEDENT>else:<EOL><INDENT>assay_total = <NUM_LIT:1.0><EOL><DEDENT>return MaterialPackage(self, mass * self.converted_assays[assay] /<EOL>assay_total, P, T, self._isCoal(assay),<EOL>self._get_HHV(assay))<EOL>

Create a MaterialPackage based on the specified parameters.

:param assay:     Name of the assay to be used to create the package.
:param mass:      Package mass. [kg]
:param P:         Package pressure. [atm]
:param T:         Package temperature. [°C]
:param normalise: Indicates whether the assay must be normalised
  before creating the package.

:returns: MaterialPackage object.


return self.size_classes.index(size_class)<EOL>

Determine the index of the specified size class.

:param size_class: The formula and phase of the specified size class,
  e.g. 'Fe2O3[S1]'.

:returns: The index of the specified size class.


result = "<STR_LIT>" + self.name + "<STR_LIT>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT:20>)<EOL>assay_names = sorted(self.assays.keys())<EOL>for assay_name in assay_names:<EOL><INDENT>result = result + assay_name.ljust(<NUM_LIT:20>)<EOL><DEDENT>result = result + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT:20>)<EOL>assay_names = sorted(self.assays.keys())<EOL>for assay_name in assay_names:<EOL><INDENT>result = result + str(self.solid_densities[assay_name]).ljust(<NUM_LIT:20>)<EOL><DEDENT>result = result + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT:20>)<EOL>assay_names = sorted(self.assays.keys())<EOL>for assay_name in assay_names:<EOL><INDENT>result = result + str(self.H2O_fractions[assay_name]).ljust(<NUM_LIT:20>)<EOL><DEDENT>result = result + "<STR_LIT:\n>"<EOL>for size_class in self.size_classes:<EOL><INDENT>result = result + str(size_class).ljust(<NUM_LIT:20>)<EOL>compound_index = self.get_size_class_index(size_class)<EOL>for assay_name in assay_names:<EOL><INDENT>result = result + str(<EOL>self.assays[assay_name][compound_index]).ljust(<NUM_LIT:20>)<EOL><DEDENT>result = result + "<STR_LIT:\n>"<EOL><DEDENT>return result<EOL>


<EOL>if type(other) is MaterialPackage:<EOL><INDENT>solid_mass = self.get_solid_mass()<EOL>other_solid_mass = other.get_solid_mass()<EOL>solid_density = (solid_mass + other_solid_mass) /(solid_mass / self.solid_density +<EOL>other_solid_mass / other.solid_density)<EOL>H2O_mass = self.H2O_mass + other.H2O_mass<EOL>if self.material == other.material:<EOL><INDENT>result = MaterialPackage(<EOL>self.material,<EOL>solid_density,<EOL>H2O_mass,<EOL>self.size_class_masses + other.size_class_masses)<EOL>return result<EOL><DEDENT>else:  <EOL><INDENT>result = self.clone()<EOL>result.solid_density = solid_density<EOL>result.H2O_mass = H2O_mass<EOL>for size_class in other.material.size_classes:<EOL><INDENT>if size_class not in self.material.size_classes:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" + other.material.name +<EOL>"<STR_LIT>" +<EOL>self.material.name + "<STR_LIT>" +<EOL>size_class + "<STR_LIT>" +<EOL>self.material.name + "<STR_LIT>")<EOL><DEDENT>result = result + (<EOL>size_class, other.get_size_class_mass(size_class))<EOL><DEDENT>return result<EOL><DEDENT><DEDENT>elif self._is_H2O_mass_tuple(other):<EOL><INDENT>mass = other[<NUM_LIT:1>]<EOL>result = self.clone()<EOL>result.H2O_mass += mass<EOL>return result<EOL><DEDENT>elif self._is_size_class_mass_tuple(other):<EOL><INDENT>size_class = other[<NUM_LIT:0>]<EOL>compound_index = self.material.get_size_class_index(size_class)<EOL>mass = other[<NUM_LIT:1>]<EOL>result = self.clone()<EOL>result.size_class_masses[compound_index] =result.size_class_masses[compound_index] + mass<EOL>return result<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

Addition operator (+).
Add self and 'other' together, return the result as a new package,
and leave self unchanged.

:param other: Can can be one of the following:
  1. MaterialPackage: 'other' is added to self to create a new package.
  2. tuple: (size class, mass) The specified mass of the specified size
  class is added to self.

:returns: A new Material package that is the sum of self and 'other'.


return <NUM_LIT:1.0> - (self.H2O_mass / <NUM_LIT:1.0>) / self.get_volume()<EOL>

Determine the volume fraction of the solids of self.


self.solid_density = <NUM_LIT:1.0><EOL>self.H2O_mass = <NUM_LIT:0.0><EOL>self.size_class_masses = self.size_class_masses * <NUM_LIT:0.0><EOL>

Set all the size class masses and H20_mass in the package to zero
and the solid_density to 1.0


result = "<STR_LIT>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) + self.material.name + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) +str(self.get_mass_fraction_solids()) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) +str(self.get_volume_fraction_solids()) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) +str(self.solid_density) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) +str(self.get_density()) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) + str(self.get_mass()) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) + str(self.H2O_mass) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>".ljust(<NUM_LIT>) + str(self.get_volume()) + "<STR_LIT:\n>"<EOL>result = result + "<STR_LIT>"<EOL>for size_class in self.material.size_classes:<EOL><INDENT>index = self.material.get_size_class_index(size_class)<EOL>result = result + str(size_class).ljust(<NUM_LIT>) + str(<EOL>self.size_class_masses[index]) + "<STR_LIT:\n>"<EOL><DEDENT>return result<EOL>

Create a string representation of the object.


Prepare the lines read from the text file before starting to process
it.


return self.size_class_masses.sum() + self.H2O_mass<EOL>

Determine the mass of self.

:returns: [kg] The mass of self.


return self.H2O_mass / <NUM_LIT:1.0> + self.get_solid_mass() / self.solid_density<EOL>


if not type(value) is tuple:<EOL><INDENT>return False<EOL><DEDENT>elif not len(value) == <NUM_LIT:2>:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:0>]) is float:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float andnot type(value[<NUM_LIT:1>]) is numpy.float64 andnot type(value[<NUM_LIT:1>]) is numpy.float32:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>

Determines whether value is a tuple of the format
(size class(float), mass(float)).

:param value: The value to check.

:returns: Whether the value is a tuple in the required format.


if not type(value) is tuple:<EOL><INDENT>return False<EOL><DEDENT>elif not len(value) == <NUM_LIT:2>:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:0>]) is str and not value[<NUM_LIT:0>] == "<STR_LIT>":<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float andnot type(value[<NUM_LIT:1>]) is numpy.float64 andnot type(value[<NUM_LIT:1>]) is numpy.float32:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>


return self.get_mass() / self.get_volume()<EOL>


def add_assay(self, name, solid_density, H2O_fraction, assay):

if not type(solid_density) is float:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>self.solid_densities[name] = solid_density<EOL>if not type(H2O_fraction) is float:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>self.H2O_fractions[name] = H2O_fraction<EOL>if not type(assay) is numpy.ndarray:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>elif not assay.shape == (self.size_class_count,):<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>elif name in self.assays.keys():<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>")<EOL><DEDENT>self.assays[name] = assay<EOL>

Add an assay to the material.

        :param name: The name of the new assay.
        :param assay: A numpy array containing the size class mass fractions
          for the assay. The sequence of the assay's elements must correspond
          to the sequence of the material's size classes.


return self.size_class_masses[self.material.get_size_class_index(<EOL>size_class)]<EOL>

Determine the mass of the specified size class in self.

:param size_class: The formula and phase of the size class,
  e.g. 'Fe2O3[S1]'

:returns: [kg] The mass of the size class in self.


<EOL>if type(other) is MaterialPackage:<EOL><INDENT>if self.material == other.material:<EOL><INDENT>self.size_class_masses =self.size_class_masses + other.size_class_masses<EOL><DEDENT>else:  <EOL><INDENT>for size_class in other.material.size_classes:<EOL><INDENT>if size_class not in self.material.size_classes:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" + other.material.name +<EOL>"<STR_LIT>" +<EOL>self.material.name +<EOL>"<STR_LIT>" + size_class +<EOL>"<STR_LIT>" + self.material.name + "<STR_LIT>")<EOL><DEDENT>self.add_to(<EOL>(size_class, other.get_size_class_mass(size_class)))<EOL><DEDENT><DEDENT><DEDENT>elif self._is_size_class_mass_tuple(other):<EOL><INDENT>size_class = other[<NUM_LIT:0>]<EOL>compound_index = self.material.get_size_class_index(size_class)<EOL>mass = other[<NUM_LIT:1>]<EOL>self.size_class_masses[compound_index] =self.size_class_masses[compound_index] + mass<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>

Add another psd material package to this material package.

:param other: The other material package.


return self.size_class_masses / self.size_class_masses.sum()<EOL>

Determine the assay of self.

:returns: [mass fractions] An array containing the assay of self.


self.size_class_masses = self.size_class_masses * <NUM_LIT:0.0><EOL>

Set all the size class masses in the package to zero.


def create_package(self, assay=None, mass=<NUM_LIT:0.0>, normalise=True):

if assay is None:<EOL><INDENT>return MaterialPackage(self, self.create_empty_assay())<EOL><DEDENT>if normalise:<EOL><INDENT>assay_total = self.get_assay_total(assay)<EOL><DEDENT>else:<EOL><INDENT>assay_total = <NUM_LIT:1.0><EOL><DEDENT>return MaterialPackage(self, mass * self.assays[assay] / assay_total)<EOL>

Create a MaterialPackage based on the specified parameters.

:param assay: The name of the assay based on which the package must be
  created.
:param mass: [kg] The mass of the package.
:param normalise: Indicates whether the assay must be normalised before
  creating the package.

:returns: The created MaterialPackage.


result = list()<EOL>for line in lines:<EOL><INDENT>line = line.strip()<EOL>line = line.replace("<STR_LIT:\t>", "<STR_LIT:U+0020>")<EOL>while line.find("<STR_LIT:U+0020>") > -<NUM_LIT:1>:<EOL><INDENT>line = line.replace("<STR_LIT:U+0020>", "<STR_LIT:U+0020>")<EOL><DEDENT>result.append(line)<EOL><DEDENT>return result<EOL>


return self.size_class_masses.sum()<EOL>

Determine the mass of self.

returns: [kg] The mass of self.


raise NotImplementedError()<EOL>

Calculate the mu value given the material state.

:param **state: material state

:returns: float


raise NotImplementedError()<EOL>

Calculate the alpha value given the material state.

:param **state: material state

:returns: float


return self.mu(**state) / self.rho(**state)<EOL>

Calculate the nu value given the material state.

:param **state: material state

:returns: float


<EOL>if type(other) is MaterialPackage:<EOL><INDENT>if self.material == other.material:<EOL><INDENT>self.compound_masses += other.compound_masses<EOL><DEDENT>else:<EOL><INDENT>for compound in other.material.compounds:<EOL><INDENT>if compound not in self.material.compounds:<EOL><INDENT>raise Exception("<STR_LIT>" + other.material.name +<EOL>"<STR_LIT>" +<EOL>self.material.name +<EOL>"<STR_LIT>" + compound +<EOL>"<STR_LIT>" +<EOL>self.material.name + "<STR_LIT>")<EOL><DEDENT>self.add_to((compound, other.get_compound_mass(compound)))<EOL><DEDENT><DEDENT><DEDENT>elif self._is_compound_mass_tuple(other):<EOL><INDENT>compound = other[<NUM_LIT:0>]<EOL>compound_index = self.material.get_compound_index(compound)<EOL>mass = other[<NUM_LIT:1>]<EOL>self.compound_masses[compound_index] += mass<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>

Add another chem material package to this material package.

:param other: The other material package.


result = copy.copy(self)<EOL>result.compound_masses = copy.deepcopy(self.compound_masses)<EOL>return result<EOL>

Create a complete copy of self.

:returns: A MaterialPackage that is identical to self.


self.compound_masses *= <NUM_LIT:0.0><EOL>

Set all the compound masses in the package to zero.


if not type(value) is tuple:<EOL><INDENT>return False<EOL><DEDENT>elif not len(value) == <NUM_LIT:2>:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:0>]) is str:<EOL><INDENT>return False<EOL><DEDENT>elif not type(value[<NUM_LIT:1>]) is float:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>

Determines whether value is a tuple of the format (compound(str),
mass(float)).


return sum(self.assays[name])<EOL>

Calculate the total of the specified assay.

:param name: The name of the assay.

:returns: The total mass fraction of the specified assay.


<EOL>if type(other) is MaterialPackage:<EOL><INDENT>if self.material == other.material:<EOL><INDENT>result = MaterialPackage(<EOL>self.material,<EOL>self.compound_masses + other.compound_masses)<EOL>return result<EOL><DEDENT>else:  <EOL><INDENT>result = self.clone()<EOL>for compound in other.material.compounds:<EOL><INDENT>if compound not in self.material.compounds:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" + other.material.name +<EOL>"<STR_LIT>" +<EOL>self.material.name +<EOL>"<STR_LIT>" + compound +<EOL>"<STR_LIT>" + self.material.name + "<STR_LIT>")<EOL><DEDENT>result += (compound, other.get_compound_mass(compound))<EOL><DEDENT>return result<EOL><DEDENT><DEDENT>elif self._is_compound_mass_tuple(other):<EOL><INDENT>compound = other[<NUM_LIT:0>]<EOL>compound_index = self.material.get_compound_index(compound)<EOL>mass = other[<NUM_LIT:1>]<EOL>result = self.clone()<EOL>result.compound_masses[compound_index] += mass<EOL>return result<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>

Add self and 'other' together, return the result as a new package, and
leave self unchanged.

:param other: Can can be one of the following:
  1. MaterialPackage: 'other' is added to self to create a new package.
  2. tuple: (compound, mass): The specified mass of the specified
  compound is added to self.

:returns: A new Material package that is the sum of self and 'other'.


element_symbols = self.material.elements<EOL>element_masses = self.get_element_masses()<EOL>result = {}<EOL>for s, m in zip(element_symbols, element_masses):<EOL><INDENT>result[s] = m<EOL><DEDENT>return result<EOL>

Determine the masses of elements in the package and return as a
dictionary.

:returns: [kg] A dictionary of element symbols and masses.


<EOL>if type(scalar) is float:<EOL><INDENT>if scalar < <NUM_LIT:0.0>:<EOL><INDENT>raise Exception(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>result = MaterialPackage(<EOL>self.material, [c * scalar for c in self.compound_masses])<EOL>return result<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>

The multiplication operator (*).

Create a new package by multiplying self with scalar.

:param scalar: The result is a new package with its content equal to
  self multiplied by a scalar, leaving self unchanged.

:returns: A new MaterialPackage equal to self package multiplied by
  other.


result = [<NUM_LIT:0>]<EOL>for compound in self.material.compounds:<EOL><INDENT>c = self.get_compound_mass(compound)<EOL>f = [c * x for x in emf(compound, [element])]<EOL>result = [v+f[ix] for ix, v in enumerate(result)]<EOL><DEDENT>return result[<NUM_LIT:0>]<EOL>

Determine the masses of elements in the package.

:returns: [kg] An array of element masses. The sequence of the elements
  in the result corresponds with the sequence of elements in the
  element list of the material.


return sum(self.compound_masses)<EOL>

Get the mass of the package.

:returns: [kg]


if assay is None:<EOL><INDENT>return MaterialPackage(self, self.create_empty_assay())<EOL><DEDENT>if normalise:<EOL><INDENT>assay_total = self.get_assay_total(assay)<EOL><DEDENT>else:<EOL><INDENT>assay_total = <NUM_LIT:1.0><EOL><DEDENT>masses = [(mass * m) / assay_total for m in self.assays[assay]]<EOL>return MaterialPackage(self, masses)<EOL>


if not self._meet_execution_criteria(clock.timestep_ix):<EOL><INDENT>return<EOL><DEDENT>if self.description is None:<EOL><INDENT>tx_name = self.name<EOL><DEDENT>else:<EOL><INDENT>tx_name = self.description<EOL><DEDENT>if self._months_executed == <NUM_LIT:0>:<EOL><INDENT>generalLedger.create_transaction(<EOL>tx_name,<EOL>description='<STR_LIT>',<EOL>tx_date=clock.get_datetime(),<EOL>dt_account=self.bank_account,<EOL>cr_account=self.loan_account,<EOL>source=self.path,<EOL>amount=self.amount)<EOL><DEDENT>else:<EOL><INDENT>curr_interest_amount = (self._amount_left *<EOL>self.interest_rate) / <NUM_LIT><EOL>generalLedger.create_transaction(<EOL>tx_name,<EOL>description='<STR_LIT>',<EOL>tx_date=clock.get_datetime(),<EOL>dt_account=self.interest_account,<EOL>cr_account=self.loan_account,<EOL>source=self.path,<EOL>amount=curr_interest_amount)<EOL>generalLedger.create_transaction(<EOL>tx_name,<EOL>description='<STR_LIT>',<EOL>tx_date=clock.get_datetime(),<EOL>dt_account=self.loan_account,<EOL>cr_account=self.bank_account,<EOL>source=self.path,<EOL>amount=self._monthly_payment)<EOL>self._amount_left += curr_interest_amount - self._monthly_payment<EOL><DEDENT>self._months_executed += self.interval<EOL>

Execute the activity at the current clock cycle.

:param clock: The clock containing the current execution time and
  period information.
:param generalLedger: The general ledger into which to create the
  transactions.


if not self._meet_execution_criteria(clock.timestep_ix):<EOL><INDENT>return<EOL><DEDENT>generalLedger.create_transaction(<EOL>self.description if self.description is not None else self.name,<EOL>description='<STR_LIT>',<EOL>tx_date=clock.get_datetime(),<EOL>dt_account=self.dt_account,<EOL>cr_account=self.cr_account,<EOL>source=self.path,<EOL>amount=self.amount)<EOL>


def create_component(self, name, description=None):

new_comp = Component(name, self.gl, description=description)<EOL>new_comp.set_parent_path(self.path)<EOL>self.components.append(new_comp)<EOL>return new_comp<EOL>

Create a sub component in the business component.

:param name: The new component's name.
:param description: The new component's description.

:returns: The created component.


self._parent_path = value<EOL>self.path = value + r'<STR_LIT:/>' + self.name<EOL>self._update_childrens_parent_path()<EOL>

Set the parent path and the path from the new parent path.

:param value: The path to the object's parent


component_to_remove = None<EOL>for c in self.components:<EOL><INDENT>if c.name == name:<EOL><INDENT>component_to_remove = c<EOL><DEDENT><DEDENT>if component_to_remove is not None:<EOL><INDENT>self.components.remove(component_to_remove)<EOL><DEDENT>

Remove a sub component from the component.

:param name: The name of the component to remove.


return []<EOL>

Retrieve the general ledger accounts referenced in this instance.

:returns: The referenced accounts.


Set the parent path and the path from the new parent path.

:param value: The path to the object's parent.


entity_to_remove = None<EOL>for e in self.entities:<EOL><INDENT>if e.name == name:<EOL><INDENT>entity_to_remove = e<EOL><DEDENT><DEDENT>if entity_to_remove is not None:<EOL><INDENT>self.entities.remove(entity_to_remove)<EOL><DEDENT>

Remove an entity from the model.

:param name: The name of the entity to remove.


self.prepare_to_run()<EOL>for i in range(<NUM_LIT:0>, self.period_count):<EOL><INDENT>for e in self.entities:<EOL><INDENT>e.run(self.clock)<EOL><DEDENT>self.clock.tick()<EOL><DEDENT>


def create_entity(self, name, gl_structure, description=None):

new_entity = Entity(name, gl_structure, description=description)<EOL>self.entities.append(new_entity)<EOL>return new_entity<EOL>

Create an entity and add it to the model.

:param name: The entity name.
:param gl_structure: The entity's general ledger structure.
:param description: The entity description.

:returns: The created entity.


T = state['<STR_LIT:T>']<EOL>y = state['<STR_LIT:y>']<EOL>x = amount_fractions(y)<EOL>return super().calculate(T=T, x=x)<EOL>

Calculate dynamic viscosity at the specified temperature and
composition:

:param T: [K] temperature
:param y: [mass fraction] composition dictionary , e.g. \
{'SiO2': 0.25, 'CaO': 0.25, 'MgO': 0.25, 'FeO': 0.25}

:returns: [Pa.s] dynamic viscosity

The **state parameter contains the keyword argument(s) specified above\
that are used to describe the state of the material.


T = state['<STR_LIT:T>']<EOL>x = state['<STR_LIT:x>']<EOL>compounds_sio2 = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>compounds_cao = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>compounds_al2o3 = ['<STR_LIT>']<EOL>compounds_caf2 = ['<STR_LIT>']<EOL>compounds_na2o = ['<STR_LIT>', '<STR_LIT>']<EOL>compounds_all = (compounds_sio2 + compounds_cao + compounds_al2o3 +<EOL>compounds_caf2 + compounds_na2o)<EOL>if '<STR_LIT>' in x:<EOL><INDENT>x['<STR_LIT>'] = <NUM_LIT> * x['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in x:<EOL><INDENT>x['<STR_LIT>'] = <NUM_LIT> * x['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in x:<EOL><INDENT>x['<STR_LIT>'] = <NUM_LIT> * x['<STR_LIT>']<EOL><DEDENT>x_total = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_all])<EOL>x = {c: x.get(c, <NUM_LIT:0.0>)/x_total for c in compounds_all}<EOL>x1 = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_sio2])<EOL>x2 = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_cao])<EOL>x3 = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_al2o3])<EOL>x4 = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_caf2])<EOL>x5 = sum([x.get(c, <NUM_LIT:0.0>) for c in compounds_na2o])<EOL>A = exp(-<NUM_LIT> + <NUM_LIT>*x2 + <NUM_LIT>*x4 + <NUM_LIT>*x5 - <NUM_LIT>*x3)<EOL>B = <NUM_LIT> - <NUM_LIT>*x2 - <NUM_LIT>*x4 - <NUM_LIT>*x5 + <NUM_LIT>*x3<EOL>result = A*T*exp(B/T)  <EOL>return result / <NUM_LIT><EOL>

Calculate dynamic viscosity at the specified temperature and
composition:

:param T: [K] temperature
:param x: [mole fraction] composition dictionary , e.g. \
{'SiO2': 0.25, 'CaO': 0.25, 'MgO': 0.25, 'FeO': 0.25}

:returns: [Pa.s] dynamic viscosity

The **state parameter contains the keyword argument(s) specified above\
that are used to describe the state of the material.