preparing the wavefunction