revised code for hw1 through 5, excluding MPI relaxation