Every magnetic atom is a tiny bar magnet. Whether a crystal full of them makes a useful magnet depends on how neighbouring atoms line up. There are three common patterns, and you can rotate a real example of each below.
Interactive 3D view of ferromagnetic bcc Fe, antiferromagnetic NiO, and ferrimagnetic GdCo5, with a temperature slider and net moment readout
Each arrow is one atom's magnetic moment, and its length is proportional to the size of that moment. The gray wireframe marks one unit cell. Drag to rotate, and use the slider to heat the crystal.
Every moment points the same way, so they all add. This is what most people picture as "a magnet". Iron carries about 2.2 μB per atom and stays ordered up to its Curie temperature of 1043 K.
Neighbouring moments are equal in size and opposite in direction, so the total is exactly zero. Look at NiO side-on: each sheet of Ni atoms is parallel within the sheet, and alternate sheets are reversed. The crystal is just as ordered as iron, but it produces no external field. The order melts at the Néel temperature, 523 K.
Moments are again opposed, but the two sides are not equal, so the cancellation is incomplete. In GdCo₅ one large Gd moment (about 7 μB) points against five smaller Co moments (about 1.7 μB each). The Co side wins: 5 × 1.7 − 7.0 ≈ 1.5 μB per formula unit.
This is why adding a high-moment atom like Gd to a Co or Fe magnet lowers the magnetization instead of raising it. It is also why the net moment of GdCoâ‚… rises on heating before it collapses: the Gd sublattice disorders faster than the Co sublattice, so less of the Co moment is cancelled.
Structures: the unit cells and atom positions are parsed from CIF files (bcc Fe, the type-II antiferromagnetic cell of NiO, and GdCoâ‚… from the Materials Project, mp-1077071).
Moments: the sizes and directions are approximate literature values. The CIFs carry no magnetic information.
Temperature: the ordering temperatures are the measured ones, but the motion is a cartoon. Each spin tilts and precesses by an amount set by the slider; it is not a spin-dynamics simulation, so the shape of the magnetization curve is only qualitative.
An interactive 3D look at magnetic order in bcc Fe, NiO, and GdCo5