joselado / dmrgpy

DMRGPy is a Python library to compute quasi-one-dimensional spin chains and fermionic systems using matrix product states with DMRG as implemented in ITensor. Most of the computations can be performed both with DMRG and exact diagonalization for small systems, which allows one to benchmark the results.
GNU General Public License v3.0
84 stars 20 forks source link

excited energy #16

Closed rgst04 closed 1 year ago

rgst04 commented 1 year ago

Hi Professor,

Thanks for the resource, I find it very useful. I am trying to use DMRG to calculate excited energy of a spin system. When I used sc.get_excited(mode="DMRG"), it does not give me the full spectrum (all eigenvalues of the system). I am wondering how I could get all the excited energy eigenvalues? Thanks.

joselado commented 1 year ago

Hi rgst04,

thank you for your message. To get a certain number of excited states, for example 5, you should write sc.get_excited(mode="DMRG",n=5) the code will give you the states closest to the ground state (including the ground state)

Best regards, Jose

rgst04 commented 1 year ago

Hi Professor,

Thank you very much for the reply. For es,ws=sc.get_excited_states(mode="DMRG", n=5), does that give me both the energy and eigenvectors? When I tried to print the value, it seems to give me the eigenvalues, but when I use "print(ws)", it does not print the eigenstates. How could I get the eigenvectors in this case?

joselado commented 1 year ago

Hi rgst04,

ws is a list of eigenvectors. The eigenvectors are not simple numeric arrays, but rather abstract objects. Those objects can be summed, and you can compute expectation values of operators as done in the example below https://github.com/joselado/dmrgpy/blob/master/examples/sum_mps/main.py

Best regards, Jose

rgst04 commented 1 year ago

Hi Professor,

Thanks very much, that is very helpful. When I tried to run the example https://github.com/joselado/dmrgpy/blob/master/examples/excited_states/main.py, I changed the number of sites n=15, what I found is that the "ED" mode almost takes the same time as the"DMRG" mode. I am wondering if there is a reason for this or if there is a way to make "DMRG" faster than "ED" mode?

joselado commented 1 year ago

Hi rgst04,

the DMRG mode will be faster than ED as you go to bigger systems. In particular, for n=40 it would not be possible to use ED due to memory limitations, while with DMRG you will be able to compute excited states.

Best regards, Jose