## ExpMPOEvolution.run() vs. update()

How do I use this algorithm? What does that parameter do?
dorf
Posts: 24
Joined: 16 Feb 2021, 16:34

### ExpMPOEvolution.run() vs. update()

Hello,
I am calculating some expectation values for a range of time steps. I have some MPS psi_0 and the following evolution:

Code: Select all

evol_params = {'approximation': 'I', 'dt': 0.1, 'N_steps': 1}
Let's say I want to calculate quantities at 100 time steps. What's the most efficient way of doing so? Should I do something like

Code: Select all

psi_new = psi_0
for time_step in range(100):
evol = ExpMPOEvolution(psi_new, model, evol_params)
psi_new = evol.run()
do something with psi_new


I assume I can just initialize evol once and then just repeatedly make it run, right?

Code: Select all

evol = ExpMPOEvolution(psi_0, model, evol_params)
for time_step in range(100):
psi_new = evol.run()
do something with psi_new

I browsed through the code though and saw that run() is calling the update() method. Should I call this in each iteration of the loop instead?
Another option, I guess, is to use checkpoints, interrupt the run, do something to the wavefunction and then resume the run?
Thank you very much and best regards!
Johannes
Posts: 357
Joined: 21 Jul 2018, 12:52
Location: TU Munich

### Re: ExpMPOEvolution.run() vs. update()

The latter is the recommended way to do a time evolution. You can find the corresponding loop in the source code of the RealTimeEvolution Simulation class in the run_algorithm method.
dorf
Posts: 24
Joined: 16 Feb 2021, 16:34

### Re: ExpMPOEvolution.run() vs. update()

Thank you very much for your reply. So checking the source codes it seems I'd have to use the 'make_measurement()' method. However, I want to measure something like this at each time step:

Code: Select all

for t in range(num_time_steps):
env = MPSEnvironment(psi_0, evol.psi)
out[t] = env.expectation_value(op, sites)

It seems this is not provided as a measurement. Does that mean I'd have to implement a custom 'measurement' class (maybe using 'psi_method') to perform this at each time step?

If you open an issue on github for this kind of measurement class (with some guidance maybe), I'm happy to contribute it. I'm sure these correlation functions come in handy