Пример #1
0
def _get_cv(kelvin=1, gram=1, mol=1):

    Al = Substance.from_formula('Al', data={'DebyeT': 428*kelvin})
    Be = Substance.from_formula('Be', data={'DebyeT': 1440*kelvin})

    def einT(s):
        return 0.806*s.data['DebyeT']
    return {s.name: EinsteinSolid([einT(s), s.mass * gram/mol], substance=s) for s in (Al, Be)}
Пример #2
0
def test_as_per_substance_html_table():
    substances = OrderedDict([(k, Substance.from_formula(k)) for k in 'H OH'.split()])
    assert html(as_per_substance_html_table([2, 3], substances)).count('<tr>') == 3
    assert html(as_per_substance_html_table({'H': 2, 'OH': 3}, substances)).count('<tr>') == 3
Пример #3
0
# FutureLab
# Primer taller python

# Escribiendo fórmulas químicas
from chempy import Substance

ferricyanide = Substance.from_formula("Fe(CN)6-3")
ferricyanide.composition == {0: -3, 26: 1, 6: 6, 7: 6}
print(ferricyanide.unicode_name)

print("%.3f" % ferricyanide.mass)
Пример #4
0
def getMolarMass(formula, roundNumber):
    sub = Substance.from_formula(formula)
    mass = sub.molar_mass(u)
    mass = round(mass, roundNumber)
    return mass
Пример #5
0
DISSOCIATION_FACTORS = {
    "CO2": lambda H, eqc, cell_id: 1 + eqc["K_CO2"].data[cell_id] * (1 / H + eqc["K_HCO3"].data[cell_id] / (H ** 2)),
    "SO2": lambda H, eqc, cell_id: 1 + eqc["K_SO2"].data[cell_id] * (1 / H + eqc["K_HSO3"].data[cell_id] / (H ** 2)),
    "NH3": lambda H, eqc, cell_id: 1 + eqc["K_NH3"].data[cell_id] / K_H2O * H,
    "HNO3": lambda H, eqc, cell_id: 1 + eqc["K_HNO3"].data[cell_id] / H,
    "O3": lambda _, __, ___: 1,
    "H2O2": lambda _, __, ___: 1
}


class KineticConsts:
    def __init__(self, formulae):
        self.KINETIC_CONST = {
            "k0": KinConst(formulae, k=2.4e4 / si.s / M, dT=0 * dT_u, T_0=ROOM_TEMP),
            "k1": KinConst(formulae, k=3.5e5 / si.s / M, dT=-5530 * dT_u, T_0=ROOM_TEMP),
            "k2": KinConst(formulae, k=1.5e9 / si.s / M, dT=-5280 * dT_u, T_0=ROOM_TEMP),
            # Different unit due to a different pseudo-order of kinetics
            "k3": KinConst(formulae, k=7.45e9 / si.s / M / M, dT=-4430 * dT_u, T_0=ROOM_TEMP),
        }


SPECIFIC_GRAVITY = {
    compound: Substance.from_formula(compound).mass * si.gram / si.mole / Md
    for compound in {*GASEOUS_COMPOUNDS.values()}
}

for compounds in AQUEOUS_COMPOUNDS.values():
    for compound in compounds:
        SPECIFIC_GRAVITY[compound] = Substance.from_formula(compound).mass * si.gram / si.mole / Md
Пример #6
0
def test_Radioyltic__Reaction_html():
    rate = Radiolytic([2.1*u.per100eV])
    rxn = Reaction({}, {'H': 1}, rate)
    H = Substance.from_formula('H')
    html = rxn.html({'H': H}, with_param=True)
    assert html == ' &rarr; H&#59; %s' % str(rate)
Пример #7
0
def Mass(name= 'O'):
    #Mole Mass Calculated by chempy
    return Substance.from_formula(name).mass
