save wavefunction general merged