implement pair energy for finite magnetic field