set "errgoal" and "maxiter" in Davidson algorithm manually

Dear there,
I have a maybe naive question about how to set parameters used in Davidson iteration in ITensor. When I do DMRG calculation, I run something like this:

sweeps= Sweeps(10) 
setmaxdim!(sweeps, 3000)
energy, psi = dmrg(H, psi0, sweeps, observer=obs; write_when_maxdim_exceeds=1000)

And I find in iterativesolvers.jl in ITensor github, the Davidson function takes some other parameters like maxiter, errgoal etc. The default errgoal is 1E-14, but I want to increase it to larger number in initial sweeps. Could you let me know how to do that? Thank you so much!!

The current version doesn’t use the davidson routine for DMRG but eigsolve from KrylovKit.jl
The latest version should have this but the docs for it are in the dev version here
Check out

  • eigsolve_krylovdim::Int = 3
  • eigsolve_tol::Number = 1e-14
  • eigsolve_maxiter::Int = 1

(If you are using the davidson routine elswhere, then you can simply pass those parameters you mention)

2 Likes

Thank you!!
I’ve another naive syntex question… I’m not very sure what’s the difference between using " ; " or
" , " in dmrg(H, psi0, other arguments...) ? For example, before I use:
dmrg(H, psi0, sweeps, observer=obs; write_when_maxdim_exceeds=1000)
Now I change to use:
dmrg(H, psi0, sweeps, observer=obs; eigsolve_tol=1e-6, write_when_maxdim_exceeds=1000)

Both works perfectly without error, but I’m actually not sure what arguments should be separated by " ; " and what should be separated by " , "…

Also is there a way I can make ITensor print out eigsolve parameters like eigsolve_tol in each sweep so that I can keep track of the value I set manually?
Thank you!

Hi @zz123,
For questions about Julia syntax, please use the Julia Discourse (https://discourse.julialang.org) and/or consult the Julia docs. Regarding your question about the semicolon, here is the relevant docs page:
https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments

For custom printing of variables inside of DMRG, we offer the “Observer” system (see more info here). However, currently the parameters like eigsolve_tol aren’t passed to the observer object, so we’d have to change that to make them available. I think it’s a good idea to do that, so I’ll modify the code to make sure those are also passed.

Best regards,
Miles

1 Like

Actually, upon looking at our DMRG code some more, here’s what I’d recommend about printing the eigsolve_tol parameter and similar ones. These parameters are kept the same throughout all of the DMRG sweeps, so there isn’t much call to print them every step or every sweep. A good solution for you, if you’d like to print them, is just to print out the keyword arguments you are passing into DMRG, such as eigsolve_tol, right before you call DMRG, and then you can be assured it is kept the same inside DMRG.

For parameters you aren’t passing, you can assume they are held fixed to their default values throughout. For these default values, see the dmrg function documentation here.

Got it! Thank you so much!