Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/en/tutorials/jupyter/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Below are a collection of ALPS simulations in Jupyter notebooks. You can learn a

- [Energy Gap of a Spin-1 Heisenberg Chain](ed/spingapspinoneheisenbergchain) <a href = "/codes/ed/spinGapSpinOneHeisenbergChain.ipynb" download><span class="material-icons" style="vertical-align:bottom;padding-left: 1px; padding-right: 5px;">download</span></a>

- [Energy Spectra of 1D Systems: Chain, Ladder, and Isomers](ed/spectra1dsystems) <a href = "/codes/ed/spectra1DSystems.ipynb" download><span class="material-icons" style="vertical-align:bottom;padding-left: 1px; padding-right: 5px;">download</span></a>
- [Energy Spectra of 1D Systems: Chain, Ladder, and Dimers](ed/spectra1dsystems) <a href = "/codes/ed/spectra1DSystems.ipynb" download><span class="material-icons" style="vertical-align:bottom;padding-left: 1px; padding-right: 5px;">download</span></a>

## Density Matrix Renormalization Group

Expand Down
56 changes: 53 additions & 3 deletions content/en/tutorials/jupyter/dmft/dmftBetheHubbard.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cascade:
type: docs
---

The dynamical mean-field theory (DMFT) for strongly correlated electron systems is based on mapping of lattice models onto quantum impurity models subject to a self-consistency condition [Georges, et al, Rev. Mod. Phys. 68, 13 (1996)]. The mapping is exact for models of correlated electrons in the limit of large lattice coordination or infinite spatial dimensions. Bethe lattice is an example lattice with infinite spatial dimensions and can be simulated by DMFT with ALPS.
The dynamical mean-field theory (DMFT) for strongly correlated electron systems is based on mapping of lattice models onto quantum impurity models subject to a self-consistency condition [A. Georges, G. Kotliar, W. Krauth, and M.J. Rozenberg, Reviews of Modern Physics 68, 13-125 (1996)](https://doi.org/10.1103/RevModPhys.68.13). The mapping is exact for models of correlated electrons in the limit of large lattice coordination or infinite spatial dimensions. Bethe lattice is an example lattice with infinite spatial dimensions and can be simulated by DMFT with ALPS.

### Bethe Lattice
An example picture of Bethe lattice is shown below, where there are 3 coordination numbers for each lattice site. The effective dimension of the lattice is infinite. It, therefore, offers a great opportunity to implement DMFT on such a lattice, where the DMFT method can be benchmarked and explored.
Expand All @@ -27,6 +27,40 @@ where
- $U$ is on-site interaction energy, with $U > 0$ corresponding to repulsive interactions.
- $n_{i,\sigma} = c_{i,\sigma}^\dagger c_{i,\sigma}$ is number operator for fermions with flavor $\sigma$ at site $i$.

### Parameters

| Parameter | Meaning | Value |
|---|---|---|
| `SOLVER` | impurity solver algorithm | `Interaction Expansion` (CT-INT QMC) |
| `U` | on-site Hubbard repulsion | `3` |
| `t` | hopping amplitude, rescaled for the Bethe lattice | `0.707106781...` ($=1/\sqrt{2}$) |
| `BETA` | inverse temperature $1/T$ | `6` (high $T$), `12` (low $T$) |
| `MU` | chemical potential (half filling) | `0` |
| `FLAVORS` | number of fermion flavors (spin up/down) | `2` |
| `SITES` | number of impurity sites | `1` |
| `ANTIFERROMAGNET` | allow symmetry-broken AFM solution | `1` |
| `H_INIT` | initial symmetry-breaking field, to seed the AFM state | `0.05` |
| `N`, `NMATSUBARA` | number of imaginary-time / Matsubara-frequency points | `500` |
| `SWEEPS`, `THERMALIZATION` | QMC sweeps and thermalization steps | `1e8`, `1000` |
| `MAX_IT`, `MAX_TIME` | DMFT self-consistency iterations, wall-time cap per iteration (s) | `10`, `10` |
| `CONVERGED` | self-consistency convergence threshold | `0.005` |

### Lattice

```
o o
\ /
o---o---o each site has z=3 neighbours,
/ \ connected in a loop-free tree
o o → Bethe lattice, coordination z=3
```

The Bethe lattice (an infinite, loop-free tree) is used because it is the simplest lattice for which DMFT becomes numerically *exact* in the limit of infinite coordination number — the self-consistency condition for the local Green's function collapses to the simple semicircular-DOS relation used internally by `pyalps.runDMFT`, with the hopping $t$ rescaled by $1/\sqrt{z}$ (hence `t=1/sqrt(2)` for effective coordination in the infinite-$z$ limit) so the bandwidth stays finite. See the [ALPS lattice library](../../../documentation/intro/latticehowtos) for finite-dimensional lattices where DMFT is instead an approximation.

### Method Choice

Unlike the ED/DMRG tutorials, the local impurity problem here is solved stochastically: the `Interaction Expansion` continuous-time quantum Monte Carlo (CT-INT) solver samples diagrams in powers of $U$ rather than diagonalizing a Hamiltonian, which is what makes it possible to reach the true infinite-coordination Bethe lattice (no finite-size Hilbert space to truncate). `MAX_TIME=10` caps each DMFT iteration to 10 seconds of QMC sampling regardless of the nominal `SWEEPS=1e8`, so the full `MAX_IT=10`-iteration self-consistency loop for both temperatures completes in a few minutes.

### Simulation
We first import the required modules.

Expand Down Expand Up @@ -111,7 +145,23 @@ The graph of the simulation should look like below:

The result shows a Neel transition for the Hubbard model on the Bethe lattice, where the system undergoes a transition from the antiferromagnetic state at low temperatures ("BETA = 12") to the paramagnetic state at high temperatures ("BETA = 6").

### Results

```python
The single-particle Green's function at the two ends of the imaginary-time interval, from running the code above:

```
| $\beta$ | Flavor | $G(\tau=0)$ | $G(\tau=\beta/2)$ |
|---|---|---|---|
| 6 | 0 (↑) | -0.4868 | -0.0759 |
| 6 | 1 (↓) | -0.5132 | -0.0776 |
| 12 | 0 (↑) | -0.8932 | -0.0039 |
| 12 | 1 (↓) | -0.1066 | -0.0037 |

At $\beta=6$, the two spin flavors are nearly symmetric ($-0.487$ vs. $-0.513$) — a paramagnetic solution. At $\beta=12$, the flavors split strongly ($-0.893$ vs. $-0.107$) — the AFM symmetry-breaking field `H_INIT` has grown into a robust staggered magnetization, signalling the system has crossed into the antiferromagnetically-ordered phase on cooling.

### Summary and Outlook

DMFT on the Bethe lattice shows the half-filled Hubbard model crossing from a paramagnetic solution at high temperature ($\beta=6$) to a magnetically-ordered (Néel) solution at low temperature ($\beta=12$), visible directly in the splitting of the two spin flavors' Green's functions.

1. At what value of $\beta$ between 6 and 12 does the splitting between the two flavors first become significant — can you bracket the Néel transition temperature?
2. How does the transition temperature shift if the interaction $U$ is increased from 3 to 6?
3. What would you expect to see in the paramagnetic phase if you additionally computed the local density of states via `maxent`?
53 changes: 53 additions & 0 deletions content/en/tutorials/jupyter/dmrg/energygapspinhalf.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,42 @@ cascade:

In this tutorial, we will calculate the energy gap of a 32-site spin-1/2 chain using DMRG simulations. The gap, as one knows, approaches 0 in the thermodynamic limit for a spin-1/2 chain.

The Hamiltonian is the antiferromagnetic Heisenberg exchange model, first introduced by [W. Heisenberg, Zeitschrift für Physik 49, 619-636 (1928)](https://doi.org/10.1007/BF01328601):
$$
H = J\sum_{\langle i,j \rangle} \mathbf{S}^i \cdot \mathbf{S}^j, \qquad J>0.
$$

The calculation can be done by two methods. The first method is through the direct calculation of both the ground state and the first excited state energies in the same DMRG simulation. The difference of the two energies gives the energy gap. The second method is through the calculation of two ground state energy in two spin sectors: singlet and triplet spin sectors, by fixing the total spin magnetization to either 0 or 1.

### Parameters

| Parameter | Meaning | Value |
|---|---|---|
| `LATTICE` | lattice used for the chain | `open chain lattice` |
| `MODEL` | Hamiltonian family | `spin` |
| `CONSERVED_QUANTUMNUMBERS` | quantum numbers fixed in the basis | `Sz` (Method 1), `N,Sz` (Method 2) |
| `Sz_total` | total magnetization sector | `0` (Method 1); `0` and `1` (Method 2) |
| `J` | Heisenberg exchange coupling | `1` |
| `SWEEPS` | number of DMRG sweeps | `4` |
| `L` | chain length | `32` |
| `MAXSTATES` | number of DMRG basis states kept | `100` (Method 1), `40` (Method 2) |
| `NUMBER_EIGENVALUES` | number of low-lying eigenstates kept | `2` (Method 1), `1` (Method 2) |

### Lattice

The `open chain lattice` is a 1D open chain of `L=32` sites with Heisenberg exchange $J$ on every bond:

```
J J J J
o-----o-----o-----o-- ... --o (32 sites, open boundary conditions)
```

An open (rather than periodic) chain is used because DMRG's accuracy for a fixed number of kept states `MAXSTATES` is best on open boundaries, which is standard practice for 1D DMRG. See the [ALPS lattice library](../../../documentation/intro/latticehowtos) for other built-in lattices.

### Method Choice

The full Hilbert space of a 32-site spin-1/2 chain is $2^{32}\approx4.3\times10^9$ states — far too large for exact diagonalization. DMRG truncates this to `MAXSTATES=100` variationally-optimal basis states per block, making the calculation tractable (a few seconds per run here) while keeping the truncation error negligible for this chain length.

### Method 1: Direct Calculation of Ground-state and Excited-state Energies

We first load the necessary libraries and prepare the input parameters.
Expand Down Expand Up @@ -117,3 +151,22 @@ print('Gap:', energies[1]-energies[0])
```

Let us compare the energies and gap from both methods. Do they agree with each other?

### Results

Running the code above gives:

| Method | Energies | Gap |
|---|---|---|
| 1 (direct) | $E_0=-13.99732$, $E_1=-13.87958$ | 0.11774 |
| 2 (quantum numbers) | $E(S_z=0)=-13.99732$, $E(S_z=1)=-13.87958$ | 0.11774 |

The two methods agree to 5 significant figures, as expected since they compute the same physical gap two different ways.

### Summary and Outlook

For a 32-site open spin-1/2 chain, DMRG gives an excitation gap of $\Delta/J\approx0.1177$ — a finite-size value, not yet the (vanishing) thermodynamic-limit gap; see the companion "Extrapolation of Energy Gap" tutorial for how this gap closes as $L\to\infty$.

1. Why do the two methods above give exactly the same gap even though they solve different eigenvalue problems?
2. What do you expect to happen to this gap if you double the chain length to $L=64$?
3. How does the gap change if the number of kept states `MAXSTATES` is reduced to 20 — is 100 states already converged?
57 changes: 57 additions & 0 deletions content/en/tutorials/jupyter/dmrg/energygapspinone.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ In this tutorial, we will calculate the energy gap of a 64-site spin-1 chain usi

Similar to the spin-1/2 case, the calculation can be carried out in two ways. The first method is through the direct calculation of 4 lowest energy states in the same DMRG run. We will see the 2-fold degeneracy of the ground state and the energy gap between the ground state and the first excited state. The second method is through the calculation of ground state energies in different total spin sectors, i.e., the total magnetization 0, 1, and 2. We will find that the ground state eneries for the magnetization 0 and 1 are identical within error bounds, and that the energy gap can be calculated by the ground state energy difference between magnetization 1 and 2 sectors.

This is the Heisenberg exchange model (see [W. Heisenberg, Zeitschrift für Physik 49, 619-636 (1928)](https://doi.org/10.1007/BF01328601)) with spin-1 sites instead of spin-1/2. The predicted finite gap in the integer-spin case is the Haldane gap, from [F.D.M. Haldane, Physics Letters A 93, 464-468 (1983)](https://doi.org/10.1016/0375-9601(83)90631-X).

### Parameters

| Parameter | Meaning | Value |
|---|---|---|
| `LATTICE` | lattice used for the chain | `open chain lattice` |
| `MODEL` | Hamiltonian family | `spin` |
| `local_S` | spin quantum number per site | `1` |
| `CONSERVED_QUANTUMNUMBERS` | quantum numbers fixed in the basis | `Sz` (Method 1), `N,Sz` (Method 2) |
| `Sz_total` | total magnetization sector | `0` (Method 1); `0`, `1`, `2` (Method 2) |
| `J` | Heisenberg exchange coupling | `1` |
| `SWEEPS` | number of DMRG sweeps | `5` |
| `L` | chain length | `64` |
| `MAXSTATES` | number of DMRG basis states kept | `300` |
| `NUMBER_EIGENVALUES` | number of low-lying eigenstates kept | `4` (Method 1), `1` (Method 2) |

### Lattice

```
J J J J
o-----o-----o-----o-- ... --o (64 sites, spin-1 each, open boundary conditions)
```

Same `open chain lattice` as the spin-1/2 case, but with `local_S=1` and double the length (`L=64`), since a longer chain is needed to resolve the finite Haldane gap cleanly from finite-size corrections. See the [ALPS lattice library](../../../documentation/intro/latticehowtos) for other built-in lattices.

### Method Choice

For spin-1, the local Hilbert space is 3-dimensional, so the untruncated space of a 64-site chain is $3^{64}\approx3.4\times10^{30}$ — far beyond exact diagonalization. DMRG's `MAXSTATES=300` keeps this tractable; more states are kept here than in the spin-1/2 tutorial because resolving the near-degenerate ground-state pair (see below) requires higher accuracy.

## Method 1: Direct Calculation of 4 Lowest Energies

We first load the necessary libraries and prepare the input parameters.
Expand Down Expand Up @@ -67,6 +97,8 @@ print('\nGap:', abs(energies[1]-energies[0]), abs(energies[2]-energies[1]))

From the simulation, do you see the ground-state degeneracy and a finite energy gap to the first excited state?

Running the code above gives the four lowest energies $E_0,E_1,E_2,E_3 = -88.48667, -88.48666, -88.05889, -88.05629$: the two lowest states are degenerate to within $3\times10^{-7}$ (the 2-fold ground-state degeneracy), and the gap to the next pair is $E_2-E_1\approx0.4278$.

## Method 2: Using Quantum Numbers

We first restrict the simulations in the magnetization `Sz_total = 0` and `Sz_total = 1` sectors. The ground state energy difference between the two sectors is then extracted, which shows that they are degenerate. We then repeat the calculation with `Sz_total = 1` and `Sz_total = 2`. The results are used to extract the energy gap.
Expand Down Expand Up @@ -126,6 +158,8 @@ print('Gap:', energies[sz_tot[1]]-energies[sz_tot[0]])

Do you see the degenerate ground states from the two magnetization sectors?

Running the code above for `sz_tot=[0,1]` gives $E(S_z=0)=-88.48667$ and $E(S_z=1)=-88.48666$ — a gap of only $9\times10^{-6}$, confirming the two sectors are degenerate within DMRG accuracy.

Next, we change the list of magnetizations to `sz_tot = [1,2]` and repeat the simulation. For convenience, we copy the above codes in the following. The only change is the magnetization list.


Expand Down Expand Up @@ -168,3 +202,26 @@ print('Gap:', energies[sz_tot[1]]-energies[sz_tot[0]])
```

Can you now correctly extract the energy gap for a 64-site spin-1 chain? Do you see agreement with the result from Method 1?

Running the code above for `sz_tot=[1,2]` gives a gap of $0.42755$, in close agreement with the $0.4278$ found by Method 1 (small differences come from the two methods using independent DMRG runs with slightly different truncation).

### Results

Summary of both methods for the 64-site spin-1 chain:

| Method | Quantity | Value |
|---|---|---|
| 1 | $E_0-E_1$ (ground-state degeneracy splitting) | $3\times10^{-7}$ |
| 1 | $E_2-E_1$ (excitation gap) | 0.4278 |
| 2 | $E(S_z{=}1)-E(S_z{=}0)$ (degeneracy check) | $9\times10^{-6}$ |
| 2 | $E(S_z{=}2)-E(S_z{=}1)$ (excitation gap) | 0.4276 |

Both methods agree on a finite-size gap of $\Delta/J\approx0.4276$–$0.4278$ at $L=64$, consistent with the thermodynamic-limit Haldane gap $\Delta/J\approx0.4105$ found in the "Spin Gap of a Spin-1 Heisenberg Chain" exact-diagonalization tutorial.

### Summary and Outlook

Unlike the gapless spin-1/2 chain, the spin-1 Heisenberg chain has a 2-fold degenerate ground state and a finite excitation gap even at $L=64$ — direct DMRG confirmation of Haldane's prediction for integer-spin chains.

1. Why is the ground state 2-fold degenerate for a spin-1 chain but non-degenerate for spin-1/2?
2. How close is the $L=64$ gap here to the true thermodynamic-limit Haldane gap, and what does that tell you about finite-size corrections at this length?
3. Try `local_S=3/2`: is the ground state gapped or gapless, and how does this depend on whether the spin is integer or half-integer?
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,39 @@ cascade:

In this tutorial, we will calculate energy gap for a spin-1/2 chain with various lattice sizes: 32, 64, 96, and 128. We will fix the number of states in the DMRG simulation to $D=100$, which produces results with enough accuracy. The energy gaps vs lattice sizes will be plotted and extrapolated to the thermodynamic limit.

The Hamiltonian is the antiferromagnetic Heisenberg exchange model, first introduced by [W. Heisenberg, Zeitschrift für Physik 49, 619-636 (1928)](https://doi.org/10.1007/BF01328601):
$$
H = J\sum_{\langle i,j \rangle} \mathbf{S}^i \cdot \mathbf{S}^j, \qquad J>0.
$$
For a spin-1/2 chain, the gap is known to close as $1/L$ in the thermodynamic limit, which is the scaling form fitted below.

### Parameters

| Parameter | Meaning | Value |
|---|---|---|
| `LATTICE` | lattice used for the chain | `open chain lattice` |
| `MODEL` | Hamiltonian family | `spin` |
| `CONSERVED_QUANTUMNUMBERS` | quantum numbers fixed in the basis | `Sz` |
| `Sz_total` | total magnetization sector | `0` |
| `J` | Heisenberg exchange coupling | `1` |
| `SWEEPS` | number of DMRG sweeps | `4` |
| `L` | chain length | `32, 64, 96, 128` |
| `MAXSTATES` | number of DMRG basis states kept | `100` |
| `NUMBER_EIGENVALUES` | number of low-lying eigenstates kept | `2` |

### Lattice

```
J J J J
o-----o-----o-----o-- ... --o (L = 32, 64, 96, or 128 sites, open boundary conditions)
```

Same `open chain lattice` as the single-size gap tutorial, repeated at four lengths so the finite-size gap can be extrapolated to $L\to\infty$. See the [ALPS lattice library](../../../documentation/intro/latticehowtos) for other built-in lattices.

### Method Choice

At $L=128$ the untruncated Hilbert space is $2^{128}$, astronomically beyond exact diagonalization; DMRG with a fixed `MAXSTATES=100` keeps the calculation tractable at every size while still resolving the gap accurately enough for the $1/L$ extrapolation below. All four sizes together run in well under a minute.

We first import the necessary libraries.


Expand Down Expand Up @@ -112,3 +145,24 @@ plt.show()

The final energy gap figure should look like the following:
![Energy Gap of a Spin-1/2 Chain](/figs/dmrg/extrapolationGapSHalf.png)

### Results

Running the code above gives:

| $L$ | $1/L$ | Gap $\Delta/J$ |
|---|---|---|
| 32 | 0.03125 | 0.11774 |
| 64 | 0.01563 | 0.06176 |
| 96 | 0.01042 | 0.04205 |
| 128 | 0.00781 | 0.03194 |

The linear fit in $1/L$ extrapolates to $\Delta/J\approx0.0040$ at $L\to\infty$ — consistent with zero within the fit's finite-size systematic error, confirming that the spin-1/2 Heisenberg chain is gapless.

### Summary and Outlook

The DMRG-computed gap for the spin-1/2 Heisenberg chain shrinks approximately linearly in $1/L$ and extrapolates to essentially zero, confirming the chain is gapless in the thermodynamic limit — in direct contrast to the finite Haldane gap found for the spin-1 chain.

1. Is a strictly linear fit in $1/L$ the best choice here, or would a form with logarithmic corrections (as predicted by field theory for the spin-1/2 chain) fit better?
2. How does the extrapolated gap change if you include larger lattice sizes, e.g. $L=160,192$?
3. Compare this extrapolation to the spin-1 case: why does that one extrapolate to a finite gap instead of zero?
Loading