Toolyard

Crystal Lattice 3D Viewer

Equations in this simulation

Z = N_corner ÷ 8 + N_edge ÷ 4 + N_face ÷ 2 + N_inside
N_corneratoms on the corners of the celleach is shared by the 8 cells that meet there
N_edge, N_faceatoms on the edges and facesan edge is shared by 4 cells, a face by 2
Zatoms per unit cell1 for simple cubic, 2 for body-centered, 4 for face-centered; for a salt, formula units per cell

With the current values:

ρ = Z M ÷ (N_A V)
Mmolar mass of one formula unitfor NaCl, 22.99 + 35.45 = 58.44 g/mol
N_AAvogadro constant6.022 × 10²³ per mole
Vvolume of the cella³ for a cubic cell; (√3 ÷ 2) a² c for the hexagonal one
ρdensity of the crystalX-ray measurements of a and the density together gave one of the best early values of N_A

With the current values:

packing fraction = Σ (4/3) π r³ ÷ V
rradius of each atom or ionmetallic radii for the metals, ionic radii for NaCl and CsCl, covalent radii for zinc blende and diamond
packingshare of the cell filled by the spheres52% simple cubic, 68% body-centered, 74% face-centered and hexagonal close-packed, the most any packing of equal spheres can reach

With the current values:

1 ÷ d² = (h² + k² + l²) ÷ a² (hexagonal: 4(h² + hk + k²) ÷ 3a² + l² ÷ c²)
h, k, lMiller indicesthe planes cut the cell edges at a ÷ h, a ÷ k and a ÷ l; a 0 means the planes run parallel to that edge
dspacing of the planesthe distance between neighboring planes of the family drawn in yellow

With the current values:

n λ = 2 d sin θ
λX-ray wavelength λit must be shorter than 2d, or the planes cannot reflect it at any angle
θBragg anglethe angle between the beam and the planes; the detector sits at 2θ from the beam
norder of the reflectionthe reflection (2 2 2) is the second order of (1 1 1): its planes are half as far apart

With the current values:

F = Σ f_j e^(2πi (h x_j + k y_j + l z_j)), I ∝ |F|² (1 + cos² 2θ) ÷ (sin² θ cos θ)
x_j, y_j, z_jposition of atom j as fractions of the cell edgesthe atoms between the planes scatter out of step with those on them
f_jscattering factor of atom jabout the number of electrons Z at low angles, falling at higher angles; here f = Z e^(−2s²) ÷ (1 + 3s²), s = sin θ ÷ λ in Å⁻¹
Fstructure factorwhen F = 0 the reflection is absent: body-centered iron has no (1 0 0) peak, because the atom in the middle cancels the corners

With the current values:

How to use the crystal lattice viewer

  1. Pick a structure. The unit cell is drawn with the atoms of the real example, at its measured lattice constant, and the results count the atoms per cell (corners shared by 8 cells, edges by 4, faces by 2), the coordination number, the nearest-neighbor distance, the packing fraction and the density, next to the measured density. Switch to space-filling to see the atoms at their real size, or cut them at the faces of the cell to see how much of each corner atom belongs to it.
  2. Set the Miller indices h, k and l. The planes of that family are drawn in yellow, the atoms on them light up, and the results give the spacing d and the angle 2θ at which the planes reflect X-rays by Bragg's law. Some choices are absent, such as (1 0 0) in body-centered iron, because the atoms between the planes scatter exactly out of step; with small spacings the wavelength is too long to reflect at all.
  3. Watch the detector sweep from 0 to 150°: the red beam comes in, the yellow beam goes out at the same angle to the planes, and it brightens when the path difference is a whole number of wavelengths. The chart below shows the whole powder pattern. Drag the lattice constant to see the density and the peaks shift, and switch to molybdenum radiation to see more peaks. The Molar Mass Calculator gives the mass that goes into the density.

Frequently asked questions

What is a unit cell?