Пример #8
0
def mol():
    elems = [
        'Ac', 'Ag', 'Al', 'Am', 'Ar', 'As', 'At', 'Au', 'B', 'Ba', 'Be', 'Bh',
        'Bi', 'Bk', 'Br', 'C', 'Ca', 'Cd', 'Ce', 'Cf', 'Cl', 'Cm', 'Co', 'Cr',
        'Cs', 'Cu', 'Ds', 'Db', 'Dy', 'Er', 'Es', 'Eu', 'F', 'Fe', 'Fm', 'Fr',
        'Ga', 'Gd', 'Ge', 'H', 'He', 'Hf', 'Hg', 'Ho', 'Hs', 'I', 'In', 'Ir',
        'K', 'Kr', 'La', 'Li', 'Lr', 'Lu', 'Md', 'Mg', 'Mn', 'Mo', 'Mt', 'N',
        'Na', 'Nb', 'Nd', 'Ne', 'Ni', 'No', 'Np', 'O', 'Os', 'P', 'Pa', 'Pb',
        'Pd', 'Pm', 'Po', 'Pr', 'Pt', 'Pu', 'Ra', 'Rb', 'Re', 'Rf', 'Rg', 'Rh',
        'Rn', 'Ru', 'S', 'Sb', 'Sc', 'Se', 'Sg', 'Si', 'Sm', 'Sn', 'Sr', 'Ta',
        'Tb', 'Tc', 'Te', 'Th', 'Ti', 'Tl', 'Tm', 'U', 'V', 'W', 'Xe', 'Y',
        'Yb', 'Zn', 'Zr', 'NaH2PO4 ', '    H2CO3 ', '    BaSO4 ', '    CaCO3 ',
        '    CaO ', '    H2SO3 ', '    H3PO4 ', '    NaPO3 ', '    SO3 ',
        '    Be(OH)2 ', '    BaO ', '    Na2SO3 ', '    SO2 ', '    Li2O ',
        '    Na2HPO4 ', '    H4As2O7 ', '    CaC2 ', '    Mg(OH)2 ',
        '    HAsO3 ', '    KHSO4 ', '    H3PO4 ', '    NaCl ', '    HAsO2 ',
        '    UO3 ', '    CdSO4 ', '    HIO3 ', '    Ca(HCO3)2 ', '    FeS ',
        '    (NH4)2SO4 ', '    Hg2CO3 ', '    CaSO4 ', '    BeF2 ', '    Mg ',
        '    SiO2 ', '    K2O ', '    C ', '    Ca(OH)2 ', '    N2O3 ',
        '    SiO2 ', '    BaO2 ', '    Na2Cr2O7 ', '    Ca(OH)2 ',
        '    Fe2O3 ', '    CO2 ', '    Na2O ', '    NH4NO3 ', '    N2O5 ',
        '    CaS ', '    Al(OH)3 ', '    (CuOH)2CO3 ', '    SrBr2 ',
        '    H2O2 ', '    Ca(ClO3)2 ', '    PCl5 ', '    Zn ', '    Al2O3 ',
        '    PCl5 ', '    Zn ', '    BeO ', '    N2 ', '    BeSO4 ',
        '    Cu(CN)2 ', '    SiC ', '    NH3 ', '    Fe2(C2O4)3 ', '    H2 ',
        '    K ', '    CO ', '    HNO2 ', '    O2 ', '    NaHCO3 ', '    CO2 ',
        '    Xe ', '    MnS ', '    CaC2 ', '    ClO2 ', '    CuSO4 ',
        '    NaOH ', '    Ca(OH)2 ', '    PbCrO4 ', '    HgO ', '    (CN)2 ',
        '    BaCO3 ', '    H3AsO4 ', '    CaO ', '    Zn(OH)2 ', '    HNO3 ',
        '    UF4 ', '    Mn2O3 ', '    MnO2 ', '    AlN ', '    Ca3(PO4)2 ',
        '    S ', '    N2 ', '    CaCO3 ', '    As2O3 ', '    Be(OH)2 ',
        '    NaOH ', '    MgNH4PO4 ', '    H3PO4 ', '    CaS ', '    Cu ',
        '    (NH4)2BeF4 ', '    Sn(OH)2 ', '    NH4VO3 ', '    H3AsO3 ',
        '    NaCl ', '    Fe(OH)3 ', '    As2O5 ', '    NaOH ', '    VO2Cl ',
        '    B2O3 ', '    CH4 ', '    SiH4 ', '    TiCl4 ', '    Pb(OH)2 ',
        '    Si ', '    Si ', '    CaS2 ', '    Na2SnO3 ', '    Na2S2 ',
        '    (NH4)2Cr2O7 ', '    HCl ', '    KClO3 ', '    Zn ', '    Na2CO3 ',
        '    Ca(OH)2 ', '    CaS ', '    Sn(OH)4 ', '    Na ',
        '    Ca3(PO4)2 ', '    FeCl3 ', '    H3PO3 ', '    AlCl3 ', '    KOH ',
        '    H2SO4 ', '    SiO2 ', '    CaCN2 ', '    HCl ', '    KClO3 ',
        '    P4 ', '    P4O10 ', '    Sb ', '    NH4Cl ', '    KBr ',
        '    AgNO3 ', '    Ca3(PO4)2 ', '    POCl3 ', '    C2H5OH ',
        '    UO2 ', '    Ag2S ', '    C ', '    PCl3 ', '    H3PO4 ',
        '    MnO2 ', '    Fe2O3 ', '    PCl5 ', '    FeO ', '    Ca(NO3)2 ',
        '    Fe ', '    Fe2O3 ', '    FeSO4 ', '    NH3 ', '    Al ',
        '    BaCl2 ', '    Fe2(SO4)3 ', '    Au2S3 ', '    Au ', '    NiS ',
        '    Al ', '    C2H5OH ', '    Na2O2 ', '    Fe2O3 ', '    Pb(NO3)2 ',
        '    Al2(SO4)3 ', '    Au2O3 ', '    Ca3(PO4)2 ', '    SiCl4 ',
        '    Ca ', '    FeCl3 ', '    Al2O3 ', '    NO ', '    Pb3O4 ',
        '    CuSO4 ', '    KO2 ', '    P4O6 ', '    P4O10 ', '    Al ',
        '    Fe ', '    H3PO4 ', '    MnO2 ', '    K2CO3 ', '    PCl5 ',
        '    P4O6 ', '    Al(OH)3 ', '    Fe2(SO4)3 ', '    Bi(NO3)3 ',
        '    V2O5 ', '    Cr(OH)3 ', '    Hg(OH)2 ', '    Fe ', '    Ca3P2 ',
        '    H2SO4 ', '    Al(NO3)3 ', '    K2MnO4 ', '    Na3AsO3 ',
        '    Mg3N2 ', '    Fe3O4 ', '    C2H2 ', '    (NH4)2Cr2O7 ',
        '    C3H8 ', '    As ', '    H3BO3 ', '    Al ', '    V2O5 ',
        '    H3BO3 ', '    Na2B4O7 ', '    Pb ', '    C2H3Cl ',
        '    CaHPO4.2H2O ', '    Ca3(PO4)2 ', '    Se ', '    Al ',
        '    K3AsO4 ', '    I2 ', '    Al ', '    FeS ', '    Ca3(PO4)2 ',
        '    FeC2O4⋅2H2O ', '    MgNH4AsO4.6H2O ', '    H2SO4 ', '    U3O8 ',
        '    (NH4)3AsS4 ', '    Pb3(VO4)2.PbCl2 ', '    NH3 ', '    Hg2CrO4 ',
        '    Al4C3 ', '    Ca10F2(PO4)6 ', '    Ca5F(PO4)3 ',
        '    UO2(NO3)2.6H2O ', '    S8 ', '    NH3 ', '    HClO4 ', '    Au ',
        '    CO2 ', '    V2O5 ', '    FeS2 ', '    Si2H3 ', '    P4 ',
        '    H2S ', '    C4H10 ', '    Ca3(PO4)2 ', '    C6H6 ', '    C10H16 ',
        '    C7H6O2 ', '    C7H16 ', '    C7H10N ', '    KNO3 ',
        '    K4Fe(CN)6 ', '    K3[Fe(SCN)6] ', '    K4[Fe(SCN)6] '
    ]
    values = []
    elem = choice(elems)

    for i in range(4):
        values.append(randint(1, 5))

    if len(elem) < 2 and values[0] != 1:
        e = elem + str(values[0])
    else:
        e = elem

    el = Substance.from_formula(f'{e}')  # simpler
    mm = el.molar_mass(u)

    return render_template('mol.html', values=values, elem=e, mm=mm)
