Efficient modified Jacobi relaxation for minimizing the energy functional.