Hi,
I am a relatively new entrant into TeNPy. I am interested in calculating an expectation value of an operator with a single conservation law (such as total magnetization being conserved) ,
\(<\psi|O(t)|\psi>\) where \(|\psi>\) is a simple product state and my operator \(O(t)\) is obtained after a Heisenberg evolution of some initial operator, say \(O(0)\).
I am able to get \(O(t)\) using my TEBD code and I also have a code written up for the simple MPS \(|\psi>\). I now just need to compute the expectation value \(<\psi|O(t)|\psi>\) ( I would like to keep the time evolution on the operator only)..
Is there an inbuilt function in Tenpy that takes inputs as (\(O,|\psi>\)) and returns for me the expectation value ?
Thank you very much !
Expectation value of an operator
Re: Expectation value of an operator
Ho did you get O(t)? Currently, I don't think there is TEBD code to Heisenberg-Evolve an operator - did you write that yourself?
I presume you have O in the form of an MPO then?
For a TeNPy MPO, it's simply expectation_value, e.g.
Note that a TeNPy MPO requires the
I presume you have O in the form of an MPO then?
For a TeNPy MPO, it's simply expectation_value, e.g.
E = H.expectation_value(psi)
, or for finite systems MPOEnvironment(H, psi).full_contraction()
.Note that a TeNPy MPO requires the
IdL/IdR
indices at least on the very left/right ends, to define how to terminate the open indices of the MPO in the contraction of <psi|O|psi>.