Пример #9
0
 async def mass(self, ctx, *, substance: str):
     """Find the mass of an element or compound!
     It doesn't even have to exist!"""
     compound = Substance.from_formula(substance)
     mass = compound.molar_mass()
     await ctx.send(f'```py\nMolar mass of {compound.unicode_name}: {round(mass, 2)} g/mol```')
Пример #10
0
def Mass(name='O'):
    #Mole Mass Calculated by chempy
    return Substance.from_formula(name).mass
from chempy import Substance
from chempy import balance_stoichiometry
import sys
from pprint import pprint
from chempy import mass_fractions

print("PLEASE CAPITALIZE ELEMENTS RESPECTFULLY/CORRECTLY")

e1 = input('Reagent compound 1: ')
e2 = input('Reagent compound 2: ')
e3 = input('Product compound 1: ')
e4 = input('Product compound 2: ')

s1 = Substance.from_formula(e1)
s2 = Substance.from_formula(e2)
s3 = Substance.from_formula(e3)
s4 = Substance.from_formula(e4)

print(e1, "=", round(s1.molar_mass(), 3))
print(e2, "=", round(s2.molar_mass(), 3))
print(e3, "=", round(s3.molar_mass(), 3))
print(e4, "=", round(s4.molar_mass(), 3))

reac, prod = balance_stoichiometry({e1, e2}, {e3, e4})

pprint(reac)
pprint(prod)

