# Difference between revisions of "Tutorial:SparseDiagonalization"

### The one dimensional Heisenberg chain

The parameter file sparsediag/parm1 sets up a spin-1 Heisenberg chain with 4 sites:

MODEL="spin"; LATTICE="chain lattice"; LATTICE_LIBRARY="../lattices.xml" MODEL_LIBRARY="../models.xml" CONSERVED_QUANTUMNUMBERS="Sz"; MEASURE_LOCAL[Local magnetization]=Sz MEASURE_STRUCTURE_FACTOR[Structure Factor Sz]=Sz MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus" local_S=1; J=1; {L=4;}

Using the following sequence of commands you can first convert the input parameters to XML and then run the application sparsediag:

parameter2xml parm1 sparsediag parm1.in.xml

The lowest Eigenvalues/Eigenstates are calculated in each sector (Sz,P) where P denotes the total momentum. The outputfile parm1.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser. In our case the ground state lies in the Sz=0, P=0 sector. The corresponding diagonal spin correlations look like

Diagonal spin correlations[( 0 ) -- ( 0 )] (0.666667,0) Diagonal spin correlations[( 0 ) -- ( 1 )] (-0.5,0) Diagonal spin correlations[( 0 ) -- ( 2 )] (0.333333,0) Diagonal spin correlations[( 0 ) -- ( 3 )] (-0.5,0)

The numbers [( a ) -- ( b )] in the above brackets refer to site indices, i. e. Sz(a)*Sz(b). In the right column one can read off the (complex) value of the correlation function.

The output for the Sz structure factor for this state looks like

Structure Factor Sz[( 0 )] 5.551115123125783e-17 Structure Factor Sz[( 1.570796326794897 )] 0.333333333333333 Structure Factor Sz[( 3.141592653589793 )] 2 Structure Factor Sz[( 4.71238898038469 )] 0.3333333333333329

where the number in the brackets [(q)] denotes the wavenumber.

One can specify the Sz sector explicitly by adding the following line to the parameter file:

Sz_total=0;

Now, only the Eigenvalues/Eigenstates with Sz=0 are calculated.

In the next example (parm2) we calculate the Haldane Gap for L=4...10, which is the energy gap between the lowest Sz=0 state and the lowest Sz=1 state:

MODEL="spin"; LATTICE="chain lattice"; LATTICE_LIBRARY="../lattices.xml" MODEL_LIBRARY="../models.xml" CONSERVED_QUANTUMNUMBERS="Sz"; local_S=1; J=1; {L=4;Sz_total=0;} {L=4;Sz_total=1;} {L=6;Sz_total=0;} {L=6;Sz_total=1;} {L=8;Sz_total=0;} {L=8;Sz_total=1;} {L=10;Sz_total=0;} {L=10;Sz_total=1;}

We find the following values:

L=4: Egap = 1.00000000000000 L=6: Egap = 0.72062736262389 L=8: Egap = 0.59355525437528 L=10:Egap = 0.52480795041362

For L->infinity one finds the value of the Haldane gap in the thermodynamic limit Egap=0.41.

Note that the XML output file contains a result denoted by "Energy Gap". In our case this corresponds to the gap in a certain Sz_total sector. For example in above case for L=4 and Sz_total=0 we find the lowest energy at total momentum P=0 and the second lowest energy at P=pi/2 (resp. 3pi/2). The difference between those two energies is denoted by "Energy Gap" in the output file. For L->infinity we reach the continuum limit so that this gap vanishes.

### Spectrum of the S=1/2 Heisenberg ladder

The parameter file sparsediag/parm3 sets up a spin-1/2 Heisenberg ladder of length 8:

MODEL="spin"; LATTICE="ladder"; LATTICE_LIBRARY="../lattices.xml" MODEL_LIBRARY="../models.xml" CONSERVED_QUANTUMNUMBERS="Sz"; local_S=1/2; L=8; J=1; J'=1; {h=0;}

J and J' denotes the coupling strength along the legs and on the rungs of the ladder respectively.

We again convert the input file to XML by

parameter2xml parm3

and then run the program with

sparsediag parm3.in.xml

(this will take a while since more than 100 sectors will be computed).

The output file parm3.task1.out.xml contains the lowest Eigenvalue in each sector defined by total Sz and total momentum P. You can use a standard internet browser to view it.