Perturbation order histograms

To analyze the behaviour of the Markov chain in CTHYB the perturbation order histograms are a central tool. This is a simple example showing how to sample and plot these histograms.

As an example we solve the one-orbital Anderson impurity at inverse temperature \(\beta\), embedded in a flat (Wilson) bath with non-interacting Green’s function \(G^{-1}_{0,\sigma} (i\omega_n) = i \omega_n - \epsilon_f - V^2 \Gamma_\sigma(i \omega_n)\), and local interaction \(H_\mathrm{int} = U n_\uparrow n_\downarrow\), where \(U\) is the Hubbard interaction, \(\epsilon_f\) is the local energy. The bath \(\Gamma\), and the bath has bandwidth \(D\) and hybridization \(V\).

[2]:
from triqs.operators import n
from h5 import HDFArchive
from triqs.gf import inverse, iOmega_n, Wilson

from triqs_cthyb import Solver

U, e_f, D, V, beta = 2., -1., 1., 1., 20.
Sz = 0.5 * ( n('up', 0) - n('down', 0) )

S = Solver(
    beta=beta, gf_struct=[('up',[0]), ('down',[0])],
    n_tau=400, n_iw=50,)

S.G0_iw << inverse(iOmega_n - e_f - V**2 * Wilson(D))

S.solve(
    h_int=U*n('up',0)*n('down',0),
    n_cycles=100000,
    length_cycle=20,
    n_warmup_cycles=100,
    measure_G_tau=False,
    measure_pert_order=True,
    )
Starting on 1 Nodes at : 2019-06-05 17:20:04.584678

╔╦╗╦═╗╦╔═╗ ╔═╗  ┌─┐┌┬┐┬ ┬┬ ┬┌┐
 ║ ╠╦╝║║═╬╗╚═╗  │   │ ├─┤└┬┘├┴┐
 ╩ ╩╚═╩╚═╝╚╚═╝  └─┘ ┴ ┴ ┴ ┴ └─┘

The local Hamiltonian of the problem:
(-1,0)*c_dag('down',0)*c('down',0) + (-1,0)*c_dag('up',0)*c('up',0) + (2,0)*c_dag('down',0)*c_dag('up',0)*c('up',0)*c('down',0)
Using autopartition algorithm to partition the local Hilbert space
Found 4 subspaces.

Warming up ...

Accumulating ...
17:20:04   0% ETA 00:00:14 cycle 667 of 100000
17:20:06  14% ETA 00:00:12 cycle 14816 of 100000
17:20:09  31% ETA 00:00:10 cycle 31517 of 100000
17:20:12  51% ETA 00:00:07 cycle 51752 of 100000
17:20:16  78% ETA 00:00:03 cycle 78933 of 100000


[Rank 0] Collect results: Waiting for all mpi-threads to finish accumulating...
[Rank 0] Timings for all measures:
Measure                   | seconds
Average sign              | 0.0121935
Perturbation order        | 0.017634
Perturbation order (down) | 0.0144553
Perturbation order (up)   | 0.011125
Total measure time        | 0.0554078
[Rank 0] Acceptance rate for all moves:
Move set Insert two operators: 0.056355
  Move  Insert Delta_up: 0.0565787
  Move  Insert Delta_down: 0.0561309
Move set Remove two operators: 0.0564614
  Move  Remove Delta_up: 0.0566373
  Move  Remove Delta_down: 0.0562848
Move  Shift one operator: 0.758509
[Rank 0] Warmup lasted: 0.0125826 seconds [00:00:00]
[Rank 0] Simulation lasted: 14.9179 seconds [00:00:14]
[Rank 0] Number of measures: 100000
Total number of measures: 100000
Average sign: (1,0)

Plotting perturbation order histograms

The measured histograms are available as the member properties S.perturbation_order and S.perturbation_order_total of the cthyb solver.

For an ergodic Markov chain with sufficient number of warmup sweeps, the perturbation order distribution should be approximately Gaussian (or Possonian for low average orders).

[3]:
from triqs.plot.mpl_interface import oplot, oplotr, plt

oplot(S.perturbation_order_total, label='total')
for b in S.perturbation_order:
    oplot(S.perturbation_order[b], label='block {:s}'.format(b))

plt.semilogy([], [])
plt.xlim([0, 40]);
../_images/guide_perturbation_order_notebook_4_0.svg

The total average perturbation order is important information to determine the length_cycle parameter that controls the number of attempted moves between measurements. To ensure low correlation between measurements the length_cycle should be high enough that the attempted moves can significanty change the configuration.

Autor: H. U.R. Strand (2019)