A mechanism for water splitting and oxygen production in photosynthesis