Numerical integration of Landau-Lifshitz-Gilbert equation based on the midpoint rule