An algorithm for earthquakes clustering based on maximum likelihood