Skip to content

DLR tutorial #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.3.x
Choose a base branch
from
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
201 changes: 201 additions & 0 deletions ModelDMFT/06-Discrete_Lehman_Representation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "329ad08d",
"metadata": {},
"source": [
"# A DLR DMFT calculation\n",
"\n",
"The goal of this notebook is to make a more economical DMFT calculation using the Discrete Lehman Representation of Green's functions (DLR). If you are interested in more of the theory behind this method,a good first reference is [(here)](https://doi.org/10.1103/PhysRevB.86.085133), which this tutorial follows closely. \n",
"\n",
"You will construct first a simple self-consistent loop for the Sachdev-Ye-Kitaev model, and then an IPT calculation with a more compact and economical framework than in Tutorial 1. \n",
"\n",
"## Discrete Lehman Representation\n",
"Here we take advantage of the spectral representation of the Green's function\n",
"\\begin{equation}\n",
"G(\\tau)=-\\int_{-\\infty}^{\\infty} K(\\tau, \\omega) \\rho(\\omega) d \\omega\n",
"\\end{equation}\n",
"with the fermionic kernel being given by \n",
"\\begin{equation}\n",
"K(\\tau, \\omega)=\\frac{e^{-\\omega \\tau}}{1+e^{-\\beta \\omega}}\n",
"\\end{equation}\n",
"The kernel $K$ can be approximated by a low rank decomposition. This has some negative consequences, such as the ill-conditioning of analytic continuation (which you make have seen in the Pade approximates used in previous tutorials), but it also has some benefits. This behaviour can be exploited to provide a compact representation of $G$. \n",
"\\begin{equation}\n",
"G(\\tau) \\approx G_{\\mathrm{DLR}}(\\tau)=\\sum_{k=1}^r \\frac{e^{-\\omega_k \\tau}}{1+e^{-\\omega_k}} \\widehat{g}_k=\\sum_{k=1}^r \\widetilde{g}_k e^{-\\omega_k \\tau}\n",
"\\end{equation}"
]
},
{
"cell_type": "markdown",
"id": "fee0f10b",
"metadata": {},
"source": [
"### Constructing DLR Green's Functions\n",
"The DLR Green's function is constructed on $r$ Matsubara frequency points which are uniquely determined (independent of $G$) by a error $\\epsilon$ in the accuracy of the representation and a high-energy cutoff. $\\Lambda = \\beta \\omega_{max}$. \n",
"These values are given to TRIQS via the parameters `dlr_error` and `w_max` . In general, these should be convergence criterion. \n",
"Particular care is needed when approximating stochastic data, such as quantum Monte Carlo data, which might include statistical noise.\n",
" For the determinstic Dyson equations solved here, these should be made quite large and small respectively. Here you will see that the representation needs only $\\mathcal{O}(10^2)$ points to converge correctly, compared to $\\mathcal{O}(10^8)$ with a uniform Matsubara grid. \n",
"\n",
" The example below shows how to construct a fermionic Green's function in both Matsubara frequencies and imaginary time. "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f916c67b",
"metadata": {},
"outputs": [],
"source": [
"from triqs.gf import *\n",
"from triqs.gf.tools import *\n",
"from triqs.operators import *\n",
"from triqs.gf.block_gf import *\n",
"from triqs.gf.descriptors import Function\n",
"import h5\n",
"import numpy as np\n",
"from triqs.plot.mpl_interface import *\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"import json, sys, os\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "c53fb03e",
"metadata": {},
"outputs": [],
"source": [
"params = {\n",
" \"beta\": 50.0,\n",
" \"mu\": 0.0,\n",
" \"alpha\" : 0.5,\n",
" \"w_max\": 10.0,\n",
" \"dlr_err\": 1e-8, \n",
" \"J\" : 1.0,\n",
" \"max_iter\": 1000,\n",
" \"threshold\": 1e-8,\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "741f5e46",
"metadata": {},
"outputs": [],
"source": [
"gf_struct =[('up',1), ('dn',1)]\n",
"iw_mesh = MeshDLRImFreq(beta=params[\"beta\"], statistic='Fermion', w_max= params[\"w_max\"], eps = params[\"dlr_err\"], symmetrize = True)\n",
"# careful! does not work without symmetrize=True\n",
"G_iw = BlockGf(mesh=iw_mesh, gf_struct=gf_struct)\n",
"G_tau = make_gf_dlr_imtime(G_iw)\n",
"Sigma_iw = G_iw.copy()\n",
"Sigma_tau = make_gf_dlr_imtime(Sigma_iw)"
]
},
{
"cell_type": "markdown",
"id": "cbef9746",
"metadata": {},
"source": [
"### A word of caution\n",
"The DLR representation now allows one to evaluate $G(\\tau)$ for any $\\tau$, even if it is not included in the original grid. While these are faithful representations, the current TRIQS implementation does not impose additional properties of Green's functions, such as antiperiodicity. See the below examples for some subtleties in evaluating $G(\\tau)$. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cef335d7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[-0.50000001+2.1345501e-16j]]\n",
"[[0.00044346+2.40809328e-11j]]\n",
"[[-0.50000001-5.37912629e-16j]]\n",
"[[-0.06406086-4.89547088e-17j]]\n",
"[[-0.06406086-4.89547088e-17j]]\n",
"[[nan+nanj]]\n",
"[[nan+nanj]]\n"
]
}
],
"source": [
"G_iw << SemiCircular(2)\n",
"G_tau << make_gf_dlr_imtime(G_iw)\n",
"G_dlr = make_gf_dlr(G_iw[\"up\"]) # the DLR coefficents \n",
"\n",
"print(G_dlr(0.0)) # evaluating at tau = 0.0 for float\n",
"print(G_dlr(0)) # evaluating at iw_0 for int\n",
"print(G_dlr(50.0)) # evaluating at tau = beta gives density\n",
"print(G_dlr(45.0)) # evaluating at tau = 5.0\n",
"print(G_dlr(-5.0)) # evaluating at tau = -5.0 does not obey G(-tau) = -G(beta - tau)\n",
"print(G_dlr(-150.0)) # evaluating outside the range of the DLR coefficients does not wrap back around\n",
"print(G_dlr(150.0)) # evaluating outside the range of the DLR coefficients does not wrap back around\n"
]
},
{
"cell_type": "markdown",
"id": "d5547d81",
"metadata": {},
"source": [
"### Exercise 1 \n",
"Now we are going to evluate the self-consistent Dyson loop for the $O+1$D (impurity) Sachdev-Ye-Kitaev (SYK) model. The Hamiltonian is given by \n",
"$$H = \\sum^N_{ijkl} J_{ijkl} c^\\dagger_i c^\\dagger_j c_k c_l$$\n",
"where the $J_{ijkl}$ couplings between $N$ fermions that are random Gaussian couplings with constant variance $J^2$.\n",
" This model has many interesting applications for non-Fermi liquids, or strange metals, and quantum criticality. You can read more about the model and its' extensions [(here)](https://doi-org.myaccess.library.utoronto.ca/10.1103/RevModPhys.94.035004). Here we are just interested in the simple form of the self-energy in the large-$N$ limit of the model which is exactly solvable. Here we have (up to some prefactors)\n",
"\\begin{equation}\n",
"\\Sigma(\\tau) = -J^2 G^2(\\tau)G(-\\tau)\n",
"\\end{equation}\n",
"which has a superficial resemble to the IPT equations (except with the local $G$ rather than the Weiss $\\mathcal{G}_0$). Now it is your turn to write a self-consistent loop to solve for $G$. "
]
},
{
"cell_type": "markdown",
"id": "1b42178d",
"metadata": {},
"source": [
"### Optional Exercise 1b\n",
"To really see the power of DLR, try converging these equations down to lower $T$. To do this, take a higher $T$ solution as a guess and continue lowering $T$. Steps of $\\beta = 10, 20$ should be slow enough. As you approach the $\\beta = \\infty$ limit, your result should begin to match the conformal solution to these equations. Try comparing!\n",
"\\begin{equation}\n",
"G_c(\\tau)=-\\frac{\\pi^{1 / 4}}{\\sqrt{2 \\beta}}\\left(\\sin \\left(\\frac{\\pi \\tau}{\\beta}\\right)\\right)^{-1 / 2}\n",
"\\end{equation}"
]
},
{
"cell_type": "markdown",
"id": "45fedad2",
"metadata": {},
"source": [
"### Exercise 2 \n",
"\n",
"Now that you see the power of DLR, try repeating Tutorial 1 to converge the IPT equations for a given $\\beta$ and $U$. See how much quicker your calculations are compared to Tutorial 1. \n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading