Esempio n. 1
0
def test_Reaction():
    a = Molecule("a", -1)
    b = Molecule("b", -2)
    r = Reaction([a], [b])

    assert r.reactants == [a]
    assert r.products == [b]
    assert r.energy == -1
    assert str(r) == "a -> b"
Esempio n. 2
0
def test_EReaction():
    a = Molecule("a", -1)
    b = Molecule("b", -2)
    r = EReaction([a], [b], ne=1, ref_pot=1)

    assert r.reactants == [a]
    assert r.products == [b]
    assert r.energy == -2
    assert str(r) == "a -> b + !1.00!"
Esempio n. 3
0
def path2():
    refp = 5

    b = Molecule("b", 0)
    c = Molecule("c", 2)
    d = Molecule("d", -1)
    e = Molecule("e", 3)
    f = Molecule("f", 0.5)

    r2 = Reaction([b], [c])
    r3 = Reaction([c], [d, e])
    r4 = EReaction([e], [f], ne=1, ref_pot=refp)

    return Path([r2, r3, r4], "2", step_sizes=[2, -1, 3])
Esempio n. 4
0
def path1():
    refp = 5

    a = Molecule("a", 1)
    b = Molecule("b", 0)
    c = Molecule("c", 2)
    d = Molecule("d", -1)
    e = Molecule("e", 3)
    f = Molecule("f", 0.5)

    r1 = Reaction([a], [b])
    r2 = Reaction([b], [c])
    r3 = Reaction([c], [d, e])
    r4 = EReaction([e], [f], ne=1, ref_pot=refp)

    return Path([r1, r2, r3, r4], "1")
Esempio n. 5
0
def web():
    refp = 5
    a = Molecule("a", 1)
    b = Molecule("b", 0)
    c = Molecule("c", 2)
    d = Molecule("d", -1)
    e = Molecule("e", 3)
    f = Molecule("f", 0.5)
    r1 = Reaction([a], [b])
    r2 = Reaction([b], [c])
    r3 = Reaction([c], [d, e])
    r4 = EReaction([e], [f], ne=1, ref_pot=refp)
    path1 = Path([r1, r2, r3, r4], "P1")
    path2 = Path([r2, r3, r4], "P2")
    path3 = Path([r2, r3, r4], "", step_sizes=[2, -1, 3])

    return Web([path1, path2, path3])
Esempio n. 6
0
def test_init():
    a = Molecule("a", -1)
    assert a.name == "a"
    assert a.energy == -1
    assert str(a) == "<a -1.0000>"
    assert repr(a) == "<a -1.0000>"
Esempio n. 7
0
import matplotlib.pyplot as plt

from reaction_web import EReaction, Molecule, Path, Reaction, Web, plot

proton = Molecule("H+", 1, 1)
H = Molecule("H", 0, 2)
H2 = Molecule("H2", -1, 1)
O = Molecule("O", 0, 3)
H2O = Molecule("H2O", -2, 1)

print(f"""\
Proton        : {proton}
Hydrogen atom : {H}
Hydrogen mol  : {H2}
""")

# H+ + e- -> H (potential of -1.5)
r1 = EReaction([proton], [H], ne=1, ref_pot=-1.5)
# H + H -> H2
r2 = Reaction([H] * 2, [H2])
# H2 + O -> H2O
r3 = Reaction([H2, O], [H2O])
print(f"""\
Reaction 1: {r1}
Reaction 2: {r2}
Reaction 3: {r3}
""")

# Water production
# H + H -> H2
# H2 + O -> H2O