Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1. Bravais lattices, metric tensors and packing fractions

School of Engineering, Nazarbayev University

Why does aluminum deform ductily on twelve close-packed slip systems while silicon cleaves brittlely along tetrahedral bonds, and why do titanium and magnesium require non-orthogonal 120∘120^\circ basis vectors? Every geometric property of a crystal, bond lengths, interaxial angles, unit-cell volumes, neighbor coordination shells, and sphere packing fractions, is encoded in a 3×33\times 3 lattice matrix A\mathbf{A} and its covariant metric tensor G=AA⊤\mathbf{G} = \mathbf{A}\mathbf{A}^\top. In this lecture, we build cubic and hexagonal close-packed unit cells, show metric rotational invariance, and verify Kepler’s close-packing limit.

Learning objectives

  1. Construct sc, bcc, fcc, diamond, and hcp unit cells (lattices.cubic_unit_cell, lattices.hcp_unit_cell) and map fractional to Cartesian coordinates r=fA\mathbf{r} = \mathbf{f}\mathbf{A}.

  2. Evaluate the covariant metric tensor Gij=ai⋅ajG_{ij} = \mathbf{a}_i \cdot \mathbf{a}_j, cell volume det⁡G\sqrt{\det\mathbf{G}}, and interaxial angles (α,β,γ)(\alpha,\beta,\gamma) via lattices.metric_tensor.

  3. Enumerate neighbor coordination shells (Z1,Z2,Z3)(Z_1, Z_2, Z_3) (lattices.coordination_shells) and verify exact hard-sphere APFs (lattices.atomic_packing_fraction).

  4. Analyze how non-ideal HCP axial ratios c/a≠8/3c/a \neq \sqrt{8/3} in Ti and Mg split the first coordination shell into basal and pyramidal bonds.

Time: about 60 min

1. Principles and governing equations

1.1 Direct Lattice Basis & Fractional Coordinates

Stacking the three primitive or conventional basis vectors a1,a2,a3∈R3\mathbf{a}_1, \mathbf{a}_2, \mathbf{a}_3 \in \mathbb{R}^3 as rows of A∈R3×3\mathbf{A} \in \mathbb{R}^{3\times 3}, any basis atom with fractional coordinates fj=(uj,vj,wj)∈[0,1)3\mathbf{f}_j = (u_j, v_j, w_j) \in [0, 1)^3 sits at Cartesian position:

rj=uja1+vja2+wja3=fjA(1.1)\mathbf{r}_j = u_j \mathbf{a}_1 + v_j \mathbf{a}_2 + w_j \mathbf{a}_3 = \mathbf{f}_j \mathbf{A} \tag{1.1}

For the 2-atom primitive hexagonal close-packed (HCP) lattice with basal constant aa and height cc, lattices.hcp_unit_cell uses a1=(a,0,0)\mathbf{a}_1 = (a, 0, 0), a2=(−a/2,32a,0)\mathbf{a}_2 = (-a/2, \frac{\sqrt{3}}{2}a, 0), a3=(0,0,c)\mathbf{a}_3 = (0, 0, c) with basis f0=(0,0,0)\mathbf{f}_0 = (0,0,0) and f1=(13,23,12)\mathbf{f}_1 = (\frac{1}{3}, \frac{2}{3}, \frac{1}{2}). Hard spheres touching both in the basal plane (dbasal=ad_{\mathrm{basal}} = a) and between ABAB planes require the ideal axial ratio:

(ca)ideal=83≈1.632993(1.2)\left(\frac{c}{a}\right)_{\mathrm{ideal}} = \sqrt{\frac{8}{3}} \approx 1.632993 \tag{1.2}

