A general spectral difference method for calculating the minimum safety distance to avoid the pounding of adjacent structures during earthquakes