What I did so far is:

Code: Select all

```
def lanczos_arpack_spectrum(H, psi, k, lanczos_params={}):
"""
<Removed docs to increase readability>
"""
H_flat, psi_flat = FlatHermitianOperator.from_guess_with_pipe(H.matvec, psi, dtype=H.dtype)
tol = get_parameter(lanczos_params, 'P_tol', 1.e-14, "Lanczos")
N_min = get_parameter(lanczos_params, 'N_min', None, "Lanczos")
Es = speigsh(H_flat, k=k, which='SA', v0=psi_flat, tol=tol, ncv=N_min, return_eigenvectors=False)
return Es
```

Code: Select all

```
psi = engine.prepare_update() # engine is of type TwoSiteEngine
ortho = []
E0 = []
for i in range(k):
(E, psi1, _) = lanczos(engine.eff_H, psi, dmrg_params['lanczos_params'], orthogonal_to = [x.copy() for x in ortho])
E0.append(E)
ortho.append(psi1.copy())
```

Edit: Apparently my initial state is very close to the ground state and thus an extremely bad guess for the excited states. I should probably use a random initial states for the higher eigenstates.

Thank you for your help!