# 1D SSH model DMRG code

+1 vote

HI,

I am new to C language and iTensor.
I want to perform a DMRG calculation on the SSH model with Hamiltonian

$H=-\sum\i (1+\eta) c{A,i}^\dagger c{B,i} +(1-\eta) c{B,i}^\dagger c_{A,i+1} + h.c.$

I considered the A site as odd index site and B site as even index in a 1D chain. This is the code I used

#include "itensor/all.h"
using namespace itensor;
int main()
{
int N = 20;
Real eta = 0.5;

auto sites = Spinless(N);
auto ampo = AutoMPO(sites);
for(int j = 1; j <= N; ++j)
{
if (j%2 == 1)
{
ampo += -(1+eta),"Cdag",j,"C",j+1;
ampo += -(1+eta),"Cdag",j+1,"C",j;
}
else (j%2 ==0)
{
ampo += -(1-eta),"Cdag",j,"C",j+1;
ampo += -(1-eta),"Cdag",j+1,"C",j;
}
}
auto H = MPO(ampo);
auto psi = MPS(sites);

auto sweeps = Sweeps(5);
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 energy = dmrg(psi,H,sweeps,"Quiet");

printfln("\nGround State Energy = %.10f",energy);

return 0;
}


However, the Hamiltonian seems haven't been created properly. The program terminated at a line saying "Using approx/svd conversion of AutoMPO->MPO"... May someone suggests what's wrong in my code?