In a very classical picture of an atom (this is not the correct quantum mechanical picture, but it can nevertheless give us some insight to this topic...), the electrons orbit the nucleus in circular orbits which form current loops (any charge moving in a closed loop forms a current loop!), each loop producing a magnetic field as discussed in the previous section. In atoms where the orbitals are filled, the magnetic fields produced by the various current loops
Ordinarily, even in materials made up of atoms having a net magnetic dipole (so-called magnetic dipole moments), the atomic dipoles themselves tend to be randomly oriented within the material, and so the net magnetic field produced by the material is zero. However, some special materials, called ferromagnetic materials, have magnetic domains within which all of the atomic magnetic dipole moments tend to be more-or-less
However, if a strong external magnetic field is produced in the region of the material, the resulting magnetic force on the atomic dipoles can overcome internal friction between the magnetic domains in a ferromagnetic material and cause the domains to rotate until they tend to more-or-less align themselves with the external magnetic field. (Thermal agitation keeps us from ever getting a perfect alignment of domains!) The net, external magnetic field (the magnetic field measured outside of the material) is then a combination of the original external magnetic field (the one that rotated the magnetic domains in the ferromagnetic material) plus a very large magnetic field produced by the material itself (due to the alignment of its magnetic domains, so all of the atomic dipoles produce magnetic fields that tend to add to one another).
If the external magnetic field is now turned off, instead of going back to their randomly oriented positions, the magnetic domains within the ferromagnetic material tend to stay more-or-less aligned. (The internal friction between neighboring domains keeps them from randomizing.) We are thus left with a material which produces a strong magnetic field. Such a material is called a ferromagnet or, more commonly, a permanent magnet. The magnetic domains will remain aligned until randomized by thermal agitation or by some other external force which can do work in rotating the domains within the material. (For example, heating up a magnet or whacking it with a hammer can remove the materialís magnetic effects!)