jcmgray / quimb

A python library for quantum information and many-body calculations including tensor networks.
http://quimb.readthedocs.io
Other
484 stars 108 forks source link

p0 - Initial MPS guess - DMRG #216

Closed mehrankhosrojerdi closed 8 months ago

mehrankhosrojerdi commented 8 months ago

What is your issue?

Hello @jcmgray !

A quick question about initial MPS guess, first let me explain what the project aim is. There is a many body system based on the ANNNI Hamiltonian model, which is formed as follows:

$$H{ANNNI} = J \sum S{X}^{i} S{X}^{i+1} -k \sum S{X}^{i} S{X}^{i+2} + h \sum S{Z}^{i}$$

This Hamiltonian includes the nearest neighbour and the next nearest neighbour which I made the Local Hamiltonian of this model based on the first article that you mentioned in issue #61. The aim of this project is implementing this special type of local Hamiltonian in the form of the DMRG.

# define the zero MPO tensor
W = np.zeros([5, 5, 2, 2], dtype = float)
# allocate different values to each of the sites
W[0, 0, :, :] = I
W[0, 1, :, :] = X
W[0, 2, :, :] = X
W[0, 4, :, :] = h * Z
W[1, 4, :, :] = j * X
W[2, 3, :, :] = I 
W[3, 4, :, :] = -k * X
W[4, 4, :, :] = I
Wl = W[0, :, :, :]
Wr = W[:, 4, :, :]
# build the MPO
H = qtn.MatrixProductOperator([Wl] + [W] * (L - 2) + [Wr])

To implement the finite DMRG, I simply need to place the local Hamiltonian inside the DMRG function, and it will calculate the DMRG state with optimized energy. Here the question is, how we can understand that DMRG is finding the global minimum energy rather than the local minimum one.

I encountered this question when I tried to consider different conditions for $p0$ such as ones MPS, zeros MPS, the MPS derived from dense Hamiltonians, the MPS formed by combining eigenstates for each site, and of course the random MPS with the same bond dimension as MPO.

Thus, the result is sensitive to the MPS, because I had different results for each of these conditions. I have to find a strategy that allows me to be confident about the ground state that I get. Otherwise, everything will be random.

My questions are briefly here: How I can determine an appropreate form of the $p0$ in DMRG case ? Can you tell me how important the bond dimension of $p0$ is in this case? What is the importance of the number of "sweeps" in this case?

Thank you in advance. I'm looking forward to your reply.

jcmgray commented 8 months ago

Hi @mehrankhosrojerdi, sorry to be slow getting to this!

It looks like you have got the MPO set-up correctly. Doing DMRG calculations is indeed a bit of an art and requires ideally some knowledge of how the algorithm works (the intro here is quite good https://arxiv.org/abs/1603.03039 if you haven't read something similar yet!). But to answer roughly your questions:

  1. the initial state sometimes is important and sometimes is not, generally a random MPS is an OK starting guess for spin problems as it essentially will always have a non-zero overlap with the target state. You can try a few different ones and if they are not converging to the same thing then one can start to think harder about initial states.
  2. the bond dimension of the initial state is often not that important and chosen as something on the small side, since it is adaptively increased if necessary during the DMRG2 sweeps.
  3. the DMRG algorithm is iterative, so one generally wants a number of sweeps sufficient for the energy to converge.

I think it would be helpful if you posted a full-enough version of the code (i.e. the Hamiltonian parameters you are using and how you are calling the DMRG routine etc.), that can run standalone and demonstrates the problem. I say that because when I choose some random parameters, and in relation to the points above, DMRG on this MPO seems to nicely converge for a) different random states b) different initial bond dimensions and c) within a small number of sweeps.

mehrankhosrojerdi commented 8 months ago

Dear professor @jcmgray many thanks for your answere. I can see convergance in DMRG state and just the result for optimized energy is different for different MPSs after millionths which it could be either due to the computational error or degeneracy. I had some ambiguties about bond dimension and sweep that are solved. Anyway, I appreaciate your reply a lot.

jcmgray commented 8 months ago

is different for different MPSs after millionths

Ah okay if you mean in the far digits of precision, that is quite possible. You can set the tolerance to converge which should fix this - the defaults are more in line with what is usual for simulations rather than matching e.g. numerical precision.

Closing this for now, but feel free to re-open or start a discussion if you have more questions!