# termohim

Apr 5th, 2012
541
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. global ko1,ko2,ko3,ko4,dH,dS,da,k1,k2,k3,db,dc,dcc,t,kk,dG,u0,u1,u2,u3,dgt,kp
2.
3. procedure main()
4. k1:=1e-3
5. k2:=1e-6
6. k3:=1e5
7. write("-- Termohim v 1.0 --")
9. write("\n\n")
10.
11. write(" -- Koefficient -- ")
16. write("\n")
17.
18. write(" -- Entalpy -- ")
19. dH:=delta()
20. write("delta H = ",dH,"\n")
21.
22. write(" -- Entropy -- ")
23. dS:=delta()
24. write("delta S = ",dS,"\n")
25.
26. write(" -- a -- ")
27. da:=delta()
28. write("delta a = ",da,"\n")
29.
30. write(" -- b -- ")
31. db:=delta()*k1
32. write("delta b = ",db,"\n")
33.
34. write(" -- c -- ")
35. dc:=delta()*k2
36. write("delta c = ",dc,"\n")
37.
38. write(" -- c strike -- ")
39. dcc:=delta()*k3
40. write("delta c strike = ",dcc,"\n")
41.
42. write(" -- Temperature -- ")
44. write("\n")
45.
46. write(" -- dH,where T = ",t," --")
47. kk:=kirhgoff()
48. write("delta H = ",kk,"\n")
49.
50. write(" -- Gibbs energy --")
51. dG:=gibbs()
52. write("delta G = ",dG,"\n")
53.
54. write(" -- Temkin-Shwarcman method -- ")
59. dgt:=temkin()
60. write("delta G = ",dgt,"\n")
61.
62. write("-- Kp -- ")
63. kp:=balance()
64. write("Kp = ",kp," \n")
65.
66. delay(100000)
67. end
68.
69. procedure delta()
74. return ((ko3*y)+(ko4*z))-((ko1*w)+(ko2*x))
75. end
76.
77. procedure kirhgoff()
78. local q1,q2,q3,q4,q5
79. q1:=dH*1000
80. q2:=da*(t-298.0)
81. q3:=(db/2.0)*((t^2)-(298^2))
82. q4:=(dc/3.0)*((t^3)-(298^3))
83. q5:=dcc*((1.0/t)-(1.0/298.0))
84. return (q1+q2+q3+q4-q5)/1000
85. end
86.
87. procedure gibbs()
88. return (dH*1000)-(298*dS)
89. end
90.
91. procedure temkin()
92. return (dH*1000)-(t*dS)-t*(u0*da+u1*db+u2*dc+u3*dcc)
93. end
94.
95. procedure balance()
96. return exp(dgt/(-8.314*t))
97. end
RAW Paste Data