implemented the magnet distortion