Hi Miles,

I've attempted to calculate the ground-state fidelity

for the transverse Ising model using DMRG. I'm getting

incorrect results. Below is my code (adapted from

excited_dmrg.cc). Can you help me with this?

(Another question: How do you suppress in the code

intermediate outputs?)

Thanks in advance.

Oz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

## include "itensor/all.h"

using namespace itensor;

## define N 100

## define NP 11

## define J -1.0

## define DL 0.1

double h,h1;

double fid[NP];

double E0[NP],E1[NP];

int main()

{

for(int k = 0; k < NP-1; ++k)

{

h= 0.5 + 0.1*k;

h1= h + DL;

//creates_chain()

```
auto sites = SpinHalf(N); //make a chain of N spin 1/2's
```

// creates_hamiltonian() transvese field - h

```
auto ampo = AutoMPO(sites);
for(int j = 1; j < N; ++j)
{
ampo += -4*J,"Sz",j,"Sz",j+1;
}
for(int j = 1; j <= N; ++j)
{
ampo += -2*h,"Sx",j;
}
auto H = MPO(ampo);
```

//// creates_hamiltonian() transvese field - h1= h + DL

```
auto ampo1 = AutoMPO(sites);
for(int j = 1; j < N; ++j)
{
ampo1 += -4*J,"Sz",j,"Sz",j+1;
}
for(int j = 1; j <= N; ++j)
{
ampo1 += -2*h1,"Sx",j;
}
auto H1 = MPO(ampo1);
```

// init_wavefunction()

```
auto state = InitState(sites);
for(int i = 1; i <= N; ++i)
{
if(i%2 == 1)
state.set(i,"Up");
else
state.set(i,"Dn");
}
auto psi = MPS(state);
```

//sets*sweeping*parameters()

```
auto sweeps = Sweeps(30);
sweeps.maxm() = 10,20,100,100,200;
sweeps.cutoff() = 1E-10;
sweeps.niter() = 2;
sweeps.noise() = 1E-7,1E-8,0.0;
```

// println(sweeps);

```
auto psi0 = MPS(sites);
auto psi1 = MPS(sites);
```

//finds_groundstate()

```
auto en0 = dmrg(psi0,H,sweeps,{"Quiet=",true});
auto en1 = dmrg(psi1,H1,sweeps,{"Quiet=",true});
```

// println("\n----------------------\n");

```
fid[k]= overlap(psi0,psi1);
E0[k] = en0;
E1[k] = en1;
```

}

printfln(" h fidelity");

for(int k = 0; k < NP-1; ++k)

{

h= 0.5 + 0.1*k;

printfln("%.2f %.5E",h,fid[k]);

}

return 0;

}