for fractions in map(mass_fractions, [reac, prod]):
    pprint({k: '{0:.3g} wt%'.format(v * 100) for k, v in fractions.items()})
Пример #12
0
from chempy import balance_stoichiometry  # Main reaction in NASA's booster rockets:
from chempy import Substance
reac, prod = balance_stoichiometry({'NH4ClO4', 'Al'}, {'Al2O3', 'HCl', 'H2O', 'N2'})
from pprint import pprint
pprint(dict(reac))
# {'Al': 10, 'NH4ClO4': 6}
pprint(dict(prod))
# {'Al2O3': 5, 'H2O': 9, 'HCl': 6, 'N2': 3}
iron = Substance.from_formula('Fe')
x = Substance.from_formula("NH4ClO4")
print(x.mass)
Пример #13
0
def stoic():
    eq = '''NaH2PO4 -> NaPO3 + H2O
    H2CO3 -> H2O + CO2
    BaSO4 + H2SO4 -> Ba(HSO4)2
    CaCO3 -> CaO + CO2
    CaO + H2O -> Ca(OH)2
    H2SO3 -> H2O + SO2
    H3PO4 + Ca(OH)2 -> CaHPO4.2H2O
    NaPO3 + CuO -> NaCuPO4
    SO3 + H2O -> H2SO4
    Be(OH)2 -> BeO + H2O
    BaO + H2O -> Ba(OH)2
    Na2SO3 + S -> Na2S2O3
    SO2 + H2O -> H2SO3
    Li2O + H2O -> LiOH
    Na2HPO4 -> Na4P2O7 + H2O
    H4As2O7 -> As2O5 + H2O
    CaC2 + N2 -> CaCN2 + C
    Mg(OH)2 -> (MgOH)2O + H2O
    HAsO3 -> As2O5 + H2O
    KHSO4 -> K2S2O7 + H2O
    H3PO4 -> H4P2O7 + H2O
    NaCl + NH4HCO3 -> NaHCO3 + NH4Cl
    HAsO2 -> As2O3 + H2O
    UO3 + H2 -> UO2 + H2O
    CdSO4 + H2S -> CdS + H2SO4
    HIO3 -> I2O5 + H2O
    Ca(HCO3)2 -> CaCO3 + CO2 + H2O
    FeS + H2SO4 -> H2S + FeSO4
    (NH4)2SO4 + CaCO3 -> (NH4)2CO3 + CaSO4
    Hg2CO3 -> Hg + HgO + CO2
    CaSO4 -> CaS + O2
    BeF2 + Mg -> MgF2 + Be
    Mg + N2 -> Mg3N2
    SiO2 + Ca(OH)2 -> CaSiO3 + H2O
    K2O + H2O -> KOH
    C + H2O -> CO + H2
    Ca(OH)2 + CO2 -> Ca(HCO3)2
    N2O3 + H2O -> HNO2
    SiO2 + Na2CO3 -> Na2SiO3 + CO2
    BaO2 + H2SO4 -> BaSO4 + H2O2
    Na2Cr2O7 + S -> Cr2O3 + Na2SO4
    Ca(OH)2 + CO2 -> CaCO3 + H2O
    Fe2O3 + SiO2 -> Fe2Si2O7
    CO2 + NH3 + H2O -> NH4HCO3
    Na2O + H2O -> NaOH
    NH4NO3 -> N2O + H2O
    N2O5 + H2O -> HNO3
    CaS + H2O -> Ca(OH)2 + H2S
    Al(OH)3 + NaOH -> NaAlO2 + H2O
    (CuOH)2CO3 -> CuO + CO2 + H2O
    SrBr2 + (NH4)2CO3 -> SrCO3 + NH4Br
    H2O2 -> H2O + O2
    Ca(ClO3)2 -> CaCl2 + O2
    PCl5 + H2O -> POCl3 + HCl
    Zn + KOH -> K2ZnO2 + H2
    Al2O3 + Na2CO3 -> NaAlO2 + CO2
    PCl5 + KNO2 -> NOCl + POCl3 + KCl
    Zn + HCl -> ZnCl2 + H2
    BeO + C + Cl2 -> BeCl2 + CO
    N2 + O2 -> N2O
    BeSO4 + NH4OH -> Be(OH)2 + (NH4)2SO4
    Cu(CN)2 -> CuCN + C2N2
    SiC + Cl2 -> SiCl4 + C
    NH3 + O2 -> HNO3 + H2O
    Fe2(C2O4)3 -> FeC2O4 + CO2
    H2 + O2 -> H2O
    K + Br2 -> KBr
    CO + O2 -> CO2
    HNO2 + O2 -> HNO3
    O2 -> O3
    NaHCO3 -> Na2CO3 + CO2 + H2O
    CO2 + NH3 -> OC(NH2)2 + H2O
    Xe + F2 -> XeF6
    MnS + HCl -> H2S + MnCl2
    CaC2 + H2O -> C2H2 + Ca(OH)2
    ClO2 + H2O -> HClO2 + HClO3
    CuSO4 + KCN -> Cu(CN)2 + K2SO4
    NaOH + FeSO4 -> Na2SO4 + Fe(OH)2
    Ca(OH)2 + H3PO4 -> CaHPO4 + H2O
    PbCrO4 + HNO3 -> Pb(NO3)2 + H2CrO4
    HgO -> Hg + O2
    (CN)2 + NaOH -> NaCN + NaOCN + H2O
    BaCO3 + HNO3 -> Ba(NO3)2 + CO2 + H2O
    H3AsO4 -> As2O5 + H2O
    CaO + C -> CaC2 + CO
    Zn(OH)2 + NaOH -> Na2ZnO2 + H2O
    HNO3 + P2O5 -> N2O5 + HPO3
    UF4 + Mg -> MgF2 + U
    Mn2O3 + Al -> Al2O3 + Mn
    MnO2 + K2CO3 + KNO3 -> K2MnO4 + KNO2 + CO2
    AlN + H2O -> NH3 + Al(OH)3
    Ca3(PO4)2 + H2SO4 -> CaSO4 + Ca(H2PO4)2
    S + N2O -> SO2 + N2
    N2 + H2 -> NH3
    CaCO3 + HCl -> CaCl2 + H2O + CO2
    As2O3 + H2O -> H3AsO3
    Be(OH)2 + NH4HF2 -> (NH4)2BeF4 + H2O
    NaOH + Zn(NO3)2 -> NaNO3 + Zn(OH)2
    MgNH4PO4 -> Mg2P2O7 + NH3 + H2O
    H3PO4 + Ca(OH)2 -> Ca(H2PO4)2 + H2O
    CaS + H2O -> Ca(HS)2 + Ca(OH)2
    Cu + CO2 + O2 + H2O -> CuCO3.Cu(OH)2
    (NH4)2BeF4 -> BeF2 + NH3 + HF
    Sn(OH)2 + NaOH -> Na2SnO2 + H2O
    NH4VO3 -> V2O5 + NH3 + H2O
    H3AsO3 -> As2O3 + H2O
    NaCl + H2SO4 -> Na2SO4 + HCl
    Fe(OH)3 -> Fe2O3 + H2O
    As2O5 + H2O -> H3AsO4
    NaOH + Cl2 -> NaCl + NaClO + H2O
    VO2Cl + NH4OH -> NH4VO3 + NH4Cl + H2O
    B2O3 + H2O -> H3BO3
    CH4 + O2 -> CO2 +H2O
    SiH4 + O2 -> SiO2 + H2O
    TiCl4 + Mg -> MgCl2 + Ti
    Pb(OH)2 + NaOH -> Na2PbO2 + H2O
    Si + NaOH + H2O -> Na2SiO3 + H2
    Si + S8 -> Si2S4
    CaS2 + O2 -> CaS2O3
    Na2SnO3 + H2S -> SnS2 + NaOH + H2O
    Na2S2 + O2 -> Na2S2O3
    (NH4)2Cr2O7 -> Cr2O3 + N2 + H2O
    HCl + K2CO3 -> KCl + H2O + CO2
    KClO3 -> KCl + O2
    Zn + NaOH + H2O -> Na2Zn(OH)4 + H2
    Na2CO3 + HCl -> NaCl + H2O + CO2
    Ca(OH)2 + P4O10 + H2O -> Ca(H2PO4)2
    CaS + H2O + CO2 -> Ca(HCO3)2 + H2S
    Sn(OH)4 + NaOH -> Na2SnO3 + H2O
    Na + H2O -> NaOH + H2
    Ca3(PO4)2 + SiO2 -> CaSiO3 + P2O5
    FeCl3 + NH4OH -> Fe(OH)3 + NH4Cl
    H3PO3 -> H3PO4 + PH3
    AlCl3 + AgNO3 -> AgCl + Al(NO3)3
    KOH + AlCl3 -> KCl + Al(OH)3
    H2SO4 + NaHCO3 -> Na2SO4 + CO2 + H2O
    SiO2 + HF -> SiF4 + H2O
    CaCN2 + H2O -> CaCO3 + NH3
    HCl + HNO3 -> NOCl + Cl2 + H2O
    KClO3 -> KClO4 + KCl
    P4 + O2 -> P2O5
    P4O10 + HCl -> POCl3 + HPO3
    Sb + O2 -> Sb4O6
    NH4Cl + Ca(OH)2 -> CaCl2 + NH3 + H2O
    KBr + Al(ClO4)3 -> AlBr3 + KClO4
    AgNO3 + FeCl3 -> Fe(NO3)3 + AgCl
    Ca3(PO4)2 + H3PO4 -> Ca(H2PO4)2
    POCl3 + H2O -> H3PO4 + HCl
    C2H5OH + O2 -> CO + H2O
    UO2 + HF -> UF4 + H2O
    Ag2S + KCN -> KAg(CN)2 + K2S
    C + SiO2 + Cl2 -> SiCl4 + CO
    PCl3 + H2O -> H3PO3 + HCl
    H3PO4 + (NH4)2MoO4 + HNO3 -> (NH4)3PO4.12MoO3 + NH4NO3 + H2O
    MnO2 + HCl -> MnCl2 + H2O + Cl2
    Fe2O3 + C -> CO + Fe
    PCl5 + P2O5 -> POCl3
    FeO + H3PO4 -> Fe3(PO4)2 + H2O
    Ca(NO3)2 -> CaO + NO2 + O2
    Fe + O2 -> Fe2O3
    Fe2O3 + H2 -> Fe + H2O
    FeSO4 + K3[Fe(CN)6] -> Fe3[Fe(CN)6]2 + K2SO4
    NH3 + O2 -> HNO2 + H2O
    Al + O2 -> Al2O3
    BaCl2 + Al2(SO4)3 -> BaSO4 + AlCl3
    Fe2(SO4)3 + Ba(NO3)2 -> BaSO4 + Fe(NO3)3
    Au2S3 + H2 -> Au + H2S
    Au + HCl + HNO3 -> AuCl3 + NO + H2O
    NiS + O2 -> NiO + SO2
    Al + FeO -> Al2O3 + Fe
    C2H5OH + O2 -> CO2 + H2O
    Na2O2 + H2O -> NaOH + O2
    Fe2O3 + CO -> Fe + CO2
    Pb(NO3)2 -> PbO + NO2 + O2
    Al2(SO4)3 + Ca(OH)2 -> CaSO4 + Al(OH)3
    Au2O3 -> Au + O2
    Ca3(PO4)2 + H2SO4 -> CaSO4 + H3PO4
    SiCl4 + H2O -> H4SiO4 + HCl
    Ca + AlCl3 -> CaCl2 + Al
    FeCl3 + Ca(OH)2 -> CaCl2 + Fe(OH)3
    Al2O3 + C + N2 -> AlN + CO
    NO + NaOH -> NaNO2 + H2O + N2O
    Pb3O4 + HNO3 -> Pb(NO3)2 + PbO2 + H2O
    CuSO4 + KCN -> CuCN + K2SO4 + C2N2
    KO2 + CO2 -> K2CO3 + O2
    P4O6 -> P4 + P2O4
    P4O10 + H2O -> H3PO4
    Al + KOH + H2O -> KAlO2 + H2
    Fe + H2O + O2 -> Fe2O3.H2O
    H3PO4 + HCl -> PCl5 + H2O
    MnO2 + KOH + O2 -> K2MnO4 + H2O
    K2CO3 + C + N2 -> KCN + CO
    PCl5 + H2O -> H3PO4 + HCl
    P4O6 + H2O -> H3PO3
    Al(OH)3 + H2SO4 -> Al2(SO4)3 + H2O
    Fe2(SO4)3 + KOH -> K2SO4 + Fe(OH)3
    Bi(NO3)3 + H2S -> Bi2S3 + HNO3
    V2O5 + HCl -> VOCl3 + H2O
    Cr(OH)3 + H2SO4 -> Cr2(SO4)3 + H2O
    Hg(OH)2 + H3PO4 -> Hg3(PO4)2 + H2O
    Fe + H2O -> Fe3O4 + H2
    Ca3P2 + H2O -> Ca(OH)2 + PH3
    H2SO4 + Al(OH)3 -> Al2(SO4)3 + H2O
    Al(NO3)3 + Na2CO3 -> Al2(CO3)3 + NaNO3
    K2MnO4 + H2SO4 -> KMnO4 + MnO2 + K2SO4 + H2O
    Na3AsO3 + H2S -> As2S3 + NaOH
    Mg3N2 + H2O -> Mg(OH)2 + NH3
    Fe3O4 + H2 -> Fe + H2O
    C2H2 + O2 -> CO2 + H2O
    (NH4)2Cr2O7 -> NH3 + H2O + Cr2O3 + O2
    C3H8 + O2 -> CO2 + H2O
    As + NaOH -> Na3AsO3 + H2
    H3BO3 + Na2CO3 -> Na2B4O7 + CO2 + H2O
    Al + HCl -> AlCl3 + H2
    V2O5 + Ca -> CaO + V
    H3BO3 -> H4B6O11 + H2O
    Na2B4O7 + HCl + H2O -> NaCl + H3BO3
    Pb + Na + C2H5Cl -> Pb(C2H5)4 + NaCl
    C2H3Cl + O2 -> CO2 + H2O + HCl
    CaHPO4.2H2O + NaOH + H2O -> Na2HPO4.12H2O + Ca(OH)2
    Ca3(PO4)2 + SiO2 -> P4O10 + CaSiO3
    Se + NaOH -> Na2Se + Na2SeO3 + H2O
    Al + NaOH + H2O -> NaAl(OH)4 + H2
    K3AsO4 + H2S -> As2S5 + KOH + H2O
    I2 + HNO3 -> HIO3 + NO2 + H2
    Al + NH4ClO4 -> Al2O3 + AlCl3 + NO + H2O
    FeS + O2 -> Fe2O3 + SO2
    Ca3(PO4)2 + C -> Ca3P2 + CO
    FeC2O4⋅2H2O + H2C2O4 + H2O2 + K2C2O4 -> K3[Fe(C2O4)3]⋅3H2O
    MgNH4AsO4.6H2O -> Mg2As2O7 + NH3 + H2O
    H2SO4 + HI -> H2S + I2 + H2O
    U3O8 + HNO3 -> UO2(NO3)2 + NO2 + H2O
    (NH4)3AsS4 + HCl -> As2S5 + H2S + NH4Cl
    Pb3(VO4)2.PbCl2 + HCl -> VO2Cl + PbCl2 + H2O
    NH3 + O2 -> NO + H2O
    Hg2CrO4 -> Cr2O3 + Hg + O2
    Al4C3 + H2O -> CH4 + Al(OH)3
    Ca10F2(PO4)6 + H2SO4 -> Ca(H2PO4)2 + CaSO4 + HF
    Ca5F(PO4)3 + H2SO4 -> Ca(H2PO4)2 + CaSO4 + HF
    UO2(NO3)2.6H2O -> UO3 + NO2 + O2 + H2O
    S8 + O2 -> SO3
    NH3 + NO -> N2 + H2O
    HClO4 + P4O10 -> H3PO4 + Cl2O7
    Au + KCN + O2 + H2O -> K[Au(CN)2] + KOH
    CO2 + H2O -> C6H12O6 + O2
    V2O5 + Al -> Al2O3 + V
    FeS2 + O2 -> Fe2O3 + SO2
    Si2H3 + O2 -> SiO2 + H2O
    P4 + H2O -> H3PO4 + H2
    H2S + Cl2 -> S8 + HCl
    C4H10 + O2 -> CO2 + H2O
    Ca3(PO4)2 + SiO2 + C -> CaSiO3 + P4 + CO
    C6H6 + O2 -> CO2 + H2O
    C10H16 + Cl2 -> C + HCl
    C7H6O2 + O2 -> CO2 + H2O
    C7H16 + O2 -> CO2 + H2O
    C7H10N + O2 -> CO2 + H2O + NO2
    KNO3 + C12H22O11 -> N2 + CO2 + H2O + K2CO3
    K4Fe(CN)6 + KMnO4 + H2SO4 -> KHSO4 + Fe2(SO4)3 + MnSO4 + HNO3 + CO2 + H2O
    K3[Fe(SCN)6] + Na2Cr2O7 + H2SO4 -> Fe(NO3)3 + Cr2(SO4)3 + CO2 + H2O + Na2SO4 + KNO3
    K4[Fe(SCN)6] + K2Cr2O7 + H2SO4 -> Fe2(SO4)3 + Cr2(SO4)3 + CO2 + H2O + K2SO4 + KNO3'''.split(
        '\n')

    q = choice(eq)
    e = q.split('->')
    r = e[0].split('+')
    p = e[1].split('+')
    mass = randint(1, 100)
    reac, prod = balance_stoichiometry(set(r), set(p))
    reacs = list(dict(reac).keys())
    reacVals = list(dict(reac).values())

    prods = list(dict(prod).keys())
    prodVals = list(dict(prod).values())

    try:
        mm0 = Substance.from_formula(str(reacs[0])).molar_mass(u)
        mm1 = Substance.from_formula(str(reacs[1])).molar_mass(u)
        ans = ((((mass / mm0) * reacVals[1]) / reacVals[0]) * mm1) * u.g
    except:
        return redirect(url_for('stoic'))

    return render_template('stoic.html',
                           equation=q,
                           reac=reacs,
                           reacVals=reacVals,
                           prod=prods,
                           prodVal=prodVals,
                           mass=mass,
                           mm0=mm0,
                           mm1=mm1,
                           ans=ans)
