LAMMPS from scratch · 20 min

Building the system

Four lines turn a number into a crystal: lattice, region, create_box and create_atoms. You derive the lattice spacing, box size and atom count by hand for any lattice, then let LAMMPS build it and compare its log line by line, including a box size that does not fit the crystal.

1 · Understand: four lines, one crystal

LineWhat it doesIn melt
lattice fcc 0.8442describes a pattern of points: the FCC cube with 4 atoms; in LJ units the number is the density, so the cube edge is a = (4/0.8442)1/3a = 1.6795962
region box block 0 10 0 10 0 10a named shape; numbers are counted in lattice spacingsa cube 16.795962 on each side
create_box 1 boxmakes the simulation box with that shape and 1 atom typebox (0,0,0) to (16.795962, …)
create_atoms 1 boxputs an atom of type 1 on every lattice point inside the region4 × 10³ = 4000 atoms

In LJ units the lattice number is a density; in every other unit style it is the lattice constant itself (for copper in metal units, lattice fcc 3.615 means a = 3.615 Å). LAMMPS confirms what it built in three log lines:

Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962 Created orthogonal box = (0 0 0) to (16.795962 16.795962 16.795962) Created 4000 atoms

2 · The rules by hand

Latticeatoms per cell nspacing a (LJ units, density ρ)nearest neighbour
sc (simple cubic)1(1/ρ)1/3a
bcc2(2/ρ)1/3a√3/2
fcc4(4/ρ)1/3a/√2
diamond8(8/ρ)1/3a√3/4
sq (2D square)1(1/ρ)1/2a
hex (2D)2 in an a × √3a cell(2/(ρ√3))1/2a
box length = number of cells × spacing atoms = n × cells_x × cells_y × cells_z (whole numbers of cells) fcc, ρ = 0.8442, 3 cells: a = (4/0.8442)^(1/3) = 1.6795962, L = 5.0387886, N = 4 × 27 = 108

3 · Modify, predict, observe: the lattice builder

Pick a lattice, a density and the number of cells. The page predicts the three log lines; LAMMPS then builds the system and the numbers are compared.

Try:

Predict by hand


      

What the builder shows

Your turn

1. How many atoms does lattice bcc 0.8442 with region box block 0 5 0 5 0 5 give, and what is the box length?

2. Count the 63 atoms of the 2.5-cell fcc box by hand.

3. In metal units you write lattice fcc 0.8442. What goes wrong?