adding magnetic field