Currents in wires produce magnetic fields. What produces the magnetic field from a bar magnet, where there are no wires? Why does that field look like the field of a solenoid?
Consider the Bohr model of the atom, where electrons travel in circular orbits around the nucleus. An electron in a circular orbit looks like a current loop, with a current:
I = e/T = ev/2pr
A current loop has a magnetic moment m, so for the orbiting electron we get:
m = IA = (ev/2pr) * (pr2) = evr/2
If we multiply top and bottom by m, the electron mass, we get mvr in the numerator. This is the orbital angular momentum of the electron, L.
Therefore, by the Bohr model, m = eL/2m. The orbital magnetic moment of the electron is proportional to its orbital angular momentum. The orbital angular momentum is quantized in multiples of h_bar = h/2p, where h is Planck's constant. The Bohr model is rather simplistic; an analysis using quantum mechanics shows that the smallest non-zero value of the electron's orbital magnetic moment is:
m = (2)1/2 e h_bar /2m
Another contribution to an atom's magnetic moment comes from electron spin. The magnetic moment associated with electron spin is:
mspin = e h_bar/2m
This combination of factors is known as the Bohr magneton:
mB = e h_bar/2m = 9.27 x 10-27 J/T
The net magnetic moment of an atom is the vector sum of its orbital and spin magnetic moments. Many materials are not magnetic (i.e., they don't act like bar magnets) because the magnetic moments completely or mostly cancel. In materials you can make bar magnets out of, however, neighboring atoms interact in such a way that their magnetic moments are aligned. In other words, the material acts like one big current loop, producing a magnetic field.