Computational materials science in Python: crystal lattices, diffraction, elasticity, phase diagrams, phase-field models and kinetics
A material followed from its unit cell to its microstructure and its selection for a design, with every method written out in NumPy and checked against an exact result.
The properties of a material are set at several length scales, and this book treats each by computing with it, in five parts. The first part starts from the unit cell: its metric tensor gives bond lengths, densities and packing fractions, its reciprocal lattice gives the spacing of planes, and the structure factor gives the powder diffraction pattern and the broadening of its peaks. The second part treats the elastic constants of cubic crystals and of polycrystals, crystals held together by a pair potential, vacancies and the stress needed to move a dislocation. The third part builds phase diagrams from models of the Gibbs energy and follows an alloy through solidification. The fourth part solves the Cahn–Hilliard and Allen–Cahn equations for the separation of a solution into two phases and for the motion of a boundary. The fifth part treats diffusion, the kinetics of transformations, creep life and the selection of materials, and closes with a project that connects the modules on a model alloy.
Each lecture is an executed Jupyter notebook of about one hour. It states the principle and its
equations, works through four short demonstrations, and then repeats by hand the calculation of a
function of the package that it has used. The notebooks share a small Python package,
engmaterials, written to be read as much as to be used; its core needs NumPy alone. Each lecture
has two numbered figures and ends with three exercises: one that verifies a result, one that looks
for a way in which the method fails, and one that asks the reader to write a function. A worked
solution to every exercise is given in the Worked solutions part of the book.
The material properties in the package are representative values typed in for the examples and are not reference data. Parameters of the models are labelled as assumed, and data that stand for measurements are synthetic: they are generated in the notebooks from stated laws, so that the answer is known and a method can be judged against it. The alloy of the closing project is a teaching model and not a real material.
The level is that of the final undergraduate year or the first year of graduate study in materials, chemical or mechanical engineering. The lectures assume calculus, linear algebra, a first course in thermodynamics, and Python with NumPy. Symbols are collected in Notation and conventions, a plan for a semester in the syllabus, the checks of the package in the validation report, and original papers and books for further study in Suggested references.
Part I. Crystal geometry, reciprocal space and X-ray diffraction¶
| Lecture | Topics |
|---|---|
| 0. Units, crystal densities and the element table | ångström, electron volt and molar units; density and molar volume from the unit cell; the table of 14 elements; thermal expansion and density |
| 1. Bravais lattices, metric tensors and packing fractions | cubic and hexagonal cells; the metric tensor; neighbour shells and packing fractions; HCP away from the ideal axial ratio |
| 2. Reciprocal lattices, Miller planes and Brillouin zones | reciprocal basis vectors; plane spacings in any lattice; the Brillouin zone of a hexagonal lattice; strain along one axis |
| 3. X-ray diffraction, structure factors and systematic absences | Bragg’s law; the structure factor; systematic absences of BCC, FCC, diamond and HCP; computed powder patterns; the choice of wavelength |
| 4. Peak broadening: the Scherrer equation and the Williamson–Hall plot | size and strain broadening; why the single-peak Scherrer estimate is biased; the Williamson–Hall plot; instrumental broadening |
Part II. Elasticity, pair potentials and defects¶
| Lecture | Topics |
|---|---|
| 5. Elasticity of cubic single crystals and the Zener ratio | stiffness and compliance of a cubic crystal; Born stability; the Zener ratio; Young’s modulus as a function of direction |
| 6. Polycrystals: Voigt–Reuss–Hill averages and the Pugh ratio | Voigt, Reuss and Hill averages; the universal anisotropy index; the Pugh ratio and the Cauchy pressure |
| 7. Pair potentials, lattice sums and the Cauchy relation | Lennard-Jones and Morse potentials; shifted-force cutoff; lattice sums for FCC, BCC and SC; elastic constants from lattice sums; the Cauchy relation |
| 8. Vacancies and the Peierls–Nabarro stress | equilibrium vacancy fraction; differential dilatometry on synthetic data; ideal shear strength; the Peierls–Nabarro stress and the choice of slip plane |
Part III. Solution thermodynamics and solidification¶
| Lecture | Topics |
|---|---|
| 9. Regular and Redlich–Kister solutions and the spinodal | regular solutions; Redlich–Kister terms; chemical potentials; the critical temperature and the spinodal |
| 10. Common tangents, binodals and binary phase diagrams | equality of chemical potentials; the common tangent as a lower convex hull; binodal and spinodal; liquidus and solidus of an ideal isomorphous system |
| 11. The lever rule, eutectics and Scheil–Gulliver solidification | the lever rule; primary and eutectic constituents; Scheil–Gulliver solidification; homogenization time |
Part IV. Phase-field models of microstructure¶
| Lecture | Topics |
|---|---|
| 12. Diffuse interfaces and the linear theory of spinodal decomposition | the gradient-energy functional; the equilibrium interface profile and its energy; growth rate of a composition wave; explicit and semi-implicit time stepping |
| 13. Spinodal decomposition and coarsening in two dimensions | a two-dimensional Cahn–Hilliard solver; interpenetrating domains and droplets; bulk and gradient energy; the domain size from the structure factor |
| 14. The Allen–Cahn equation and motion by curvature | the Allen–Cahn equation; motion by curvature; a shrinking circle; conserved against non-conserved coarsening |
Part V. Diffusion, transformation kinetics and materials selection¶
| Lecture | Topics |
|---|---|
| 15. Carburization, the Crank–Nicolson method and Boltzmann–Matano analysis | diffusivities of carbon and iron in austenite (assumed Arrhenius parameters); the error-function profile; the Crank–Nicolson method; Boltzmann–Matano analysis |
| 16. Transformation kinetics, creep life and materials selection | JMAK kinetics and the Avrami plot; a time–temperature–transformation curve; the Larson–Miller parameter; performance indices and a Pareto front |
| 17. Project: a model alloy from lattice constant to Pareto front | a model alloy with assumed parameters followed from lattice constant to density, moduli, spinodal ageing, a yield-strength model and a Pareto front |
Where to start¶
| If you are… | Read |
|---|---|
| reading a powder diffraction pattern | Lectures 1 to 4 |
| working with elastic constants | Lectures 5 and 6 |
| starting molecular simulation of solids | Lectures 7 and 8 |
| computing a phase diagram | Lectures 9 to 11 |
| starting phase-field modelling | Lectures 12 to 14 |
| short of time | Lectures 3, 6, 10, 13 and 15 |
Companion books¶
engml-1-foundations, engml-2-applied and engml-3-frontier: machine learning and physics-informed modelling for chemical and materials engineers.
engtransport: heat and mass transfer through worked problems.
onsager
-variational -methods: variational methods in soft matter. engsim: molecular dynamics and Monte Carlo simulation from scratch.
error-analysis: evaluating, propagating and reporting uncertainty.
Author and licence¶
Yanwei Wang, Department of Chemical and Materials Engineering, School of Engineering, Nazarbayev
University, Astana, Kazakhstan (yanwei