Diversity and productivity peak at intermediate dispersal rate in evolving metacommunities