The smallest box of atoms that builds the whole crystal when it is repeated in every direction, like a tile. A cubic cell is described by one length, the lattice constant a; the hexagonal cell of magnesium needs two, a and c. The atoms per cell, Z, counts each corner atom as an eighth, each edge atom as a quarter and each face atom as a half, because neighboring cells share them.

How do you calculate the density of a crystal?

Divide the mass of the atoms in one cell by its volume: ρ = Z M ÷ (N_A a³). For copper, 4 × 63.55 g/mol ÷ (6.022 × 10²³ × (361.5 pm)³) = 8.94 g/cm³, against a measured 8.96. Run backward, the same equation gave one of the most accurate early values of the Avogadro constant.

What are Miller indices?

Three whole numbers (h k l) that name a family of parallel planes: the planes cut the cell edges at a ÷ h, a ÷ k and a ÷ l, and a 0 means the planes run parallel to that edge. In a cubic crystal the spacing is d = a ÷ √(h² + k² + l²). Hexagonal crystals often use four indices (h k i l), with i = −(h + k).

Why are some X-ray reflections missing?

Bragg's law says when the waves from one set of planes are in step, but the atoms between those planes also scatter. In body-centered iron the atom in the middle of the cell sits halfway between the (1 0 0) planes and cancels them exactly, so the structure factor F is zero and there is no peak. Which peaks are missing is how X-ray diffraction tells the lattice types apart.

It says WebGL is turned off.

The 3D view needs WebGL, which every current browser has. It can be switched off by hardware acceleration being disabled in the browser settings, or by a very old graphics driver. Turn hardware acceleration on, or try another browser.

Is anything uploaded?

No. The simulation is drawn by your own browser with WebGL; nothing is sent anywhere, and it keeps working offline once the page has loaded.

More science simulations

Projectile Motion SimulatorPendulum SimulatorDouble-Slit Experiment SimulatorElectric Field SimulatorOrbit SimulatorMass-Spring Oscillator SimulatorRutherford Scattering SimulatorParticle Collider Event DisplayRadioactive Decay SimulatorBohr Atom Simulator3D Molecule ViewerIdeal Gas SimulatorDiffusion and Osmosis SimulatorDNA and RNA Folding ViewerBacterial Growth SimulatorCentrifuge SimulatorLens and Mirror Ray Diagram SimulatorStanding Wave SimulatorDoppler Effect SimulatorCollision and Momentum SimulatorRC and RL Circuit SimulatorCharged Particle in a Magnetic Field SimulatorBlackbody Radiation SimulatorSpecial Relativity SimulatorRefraction and Total Internal Reflection SimulatorSeries and Parallel Circuit SimulatorFluid Flow and Bernoulli's Principle SimulatorElectromagnetic Induction SimulatorTitration Curve SimulatorReaction Rate and Collision Theory SimulatorChemical Equilibrium Simulator (Le Chatelier)Galvanic Cell and Electrolysis SimulatorHeating Curve and Phase Change SimulatorAtomic Orbitals 3D ViewerBuffer SimulatorChromatography SimulatorSpectrophotometer and Beer-Lambert Law SimulatorEnzyme Kinetics SimulatorAction Potential SimulatorPCR SimulatorNatural Selection and Population Genetics SimulatorHeart and Cardiac Cycle SimulatorGel Electrophoresis SimulatorMitosis and Meiosis SimulatorProtein Synthesis Simulator: Transcription and TranslationPhotosynthesis and Limiting Factors SimulatorPredator and Prey Population SimulatorEpidemic Spread Simulator: SIR and SEIRSeasons and Day Length SimulatorPlate Tectonics and Earthquake SimulatorMoon Phases, Tides and Eclipses SimulatorGreenhouse Effect SimulatorStellar Evolution and Hertzsprung–Russell Diagram SimulatorGalton Board SimulatorFourier Series Simulator

Related calculators and tools

Guides