old program for magnetic field profile calculation