Thermochemistry

Fill in a module description here

Thermochemistry

Calculate heat: \(q=C \times \Delta T\)

Heat Capacity

The heat capacity of a substanc depends on its mass and the specific heat.

The heat capacity of a substance: \(C = s \times \Delta T\)

Thermal Reaction

Standard Enthalpy

\(\Delta_f H^{\ominus}= \sum v \Delta_f H^{\ominus}(\) products \()-\sum v \Delta_f H^{\ominus}(\) reactants \()\)


source

ThermalReaction

 ThermalReaction (reactants:list, products:list)

Initialize self. See help(type(self)) for accurate signature.

Type Details
reactants list list of reactants
products list list of products
MgOH2 = Compound('Mg(OH)2')
MgOH2.formula
'O₂H₂Mg₁'
MgO = Compound('MgO')
H2O = Compound('H2O')
H2O = Compound('H2O hello')
H2O.__dict__
{'occurences': {'H': 2, 'O': 1},
 'elements': [<chemlib.chemistry.Element>,
  <chemlib.chemistry.Element>,
  <chemlib.chemistry.Element>],
 'formula': 'H₂O₁',
 'coefficient': 1,
 'name': 'water',
 'mass': None,
 'mass_t': <chemchem.core.Symbol>,
 'moles': None,
 'specific_heat': None,
 'temperature': 0    None
 Name: temperature, dtype: object}
r = ThermalReaction(reactants=[MgOH2], products=[MgO, H2O])
r.formula
'1O₂H₂Mg₁ --> 1Mg₁O₁ + 1H₂O₁'
r.balance()
True
r.formula
'1O₂H₂Mg₁ --> 1Mg₁O₁ + 1H₂O₁'
r.is_balanced
True
r.standard_enthalpy()
r.products[1].__dict__
{'occurences': {'H': 2, 'O': 1},
 'elements': [<chemlib.chemistry.Element>,
  <chemlib.chemistry.Element>,
  <chemlib.chemistry.Element>],
 'formula': 'H₂O₁',
 'coefficient': 1,
 'name': 'water',
 'mass': None,
 'mass_t': <chemchem.core.Symbol>,
 'moles': None,
 'specific_heat': None,
 'temperature': 0    None
 Name: temperature, dtype: object}
#dict(r.coefficients)['O₂H₂Mg₁]
r.__dict__
{'reactants': [<chemchem.compound.Compound>],
 'products': [<chemchem.compound.Compound>,
  <chemchem.compound.Compound>],
 'compounds': [<chemchem.compound.Compound>,
  <chemchem.compound.Compound>,
  <chemchem.compound.Compound>],
 'reactant_formulas': ['O₂H₂Mg₁'],
 'product_formulas': ['Mg₁O₁', 'H₂O₁'],
 'formula': '1O₂H₂Mg₁ --> 1Mg₁O₁ + 1H₂O₁',
 'coefficients': {'O₂H₂Mg₁': 1, 'Mg₁O₁': 1, 'H₂O₁': 1},
 'constituents': ['O₂H₂Mg₁', 'Mg₁O₁', 'H₂O₁'],
 'reactant_occurences': {'O': 2, 'H': 2, 'Mg': 1},
 'product_occurences': {'Mg': 1, 'O': 2, 'H': 2},
 'is_balanced': True}

Coffee Cup Reaction


source

CoffeCup

 CoffeCup (reactants, products=None)

Initialize self. See help(type(self)) for accurate signature.

HI = Compound('HI')
KOH = Compound('KOH')
c = CoffeCup(reactants=[HI, KOH])
c
<__main__.CoffeCup>

source

CoffeCupBuilder

 CoffeCupBuilder ()

Initialize self. See help(type(self)) for accurate signature.

\[C=s \times m \]

def calculate_heat_capacity(specific_heat, mass):
    return specific_heat * mass

Calorimeter

Hess’s Law

# TODO: Find an algorithm for hess's law

C4H8, C4H4, O2, CO2, H2O

A = np.array([
        [0, 1, 5, 4, 2],
        [1, 0, 6, 4, 2],
        [0, 0, 1, 0, 2]
    ])
A
array([[0, 1, 5, 4, 2],
       [1, 0, 6, 4, 2],
       [0, 0, 1, 0, 2]])
A.shape
(3, 5)

(3, 4) x (4, 1) = (3,1)

b = np.array([-2341, -2755, -571.6])
#b.shape
(3,)
#np.linalg.solve(A, b)
LinAlgError: Last 2 dimensions of the array must be square
A = np.array([[-4, 6], [0,2]])
b = np.array([-1516, -572])
np.linalg.solve(A,b)
array([ -50., -286.])