A direct relaxation method for calculating eigenfunctions and eigenvalues of the Schrödinger equation on a grid