# non-Hermitian DMRG in Julia

+1 vote

Hi,

I am trying to do an example by obtaining the ground state of a non-Hermitian Hamiltonian. Is it possible to do it now in Julia (or in the future version when there is Arnoldi eigensolver). I already know there's one in the C++ version. Thank you!

+1 vote

Hi Terry,
The short answer is that this is not currently available in the Julia version at the level of an option you can pass to the dmrg function, if that's what you are asking. Similarly for the C++ version there is no such option, though as you noted we do offer an Arnoldi algorithm code.

But for both versions you could modify the DMRG code to use Arnoldi. For the Julia version this should actually be pretty straightforward, because the eigsolve function we call from Julia is a function offered by the package KrylovKit.jl and that same eigsolve function offers the ability to change the algorithm to Arnoldi. Here is a documentation page on eigsolve explaining about this:
https://jutho.github.io/KrylovKit.jl/stable/man/eig/

However, not having written non-Hermitian DMRG myself, I'm not sure off hand what other changes might be needed to the rest of the DMRG algorithm. Perhaps not very many other than changing the eigen solver?

Best regards,
Miles

commented by (290 points)
Hi Miles,

For the last part, I guess you are probably correct. See this paper for example: https://arxiv.org/pdf/2001.07088.pdf

Best,
Tianqi
commented by (14.1k points)
You could try changing this line here: https://github.com/ITensor/ITensors.jl/blob/master/src/mps/dmrg.jl#L108 to ishermitian::Bool = false. You can also change the line to ishermitian::Bool = get(kwargs, :ishermitian, true) to have DMRG use the keyword argument ishermitian, which gets passed to the eigensolver from KrylovKit as Miles alluded to. I didn't make it available yet since I hadn't tested that functionality at all.

Could you try that out for your problem and let us know if it works? We can make it available if we get some confirmation that it works ok.

-Matt
commented by (290 points)
Hi Matt,

Thank you for your suggestion. I will be working on this for some non-Hermitian Hamiltonian. Just a technical question here as I am a newbie for Julia: should I write a new julia function, say nHdmrg.jl or I create my own package based on ITensor.jl as it is written here: https://itensor.github.io/ITensors.jl/stable/AdvancedUsageGuide.html

-Tianqi
commented by (14.1k points)
Hi Tianqi,

No need to make your own package or make a new function. You can follow the instructions in this section:

to make your own local "development" version of ITensors.

Unfortunately that section needs more details and is a work in progress, but all you have to do is type the command julia>] dev ITensors (where ] enters package mode at the Julia REPL). Then, if you edit the dmrg function in the file ~/.julia/dev/ITensors/src/mps/dmrg.jl, you will see the changes you make when you use ITensors with using ITensors.

As that section mentions, if you install the package Revise with julia>] add Revise, it makes it so that when you edit your local version of ITensors found in ~/.julia/dev/ITensors, you don't even have to restart Julia to see the change you make. You can test this by adding a print statement, like println("Testing Revise"), inside the dmrg function, and then run the dmrg function without restarting your Julia session.

To switch back to the "official" ITensors version you had installed, you can type julia>] free ITensors. The development version will still be saved and you can use it again by typing julia>] dev ITensors. This is the preferred way to develop a package, and you can use it to make a pull request to ITensors.

Let me know if you have any questions or if the process is confusing, I'll try to update that page with more details about the development process.

-Matt
commented by (290 points)
Hi Matt,

Thanks for your explanation in detail. It is very clear. I will try this and let you all know about my results here at a later time.

Tianqi