The simulation of the magnetic field and spin period evolution of accreting neutron stars