change int to long int for total numebr of grid points