# optimizing over product states

Hi,

I am trying to run a DMRG optimizing over product states.
My guess was setting maxm = 1 in the final sweeps.

I used the following setup:

Sweeps sweeps = Sweeps(15);
sweeps.maxm() = 5,10,20,50,100,50,20,10,5,1;
sweeps.cutoff() = 1E-15;
sweeps.niter() = 2,2,2,3,4,3,2,2,1;
sweeps.noise() = 1e-4,1e-5,1e-6,1e-7,1e-8,0;
dmrg(psi0, H, sweeps);


The problem is, once in a while, the DMRG keeps m=0 and I get a segfault, e.g.,

Sweep=9, HS=1, Bond=1/2
I 0 q 8E-13 E -0.1662838484
I 1 q 8E-13 E -0.1662838484
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=5
Trunc. err=0.0E+00, States kept: m=2
Sweep=9, HS=1, Bond=2/2
I 0 q 8E-13 E -0.1662838484
I 1 q 7E-13 E -0.1662838484
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=5
Trunc. err=0.0E+00, States kept: m=2
Sweep=9, HS=2, Bond=2/2
I 0 q 7E-13 E -0.1662838484
I 1 q 7E-13 E -0.1662838484
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=5
Trunc. err=0.0E+00, States kept: m=2
Sweep=9, HS=2, Bond=1/2
I 0 q 7E-13 E -0.1662838484
I 1 q 7E-13 E -0.1662838484
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=5
Trunc. err=0.0E+00, States kept: m=2

vN Entropy at center bond b=1 = 0.693147179809
Eigs at center bond b=1: 0.5000 0.5000
Largest m during sweep 9/15 was 2
Largest truncation error: 0
Energy after sweep 9/15 is -0.166283848350
Sweep 9/15 CPU time = 0.000961s (Wall time = 0.00123s)
Sweep=10, HS=1, Bond=1/2
I 0 q 7E-13 E -0.1662838484
I 1 q 7E-13 E -0.1662838484
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=1
Trunc. err=5.0E-01, States kept: m=0
Sweep=10, HS=1, Bond=2/2

Intel MKL ERROR: Parameter 14 was incorrect on entry to cblas_dgemm.

Intel MKL ERROR: Parameter 9 was incorrect on entry to cblas_dgemm.


First, i thought it was the MKL, but it also happens with the OSX Accelerate framework. Btw., I am using v2.

I chose such sweeps.maxm() to give it room to escape local minima, but I don't know whether it is the best approach to optimize over product states.

Any thoughts on that?

commented by (590 points)
niter must be at least 2, you have it as 1 on sweep 9. [1]

[1]: http://itensor.org/docs.cgi?page=classes/sweeps&vers=cppv2
commented by (120 points)
I've tried different values (2,3,4), but I am still getting m=0:
Truncated to Cutoff=1.0E-15, Min_m=1, Max_m=1
Trunc. err=5.0E-01, States kept: m=0
commented by (120 points)
I tried v3, but I am getting the same issue.
I don't know whethet I should report it in GitHub as well.
commented by (7.3k points)
Hello,

We will look into this to see if there is anything strange going on with the truncation.

However, one suggestion I have is, if you are interested in a product state at the end, is it sufficient to run DMRG at a finite bond dimension (greater than 1), and then after the DMRG run truncate the MPS down to a product state? In theory, I would think this should give you a better product state (i.e. a product state with lower energy).

Cheers,
Matt
commented by (44k points)
I would concur with Matt that you might be much better off not trying to run DMRG with a bond dimension set to 1. Even if our code did not give you an error in this regime (which we will look into) it’s questionable to me whether the DMRG algorithm itself (not just our implementation of it) is suitable for optimizing product states.

Matt’s approach is one good idea for finding a lowest-energy product state.

Another idea would just be to parameterize each of the tensors of the product state with a small number of parameters, then do gradient-descent optimization of the energy over these parameters. Deriving the expressions for the gradients would not be too challenging, and for specialized cases like this it’s best to write custom code I think.

Miles
commented by (120 points)
Hi Matt/Miles,

Yeah, I haven't  thought about truncate it afterwards!
Easy peasy! :)

Thanks!

Thiago
commented by (44k points)
Hi Thiago,
Just wanted to add, though, that as far as I know, this procedure is *not* guaranteed to give the lowest energy product state. It could be, but I don’t know the argument for it in general.

So I would recommend doing further optimization on the product state afterward in order to be sure you have found a minimum.

Best regards,
Miles