A galaxy cluster finding algorithm for large-scale photometric surveys