Electron spin resonance of Nd3+ and Gd3+ in AB2 cubic intermetallic compounds