add readdata.c for square lattice