changed MPI_COMM_WORLD to comm_rank in  line 39