▁micro c ry st all ine ▁gra ins , ▁which ▁are ▁aligned ▁in ▁a ▁powerful ▁magnetic ▁field ▁during ▁manufact ure , ▁so ▁their ▁magnetic ▁axes ▁all ▁point ▁in ▁the ▁same ▁direction . ▁ ▁The ▁resistance ▁of ▁the ▁cry stal ▁lattice ▁to ▁turning ▁its ▁direction ▁of ▁magnet ization ▁gives ▁these ▁comp ounds ▁a ▁very ▁high ▁magnetic ▁co erc ivity ▁( res istance ▁to ▁being ▁dem agnet ized ), ▁so ▁that ▁the ▁strong ▁dem agnet izing ▁field ▁within ▁the ▁finished ▁magnet ▁does ▁not ▁reduce ▁the ▁material ' s ▁magnet ization . ▁▁▁ ▁Second , ▁atoms ▁of ▁rare - ear th ▁elements ▁can ▁have ▁high ▁magnetic ▁moments ▁ ▁Their ▁orb ital ▁electron ▁structures ▁contain ▁many ▁un pa ired ▁electrons ; ▁in ▁other ▁elements , ▁almost ▁all ▁of ▁the ▁electrons ▁exist ▁in ▁pairs ▁with ▁opposite ▁sp ins , ▁so ▁their ▁magnetic ▁fields ▁cancel ▁out , ▁but ▁in ▁rare - ear th s ▁there ▁is ▁much ▁less ▁magnetic ▁can cellation . ▁This ▁is ▁a ▁consequence ▁of ▁incomplete ▁filling ▁of ▁the ▁f - shell , ▁which ▁can ▁contain ▁up ▁to ▁ 7   un pa ired ▁electrons . ▁ ▁In ▁a ▁magnet ▁it ▁is ▁the ▁un pa ired ▁electrons , ▁aligned ▁so ▁they ▁spin ▁in ▁the ▁same ▁direction , ▁which ▁generate ▁the ▁magnetic ▁field . ▁This ▁gives ▁the ▁materials ▁high ▁rem an ence ▁( s atur ation ▁magnet ization ▁J ). ▁The ▁maximal ▁energy ▁density ▁B · H ▁is ▁proportional ▁to ▁J , ▁so ▁these ▁materials ▁have ▁the ▁potential ▁for ▁storing ▁large ▁amounts ▁of ▁magnetic ▁energy . ▁The ▁magnetic