Electromagnetic batteries