# Numerical algorithms to generate a random wavefunction from a thermal ensemble

I am seeking an algorithm to generate a random wavefunction = $\sum {c_i |\varphi _i\rangle }$ from a thermal ensemble, whose density matrix $\rho \sim e^{-\beta H}$, without the need to diagonalize the Hamiltonian. One possible method is to generate a random number for each basis and compare it with $e^{-\beta \langle\varphi _i|H|\varphi _i \rangle }$ and if it is lower we assign the corresponding $c_i$ to complex number with norm = 1 and totally random phase and otherwise make it just zero. Another possible algorithm to assign all $c_i$ to random complex numbers of norm one and then evaluate $e^{- \frac{\beta}{2} H}|\psi \rangle$. Are there other algorithms?

Edit: I now tried the second method with evaluating $e^{- \frac{\beta}{2} H}|\psi \rangle$ by propagating the wavefunction in imaginary time and it works fine! So I recommend this one.

• Why are you not using one of the algorithms you listed? Is there something about them that makes them unsuitable? If you can edit the question to explain that, it will make it much better. (Also, this might actually be a better fit on Computational Science... it can stay here for now, but if you don't get good answers here after a little while then try asking it there.) – David Z Dec 11 '11 at 2:39