Пример #14
0
"""
default values for constants which can be altered by providing alternative
values in a constants dictionary passed to Formulae __init__ method
"""
import numpy as np
from scipy import constants as sci
from chempy import Substance
from .constants import si, M, PI_4_3, ONE_THIRD, THREE, T0, TWO_THIRDS, PI  # pylint: disable=unused-import

Md = (0.78 * Substance.from_formula('N2').mass * si.gram / si.mole +
      0.21 * Substance.from_formula('O2').mass * si.gram / si.mole +
      0.01 * Substance.from_formula('Ar').mass * si.gram / si.mole)
Mv = Substance.from_formula('H2O').mass * si.gram / si.mole

R_str = sci.R * si.joule / si.kelvin / si.mole
N_A = sci.N_A / si.mole

eps = Mv / Md
Rd = R_str / Md
Rv = R_str / Mv

D0 = 2.26e-5 * si.metre**2 / si.second
D_exp = 1.81

K0 = 2.4e-2 * si.joules / si.metres / si.seconds / si.kelvins

# mass and heat accommodation coefficients
MAC = 1.
HAC = 1.

p1000 = 1000 * si.hectopascals
Пример #15
0
    def __init__(self,
                 dt: float,
                 n_sd: int,
                 n_substep: int,
                 spectral_sampling: spec_sampling.
                 SpectralSampling = spec_sampling.Logarithmic):
        self.formulae = Formulae(
            saturation_vapour_pressure='AugustRocheMagnus')

        self.DRY_RHO = 1800 * si.kg / (si.m**3)
        self.dry_molar_mass = Substance.from_formula(
            "NH4HSO4").mass * si.gram / si.mole

        self.system_type = 'closed'

        self.t_max = (2400 + 196) * si.s
        self.output_interval = 10 * si.s
        self.dt = dt

        self.w = .5 * si.m / si.s
        self.g = 10 * si.m / si.s**2

        self.n_sd = n_sd
        self.n_substep = n_substep

        self.p0 = 950 * si.mbar
        self.T0 = 285.2 * si.K
        pv0 = .95 * self.formulae.saturation_vapour_pressure.pvs_Celsius(
            self.T0 - const.T0)
        self.q0 = const.eps * pv0 / (self.p0 - pv0)
        self.kappa = .61

        self.cloud_radius_range = (.5 * si.micrometre, 25 * si.micrometre)

        self.mass_of_dry_air = 44

        # note: rho is not specified in the paper
        rho0 = 1

        self.r_dry, self.n_in_dv = spectral_sampling(
            spectrum=spectra.Lognormal(norm_factor=566 / si.cm**3 / rho0 *
                                       self.mass_of_dry_air,
                                       m_mode=.08 * si.um / 2,
                                       s_geom=2)).sample(n_sd)

        self.ENVIRONMENT_MOLE_FRACTIONS = {
            "SO2": 0.2 * const.ppb,
            "O3": 50 * const.ppb,
            "H2O2": 0.5 * const.ppb,
            "CO2": 360 * const.ppm,
            "HNO3": 0.1 * const.ppb,
            "NH3": 0.1 * const.ppb,
        }

        self.starting_amounts = {
            "moles_" + k:
            self.formulae.trivia.volume(self.r_dry) * self.DRY_RHO /
            self.dry_molar_mass if k in ("N_mIII",
                                         "S_VI") else np.zeros(self.n_sd)
            for k in AQUEOUS_COMPOUNDS.keys()
        }

        self.dry_radius_bins_edges = np.logspace(
            np.log10(.01 * si.um), np.log10(1 * si.um), 51, endpoint=True) / 2
Пример #16
0
def test_Radioyltic__Reaction_html():
    rate = Radiolytic([2.1 * u.per100eV])
    rxn = Reaction({}, {'H': 1}, rate)
    H = Substance.from_formula('H')
    html = rxn.html({'H': H}, with_param=True)
    assert html == ' &rarr; H&#59; %s' % str(rate)
Пример #17
0
# FutureLab
# Primer taller de Python

# Propiedades físicas de compuestos para su uso en química analítica
from chempy import Substance
from chempy.properties.water_density_tanaka_2001 import water_density as rho
from chempy.units import to_unitless, default_units as u

water = Substance.from_formula('H2O')

for T_C in (10, 15, 17):
    concentration_H2O = rho(T=(273.15 + T_C) * u.kelvin,
                            units=u) / water.molar_mass(units=u)
    print('[H2O] = %.2f M (at %d °C)' %
          (to_unitless(concentration_H2O, u.molar), T_C))