Computational Chemistry with Python
Build chemistry from the atom up, in code: stoichiometry, structure and bonding, thermodynamics, equilibrium, kinetics, quantum chemistry, and a molecular-dynamics engine, all from scratch with numpy and the standard library.
11 projects, 275 hands-on levels, run in your browser.
Syllabus
- Foundations: code through chemistry: Never written code before? Start here. You will learn the absolute basics of Python, output, variables, types, decisions, loops, and functions, using moles, molar mass, reactions, concentration, and temperature as your playground. By the end you are ready for Project 1.
- Atoms, Units & Stoichiometry: Use mole counts, supplied atomic-mass tables and balanced equations to calculate product masses, limiting reactants, yields and concentrations. The formula dictionary must use the table's supported elements.
- The Periodic Table & Atomic Structure: Count subatomic particles and isotope averages, distinguish shell capacity from subshell filling order, and connect hydrogen energy levels to light. The Element class implements explicitly restricted classification and occupancy models.
- Bonding & Molecular Geometry: Represent atomic coordinates with NumPy, measure distances and angles, and apply selected VSEPR lookups. The Molecule report composes the two specified bond measurements around a chosen center; it does not infer connectivity for arbitrary molecules.
- Thermodynamics: Calculate heat, coefficient-weighted enthalpy and entropy changes, and Gibbs driving force at a stated temperature. Track J versus kJ and distinguish thermodynamic favorability from reaction speed.
- Chemical Equilibrium: Reactions do not always run to completion; they settle at equilibrium. Write the equilibrium constant, compare it to the reaction quotient to predict direction, set up ICE tables, and solve the resulting equations with a bisection root-finder you build from scratch. Le Chatelier predicts how the balance shifts under stress.
- Acids, Bases & pH: Use dilute aqueous approximations to calculate strong-acid pH, weak-acid dissociation and buffer ratios. The titration chapter covers specified pre-equivalence points; the report dispatches among these finite models.
- Reaction Kinetics: How fast does a reaction go? Kinetics measures and predicts rates. Write rate laws, apply the integrated forms for first, second, and zero order, capture temperature dependence with the Arrhenius equation, and integrate the rate equation numerically with Euler and Runge-Kutta methods you build yourself. The capstone is a decay simulator.
- Quantum Chemistry & Spectroscopy: Atoms and molecules absorb and emit light at sharp, quantized energies. Compute the energy levels of a particle in a box and of hydrogen, connect them to the light absorbed or emitted, and quantify absorption with the Beer-Lambert law. The finite-difference chapter solves the Schrodinger equation numerically with a matrix you build and diagonalize.
- Molecular Dynamics & Monte Carlo: Simulate matter atom by atom. Model interactions with the Lennard-Jones potential, sum forces and energies across a system with numpy, advance time with the velocity-Verlet integrator, and sample configurations with the Metropolis Monte Carlo method. These are the two engines that power computational chemistry.
- Capstone: A Molecular Dynamics Engine: Assemble a small reduced-unit, nonperiodic Lennard-Jones simulation class. Compute forces, advance state with velocity Verlet, and record kinetic, potential and total energy. Validate energy error and time-step dependence instead of assuming exact conservation.
Key concepts
- Bond angle: The angle between two bonds at a central atom, computed from the dot product of the bond vectors and recovered with the inverse cosine.
- Electron configuration: Occupancy of shells and subshells. The course distinguishes a sequential 2*n^2 shell-capacity model from filling a supplied subshell energy order; capacities a…
- Enthalpy: H=U+pV; reaction dH equals heat exchanged at constant pressure when only pressure-volume work occurs. Negative dH is exothermic, positive endothermic, and zero…
- Equilibrium constant: K is the product of dimensionless activities raised to signed stoichiometric powers at equilibrium. Dilute concentration and ideal-gas pressure approximations…
- Gibbs free energy: G=H-T S. At fixed T and pressure, negative reaction dG favors the forward direction, zero indicates equilibrium, and positive favors reverse. This predicts dri…
- Lennard-Jones potential: V(r)=4 epsilon ((sigma/r)**12-(sigma/r) 6), a simplified nonbonded pair attraction/repulsion model. Its minimum is at 2 (1/6)*sigma with energy -epsilon; signe…
- Limiting reagent: The reactant that runs out first and therefore caps how much product can form. Found by comparing how much product each reactant could make and taking the smal…
- Molar mass: The mass of one mole of a substance, in grams per mole, found by summing the atomic masses of every atom in its formula. Computed here by looping over an eleme…
- Mole: The SI counting unit: exactly 6.02214076e23 specified entities per mole. This course often uses the rounded constant 6.022e23. Molar mass connects that count t…
- Numerical integration: Advance a differential equation using small time steps. Euler is first-order; RK4 is fourth-order for suitable smooth problems. Velocity Verlet is a second-ord…
- pH: Negative base-10 logarithm of hydrogen-ion activity, approximated by [H+]/(1 mol/L) in dilute water. Neutrality is near pH 7 at 25 C and depends on temperature…
- Rate constant: k in a rate law rate = k[A]^n . Its temperature dependence follows the Arrhenius equation k = A exp(-Ea/RT) , which also yields the activation energy from two…
- Root-finding: Solve f(x)=0 numerically, even when an analytic formula also exists. Bisection preserves a bracket for a continuous function and halves its width each iteratio…
- Stoichiometry: The bookkeeping of reactions: using the mole ratios in a balanced equation to convert between amounts of reactants and products.
- VSEPR: Electron domains around a central atom are arranged to reduce repulsion. Multiple bonds count as one direction. Molecular shape omits lone-pair positions, so f…