Magnet
Many materials have unpaired electron spins, and the majority of these materials are paramagnetic. When the spins interact with each other in such a way that the spins align spontaneously, the materials are called ferromagnetic (what is often loosely termed as magnetic). Because of the way their regular crystalline atomic structure causes their spins to interact, some metals are ferromagnetic when found in their natural states, as ores. These include iron ore (magnetite or lodestone), cobalt and nickel, as well as the rare earth metals gadolinium and dysprosium (when at a very low temperature). Such naturally occurring ferromagnets were used in the first experiments with magnetism. Technology has since expanded the availability of magnetic materials to include various man-made products, all based, however, on naturally magnetic elements.
Rare-earth magnet
Second, atoms of rare-earth elements can have high magnetic moments because their orbital electron structure contains many unpaired electrons, in contrast to other elements, in which almost all of the electrons exist in pairs with opposite spins, so their magnetic fields cancel out. This is a consequence of incomplete filling of the f-shell, which can contain up to 7 unpaired electrons. In a magnet it is the unpaired electrons, aligned so they spin in the same direction, which generate the magnetic field. This gives the materials high remanence (saturation magnetization "J"). The maximal energy density "BH" is proportional to "J", so these materials have the potential for storing large amounts of magnetic energy. The magnetic energy product "BH" of neodymium magnets is about 18 times greater than "ordinary" magnets by volume. This allows rare-earth magnets to be smaller than other magnets with the same field strength.