# Chapter 7 - Principles of chemical equilibrium¶

## Example E1 - Pg 147¶

In [1]:
#Calculate the reaction gibbs energy
#Initialization of variables
import math
G=-31. #kJ/mol
T=37+273. #K
Cp=8/1000. #mmol/L
Catp=8/1000. #mmol/L
R=8.314 #J/K mol
#calculations
deltaG=G+R*T*math.log(Q) /1000.
#results
print '%s %.1f %s' %("Reaction Gibbs energy =",deltaG," kJ/mol")

Reaction Gibbs energy = -48.8  kJ/mol


## Example E2 - Pg 149¶

In [2]:
#Calculate the gibbs energy
#Initialization of variables
Hr=-285.83 #kJ/mol
Sr=-163.34 #J/ K mol
T=298.15 #K
#calculations
Gr=Hr-T*Sr/1000.
#results
print '%s %.2f %s' %('Gibbs energy =',Gr,'kJ/mol')

Gibbs energy = -237.13 kJ/mol


## Example E3 - Pg 153¶

In [3]:
#calculate the change in gibbs energy
#Initialization of variables
import math
aP=1 #mol/L
aATP=1 #mol/L
aH2O=1 #mol/L
aH=math.pow(10,-7) #mol/L
G=10 #kJ/mol
T=298. #K
R=8.314 #J/K mol
#calculations
Gr=G+R*T*math.log(Q)/1000.
#results
print '%s %.1f %s' %('Change in nGibbs energy =',Gr,'kJ/mol')

Change in nGibbs energy = -29.9 kJ/mol


## Example E4 - Pg 155¶

In [4]:
#Calculate the equivalent fration
#Initialization of variables
Gr=1.7*1000 #J/mol
T=298. #K
R=8.314 #J/K mol
K=0.5
#calculations
GbyRT=Gr/(R*T)
feq=K/(K+1)
#results
print '%s %.2f' %("Equivalent fraction = ",feq)
print '%s' %("For the second part, Gr=1.7 + 2.48 ln(f/1-f)")

Equivalent fraction =  0.33
For the second part, Gr=1.7 + 2.48 ln(f/1-f)


## Example E5 - Pg 157¶

In [2]:
#Calculate the pressure of N2,H2,NH3 gases
#Initialization of variables
import math
import numpy
species=(['N2', 'H2', 'NH3'])
change=(['-x', '-3x', '2x'])
E=(['1-x', '3-3x', '2x'])
print '%s' %("Concentration table")
print '%s' %("species")
print '%s' %("change")
print(E)
K=977.
#Calculations
g=math.sqrt(27*K/4.)
vector=([g, -(2*g +1), g])
sol=numpy.roots(vector)[1]

PN2=1-sol
PH2=3-3*sol
PNH3=2*sol
K=math.pow(PNH3,2)/(math.pow(PH2,3) *PN2)
#results
print '%s %.2f %s' %("Pressure of N2 gas = ",PN2,"bar")
print '%s %.2f %s' %("\n Pressure of H2 gas =",PH2,"bar")
print '%s %.2f %s' %("\n Pressure of NH3 gas =",PNH3,"bar")
print '%s %.2e %s' %("\n K final =",K,"> it is close to original value.")

Concentration table
species
change
['1-x', '3-3x', '2x']
Pressure of N2 gas =  0.10 bar

Pressure of H2 gas = 0.31 bar

Pressure of NH3 gas = 1.79 bar

K final = 9.77e+02 > it is close to original value.


## Example I2 - Pg 148¶

In [6]:
#Calculate the equilibrium constant
#Initialization of variables
import math
Gr=-3.40 #kJ/mol
R=8.314 #J/k mol
T=298. #K
#calculations
lnK=Gr*1000./(R*T)
K=math.exp(lnK)
#results
print '%s %.2f' %('Equilibrium constant K= ',K)

Equilibrium constant K=  0.25


## Example I3 - Pg 149¶

In [8]:
#Calculate the decomposition temperature
#Initialization of variables
Hr=178. #kJ/mol
Sr=161. #J/K mol
#calculations
T=Hr*1000 /Sr
#results
print '%s %.2e %s' %("Decompostion temperature =",T,"K")

Decompostion temperature = 1.11e+03 K


## Example I4 - Pg 151¶

In [9]:
#Calculate the standard reaction gibbs energy
#Initialization of variables
GCO2=-394. #kJ/mol
GCO=-137. #kJ/mol
GO2=0
#calculations
deltaG=2*GCO2-2*GCO+GO2
#results
print '%s %d %s' %('Standard reaction gibbs energy =',deltaG,' kJ/mol')

Standard reaction gibbs energy = -514  kJ/mol