https://alps.comp-phys.org/mediawiki/api.php?action=feedcontributions&user=Afeiguin&feedformat=atomALPS - User contributions [en]2022-05-16T05:52:14ZUser contributionsMediaWiki 1.27.7https://alps.comp-phys.org/mediawiki/index.php?title=Main_Page&diff=4263Main Page2011-08-04T16:06:44Z<p>Afeiguin: </p>
<hr />
<div>__NOTOC__ <br />
__NOEDITSECTION__<br />
<br />
<h4><br />
<p align="right"> English / Deutsch / [[メインページ | 日本語]] / [[主頁 | 繁體中文]] / [[主頁(简体) | 简体中文]] </p><br />
</h4><br />
<br />
<br />
<center><font size="16">Welcome to the ALPS project.</font></center><br />
<br />
<br />
The '''ALPS project''' ('''A'''lgorithms and '''L'''ibraries for '''P'''hysics '''S'''imulations) is an open source effort aiming at providing high-end simulation codes for strongly correlated quantum mechanical systems as well as C++ libraries for simplifying the development of such code. ALPS strives to increase software reuse in the physics community.<br />
<br />
<h1>Announcement:</h1> ALPS school on numerical methods to be held in Bariloche, Argentina, Dec. 2-5 2011 and related conferences:<br />
ANDES/ALPS School on Numerical Methods for Many-Body Theories Dec. 2-5, 2011, Bariloche, Argentina http://fisica.cab.cnea.gov.ar/mbt16/index.php/ANDES/ALPS_School_on_Numerical_Methods_for_Many-Body_Theories<br />
and http://fisica.cab.cnea.gov.ar/mbt16/<br />
<br />
<br />
{| style="background-color:#E8F1FF; padding:4px; border:2px solid gray"<br />
<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
== [[ALPS:Community_Portal | Community]] ==<br />
<br />
Check back regularly to read the '''latest news''' and information on the '''people''' contributing to the project.<br />
<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
== [[Forum:Overview | User Forum]] ==<br />
<br />
Go here to '''discuss''' the ALPS libraries and applications with the community of developers. <br />
This is the place to address any questions you encounter while using any codes of the ALPS project.<br />
<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
== [[PapersTalks | Papers and Talks]] ==<br />
<br />
Go here to '''find papers''' on the ALPS project, '''talks''' from the first user workshop and a list of papers citing the ALPS project.<br />
<br />
|}<br />
<br />
<br />
<br />
<br />
{| style="background-color:#E8F1FF; padding:4px; border:2px solid gray"<br />
<br />
|-<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
== [[Download_and_install_ALPS _2 | Download and Installation]] ==<br />
<br />
Useful information '''how to install''' the alps libraries and applications on workstations and clusters.<br />
<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
<br />
== Tutorials ==<br />
<br />
[[Documentation:Running_ALPS_Simulations | '''How to run''' ALPS applications]]<br />
<br />
[[ALPS_2_Tutorials:Overview | Tutorials on the ALPS applications]]<br />
<br />
[[ALPS_2_Tutorials:Coding| Tutorials on using ALPS libraries for your applications]]<br />
<br />
<br />
| bgcolor="#FFFFFF" width="33%" height="50%" valign="top" style="border: 1px solid #E8F1FF;padding-left:0.5em;padding-right:0.5em;"|<br />
== Documentation ==<br />
[[ALPS_2_Documentation:Overview | Reference documentation]]<br />
<br />
|}<br />
<br />
<br />
The main new feature of the new ALPS 2.0 release include:<br />
* New build system using CMake simplifies builds and allows builds on Windows, the Cray XT5 and other platforms that were not supported before<br />
* Binary installer packages<br />
* Binary file format HDF5 uses less space and much faster I/O<br />
* Python-based evaluation and plotting tools are simpler, much more flexible and powerful<br />
* Integration with [http://www.vistrails.org VisTrails] workflow provenance system<br />
* New applications: DMFT and TEBD<br />
* Updated applications<br />
* New and more tutorials<br />
<br />
More features, new applications, and scalability to petaflop-class machines are planned for ALPS 2.1<br />
<br />
<br />
See [[ALPS_1.3]] to access the previous version of ALPS.<br />
<br />
To contribute to this Wiki you will need to have an [[Help:Contents|account]] allowing you to edit the content of the Wiki pages.<br />
<br />
(c) 2005-2011 The ALPS collaboration</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3672ALPS 2 Tutorials:DMRG-04 Correlations2010-07-15T23:17:52Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=32<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3671ALPS 2 Tutorials:DMRG-04 Correlations2010-07-15T23:17:34Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1/2 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=32<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3670ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T23:17:06Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector (same as before, we shall use a smaller system and number of states for illustration):<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=32<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3669ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T23:16:42Z<p>Afeiguin: /* Magnetisation in the Spin-1/2 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector (same as before, we shall use a smaller number of states for illustration):<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=32<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3668ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T23:16:31Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector (same as before, we shall use a smaller number of states for illustration):<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3666ALPS 2 Tutorials:DMRG-04 Correlations2010-07-15T17:54:44Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3665ALPS 2 Tutorials:DMRG-04 Correlations2010-07-15T17:54:14Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1/2 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3664ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T17:52:53Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector (same as before, we shall use a smaller number of states for illustration):<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3663ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T17:52:19Z<p>Afeiguin: /* Magnetisation in the Spin-1/2 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3662ALPS 2 Tutorials:DMRG-03 Local Observables2010-07-15T17:52:08Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=40<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-02_Gaps&diff=3661ALPS 2 Tutorials:DMRG-02 Gaps2010-07-15T17:51:13Z<p>Afeiguin: /* Example: with quantum numbers */</p>
<hr />
<div>=Calculating The Gap=<br />
<br />
As already mentioned, the energy gap of a quantum system is given by the energy difference between the first excited state and the ground state<br />
<br />
<math>\Delta = E_1 - E_0</math> <br />
<br />
in the thermodynamic limit. This means we have to solve two problems, (i) the calculation of <br />
<br />
<math>\Delta(L) = E_1 (L) - E_0 (L)</math><br />
<br />
for finite system sizes and (ii) extrapolate <math>\Delta (L)</math> to the thermodynamic limit <math>L= \infty</math>. The latter is not specific to DMRG, but because of its preference for open boundary conditions somewhat more complicated than in the more usual case of periodic boundary conditions.<br />
<br />
==Getting The Gap For Finite Systems==<br />
<br />
Obviously, we have to be able to get access to the first excited state and its energy. DMRG fundamentally knows two ways of doing this, one which works always, but is not as neat, and another one, which is very clean, but does not work under all circumstances.<br />
<br />
# The pedestrian way is to set up a DMRG calculation that calculates both states at the same time. However, for a given number of states the accuracy will somewhat decrease, as two different quantum states both have to be described well. <br />
# The smarter way reduces the gap calculation to the calculation of two ground states. In many quantum systems, the ground state and the first excited state differ by a good quantum number and therefore are both ground states in the respective sectors. For example, for the spin-1/2 chain, the ground state is a singlet of total spin 0, and hence the ground state in the sector of magnetization 0. The first excited state is a triplet of total spin 1, i.e. consists of one excited state of magnetization 0, and the ground states of the sectors of magnetization +1 and -1 respectively. It can therefore be calculated as the ground state in magnetization sector +1.<br />
<br />
Let us do this calculation first for the spin-1/2 chain:<br />
<br />
=== Example: without quantum numbers ===<br />
<br />
In this example below, we include a line in the parameter file for the spin S=1/2 chain to tell the code that we also want to calculate the energy for the first excited state. The algorithm will build a density matrix targeting two states: the ground-state, and the first excited state, both in the same subspace with Sz=0. Since the first excited state is a triplet, this will yield the singlet-triplet gap.<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
L=32, MAXSTATES=40<br />
NUMBER_EIGENVALUES=2<br />
<br />
Notice that we only added the last line, specifying the number of eigenstates to calculate. By targeting both states, the algorithm ensures that both are represented accurately. However, this is not quite true if we keep only 100 states. Compare the energy for the ground-state obtained with the present parameter file, and the previous simulation targeting only the ground state. <br />
<br />
It is important to notice that the entanglement entropy in this example is totally meaningless, since the algorithm is calculating a density matrix mixing two states.<br />
<br />
=== Example: with quantum numbers ===<br />
<br />
To calculate the singlet-triplet gap taking advantage of quantum number conservation we need to perform two independent simulations, one with Sz=0, and another one with Sz=1. The difference of the two energies will yield the gap. This means that we only need to change the value of Sz_total in the spin_onehalf parameter file:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=1<br />
SWEEPS=4<br />
J=1<br />
L=32, MAXSTATES=40<br />
<br />
In a first attempt, fix <math>D=50,100,150</math> and calculate the gap for lengths <math>L=32,64,96,128</math>. For fixed <math>D</math>, plot the gap versus <math>1/L</math>. What you should see is that for small <math>D</math>, the results will not lie on a straight line passing through 0, but they will curve up from it. This behaviour gets better when <math>D</math> gets larger. Discuss why this might be.<br />
<br />
In a second, more meaningful attempt, fix the lengths <math>L=32,64,96,128</math> and vary <math>D=50,100,150,200</math> in order to extrapolate the gap for each fixed length in <math>D</math> (or, as explained above, the truncation error). What does the plot of the gap versus <math>1/L</math> look like now?<br />
<br />
Modify the file spin_onehalf_multiple to setup all the runs for Sz=0 and Sz=1, for different system sizes and different number of states. Use five sweeps, and extrapolate the value of the gap following the procedure outlined in the tutorial.<br />
<br />
==Extrapolating The Gap To The Thermodynamic Limit==<br />
<br />
The case of the spin-1/2 chain is a bit frustrating, because all you will be able to say, even if you push the computer to its limits, is that the gap seems to be extremely small to the best of your abilities and therefore is likely to vanish. But who can tell you that you are not looking at a case where the gap is, say, <math>e^{-50}</math>? This of course is a sobering reminder of the limits of even a highly accurate numerical method.<br />
<br />
Let us therefore turn to a more rewarding question, what is the gap of the spin-1 antiferromagnetic Heisenberg chain?<br />
<br />
Here, there is a nasty twist, which we will at the moment only state and act on, but explain only later: Calculate the gap not between the ground states of the magnetization sectors 0 and 1, but 1 and 2. If you wish, do it also for 0 and 1, for later reference, but the following refers to 1 and 2.<br />
<br />
Assume you have <math>\Delta (L)</math> with machine precision, either by a suitable extrapolation as discussed above or by a very high accuracy calculation. If you don't want to do the former, calculate the gap for system sizes <math>L=8,16,32,48,64,96,128,192,256</math> with <math>D=300</math> states each and 5 sweeps. <br />
<br />
As the effects of the open ends will decrease as <math>1/L</math>, it always makes sense to<br />
first plot the gaps <math>\Delta (L)</math> versus <math>1/L</math>, as was already done in the spin-1/2 case. Produce such a plot.<br />
<br />
What you see, is a curve that is quite straight for small L and then starts bending upward. What gap would you obtain if you extrapolate the linear part of the curve naively? (This question is relevant for situations where the correlation length of the chain is so long that it becomes hard to see the asymptotic behaviour on reachable length scales.) Is it over- or underestimated?<br />
<br />
What gap do you read off if you take the longest chain you have? Is it over- or underestimated?<br />
<br />
The ideal would be to have an idea of what the asymptotic behaviour (the curved part for long lengths) is like analytically to extrapolate. Do a plot of the gap as <math>\Delta (L)</math> versus <math>1/L^2</math>. What does the curve now look like for big lengths? Extrapolate the gap.<br />
<br />
The last plot was in fact motivated by the following argument: from Haldane's analysis of the spin-1 chain by the nonlinear sigma model, one expects that the lowest lying excitations (which for periodic boundary conditions can be labeled by a momentum <math>k</math>) are around <math>k=\pi</math> and have an energy<br />
<br />
<math>E(k) = E_0 + \sqrt{\Delta^2 + c^2 (k-\pi)^2}</math>.<br />
<br />
For the open boundary conditions, we may approximate <math>k-\pi</math> by <math>1/L</math> (think about a particle in a box), which gives a finite-system size gap of<br />
<br />
<math>\Delta(L) \approx \Delta \left( 1 + \frac{c^2}{2\Delta^2 L^2} \right) </math><br />
<br />
and indicates that in the asymptotic limit the convergence should essentially be as <math>1/L^2</math>. How close do you get to the result <math>\Delta=0.41052</math>?<br />
<br />
For those, that also did the gap between the ground states of magnetisation sectors 0 and 1, show that the gap you get there is essentially zero. All others, take this result for granted and start worrying: why is the finite gap the right one and the vanishing gap the wrong one? Is this a physics lottery? In fact, there is a very good reason why the spin-1 chain shows this peculiar behaviour for open boundary conditions that can be found analytically; but even if we were not so fortunate as to know it, we could detect the problem right away! This can be done by the observation of local observables.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-02_Gaps&diff=3660ALPS 2 Tutorials:DMRG-02 Gaps2010-07-15T17:51:02Z<p>Afeiguin: /* Example: without quantum numbers */</p>
<hr />
<div>=Calculating The Gap=<br />
<br />
As already mentioned, the energy gap of a quantum system is given by the energy difference between the first excited state and the ground state<br />
<br />
<math>\Delta = E_1 - E_0</math> <br />
<br />
in the thermodynamic limit. This means we have to solve two problems, (i) the calculation of <br />
<br />
<math>\Delta(L) = E_1 (L) - E_0 (L)</math><br />
<br />
for finite system sizes and (ii) extrapolate <math>\Delta (L)</math> to the thermodynamic limit <math>L= \infty</math>. The latter is not specific to DMRG, but because of its preference for open boundary conditions somewhat more complicated than in the more usual case of periodic boundary conditions.<br />
<br />
==Getting The Gap For Finite Systems==<br />
<br />
Obviously, we have to be able to get access to the first excited state and its energy. DMRG fundamentally knows two ways of doing this, one which works always, but is not as neat, and another one, which is very clean, but does not work under all circumstances.<br />
<br />
# The pedestrian way is to set up a DMRG calculation that calculates both states at the same time. However, for a given number of states the accuracy will somewhat decrease, as two different quantum states both have to be described well. <br />
# The smarter way reduces the gap calculation to the calculation of two ground states. In many quantum systems, the ground state and the first excited state differ by a good quantum number and therefore are both ground states in the respective sectors. For example, for the spin-1/2 chain, the ground state is a singlet of total spin 0, and hence the ground state in the sector of magnetization 0. The first excited state is a triplet of total spin 1, i.e. consists of one excited state of magnetization 0, and the ground states of the sectors of magnetization +1 and -1 respectively. It can therefore be calculated as the ground state in magnetization sector +1.<br />
<br />
Let us do this calculation first for the spin-1/2 chain:<br />
<br />
=== Example: without quantum numbers ===<br />
<br />
In this example below, we include a line in the parameter file for the spin S=1/2 chain to tell the code that we also want to calculate the energy for the first excited state. The algorithm will build a density matrix targeting two states: the ground-state, and the first excited state, both in the same subspace with Sz=0. Since the first excited state is a triplet, this will yield the singlet-triplet gap.<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
L=32, MAXSTATES=40<br />
NUMBER_EIGENVALUES=2<br />
<br />
Notice that we only added the last line, specifying the number of eigenstates to calculate. By targeting both states, the algorithm ensures that both are represented accurately. However, this is not quite true if we keep only 100 states. Compare the energy for the ground-state obtained with the present parameter file, and the previous simulation targeting only the ground state. <br />
<br />
It is important to notice that the entanglement entropy in this example is totally meaningless, since the algorithm is calculating a density matrix mixing two states.<br />
<br />
=== Example: with quantum numbers ===<br />
<br />
To calculate the singlet-triplet gap taking advantage of quantum number conservation we need to perform two independent simulations, one with Sz=0, and another one with Sz=1. The difference of the two energies will yield the gap. This means that we only need to change the value of Sz_total in the spin_onehalf parameter file:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=1<br />
SWEEPS=4<br />
J=1<br />
L=32, MAXSTATES=100<br />
<br />
In a first attempt, fix <math>D=50,100,150</math> and calculate the gap for lengths <math>L=32,64,96,128</math>. For fixed <math>D</math>, plot the gap versus <math>1/L</math>. What you should see is that for small <math>D</math>, the results will not lie on a straight line passing through 0, but they will curve up from it. This behaviour gets better when <math>D</math> gets larger. Discuss why this might be.<br />
<br />
In a second, more meaningful attempt, fix the lengths <math>L=32,64,96,128</math> and vary <math>D=50,100,150,200</math> in order to extrapolate the gap for each fixed length in <math>D</math> (or, as explained above, the truncation error). What does the plot of the gap versus <math>1/L</math> look like now?<br />
<br />
Modify the file spin_onehalf_multiple to setup all the runs for Sz=0 and Sz=1, for different system sizes and different number of states. Use five sweeps, and extrapolate the value of the gap following the procedure outlined in the tutorial.<br />
<br />
==Extrapolating The Gap To The Thermodynamic Limit==<br />
<br />
The case of the spin-1/2 chain is a bit frustrating, because all you will be able to say, even if you push the computer to its limits, is that the gap seems to be extremely small to the best of your abilities and therefore is likely to vanish. But who can tell you that you are not looking at a case where the gap is, say, <math>e^{-50}</math>? This of course is a sobering reminder of the limits of even a highly accurate numerical method.<br />
<br />
Let us therefore turn to a more rewarding question, what is the gap of the spin-1 antiferromagnetic Heisenberg chain?<br />
<br />
Here, there is a nasty twist, which we will at the moment only state and act on, but explain only later: Calculate the gap not between the ground states of the magnetization sectors 0 and 1, but 1 and 2. If you wish, do it also for 0 and 1, for later reference, but the following refers to 1 and 2.<br />
<br />
Assume you have <math>\Delta (L)</math> with machine precision, either by a suitable extrapolation as discussed above or by a very high accuracy calculation. If you don't want to do the former, calculate the gap for system sizes <math>L=8,16,32,48,64,96,128,192,256</math> with <math>D=300</math> states each and 5 sweeps. <br />
<br />
As the effects of the open ends will decrease as <math>1/L</math>, it always makes sense to<br />
first plot the gaps <math>\Delta (L)</math> versus <math>1/L</math>, as was already done in the spin-1/2 case. Produce such a plot.<br />
<br />
What you see, is a curve that is quite straight for small L and then starts bending upward. What gap would you obtain if you extrapolate the linear part of the curve naively? (This question is relevant for situations where the correlation length of the chain is so long that it becomes hard to see the asymptotic behaviour on reachable length scales.) Is it over- or underestimated?<br />
<br />
What gap do you read off if you take the longest chain you have? Is it over- or underestimated?<br />
<br />
The ideal would be to have an idea of what the asymptotic behaviour (the curved part for long lengths) is like analytically to extrapolate. Do a plot of the gap as <math>\Delta (L)</math> versus <math>1/L^2</math>. What does the curve now look like for big lengths? Extrapolate the gap.<br />
<br />
The last plot was in fact motivated by the following argument: from Haldane's analysis of the spin-1 chain by the nonlinear sigma model, one expects that the lowest lying excitations (which for periodic boundary conditions can be labeled by a momentum <math>k</math>) are around <math>k=\pi</math> and have an energy<br />
<br />
<math>E(k) = E_0 + \sqrt{\Delta^2 + c^2 (k-\pi)^2}</math>.<br />
<br />
For the open boundary conditions, we may approximate <math>k-\pi</math> by <math>1/L</math> (think about a particle in a box), which gives a finite-system size gap of<br />
<br />
<math>\Delta(L) \approx \Delta \left( 1 + \frac{c^2}{2\Delta^2 L^2} \right) </math><br />
<br />
and indicates that in the asymptotic limit the convergence should essentially be as <math>1/L^2</math>. How close do you get to the result <math>\Delta=0.41052</math>?<br />
<br />
For those, that also did the gap between the ground states of magnetisation sectors 0 and 1, show that the gap you get there is essentially zero. All others, take this result for granted and start worrying: why is the finite gap the right one and the vanishing gap the wrong one? Is this a physics lottery? In fact, there is a very good reason why the spin-1 chain shows this peculiar behaviour for open boundary conditions that can be found analytically; but even if we were not so fortunate as to know it, we could detect the problem right away! This can be done by the observation of local observables.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3659ALPS 2 Tutorials:DMRG-01 DMRG2010-07-15T17:50:30Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''LANCZOS_TOLERANCE'''<br />
Tolerance for the diagonalization (Davidson/Lanczos) piece of the code. the default value is 10^-7. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 40 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=40<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg --write-xml spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states (we shall use a smaller number of states for illustration purposes):<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
L=32<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg --write-xml spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Python script build_lattice.py that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing<br />
<br />
$ alpspython build_lattice.py 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices="6" edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ alpspython build_lattice.py 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=20 } <br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3658ALPS 2 Tutorials:DMRG-01 DMRG2010-07-15T17:50:08Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''LANCZOS_TOLERANCE'''<br />
Tolerance for the diagonalization (Davidson/Lanczos) piece of the code. the default value is 10^-7. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 40 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=40<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg --write-xml spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states (we shall use a smaller number of states for illustration purposes):<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
L=32<br />
{ MAXSTATES=20 }<br />
{ MAXSTATES=40 }<br />
{ MAXSTATES=60 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg --write-xml spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Python script build_lattice.py that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing<br />
<br />
$ alpspython build_lattice.py 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices="6" edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ alpspython build_lattice.py 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3657ALPS 2 Tutorials:DMRG-01 DMRG2010-07-15T17:49:15Z<p>Afeiguin: /* Single run */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''LANCZOS_TOLERANCE'''<br />
Tolerance for the diagonalization (Davidson/Lanczos) piece of the code. the default value is 10^-7. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 40 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=40<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg --write-xml spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
L=32<br />
{ MAXSTATES=50 }<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg --write-xml spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Python script build_lattice.py that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing<br />
<br />
$ alpspython build_lattice.py 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices="6" edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ alpspython build_lattice.py 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3656ALPS 2 Tutorials:DMRG-01 DMRG2010-07-15T17:48:54Z<p>Afeiguin: /* DMRG-specific parameters */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''LANCZOS_TOLERANCE'''<br />
Tolerance for the diagonalization (Davidson/Lanczos) piece of the code. the default value is 10^-7. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg --write-xml spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
L=32<br />
{ MAXSTATES=50 }<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg --write-xml spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Python script build_lattice.py that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing<br />
<br />
$ alpspython build_lattice.py 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices="6" edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ alpspython build_lattice.py 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=Documentation:full_DMRG&diff=3655Documentation:full DMRG2010-07-15T17:43:49Z<p>Afeiguin: /* DMRG-specific parameters */</p>
<hr />
<div>=== The Density Matrix Renormalization Group ===<br />
<br />
The Density Matrix Renormalization Group (DMRG)<br />
method is a widely-utilized sophisticated algorithm to obtain low-lying<br />
eigenvalues and eigenvectors of very large matrices such as those<br />
found in quantum many-body problems.<br />
DMRG possesses features that make it<br />
extremely powerful: it can treat systems with hundreds of quantum<br />
spins or electrons, provide extremely accurate ground-state energies,<br />
and compute gaps in low-dimensional systems. Together with quantum<br />
Monte Carlo methods, it dominates most of the numerical research in<br />
the field of strongly correlated electron systems.<br />
<br />
The DMRG is particularly suitable for one-dimensional systems, where it is definitely the method of choice if one is only interested in ground state properties and low-lying eigenstates. The algorithm is much more efficient in systems with open boundary conditions, and quasi-2d systems (ladders) with cylindrical boundary conditions, where convergence is achieved with a relatively small number of states.<br />
<br />
== References ==<br />
<br />
S. R. White<br/><br />
''Density matrix formulation for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRL/v69/i19/p2863_1 Phys. Rev. Lett. 69, 2863 (1992).]<br/><br />
<br />
S. R. White<br/><br />
''Density-matrix algorithms for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRB/v48/i14/p10345_1 Phys. Rev. B 48, 10345 (1993).]<br/><br />
<br />
U. Schollwöck<br/><br />
'' The density-matrix renormalization group''<br/><br />
[http://link.aps.org/abstract/RMP/v77/p259 Rev. Mod. Phys. 77, 259 (2005).]<br/><br />
<br />
K. Hallberg<br/><br />
''Density Matrix Renormalization: A Review of the Method and its Applications''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0303557 arXiv:cond-mat/0303557.]<br />
<br />
R. Noack and S. Manmana<br/><br />
''Diagonalization- and Numerical Renormalization-Group-Based Methods for Interacting Quantum Systems''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0510321 arXiv:cond-mat/0510321]<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use default value used of 20.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user should choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, growing in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''LANCZOS_TOLERANCE'''<br />
Tolerance for the exact diagonalization (Davidson/Lanczos) piece of the simulation. The default value is 10^-7.<br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you don't specify Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
'''VERBOSE'''<br/><br />
If set to an integer > 0, it will print extra output information, such as density-matrix eigenvalues. There are different verbose levels up to a maximum of 3, for debugging purposes, although the user shouldn't need a level larger than 1.<br />
<br />
'''START_SWEEP'''<br/> (Available after v1.3b6)<br />
Starting sweep for resuming a simulation that was interrupted, or extending it with a new set of states.<br />
<br />
'''START_DIR'''<br/><br />
Starting direction for the resumed simulation. Can assume the values 0 or 1, for "left-to-right" or "right-to-left", respectively. It has effect only in the presence of START_SWEEP. Its default value is 0.<br />
<br />
'''START_ITER'''<br/><br />
Starting iteration for the resumed simulation. It has effect only in the presence of START_SWEEP. Its default value is 1.<br />
<br />
'''TEMP_DIRECTORY'''<br/><br />
The DMRG program stores information in temporary files that reside in your local folder. There could be a large number of them, and this could overwhelm your file system, especially if you are using NFS. The address for storing these files could be changed by setting the variable TEMP_DIRECTORY in the parameter file. Another way to do this is by setting the system environment variable TMPDIR.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3514ALPS 2 Tutorials:DMRG-01 DMRG2010-06-25T20:18:07Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
L=32<br />
{ MAXSTATES=50 }<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3513ALPS 2 Tutorials:DMRG-01 DMRG2010-06-25T20:17:43Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not a straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3512ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:39:57Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with especial edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3511ALPS 2 Tutorials:DMRG-03 Local Observables2010-06-24T21:39:35Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3510ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T21:39:10Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ MAXSTATES=50 } <br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3509ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T21:35:40Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain information about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do it for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous parameter file by replacing the lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 } <br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3508ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T21:33:54Z<p>Afeiguin: /* The ALPS DMRG Code and Its Control Parameters */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details.<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file by replacing teh lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 } <br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=Documentation:full_DMRG&diff=3507Documentation:full DMRG2010-06-24T21:33:12Z<p>Afeiguin: /* DMRG-specific parameters */</p>
<hr />
<div>=== The Density Matrix Renormalization Group ===<br />
<br />
The Density Matrix Renormalization Group (DMRG)<br />
method is a widely-utilized sophisticated algorithm to obtain low-lying<br />
eigenvalues and eigenvectors of very large matrices such as those<br />
found in quantum many-body problems.<br />
DMRG possesses features that make it<br />
extremely powerful: it can treat systems with hundreds of quantum<br />
spins or electrons, provide extremely accurate ground-state energies,<br />
and compute gaps in low-dimensional systems. Together with quantum<br />
Monte Carlo methods, it dominates most of the numerical research in<br />
the field of strongly correlated electron systems.<br />
<br />
The DMRG is particularly suitable for one-dimensional systems, where it is definitely the method of choice if one is only interested in ground state properties and low-lying eigenstates. The algorithm is much more efficient in systems with open boundary conditions, and quasi-2d systems (ladders) with cylindrical boundary conditions, where convergence is achieved with a relatively small number of states.<br />
<br />
== References ==<br />
<br />
S. R. White<br/><br />
''Density matrix formulation for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRL/v69/i19/p2863_1 Phys. Rev. Lett. 69, 2863 (1992).]<br/><br />
<br />
S. R. White<br/><br />
''Density-matrix algorithms for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRB/v48/i14/p10345_1 Phys. Rev. B 48, 10345 (1993).]<br/><br />
<br />
U. Schollwöck<br/><br />
'' The density-matrix renormalization group''<br/><br />
[http://link.aps.org/abstract/RMP/v77/p259 Rev. Mod. Phys. 77, 259 (2005).]<br/><br />
<br />
K. Hallberg<br/><br />
''Density Matrix Renormalization: A Review of the Method and its Applications''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0303557 arXiv:cond-mat/0303557.]<br />
<br />
R. Noack and S. Manmana<br/><br />
''Diagonalization- and Numerical Renormalization-Group-Based Methods for Interacting Quantum Systems''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0510321 arXiv:cond-mat/0510321]<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use default value used of 20.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user should choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, growing in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you don't specify Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
'''VERBOSE'''<br/><br />
If set to an integer > 0, it will print extra output information, such as density-matrix eigenvalues. There are different verbose levels up to a maximum of 3, for debugging purposes, although the user shouldn't need a level larger than 1.<br />
<br />
'''START_SWEEP'''<br/> (Available after v1.3b6)<br />
Starting sweep for resuming a simulation that was interrupted, or extending it with a new set of states.<br />
<br />
'''START_DIR'''<br/><br />
Starting direction for the resumed simulation. Can assume the values 0 or 1, for "left-to-right" or "right-to-left", respectively. It has effect only in the presence of START_SWEEP. Its default value is 0.<br />
<br />
'''START_ITER'''<br/><br />
Starting iteration for the resumed simulation. It has effect only in the presence of START_SWEEP. Its default value is 1.<br />
<br />
'''TEMP_DIRECTORY'''<br/><br />
The DMRG program stores information in temporary files that reside in your local folder. There could be a large number of them, and this could overwhelm your file system, especially if you are using NFS. The address for storing these files could be changed by setting the variable TEMP_DIRECTORY in the parameter file. Another way to do this is by setting the system environment variable TMPDIR.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3506ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:19:17Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
The parameter file looks much like the one for the previous example, but replacing the lattice and the model as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with especial edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3505ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:16:47Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with especial edges 192"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3504ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:15:17Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1/2 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
SWEEPS=6<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3503ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:14:46Z<p>Afeiguin: /* Spin-Spin Correlations: Spin-1/2 */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=6<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-04_Correlations&diff=3502ALPS 2 Tutorials:DMRG-04 Correlations2010-06-24T21:14:35Z<p>Afeiguin: /* Example */</p>
<hr />
<div>= Correlation Functions =<br />
<br />
The most important correlation functions in many-body physics are two-point correlators, i.e. correlators that involve two sites <math>i</math> and <math>j</math>, such as <math>\langle S^+_i S^-_j \rangle</math>.<br />
Short-ranged ones determine energies (in the typical short-ranged Hamiltonians of correlation physics), long-ranged ones determine correlation lengths.<br />
<br />
== Another Go At The Energy Per Bond ==<br />
<br />
As already mentioned above, the ground state energy per bond in both spin-1/2 and spin-1 chain is given by<br />
<br />
<math>e_0(i) = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
This gives the energy of each bond individually, but we are interested in the thermodynamic limit, where all bonds are on equal footing and hence should have the same energy unless there is some physical breaking of translational invariance. <br />
<br />
Obviously, the bonds that are closest to the thermodynamic limit behaviour are those in the chain center. So, the direct approach would be to calculate <math>e_0(L/2)</math> and extrapolate it first in <math>D</math> for fixed <math>L</math> and then in <math>L</math>. <br />
<br />
Before you do this, however, plot for some values of <math>D</math> and not too small <math>L</math> <math>e_0(i)</math> versus <math>i</math> (as a check of the program, you may also consider the three contributions individually before you do the sum. What relationship between them should exist?). <br />
<br />
What do you observe for spin-1? And what for spin-1/2?<br />
<br />
For the spin-1/2 chain, bond energies oscillate strongly between odd and even numbered bonds. This is because the open ends make themselves felt very strongly due to criticality and because the spin-1/2 chain is on the verge of dimerization, i.e. a spontaneous breaking of translational symmetry of the ground state down to a periodicity of 2. It is therefore more meaningful to extrapolate the average energy of a strong and a weak bond; you immediately gain lots of accuracy. This is yet another example that it is worthwhile to have a close look at the actual output of DMRG by considering various local or (here) almost local observables.<br />
<br />
== Spin-Spin Correlations: Spin-1/2 ==<br />
<br />
Take a relatively long chain (say, <math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>. The purpose of this is to center the correlators about the chain center to make boundary effects as small as possible; there are also other ways of doing this (like averaging over several correlators with same site distance, also more or less centered). As we expect a power law, use a log-log plot. Take absolute values or multiply out the antiferromagnetic factor <math>(-1)^l</math>.<br />
<br />
What you should see, is a power law on short distances, but a faster (in fact, exponential) decay for larger distances. This has two reasons: (i) the finite system size cuts off the power-law correlations; but as we took a large system size here, this should not matter too much. (ii) DMRG's algorithmic structure effectively generates correlators which are superpositions of up to <math>D^2</math> purely exponential decays, and therefore can only mimic power laws by such superpositions - at large distance, the slowest exponential decay will survive all the others, replacing the power law by an exponential law. The larger you choose <math>D</math>, the further you push out this crossover.<br />
<br />
<br />
The following parameter file will setup this run for is. In this example we consider a chain of length <math>L=192</math> and we setup multiple runs with different numbers of states <math>D</math>. We use 6 sweeps. Make sure that the correlations look symmetric. <br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=6<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_AVERAGE[Magnetization]=Sz<br />
MEASURE_AVERAGE[Exchange]=exchange<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
MEASURE_CORRELATIONS[Diagonal spin correlations]=Sz<br />
MEASURE_CORRELATIONS[Offdiagonal spin correlations]="Splus:Sminus"<br />
L=192<br />
{ MAXSTATES=100 }<br />
{ MAXSTATES=150 }<br />
{ MAXSTATES=200 }<br />
{ MAXSTATES=250 }<br />
{ MAXSTATES=300 }<br />
{ MAXSTATES=400 }<br />
<br />
== Spin-Spin Correlations: Spin-1 ==<br />
<br />
In the spin-1 chain, we do expect exponential decay (with an analytic modification), so the exponential nature of the correlators of DMRG should fit well. Again, choose a long chain (say,<math>L=192</math>), and calculate <math> \langle S^z_i S^z_j \rangle</math> for various increasing <math>D</math>. <br />
<br />
Now plot <math>C_l = \langle S^z_{L/2-l/2} S^z_{L/2+l/2} \rangle</math> where you round the positions such that their distance is <math>l</math>, as before. As we expect an exponential law, use a log-lin plot, again eliminating the negative signs. <br />
<br />
From the log-lin plot, extract a correlation length. It will depend (and in fact monotonically increase with) <math>D</math>. Has it converged when you reach e.g. <math>D=300</math>? How does this compare to the convergence for the same number of states of local or quasi-local observables such as magnetization or energy?<br />
<br />
In fact, the calculation of correlation lengths is much harder to converge than that of the local quantities. This is due to the fact that a more profound algorithmic analysis reveals DMRG to be an algorithm geared especially well to the optimal representation of local quantities, not so much non-local ones as long-ranged correlators.<br />
<br />
== Sometimes There Is A Way Out ==<br />
<br />
In the special case of the spin-1 chain, we have a loophole for the calculation of the correlation length, which is related to the weird observation that the first excitation was not a bulk excitation. It can be shown that a good toy model for a spin-1 chain is given as follows: at each site of a spin-1, you put two spin-1/2, and construct the spin-1 states from the triplet states of the two spin-1/2 at each site. The ground state is then approximated quite well by a state where you link two spin-1/2 on ''neighbouring'' sites by a singlet state. <br />
<br />
In this construction, for open boundary conditions (but not periodic ones), on the first and on the last site there will be two lonely spins-1/2 without partner. These two spins-1/2 can form 4 states among themselves, which in the toy model are degenerate: the ground state is four-fold degenerate. In the real spin-1 chain, this four-fold degeneracy (from one state of total spin 0 and three of total spin 1) is only achieved in the thermodynamic limit when the two spins are totally removed from each other. This is why there was no gap between magnetization sectors 0 and 1. The first bulk excitation needs magnetization 2.<br />
<br />
What we can do to cure this, is to attach one spin-1/2 before the first and after the last site, taking the same bond Hamiltonian, that link up to the two lonely spins by a singlet state. You may check that now the gap is between magnetization sectors 0 and 1!<br />
<br />
In order to calculate the correlation length, one can also play the following trick: attach only one spin-1/2 at one end. This means that the ground state will now be doubly degenerate, in magnetization sectors +1/2 or -1/2, and be characterized by the boundary site where there is NO spin-1/2 attached carrying finite magnetization, that decays into the bulk, with the correlation length.<br />
<br />
For a chain of length <math>L=192</math> and <math>D=200</math>, calculate the ground state magnetization. Plot it (eliminating the sign oscillation) versus site in a log-lin plot and extract the correlation length. What do you get?</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3501ALPS 2 Tutorials:DMRG-03 Local Observables2010-06-24T21:12:56Z<p>Afeiguin: /* Example */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
The following parameter file will accomplish this:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3500ALPS 2 Tutorials:DMRG-03 Local Observables2010-06-24T21:12:24Z<p>Afeiguin: /* Excitations in the Spin-1 Chain */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
The following parameter file will setup three individual runs, one for each spin sector:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 96"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
=== Example ===<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-03_Local_Observables&diff=3499ALPS 2 Tutorials:DMRG-03 Local Observables2010-06-24T21:07:12Z<p>Afeiguin: /* Example */</p>
<hr />
<div>= Local Observables =<br />
<br />
As local observables we consider observables that are linked to one specific site. In the case of spin chains, the meaningful local observable is the local magnetization <math>\langle S^z_i \rangle </math>.<br />
<br />
== Excitations in the Spin-1 Chain ==<br />
<br />
Take a chain of length <math>L=96</math> and <math>D=200</math>. Calculate the local magnetization <math>\langle S^z_i \rangle </math> and plot it versus the site <math>i</math> for the ground states in the magnetisation sectors 0, 1, and 2.<br />
<br />
What you should obtain is an essentially flat curve for sector 0, a magnetisation which is essentially concentrated at the chain ends for sector 1, and a magnetisation which is both at the chain ends and in the bulk of the chain for sector 2. This means that the first excitation of the open chain is a boundary excitation, which would not exist on a closed system, and the second excitation of the open chain is a boundary plus a bulk excitation, which is the one we are interested in. For an as of now unknown reason, the energy of the first bulk excitation therefore has to be extracted from comparing sectors 1 and 2.<br />
<br />
The morale of the story is that by looking at this local observable, we can distinguish boundary from bulk excitations in the spin-1 chain.<br />
<br />
== Magnetisation in the Spin-1/2 Chain ==<br />
<br />
Repeat a similar calculation for the spin-1/2 chain in the lowest magnetisation sectors. What do you observe here?<br />
<br />
=== Example ===<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
SWEEPS=4<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
MEASURE_LOCAL[Local magnetization]=Sz<br />
L=96<br />
MAXSTATES=200<br />
{ Sz_total=0 }<br />
{ Sz_total=1 }<br />
{ Sz_total=2 }</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-02_Gaps&diff=3498ALPS 2 Tutorials:DMRG-02 Gaps2010-06-24T21:05:15Z<p>Afeiguin: /* Example: with quantum numbers */</p>
<hr />
<div>=Calculating The Gap=<br />
<br />
As already mentioned, the energy gap of a quantum system is given by the energy difference between the first excited state and the ground state<br />
<br />
<math>\Delta = E_1 - E_0</math> <br />
<br />
in the thermodynamic limit. This means we have to solve two problems, (i) the calculation of <br />
<br />
<math>\Delta(L) = E_1 (L) - E_0 (L)</math><br />
<br />
for finite system sizes and (ii) extrapolate <math>\Delta (L)</math> to the thermodynamic limit <math>L= \infty</math>. The latter is not specific to DMRG, but because of its preference for open boundary conditions somewhat more complicated than in the more usual case of periodic boundary conditions.<br />
<br />
==Getting The Gap For Finite Systems==<br />
<br />
Obviously, we have to be able to get access to the first excited state and its energy. DMRG fundamentally knows two ways of doing this, one which works always, but is not as neat, and another one, which is very clean, but does not work under all circumstances.<br />
<br />
# The pedestrian way is to set up a DMRG calculation that calculates both states at the same time. However, for a given number of states the accuracy will somewhat decrease, as two different quantum states both have to be described well. <br />
# The smarter way reduces the gap calculation to the calculation of two ground states. In many quantum systems, the ground state and the first excited state differ by a good quantum number and therefore are both ground states in the respective sectors. For example, for the spin-1/2 chain, the ground state is a singlet of total spin 0, and hence the ground state in the sector of magnetization 0. The first excited state is a triplet of total spin 1, i.e. consists of one excited state of magnetization 0, and the ground states of the sectors of magnetization +1 and -1 respectively. It can therefore be calculated as the ground state in magnetization sector +1.<br />
<br />
Let us do this calculation first for the spin-1/2 chain:<br />
<br />
=== Example: without quantum numbers ===<br />
<br />
In this example below, we include a line in the parameter file for the spin S=1/2 chain to tell the code that we also want to calculate the energy for the first excited state. The algorithm will build a density matrix targeting two states: the ground-state, and the first excited state, both in the same subspace with Sz=0. Since the first excited state is a triplet, this will yield the singlet-triplet gap.<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
L=32, MAXSTATES=100<br />
NUMBER_EIGENVALUES=2<br />
<br />
Notice that we only added the last line, specifying the number of eigenstates to calculate. By targeting both states, the algorithm ensures that both are represented accurately. However, this is not quite true if we keep only 100 states. Compare the energy for the ground-state obtained with the present parameter file, and the previous simulation targeting only the ground state. <br />
<br />
It is important to notice that the entanglement entropy in this example is totally meaningless, since the algorithm is calculating a density matrix mixing two states.<br />
<br />
=== Example: with quantum numbers ===<br />
<br />
To calculate the singlet-triplet gap taking advantage of quantum number conservation we need to perform two independent simulations, one with Sz=0, and another one with Sz=1. The difference of the two energies will yield the gap. This means that we only need to change the value of Sz_total in the spin_onehalf parameter file:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=1<br />
SWEEPS=4<br />
J=1<br />
L=32, MAXSTATES=100<br />
<br />
In a first attempt, fix <math>D=50,100,150</math> and calculate the gap for lengths <math>L=32,64,96,128</math>. For fixed <math>D</math>, plot the gap versus <math>1/L</math>. What you should see is that for small <math>D</math>, the results will not lie on a straight line passing through 0, but they will curve up from it. This behaviour gets better when <math>D</math> gets larger. Discuss why this might be.<br />
<br />
In a second, more meaningful attempt, fix the lengths <math>L=32,64,96,128</math> and vary <math>D=50,100,150,200</math> in order to extrapolate the gap for each fixed length in <math>D</math> (or, as explained above, the truncation error). What does the plot of the gap versus <math>1/L</math> look like now?<br />
<br />
Modify the file spin_onehalf_multiple to setup all the runs for Sz=0 and Sz=1, for different system sizes and different number of states. Use five sweeps, and extrapolate the value of the gap following the procedure outlined in the tutorial.<br />
<br />
==Extrapolating The Gap To The Thermodynamic Limit==<br />
<br />
The case of the spin-1/2 chain is a bit frustrating, because all you will be able to say, even if you push the computer to its limits, is that the gap seems to be extremely small to the best of your abilities and therefore is likely to vanish. But who can tell you that you are not looking at a case where the gap is, say, <math>e^{-50}</math>? This of course is a sobering reminder of the limits of even a highly accurate numerical method.<br />
<br />
Let us therefore turn to a more rewarding question, what is the gap of the spin-1 antiferromagnetic Heisenberg chain?<br />
<br />
Here, there is a nasty twist, which we will at the moment only state and act on, but explain only later: Calculate the gap not between the ground states of the magnetization sectors 0 and 1, but 1 and 2. If you wish, do it also for 0 and 1, for later reference, but the following refers to 1 and 2.<br />
<br />
Assume you have <math>\Delta (L)</math> with machine precision, either by a suitable extrapolation as discussed above or by a very high accuracy calculation. If you don't want to do the former, calculate the gap for system sizes <math>L=8,16,32,48,64,96,128,192,256</math> with <math>D=300</math> states each and 5 sweeps. <br />
<br />
As the effects of the open ends will decrease as <math>1/L</math>, it always makes sense to<br />
first plot the gaps <math>\Delta (L)</math> versus <math>1/L</math>, as was already done in the spin-1/2 case. Produce such a plot.<br />
<br />
What you see, is a curve that is quite straight for small L and then starts bending upward. What gap would you obtain if you extrapolate the linear part of the curve naively? (This question is relevant for situations where the correlation length of the chain is so long that it becomes hard to see the asymptotic behaviour on reachable length scales.) Is it over- or underestimated?<br />
<br />
What gap do you read off if you take the longest chain you have? Is it over- or underestimated?<br />
<br />
The ideal would be to have an idea of what the asymptotic behaviour (the curved part for long lengths) is like analytically to extrapolate. Do a plot of the gap as <math>\Delta (L)</math> versus <math>1/L^2</math>. What does the curve now look like for big lengths? Extrapolate the gap.<br />
<br />
The last plot was in fact motivated by the following argument: from Haldane's analysis of the spin-1 chain by the nonlinear sigma model, one expects that the lowest lying excitations (which for periodic boundary conditions can be labeled by a momentum <math>k</math>) are around <math>k=\pi</math> and have an energy<br />
<br />
<math>E(k) = E_0 + \sqrt{\Delta^2 + c^2 (k-\pi)^2}</math>.<br />
<br />
For the open boundary conditions, we may approximate <math>k-\pi</math> by <math>1/L</math> (think about a particle in a box), which gives a finite-system size gap of<br />
<br />
<math>\Delta(L) \approx \Delta \left( 1 + \frac{c^2}{2\Delta^2 L^2} \right) </math><br />
<br />
and indicates that in the asymptotic limit the convergence should essentially be as <math>1/L^2</math>. How close do you get to the result <math>\Delta=0.41052</math>?<br />
<br />
For those, that also did the gap between the ground states of magnetisation sectors 0 and 1, show that the gap you get there is essentially zero. All others, take this result for granted and start worrying: why is the finite gap the right one and the vanishing gap the wrong one? Is this a physics lottery? In fact, there is a very good reason why the spin-1 chain shows this peculiar behaviour for open boundary conditions that can be found analytically; but even if we were not so fortunate as to know it, we could detect the problem right away! This can be done by the observation of local observables.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-02_Gaps&diff=3497ALPS 2 Tutorials:DMRG-02 Gaps2010-06-24T21:04:51Z<p>Afeiguin: /* Example: without quantum numbers */</p>
<hr />
<div>=Calculating The Gap=<br />
<br />
As already mentioned, the energy gap of a quantum system is given by the energy difference between the first excited state and the ground state<br />
<br />
<math>\Delta = E_1 - E_0</math> <br />
<br />
in the thermodynamic limit. This means we have to solve two problems, (i) the calculation of <br />
<br />
<math>\Delta(L) = E_1 (L) - E_0 (L)</math><br />
<br />
for finite system sizes and (ii) extrapolate <math>\Delta (L)</math> to the thermodynamic limit <math>L= \infty</math>. The latter is not specific to DMRG, but because of its preference for open boundary conditions somewhat more complicated than in the more usual case of periodic boundary conditions.<br />
<br />
==Getting The Gap For Finite Systems==<br />
<br />
Obviously, we have to be able to get access to the first excited state and its energy. DMRG fundamentally knows two ways of doing this, one which works always, but is not as neat, and another one, which is very clean, but does not work under all circumstances.<br />
<br />
# The pedestrian way is to set up a DMRG calculation that calculates both states at the same time. However, for a given number of states the accuracy will somewhat decrease, as two different quantum states both have to be described well. <br />
# The smarter way reduces the gap calculation to the calculation of two ground states. In many quantum systems, the ground state and the first excited state differ by a good quantum number and therefore are both ground states in the respective sectors. For example, for the spin-1/2 chain, the ground state is a singlet of total spin 0, and hence the ground state in the sector of magnetization 0. The first excited state is a triplet of total spin 1, i.e. consists of one excited state of magnetization 0, and the ground states of the sectors of magnetization +1 and -1 respectively. It can therefore be calculated as the ground state in magnetization sector +1.<br />
<br />
Let us do this calculation first for the spin-1/2 chain:<br />
<br />
=== Example: without quantum numbers ===<br />
<br />
In this example below, we include a line in the parameter file for the spin S=1/2 chain to tell the code that we also want to calculate the energy for the first excited state. The algorithm will build a density matrix targeting two states: the ground-state, and the first excited state, both in the same subspace with Sz=0. Since the first excited state is a triplet, this will yield the singlet-triplet gap.<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
L=32, MAXSTATES=100<br />
NUMBER_EIGENVALUES=2<br />
<br />
Notice that we only added the last line, specifying the number of eigenstates to calculate. By targeting both states, the algorithm ensures that both are represented accurately. However, this is not quite true if we keep only 100 states. Compare the energy for the ground-state obtained with the present parameter file, and the previous simulation targeting only the ground state. <br />
<br />
It is important to notice that the entanglement entropy in this example is totally meaningless, since the algorithm is calculating a density matrix mixing two states.<br />
<br />
=== Example: with quantum numbers ===<br />
<br />
To calculate the singlet-triplet gap taking advantage of quantum number conservation we need to perform two independent simulations, one with Sz=0, and another one with Sz=1. The difference of the two energies will yield the gap. This means that we only need to change the value of Sz_total in the spin_onehalf parameter file:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=1<br />
J=1<br />
L=32, MAXSTATES=100<br />
<br />
In a first attempt, fix <math>D=50,100,150</math> and calculate the gap for lengths <math>L=32,64,96,128</math>. For fixed <math>D</math>, plot the gap versus <math>1/L</math>. What you should see is that for small <math>D</math>, the results will not lie on a straight line passing through 0, but they will curve up from it. This behaviour gets better when <math>D</math> gets larger. Discuss why this might be.<br />
<br />
In a second, more meaningful attempt, fix the lengths <math>L=32,64,96,128</math> and vary <math>D=50,100,150,200</math> in order to extrapolate the gap for each fixed length in <math>D</math> (or, as explained above, the truncation error). What does the plot of the gap versus <math>1/L</math> look like now?<br />
<br />
Modify the file spin_onehalf_multiple to setup all the runs for Sz=0 and Sz=1, for different system sizes and different number of states. Use five sweeps, and extrapolate the value of the gap following the procedure outlined in the tutorial.<br />
<br />
==Extrapolating The Gap To The Thermodynamic Limit==<br />
<br />
The case of the spin-1/2 chain is a bit frustrating, because all you will be able to say, even if you push the computer to its limits, is that the gap seems to be extremely small to the best of your abilities and therefore is likely to vanish. But who can tell you that you are not looking at a case where the gap is, say, <math>e^{-50}</math>? This of course is a sobering reminder of the limits of even a highly accurate numerical method.<br />
<br />
Let us therefore turn to a more rewarding question, what is the gap of the spin-1 antiferromagnetic Heisenberg chain?<br />
<br />
Here, there is a nasty twist, which we will at the moment only state and act on, but explain only later: Calculate the gap not between the ground states of the magnetization sectors 0 and 1, but 1 and 2. If you wish, do it also for 0 and 1, for later reference, but the following refers to 1 and 2.<br />
<br />
Assume you have <math>\Delta (L)</math> with machine precision, either by a suitable extrapolation as discussed above or by a very high accuracy calculation. If you don't want to do the former, calculate the gap for system sizes <math>L=8,16,32,48,64,96,128,192,256</math> with <math>D=300</math> states each and 5 sweeps. <br />
<br />
As the effects of the open ends will decrease as <math>1/L</math>, it always makes sense to<br />
first plot the gaps <math>\Delta (L)</math> versus <math>1/L</math>, as was already done in the spin-1/2 case. Produce such a plot.<br />
<br />
What you see, is a curve that is quite straight for small L and then starts bending upward. What gap would you obtain if you extrapolate the linear part of the curve naively? (This question is relevant for situations where the correlation length of the chain is so long that it becomes hard to see the asymptotic behaviour on reachable length scales.) Is it over- or underestimated?<br />
<br />
What gap do you read off if you take the longest chain you have? Is it over- or underestimated?<br />
<br />
The ideal would be to have an idea of what the asymptotic behaviour (the curved part for long lengths) is like analytically to extrapolate. Do a plot of the gap as <math>\Delta (L)</math> versus <math>1/L^2</math>. What does the curve now look like for big lengths? Extrapolate the gap.<br />
<br />
The last plot was in fact motivated by the following argument: from Haldane's analysis of the spin-1 chain by the nonlinear sigma model, one expects that the lowest lying excitations (which for periodic boundary conditions can be labeled by a momentum <math>k</math>) are around <math>k=\pi</math> and have an energy<br />
<br />
<math>E(k) = E_0 + \sqrt{\Delta^2 + c^2 (k-\pi)^2}</math>.<br />
<br />
For the open boundary conditions, we may approximate <math>k-\pi</math> by <math>1/L</math> (think about a particle in a box), which gives a finite-system size gap of<br />
<br />
<math>\Delta(L) \approx \Delta \left( 1 + \frac{c^2}{2\Delta^2 L^2} \right) </math><br />
<br />
and indicates that in the asymptotic limit the convergence should essentially be as <math>1/L^2</math>. How close do you get to the result <math>\Delta=0.41052</math>?<br />
<br />
For those, that also did the gap between the ground states of magnetisation sectors 0 and 1, show that the gap you get there is essentially zero. All others, take this result for granted and start worrying: why is the finite gap the right one and the vanishing gap the wrong one? Is this a physics lottery? In fact, there is a very good reason why the spin-1 chain shows this peculiar behaviour for open boundary conditions that can be found analytically; but even if we were not so fortunate as to know it, we could detect the problem right away! This can be done by the observation of local observables.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3496ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:58:42Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file by replacing teh lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 } <br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3495ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:57:48Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file by replacing teh lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==== Multiple runs ====<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 } <br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3494ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:57:26Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file by replacing teh lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
=== Multiple runs ===<br />
<br />
Same as for the spin S=1/2 case, we can now setup multiple runs in a single parameter file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1 <br />
NUMBER_EIGENVALUES=1 <br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 } <br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3493ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:54:54Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file by replacing teh lattice definition as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3492ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:53:33Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Clearly, it will result cumbersome to repeat this process for each system size. One way to simplify it even further is to write a shell or Perl script to do is for us automatically. A simpler one is to define all the lattices we need in a lattice library. We have included a my_lattices.xml file with lattices of sizes <math>L=32,64,96,128,192</math>. All we have to do is modify the previous paramater file as follows:<br />
<br />
LATTICE_LIBRARY="my_lattices.xml"<br />
LATTICE="open chain lattice with special edges 32"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
where we have included the lattice size in the name.<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3491ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:49:03Z<p>Afeiguin: /* Multiple runs */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin"<br />
Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
SWEEPS=4<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3490ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:48:29Z<p>Afeiguin: /* Single run */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
MODEL="spin" <br />
CONSERVED_QUANTUMNUMBERS="N,Sz" <br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3489ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:47:43Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
To run a lattice with 32 sites we shall then type<br />
<br />
$ ./build_lattice.pl 32 > my_lattice.xml<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
LATTICE_LIBRARY="my_lattice.xml"<br />
LATTICE="open chain lattice with special edges"<br />
MODEL="spin"<br />
local_S0=0.5<br />
local_S1=1<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
Sz_total=0<br />
J=1<br />
SWEEPS=4<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3488ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T20:38:48Z<p>Afeiguin: /* The one dimensional S=1 Heisenberg chain */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice file for the simulation. As it turns out, there is not straightforward way to do this, so we will have to do it manually. To simplify the process, we have included a simple Perl script build_lattice.pl that will generate the lattice for us. The only input is the number of sites in the lattice. For instance, by typing (in Unix) <br />
<br />
$ ./build_lattice.pl 6<br />
<br />
we shall obtain the output<br />
<br />
<LATTICES><br />
<GRAPH name = "open chain lattice with special edges" dimension="1" vertices=" 6 " edges="5"><br />
<VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX><br />
<VERTEX id="2" type="1"><COORDINATE>2</COORDINATE></VERTEX><br />
<VERTEX id="3" type="1"><COORDINATE>3</COORDINATE></VERTEX><br />
<VERTEX id="4" type="1"><COORDINATE>4</COORDINATE></VERTEX><br />
<VERTEX id="5" type="1"><COORDINATE>5</COORDINATE></VERTEX><br />
<VERTEX id="6" type="0"><COORDINATE>6</COORDINATE></VERTEX><br />
<EDGE source="1" target="2" id="1" type="0" vector="1"/><br />
<EDGE source="2" target="3" id="2" type="0" vector="1"/><br />
<EDGE source="3" target="4" id="3" type="0" vector="1"/><br />
<EDGE source="4" target="5" id="4" type="0" vector="1"/><br />
<EDGE source="5" target="6" id="5" type="0" vector="1"/><br />
</GRAPH><br />
</LATTICES><br />
<br />
As we can see, the lattice is defined as a one-dimensional graph that contains six vertices, and edges connecting nearest neighbors. The first and last vertices are of type "0", while the others are of type "1". We shall use this definition to implement the model on top of this lattice, which should contain informatioon about the degrees of freedom living on these vertices.<br />
<br />
The way to do this is by specifying the parameters:<br />
<br />
local_S0=0.5<br />
local_S1=1<br />
<br />
Let us see how the final parameter file should look like:<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=Documentation:full_DMRG&diff=3487Documentation:full DMRG2010-06-24T20:03:38Z<p>Afeiguin: /* References */</p>
<hr />
<div>=== The Density Matrix Renormalization Group ===<br />
<br />
The Density Matrix Renormalization Group (DMRG)<br />
method is a widely-utilized sophisticated algorithm to obtain low-lying<br />
eigenvalues and eigenvectors of very large matrices such as those<br />
found in quantum many-body problems.<br />
DMRG possesses features that make it<br />
extremely powerful: it can treat systems with hundreds of quantum<br />
spins or electrons, provide extremely accurate ground-state energies,<br />
and compute gaps in low-dimensional systems. Together with quantum<br />
Monte Carlo methods, it dominates most of the numerical research in<br />
the field of strongly correlated electron systems.<br />
<br />
The DMRG is particularly suitable for one-dimensional systems, where it is definitely the method of choice if one is only interested in ground state properties and low-lying eigenstates. The algorithm is much more efficient in systems with open boundary conditions, and quasi-2d systems (ladders) with cylindrical boundary conditions, where convergence is achieved with a relatively small number of states.<br />
<br />
== References ==<br />
<br />
S. R. White<br/><br />
''Density matrix formulation for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRL/v69/i19/p2863_1 Phys. Rev. Lett. 69, 2863 (1992).]<br/><br />
<br />
S. R. White<br/><br />
''Density-matrix algorithms for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRB/v48/i14/p10345_1 Phys. Rev. B 48, 10345 (1993).]<br/><br />
<br />
U. Schollwöck<br/><br />
'' The density-matrix renormalization group''<br/><br />
[http://link.aps.org/abstract/RMP/v77/p259 Rev. Mod. Phys. 77, 259 (2005).]<br/><br />
<br />
K. Hallberg<br/><br />
''Density Matrix Renormalization: A Review of the Method and its Applications''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0303557 arXiv:cond-mat/0303557.]<br />
<br />
R. Noack and S. Manmana<br/><br />
''Diagonalization- and Numerical Renormalization-Group-Based Methods for Interacting Quantum Systems''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0510321 arXiv:cond-mat/0510321]<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use default value used of 20.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user should choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, growing in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you don't specify Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
'''VERBOSE'''<br/><br />
If set to an integer > 0, it will print extra output information, such as density-matrix eigenvalues. There are different verbose levels up to a maximum of 3, for debugging purposes, although the user shouldn't need a level larger than 1.<br />
<br />
'''START_SWEEP'''<br/> (Available after v1.3b6)<br />
Starting sweep for resuming a simulation that was interrupted, or extending it with a new set of states.<br />
<br />
'''START_DIR'''<br/><br />
Starting direction for the resumed simulation. Can assume the values 0 or 1, for "left-to-right" or "right-to-left", respectively. It has effect only in the presence of START_SWEEP. Its default value is 0.<br />
<br />
'''START_ITER'''<br/><br />
Starting iteration for the resumed simulation. It has effect only in the presence of START_SWEEP. Its default value is 1.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=Documentation:full_DMRG&diff=3486Documentation:full DMRG2010-06-24T20:03:08Z<p>Afeiguin: /* References */</p>
<hr />
<div>=== The Density Matrix Renormalization Group ===<br />
<br />
The Density Matrix Renormalization Group (DMRG)<br />
method is a widely-utilized sophisticated algorithm to obtain low-lying<br />
eigenvalues and eigenvectors of very large matrices such as those<br />
found in quantum many-body problems.<br />
DMRG possesses features that make it<br />
extremely powerful: it can treat systems with hundreds of quantum<br />
spins or electrons, provide extremely accurate ground-state energies,<br />
and compute gaps in low-dimensional systems. Together with quantum<br />
Monte Carlo methods, it dominates most of the numerical research in<br />
the field of strongly correlated electron systems.<br />
<br />
The DMRG is particularly suitable for one-dimensional systems, where it is definitely the method of choice if one is only interested in ground state properties and low-lying eigenstates. The algorithm is much more efficient in systems with open boundary conditions, and quasi-2d systems (ladders) with cylindrical boundary conditions, where convergence is achieved with a relatively small number of states.<br />
<br />
== References ==<br />
<br />
S. R. White<br/><br />
''Density matrix formulation for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRL/v69/i19/p2863_1 Phys. Rev. Lett. 69, 2863 (1992).]<br/><br />
<br />
S. R. White<br/><br />
''Density-matrix algorithms for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRB/v48/i14/p10345_1 Phys. Rev. B 48, 10345 (1993).]<br/><br />
<br />
U. Schollwöck<br/><br />
'' The density-matrix renormalization group''<br/><br />
[http://link.aps.org/abstract/RMP/v77/p259 Rev. Mod. Phys. 77, 259 (2005).]<br/><br />
<br />
K. Hallberg<br/><br />
''Density Matrix Renormalization: A Review of the Method and its Applications''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0303557 arXiv:cond-mat/0303557.]<br />
<br />
R. Noack and S. Manmamnna<br/><br />
''Diagonalization- and Numerical Renormalization-Group-Based Methods for Interacting Quantum Systems''<br/><br />
[http://lanl.arxiv.org/abs/cond-mat/0510321 arXiv:cond-mat/0510321]<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use default value used of 20.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user should choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, growing in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you don't specify Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
'''VERBOSE'''<br/><br />
If set to an integer > 0, it will print extra output information, such as density-matrix eigenvalues. There are different verbose levels up to a maximum of 3, for debugging purposes, although the user shouldn't need a level larger than 1.<br />
<br />
'''START_SWEEP'''<br/> (Available after v1.3b6)<br />
Starting sweep for resuming a simulation that was interrupted, or extending it with a new set of states.<br />
<br />
'''START_DIR'''<br/><br />
Starting direction for the resumed simulation. Can assume the values 0 or 1, for "left-to-right" or "right-to-left", respectively. It has effect only in the presence of START_SWEEP. Its default value is 0.<br />
<br />
'''START_ITER'''<br/><br />
Starting iteration for the resumed simulation. It has effect only in the presence of START_SWEEP. Its default value is 1.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=Documentation:full_DMRG&diff=3485Documentation:full DMRG2010-06-24T19:56:16Z<p>Afeiguin: /* DMRG-specific parameters */</p>
<hr />
<div>=== The Density Matrix Renormalization Group ===<br />
<br />
The Density Matrix Renormalization Group (DMRG)<br />
method is a widely-utilized sophisticated algorithm to obtain low-lying<br />
eigenvalues and eigenvectors of very large matrices such as those<br />
found in quantum many-body problems.<br />
DMRG possesses features that make it<br />
extremely powerful: it can treat systems with hundreds of quantum<br />
spins or electrons, provide extremely accurate ground-state energies,<br />
and compute gaps in low-dimensional systems. Together with quantum<br />
Monte Carlo methods, it dominates most of the numerical research in<br />
the field of strongly correlated electron systems.<br />
<br />
The DMRG is particularly suitable for one-dimensional systems, where it is definitely the method of choice if one is only interested in ground state properties and low-lying eigenstates. The algorithm is much more efficient in systems with open boundary conditions, and quasi-2d systems (ladders) with cylindrical boundary conditions, where convergence is achieved with a relatively small number of states.<br />
<br />
== References ==<br />
<br />
S. R. White<br/><br />
''Density matrix formulation for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRL/v69/i19/p2863_1 Phys. Rev. Lett. 69, 2863 (1992).]<br/><br />
<br />
S. R. White<br/><br />
''Density-matrix algorithms for quantum renormalization groups''<br/><br />
[http://link.aps.org/abstract/PRB/v48/i14/p10345_1 Phys. Rev. B 48, 10345 (1993).]<br/><br />
<br />
U. Schollwöck<br/><br />
'' The density-matrix renormalization group''<br/><br />
[http://link.aps.org/abstract/RMP/v77/p259 Rev. Mod. Phys. 77, 259 (2005).]<br/><br />
<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use default value used of 20.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user should choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, growing in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you don't specify Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
'''VERBOSE'''<br/><br />
If set to an integer > 0, it will print extra output information, such as density-matrix eigenvalues. There are different verbose levels up to a maximum of 3, for debugging purposes, although the user shouldn't need a level larger than 1.<br />
<br />
'''START_SWEEP'''<br/> (Available after v1.3b6)<br />
Starting sweep for resuming a simulation that was interrupted, or extending it with a new set of states.<br />
<br />
'''START_DIR'''<br/><br />
Starting direction for the resumed simulation. Can assume the values 0 or 1, for "left-to-right" or "right-to-left", respectively. It has effect only in the presence of START_SWEEP. Its default value is 0.<br />
<br />
'''START_ITER'''<br/><br />
Starting iteration for the resumed simulation. It has effect only in the presence of START_SWEEP. Its default value is 1.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3484ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T19:55:38Z<p>Afeiguin: /* DMRG-specific parameters */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''TRUNCATION_ERROR'''<br />
The user can choose to set the tolerance for the simulation, instead of the number of states. The program will automagically determine how many states to keep in order to satisfy this tolerance. Care must be taken, since this could lead to an uncontrollable growth in the basis size, and a crash as a consequence. It is therefore advisable to also specify the maximum number of states as a constraint, using either MAXSTATES or NUMSTATES, as explained before. <br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice.<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguinhttps://alps.comp-phys.org/mediawiki/index.php?title=ALPS_2_Tutorials:DMRG-01_DMRG&diff=3483ALPS 2 Tutorials:DMRG-01 DMRG2010-06-24T17:56:54Z<p>Afeiguin: /* How to choose the right parameters */</p>
<hr />
<div>__FORCETOC__<br />
<br />
=Models: Heisenberg Spin Chains=<br />
<br />
For applications of DMRG, we consider two models, namely the spin-1/2 and the spin-1 antiferromagnetic Heisenberg chains of length L given by the following Hamiltonian,<br />
<br />
<math>H = \sum_{i=1}^{L-1} \frac{1}{2} (S^+_i S^-_{i+1} + S^-_i S^+_{i+1}) + S^z_i S^z_{i+1}</math> .<br />
<br />
The reason why we are choosing these two models, which you may already know from other tutorials, is that despite their <br />
superficial similarity they exhibit completely different physical behaviour and pose very different challenges to the DMRG algorithm. Let us briefly review their physical properties.<br />
<br />
==Spin-1/2 Chain==<br />
<br />
The ground state of the spin-1/2 chain can be constructed exactly by the Bethe ansatz; we therefore know its ground state energy exactly. In the thermodynamic limit <math>L\rightarrow\infty</math> the energy per site is given by<br />
<br />
<math>E_0 = 1/4 - \ln 2 = -0,4431471805599... </math><br />
<br />
Ground state energies as such are of limited interest if not compared to other energies. But this one can serve as a beautiful benchmark of the DMRG method. Of more interest is whether the ground state is separated from the excited states by an energy difference that survives also in the thermodynamic limit, i.e. whether the ''gap'' is vanishing or not. For the spin-1/2 chain, the gap is 0.<br />
<br />
At the same time, one may ask what the correlation between spins on different sites looks like. One knows for the infinitely long spin-1/2 chain that asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\sqrt{\ln|i-j|}}{|i-j|} </math> .<br />
<br />
This means that the spin-1/2 chain is ''critical'', i.e. the antiferromagnetic correlations between spins decay with their distance following a ''power law''; in this case the exponent of the power law is obviously <math>-1</math>. There is also an additional square root of a logarithm correction which can be beautifully verified by DMRG calculations on very long chains, but given the very slow increase of the logarithm with its argument, we can ignore it in a first go.<br />
<br />
==Spin-1 Chain==<br />
<br />
For decades, people thought that the spin-1 chain would behave similarly, of course with some quantitative differences due to the different spin lengths. It came as a big surprise in 1982 when Duncan Haldane pointed out that there should be a fundamental difference between isotropic antiferromagnetic Heisenberg chains depending on the length of the spin, namely between half-integer spins (<math>S=1/2,3/2,...</math>) and integer spins (<math>S=1</math>), with the difference being most pronounced for small spin lengths. Hence, the spin-1 chain became the focus of strong interest, and in fact DMRG had some of its most important early applications right for this system.<br />
<br />
Unlike the spin-1/2 chain, the spin-1 chain has no properties that can be calculated exactly by analytical means. We have to rely completely on numerics when it comes to quantitative statements.<br />
<br />
The ground state energy per site is given by<br />
<br />
<math> E_0 = -1.401484039 ... </math>.<br />
<br />
Again, the question of the existence of a gap is more important, and here one of the big differences to the spin-1/2 chain becomes visible: in the thermodynamic limit, the gap in the spin-1 chain is finite and given by<br />
<br />
<math> \Delta = 0.41052 </math><br />
<br />
to five-digit accuracy. <br />
<br />
The question for the behaviour of the spin-spin correlations leads to yet another big difference to the spin-1/2 case. The correlations read asymptotically (i.e. for <math>|i-j| \rightarrow \infty</math>) <br />
<br />
<math> \langle S^z_i S^z_j \rangle \sim (-1)^{|i-j|} \frac{\exp (-|i-j|/\xi)}{\sqrt{|i-j|}} </math> .<br />
<br />
The dominant contribution is now the exponential decay which happens on a length scale <math>\xi</math>, the ''correlation length'' which in this particular case is found numerically to be <math>\xi=6.02</math>. There is an analytic (power law) correction by a square root of the distance in the denominator, but this is often neglected in calculations of the correlation length, as it is a slow contribution compared to the fast exponential decay. It would matter, of course, if the correlation length were much larger. <br />
<br />
The spin-1 chain is therefore a prime example for a ''non-critical'' quantum system with finite gap and exponentially decaying correlations. As it will turn out, for DMRG this type of system is much easier to do.<br />
<br />
==Plan Of The Tutorial==<br />
<br />
What we want to achieve in the following tutorial, is to be able to calculate all the above quantities on our own using ALPS DMRG while learning about the principal pitfalls in this numerical project.<br />
<br />
==Vive la difference ...==<br />
<br />
The most important difference to other numerical methods is that DMRG prefers open boundary conditions, such that there are two chain ends at site 1 and <math>L</math>, not a closed loop as for example exact diagonalization and most analytical methods would prefer. This was already implicit in the notation of the Hamiltonian above and will lead to some of the more subtle aspects of DMRG calculations.<br />
<br />
=Running The Code=<br />
<br />
==General Remarks==<br />
<br />
Before we start, let us briefly discuss the inner logic of the DMRG algorithm without discussing it in full detail. Given a one-dimensional quantum system with local state spaces of dimension <math>d</math>, where <math>d=2S+1</math> for spins of length <math>S</math>, the Hilbert space dimension explodes exponentially as <math>d^L</math> with system size <math>L</math>. Exact diagonalization achieves exact results in this exponentially large Hilbert space, at the price of small system sizes. Quantum Monte Carlo gives approximate results by stochastically sampling this large space, reaching much larger system sizes. The density-matrix renormalization group (DMRG) tries yet another approach, namely to identify very small subspaces of the exponentially large Hilbert space which are hoped to contain good, very good, even excellent approximations to the states of interest such as the ground state. <br />
<br />
A first key control parameter is therefore <math>D</math>, which controls the number of states in the subspace. DMRG is monotonic in this parameter: the larger it is, the larger is the subspace and the better the approximation can be. There is also an exact limit: if <math>D\rightarrow d^L</math>, no states are discarded and the solution would be exact. This is however of no practical relevance; if such a large number of states could be achieved on the computer, exact diagonalization is a superior alternative. A remark on notation: given DMRG history, <math>D</math> comes under various names, like ''matrix dimension'' or ''number of block states''. <br />
<br />
The second key control parameter is of course system size <math>L</math>.<br />
<br />
The third control parameter(s) can only be understood by looking even closer at the DMRG algorithm. In order to find the best approximation to a state, DMRG proceeds in two steps:<br />
<br />
# In a first step (so-called ''infinite-system'' DMRG) the algorithm tries to find good subspaces by iteratively analyzing chains of length 2, 4, 6, until the desired system size <math>L</math> is reached. The procedure consists of splitting the chain in every iteration and insert two new sites at the center; the name comes from the fact that this procedure can of course be carried on infinitely, to take <math>L</math> to infinity; but don't expect very meaningful results as you approach infinity! A second remark is that this procedure favours chains of even length for DMRG treatment. <br />
# In a second step (so-called ''finite-system'' DMRG) DMRG deals with the fact that the subspace selection for shorter chains could not yet take into account all the quantum fluctuations and correlations that would be present in the chain of final length <math>L</math>. What the method does, is to go through a series of further iterations to improve the quality of the subspaces. One such iteration looking at all sites of a chain is referred to as a ''sweep'' in DMRG. The number of sweeps is the last important control parameter: if it is chosen to small, the precision reachable for a given <math>D</math> is not achieved; if it is chosen too large, calculational effort is wasted, although it is of course always good to err on the safe side. <br />
<br />
In a last remark, let us consider the ''truncation error'', which is a good indicator of the accuracy achieved by a DMRG run. In a simplified perspective, at each point in the algorithm DMRG makes one step in the direction of exponential growth of state space and then asks how much accuracy can be retained if not allowing that step, by means of an analysis of a density matrix regarding the distribution of weights (eigenvalues) corresponding to its eigenstates. The approximations of DMRG are then reflected in the fact that some statistical weight has to be discarded, which is the so-called truncation error. In many DMRG applications, it can be as small as <math>10^{-12}</math>, showing that the approximations made by DMRG are extremely light, which is the reason for the enormous success of the method. For the purpose of the tutorial it is important to know that the error in local quantities (energies, magnetizations, ...) is roughly proportional to (but usually quite a bit larger than) the truncation error, provided we are converged in the number of sweeps.<br />
<br />
==The ALPS DMRG Code and Its Control Parameters==<br />
<br />
Besides inputs such as the Hamiltonian and lattice geometry, the DMRG simulation requires a set of specific control parameters. Some of these are listed below. We refer the user to the DMRG reference page for further details:<br />
<br />
=== DMRG-specific parameters ===<br />
<br />
'''NUMBER_EIGENVALUES'''<br/><br />
Number of eigenstates and energies to calculate. Default is 1, should be set to 2 to calculate gaps.<br />
<br />
'''SWEEPS'''<br/><br />
Number of DMRG sweeps for the finite-size algorithm. Each sweep involves a left-to-right half-sweep, and a right-to-left half-sweep.<br />
<br />
'''NUM_WARMUP_STATES'''<br/><br />
Number of initial states to grow the DMRG blocks. If not specified, the algorithm will use a default value of 20 states.<br />
<br />
'''STATES'''<br/><br />
Number of DMRG states kept on each half sweep. The user should specify either 2*SWEEPS different values of STATES or one MAXSTATES or NUMSTATES value.<br />
<br />
'''MAXSTATES'''<br/><br />
Maximum number of DMRG states kept. The user may choose to specify either STATES values for each half-sweep, or a MAXSTATES or NUMSTATES that the program will use to grow the basis. The program will automatically determine how many states to use for each sweep, increasing the basis size in steps of STATES/(2*SWEEPS) until reaching MAXSTATES.<br />
<br />
'''NUMSTATES'''<br/><br />
Constant number of DMRG states kept for all sweeps.<br />
<br />
'''CONSERVED_QUANTUMNUMBERS'''<br/><br />
Quantum numbers conserved by the model of interest. They will be used in the code in order to reduce matrices in block form. If no value is specified for a particular quantum number, the program will work in the grand canonical. For instance in spin chains if you do not declare Sz_total, the program will run using a Hilbert space with dim=2^N states. Running in the "canonical" (by setting Sz_total=0, for instance) will improve performance considerably by working in a subspace with a reduced dimension. For an example of how to do this, take a look at the parms file included with the dmrg code.<br />
<br />
=== How to choose the right parameters ===<br />
<br />
It is not recommendable to use the default input values. DMRG convergence is strongly affected by the number of states used in the warmup, the number of sweeps, and the maximum number of states kept. Good practice involves looking at the convergence of the ground-state energy and truncation error as a function of the number of states. This will indicate an optimal number of states to be kept in order to maintain the errors below certain tolerance. <br />
<br />
In order to determine if enough sweeps have been performed, it is recommendable to look at the spatial distribution of the correlations, or local quantities such as the Sz projection of the spin, or the particle density. For instance, in a model that is symmetric under reflections, we should expect that these observables will also be symmetric. Another quantity that should be symmetric is the entanglement entropy. If this behavior is not reflected in the results, it is likely that this is due to running not enough sweeps (another plausible scenario is phase separation).<br />
<br />
If the Hamiltonian preserves quantum numbers, such as Sz or N, it is then possible to fix these values to run the simulation in a subspace of reduced dimension. This results in much faster runs, and optimal memory usage.<br />
<br />
=Ground State Energies=<br />
<br />
The first question we usually ask is for the ground state <math>| \psi_0 \rangle</math> and its energy <math>E_0</math>. Here we have to distinguish two cases.<br />
<br />
First, we might be interested in the ground state energy for a given Hamiltonian on a chain of a given length <math>L</math>. Secondly, we might be interested in the energy per site (or per bond) in the thermodynamic limit.<br />
<br />
==Fixed Length Ground State Energies==<br />
<br />
Consider chains of length <math>L=32,64,96,128</math>. Both for spin-1/2 and spin-1, set up ground state energy calculations for numbers of states <math>D=50,100,150,200,300</math>. For each length, tabulate the truncation error and the ground state energies as a function of <math>D</math>. Experiment carefully with the number of sweeps to assure that for a given length and number of states your result is actually converged.<br />
<br />
# For each system length and spin length, try to establish the connection between the accuracy of the total energy and the truncation error by plotting total energy vs. truncation error. <br />
# Observe how the convergence in <math>D</math> deteriorates with length for spin-1/2 and spin-1. Apart from a global factor of order of the length, do you see a difference between the convergence behaviour in the two cases? ''Hint:'' What you should see is, that but for the global factor, the convergence for large system sizes is only weakly dependent of length for the spin-1 chain, but much more strongly dependent for the spin-1/2 chain. This is because the spin-1 chain physics is dominated by segments of length of the correlation length, whereas for the spin-1/2 chain there is no finite length scale because of criticality.<br />
# Try to extrapolate ground state energies for each chain length to the <math>D\rightarrow\infty</math> limit.<br />
<br />
=== The one dimensional S=1/2 Heisenberg chain ===<br />
<br />
==== Single run ====<br />
<br />
The first example consists of setting up a simulation for a spin-1/2 Heisenberg chain with 32 sites, and open boundary conditions, keeping 100 states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
L=32 <br />
MAXSTATES=100<br />
<br />
Using the following sequence of commands you can first convert the input parameters to XML and then run the application dmrg:<br />
<br />
parameter2xml spin_onehalf<br />
dmrg spin_onehalf.in.xml<br />
<br />
The output file spin_onehalf.task1.out.xml contains all the computed quantities and can be viewed with a standard internet browser.<br />
<br />
DMRG will perform four sweeps, (four half-sweps from left to right and four half-sweeps from right to left) growing the basis in steps of MAXSTATES/(2*SWEEPS) until reaching the MAXSTATES=100 value we have declared. This is a convenient default option, but the number of states can be customized, as we show in the spin S=1 example below.<br />
<br />
==== Multiple runs ====<br />
<br />
We now proceed to illustrate how to setup several runs in a single parameter file. We shall use the example proposed in the tutorial, and simulate a chain of length L=32, changing the number of DMRG states:<br />
<br />
LATTICE="open chain lattice"<br />
SWEEPS=4<br />
CONSERVED_QUANTUMNUMBERS="N,Sz"<br />
MODEL="spin", Sz_total=0<br />
J=1<br />
NUMBER_EIGENVALUES=1<br />
{ L=32, MAXSTATES=50 }<br />
{ L=32, MAXSTATES=100 }<br />
{ L=32, MAXSTATES=150 }<br />
{ L=32, MAXSTATES=200 }<br />
{ L=32, MAXSTATES=300 }<br />
<br />
As we can see, the main difference with the previous example consists in the parameters encoded in brackets.<br />
As before, we run:<br />
<br />
parameter2xml spin_onehalf_multiple<br />
dmrg spin_onehalf_multiple.in.xml<br />
<br />
<br />
In this case, we will find five output files spin_onehalf.task#.out.xml containing the results.<br />
<br />
=== The one dimensional S=1 Heisenberg chain ===<br />
<br />
The S=1 Heisenberg chain will require some special treatment due to the open boundary conditions. As explained above, we need to include two sites at both ends of the chain with a spin S=1/2 on each of them. This requires defining a new lattice.<br />
<br />
==Ground State Energies Per Site (Bond)==<br />
<br />
If we look closely at the Hamiltonian, the energy of a chain of length <math>L</math> does not sit on the <math>L</math> sites, but on the <math>L-1</math> bonds. A first (naive) attempt therefore consists in taking the results of the last simulations and calculating <br />
<br />
<math>e_0 = \frac{E_0(L)}{L-1}</math>.<br />
<br />
Do you get really close to the values listed in the introduction? What is the wrong underlying assumption?<br />
<br />
The correct way is to eliminate the effect of the open boundary conditions by considering the energy of one bond at the center of the chain. There are two ways of doing it.<br />
<br />
# Calculate the ground state energy of two chains of length <math>L</math> and <math>L+2</math>, again for the lengths already mentioned above, and calculate <math>e_0 = (E_0(L+2) - E_0 (L))/2</math> as the energy per bond. What do the results look like now?<br />
# The less costly and usual way would be to use correlators (as discussed further below, so postpone this exercise until then) between neighbouring sites and use <br />
<br />
<math>e_0 = \frac{1}{2} (\langle S^+_i S^-_{i+1}\rangle + \langle S^-_i S^+_{i+1}\rangle ) + \langle S^z_i S^z_{i+1} \rangle </math><br />
<br />
for sites <math>i,i+1</math> at the chain center.</div>Afeiguin