I am currently studying the time evolution of a time-dependent Hamiltonian. However, I am unsure how to properly update the Hamiltonian parameters at each time step. Below is my current implementation:
Python: Select all
def simulation(psi_init, model_parameter, tdvp_params, times, A):
J0 = model_parameter.get('J', 1.0)
L = model_parameter['L']
N_t = len(times)
C_t_ij = np.zeros((N_t, L, L), dtype=complex)
psi = psi_init.copy()
for t, t_val in enumerate(times):
model_parameter['J'] = J0 * np.exp(1j * A[t])
model = HubbardModel(model_parameter)
eng_tdvp = tdvp.TwoSiteTDVPEngine(psi, model, tdvp_params)
eng_tdvp.run()
psi = eng_tdvp.psi
C_t_ij[t, :, :] = correlation(psi, model)
return C_t_ijMy concern is that this approach may be computationally expensive, since a new model and engine are created at every step. Additionally, I am worried that recreating the engine each time could potentially discard internal information that might be physically relevant for the evolution.
Is there a more efficient way to implement this, for example by defining the TDVP engine outside the time loop and only updating the necessary Hamiltonian parameters during the evolution? As it is done for the time-independent problems. I looked through the documentation but could not find a clear example of how to handle time-dependent couplings within a single TDVP engine.
Best wishes,
Lucas