Magnet
Rare earth (lanthanoid) elements have a partially occupied "f" electron shell (which can accommodate up to 14 electrons). The spin of these electrons can be aligned, resulting in very strong magnetic fields, and therefore, these elements are used in compact high-strength magnets where their higher price is not a concern. The most common types of rare-earth magnets are samarium-cobalt and neodymium-iron-boron (NIB) magnets.
Magnetic moment
The net magnetic moment of any system is a vector sum of contributions from one or both types of sources.
For example, the magnetic moment of an atom of hydrogen-1 (the lightest hydrogen isotope, consisting of a proton and an electron) is a vector sum of the following contributions:Similarly, the magnetic moment of a bar magnet is the sum of the contributing magnetic moments, which include the intrinsic and orbital magnetic moments of the unpaired electrons of the magnet's material and the nuclear magnetic moments.