Demonstration 1: Cubic & Hexagonal Unit-Cell Construction and Ideal vs Real HCP c/a
===================================================================================
Cubic sc       | n_atoms =  1 | basis[0..1] frac = [[0.0, 0.0, 0.0]]
Cubic bcc      | n_atoms =  2 | basis[0..1] frac = [[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]
Cubic fcc      | n_atoms =  4 | basis[0..1] frac = [[0.0, 0.0, 0.0], [0.0, 0.5, 0.5]]
Cubic diamond  | n_atoms =  8 | basis[0..1] frac = [[0.0, 0.0, 0.0], [0.0, 0.5, 0.5]]

Ideal HCP c/a = 1.632993 (sqrt(8/3) = 1.632993)
Ti    HCP c/a = 1.587874 (deviation = -2.76%)
Mg    HCP c/a = 1.623606 (deviation = -0.57%)

What Demonstration 1 shows. Magnesium (c/a=1.6236c/a = 1.6236, −0.57%-0.57\% from ideal) behaves almost like an ideal hard-sphere close-packed crystal, whereas titanium (c/a=1.5879c/a = 1.5879, −2.76%-2.76\% axial compression) is noticeably compressed along [0001][0001] due to directional 3d3d-electron metallic bonding, activating prismatic {101ˉ0}\{10\bar{1}0\} slip in α\alpha-Ti.


2. Covariant Metric Tensor G\mathbf{G}, Cell Volume & Rotational Invariance

In any curvilinear or non-orthogonal crystal frame, dot products and squared bond lengths between fractional displacements Δf=f2−f1\Delta\mathbf{f} = \mathbf{f}_2 - \mathbf{f}_1 are governed by the covariant metric tensor:

Gij=ai⋅aj=(AA⊤)ij,∥Δr∥22=Δf G Δf⊤,Vcell=det⁡G(2.1)G_{ij} = \mathbf{a}_i \cdot \mathbf{a}_j = (\mathbf{A}\mathbf{A}^\top)_{ij}, \qquad \|\Delta\mathbf{r}\|_2^2 = \Delta\mathbf{f}\,\mathbf{G}\,\Delta\mathbf{f}^\top, \qquad V_{\mathrm{cell}} = \sqrt{\det\mathbf{G}} \tag{2.1}

Crucially, rotating a crystal in 3-D space by any proper orthogonal matrix Q∈SO(3)\mathbf{Q} \in \mathrm{SO}(3) (A′=AQ\mathbf{A}' = \mathbf{A}\mathbf{Q}) leaves G′=AQQ⊤A⊤=G\mathbf{G}' = \mathbf{A}\mathbf{Q}\mathbf{Q}^\top\mathbf{A}^\top = \mathbf{G} strictly invariant.


Demonstration 2: Metric Tensor Geometry of HCP Ti & Exact SO(3) Rotational Invariance
=====================================================================================
Ti covariant metric tensor G [A^2]:
 [[ 8.70722 -4.35361  0.     ]
 [-4.35361  8.70722  0.     ]
 [ 0.       0.      21.95391]]
Lengths [A]   = [2.9508 2.9508 4.6855]
Angles  [deg] = [ 90.  90. 120.]  (expected: [90, 90, 120])
Volume  [A^3] = 35.331829 vs (sqrt(3)/2)*a^2*c = 35.331829
Max ||G_rotated - G||_inf under arbitrary 3-D rotation = 3.55e-15

What Demonstration 2 shows. The off-diagonal metric entry G12=a1⋅a2=−12a2=−4.3536 A˚2G_{12} = \mathbf{a}_1 \cdot \mathbf{a}_2 = -\frac{1}{2}a^2 = -4.3536\ \mathrm{\AA^2}, encoding γ=arccos⁡(−1/2)=120∘\gamma = \arccos(-1/2) = 120^\circ. Even after an arbitrary 3-D rigid rotation Q\mathbf{Q}, every component of G\mathbf{G}, all cell angles, and Vcell=35.3318 A˚3V_{\mathrm{cell}} = 35.3318\ \mathrm{\AA^3} remain identical to 10-15.


3. Coordination Shells (Z1,Z2,Z3)(Z_1, Z_2, Z_3) & Hard-Sphere Atomic Packing Fractions

If identical hard spheres of radius R=12dnnR = \frac{1}{2}d_{\mathrm{nn}} sit on every basis site and touch along nearest-neighbor bonds, the atomic packing fraction (APF) is:

APF=ncell⋅43πR3Vcell={π/6≈0.52360Simple Cubic (SC, Z1=6)3π/8≈0.68017Body-Centered Cubic (BCC, Z1=8)2π/6≈0.74048FCC & Ideal HCP (Kepler limit, Z1=12)3π/16≈0.34009Diamond Cubic (Z1=4)(3.1)\mathrm{APF} = \frac{n_{\mathrm{cell}} \cdot \frac{4}{3}\pi R^3}{V_{\mathrm{cell}}} = \begin{cases} \pi/6 \approx 0.52360 & \text{Simple Cubic (SC, } Z_1=6\text{)} \\ \sqrt{3}\pi/8 \approx 0.68017 & \text{Body-Centered Cubic (BCC, } Z_1=8\text{)} \\ \sqrt{2}\pi/6 \approx 0.74048 & \text{FCC \& Ideal HCP (Kepler limit, } Z_1=12\text{)} \\ \sqrt{3}\pi/16 \approx 0.34009 & \text{Diamond Cubic (} Z_1=4\text{)} \end{cases} \tag{3.1}

Demonstration 3: Coordination Shells (Z1, Z2, Z3) & Kepler Sphere-Packing Verification
======================================================================================
Structure |        Z1 (r1/a) |        Z2 (r2/a) |        Z3 (r3/a) |  APF_num | APF_exact
----------------------------------------------------------------------------------------
diamond   |  4 (0.4330)     | 12 (0.7071)     | 12 (0.8292)     |  0.34009 |   0.34009
sc        |  6 (1.0000)     | 12 (1.4142)     |  8 (1.7321)     |  0.52360 |   0.52360
bcc       |  8 (0.8660)     |  6 (1.0000)     | 12 (1.4142)     |  0.68017 |   0.68017
fcc       | 12 (0.7071)     |  6 (1.0000)     | 24 (1.2247)     |  0.74048 |   0.74048
hcp       | 12 (1.0000)     |  6 (1.4142)     |  2 (1.6330)     |  0.74048 |   0.74048
<Figure size 1155x440 with 2 Axes>

Figure 1.1. (a) Packing fraction of hard spheres in five structures; the dashed line is the close-packing value 2π/6\sqrt{2}\pi/6. (b) Number of neighbours in the first three shells of BCC, FCC and diamond against the shell radius in units of aa.

What Demonstration 3 shows. In BCC the first two neighbor shells are close together, which is why interatomic potentials for BCC metals must treat both: in BCC, the 8 first neighbors at r1/a=3/2=0.8660r_1/a = \sqrt{3}/2 = 0.8660 and 6 second neighbors at r2/a=1.0000r_2/a = 1.0000 are separated by only 15.5%15.5\% in distance, whereas in FCC (r1/a=1/2=0.7071r_1/a = 1/\sqrt{2} = 0.7071, r2/a=1.0000r_2/a = 1.0000) the second shell sits 41.4%41.4\% farther away.


4. Sensitivity: Splitting the HCP Shell When c/a≠8/3c/a \neq \sqrt{8/3}

In an HCP crystal, every atom has 6 in-plane basal neighbors at dbasal=ad_{\mathrm{basal}} = a and 6 out-of-plane pyramidal neighbors (3 above, 3 below) at dpyr=a23+c24d_{\mathrm{pyr}} = \sqrt{\frac{a^2}{3} + \frac{c^2}{4}}. Only at c/a=8/3c/a = \sqrt{8/3} do these coincide (Z1=12Z_1 = 12). We sweep c/a∈[1.50,1.88]c/a \in [1.50, 1.88] and observe the shell splitting.


Demonstration 4: HCP Shell Splitting Across c/a Sweep (Ti, Mg, Ideal, Zn-like)
==============================================================================
<Figure size 825x462 with 1 Axes>
Ti (c/a < ideal): Shell 1 has Z1=6 at r/a=0.9817 (pyramidal), Shell 2 has Z2=6 at r/a=1.0000 (basal)
Zn (c/a > ideal): Shell 1 has Z1=6 at r/a=1.0000 (basal),     Shell 2 has Z2=6 at r/a=1.0929 (pyramidal)

Figure 1.2. Distances to the six in-plane and the six out-of-plane neighbours of an HCP atom against the axial ratio c/ac/a. The two are equal only at the ideal ratio 8/3\sqrt{8/3}; the vertical lines mark Ti, Mg, the ideal ratio and a ratio typical of Zn.

Inside the algorithm

When c/a<8/3c/a < \sqrt{8/3} (Ti), the 6 out-of-plane bonds become shorter than aa, whereas for c/a>8/3c/a > \sqrt{8/3} (Zn), the 6 basal bonds are shortest. Below we inspect lattices.metric_tensor and lattices.atomic_packing_fraction and verify a NumPy supercell shell counter.

Check against the library


Inside the Algorithm: NumPy Supercell Shell Counter vs lattices.coordination_shells
===================================================================================
def atomic_packing_fraction(structure: str) -> float:
    """Compute hard-sphere atomic packing fraction (APF) directly from unit-cell volume and nearest-neighbor contact."""
    cell = build_unit_cell(structure, a_A=1.0, c_A=None)
    vol = metric_tensor(cell["lattice_vectors"])["volume_A3"]
    d_nn = coordination_shells(structure, a_A=1.0, max_shells=1)[0]["radius_A"]
    r_sphere = 0.5 * d_nn
    sphere_vol = (4.0 / 3.0) * np.pi * (r_sphere**3)
    return float(cell["n_atoms"] * sphere_vol / vol)

Shell 1: NumPy (r=2.55612 A, Z=12) vs library (r=2.55612 A, Z=12)
Shell 2: NumPy (r=3.61490 A, Z= 6) vs library (r=3.61490 A, Z= 6)
Shell 3: NumPy (r=4.42733 A, Z=24) vs library (r=4.42733 A, Z=24)

Exercises

Worked solutions are in 01_solutions.ipynb. The cell below the list is a short self-check to start from.

  1. Verify a result. Verify for Ti and Mg HCP cells that dpyr=Δf G Δf⊤d_{\mathrm{pyr}} = \sqrt{\Delta\mathbf{f}\,\mathbf{G}\,\Delta\mathbf{f}^\top} with Δf=(13,23,12)\Delta\mathbf{f} = (\frac{1}{3}, \frac{2}{3}, \frac{1}{2}) matches element_crystal_summary(sym)['d_nn_A'] and a2/3+c2/4\sqrt{a^2/3 + c^2/4} to rounding error.

  2. Find how it fails. Demonstrate how transposing non-orthogonal HCP Ti basis vectors (A.T instead of A) corrupts metric_tensor lengths and angles, and verify ValueError guards on coplanar lattice vectors and negative lattice constants.

  3. Implement it yourself. Implement interstitial_void_radius_ratio(structure, void_frac) via supercell nearest-atom distance and verify the 4 metallurgy ratios: FCC octahedral (2−1\sqrt{2}-1), FCC tetrahedral (3/2−1\sqrt{3/2}-1), BCC octahedral (2/3−12/\sqrt{3}-1), and BCC tetrahedral (5/3−1\sqrt{5/3}-1).


Self-check for the exercises
============================
Ti: sqrt(df @ G @ df) = 2.896702 A vs summary d_nn = 2.896702 A
Mg: sqrt(df @ G @ df) = 3.197112 A vs summary d_nn = 3.197112 A
All checks passed.