overhead of creating tvdp engines

How do I use this algorithm? What does that parameter do?
Post Reply
mgbukov
Posts: 3
Joined: 12 Oct 2021, 10:38

overhead of creating tvdp engines

Post by mgbukov »

I want to code a step-wise Floquet drive using tdvp. Since I will be switching between two MPO-Hamiltonians, the pedestrian solution would be to create a tdvp engine every time evolution step, which also instantiates the engine class every time step. I was wondering if this will result in unnecessary overhead, as compared to preallocating two engines first (or one modified coupled engine), and then just using the engine_1.run(), engine_2.run() successively [as the state psi is being updated in place anyway].

I am aware that the above is currently likely not immediately doable with TeNPy, since the tdvp engine's __init__ also instantiates an environment variable. But it's also not too hard to do (I guess), as a trivial modification of the tdvp engine class. However, before I go for it, I thought I might consult the experts first, to make sure this idea makes sense from the perspective of the intrinsic tdvp engine code (it may well be that the overhead of creating the engines every new step is negligible anyway).
User avatar
Johannes
Site Admin
Posts: 413
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: overhead of creating tvdp engines

Post by Johannes »

Just initializing the two TDVP environments independently at the same time will not yield the correct result, since each engine has an MPOEnvironment for the partial contractions of <psi|H|psi>, and the one of engine1 will not get updated during the evolution of engine2.
You could call engine1.environment.clear() after evolving engine2, and vice versa, to enforce a recalculation of the environments.
However, assuming the MPS bond dimension is reasonably large (say chi is several 100s), the re-calculation of the environment is anyways the expensive part (because it's the only thing involving tensor contractions when initializing the TDVP engine), so you don't gain much from keeping the engines alive.
Post Reply