-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh2_production.py
75 lines (67 loc) · 1.1 KB
/
h2_production.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import matplotlib.pyplot as plt
from reaction_web import EReaction, Molecule, Path, Reaction, Web, diagram, heatmap
proton = Molecule("H+", 1)
H = Molecule("H", 0)
H2 = Molecule("H2", -1)
O = Molecule("O", 0) # noqa: E741
H2O = Molecule("H2O", -2)
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
p1 = Path([r2, r3], "Water Production")
print(
f"""\
Path 1:
{p1}
Energies: {p1.energies}
"""
)
_, ax = diagram.plot_path(p1)
ax.legend()
plt.show()
# H+ + e- -> H
# H + H -> H2
p2 = Path([r1, r2], "H2 Production")
print(
f"""\
Path 2:
{p2}
Energies: {p2.energies}
"""
)
_, ax = diagram.plot_path(p2)
ax.legend()
plt.show()
# Both reactions on same plot
web = Web([p1, p2])
print(
f"""\
Web
---
{web}
"""
)
diagram.plot_web(web)
plt.show()
heatmap.heatmap_web(web)
plt.show()