An evolutionary algorithm to calculate the ground state of a quantum system