{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Susceptibility $\\chi_0$ of non-interacting fermions\n", "\n", "## Theory\n", "\n", "The susceptibility $\\chi$ of a system determines the linear-response to weak external fields and is given by the two particle response function,\n", "\n", "$$\n", "\\chi_{\\bar{a}b\\bar{c}d}(\\mathbf{r} - \\mathbf{r}', \\tau - \\tau') = \n", "\\langle \\mathcal{T} (c^\\dagger_a c_b)(\\mathbf{r}, \\tau) (c^\\dagger_c c_d)(\\mathbf{r}', \\tau') \\rangle \n", "- \\langle c^\\dagger_a c_b \\rangle \\langle c^\\dagger_c c_d \\rangle\n", "\\, ,\n", "$$\n", "\n", "where one pair of operators $c^\\dagger_a c_b$ act at position $\\mathbf{r}$ and imaginary time $\\tau$ and a second pair of operators $c^\\dagger_c c_d$ at $\\mathbf{r}'$ and $\\tau'$.\n", "\n", "In the non-interacting limit the quartic expectation value can be decomposed using Wick's theorem and the non-interacting susceptibility takes the form\n", "\n", "$$\n", "\\chi_0(\\mathbf{r}, \\tau) = \n", "- \n", "\\langle \\mathcal{T} c_b(\\mathbf{r}, \\tau) c^\\dagger_a \\rangle \n", "\\langle \\mathcal{T} c_d(-\\mathbf{r}, -\\tau) c^\\dagger_c \\rangle \n", "= - G_{b\\bar{a}}(\\mathbf{r}, \\tau) G_{d\\bar{c}}(-\\mathbf{r}, -\\tau)\n", "\\, ,\n", "$$\n", "\n", "i.e. it is just a direct product of two single particle Green's function in real-space.\n", "\n", "Fourier transformed to momentum and Matsubara frequency space $\\chi_0$ becomes a double convolution\n", "\n", "\\begin{equation}\n", " \\chi_0(\\mathbf{q}, i\\omega_n) = \n", " 2\\frac{1}{N}\\sum_{\\mathbf{k}, m} \n", " G_0(\\mathbf{k}, i\\nu_m)G_0(\\mathbf{k}+\\mathbf{q}, i\\nu_m + i\\omega_n)\n", " \\, ,\n", "\\end{equation}\n", "\n", "where $\\mathbf{q}$ and $\\mathbf{k}$ are momenta and $i\\omega_n$ and $i\\nu_m$ are Bosonic and Fermionic Matsubara frequencies, respectively, and N the number of $\\mathbf{k}$ points." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fast calculation using Fourier transform\n", "\n", "To compute $\\chi_0$ the fastest approach is to perform the direct product in real space and imaginary time above. However, we usually have the single particle Green's function in momentum and frequency $G(\\mathbf{k}, i\\nu_n)$ and are interested in the susceptibiltiy $\\chi_0$ in the same space $\\chi_0(\\mathbf{q}, i\\omega_n)$.\n", "\n", "Therefore we compute $\\chi_0$ by Fourier transforming the Green's function $G$ to imaginary time $\\tau$ and real space $\\mathbf{r}$, using fast Fourier transforms (FFT)\n", "\n", "$$\n", "G_0(\\mathbf{r}, \\tau) = \n", " \\mathcal{F}_{\\{\\mathbf{k}, i\\nu_m\\} \\rightarrow \\{\\mathbf{r}, \\tau\\}} \n", " \\big\\{ G_0(\\mathbf{k}, i\\nu_n) \\big\\}\n", " \\, ,\n", "$$\n", "\n", "giving $\\chi_0$ as the simple product\n", "\n", "$$\n", "\\chi_0(\\mathbf{r},\\tau) = 2 G_0(\\mathbf{r},\\tau)G_0(-\\mathbf{r},\\beta -\\tau)\n", "\\, ,\n", "$$\n", "\n", "where we have dropped orbital indices and added a factor of 2 for spin. Finally we Fourier transform $\\chi_0$ back to momentum and Matsubara frequency\n", "\n", "$$ \n", " \\chi_0(\\mathbf{q},i\\omega_n) \\equiv \n", " \\mathcal{F}_{\\{\\mathbf{r},\\tau\\} \\rightarrow \\{\\mathbf{q}, i\\omega_n\\}} \n", " \\big\\{ \\chi_0(\\mathbf{r}, \\tau) \\big\\}\n", " \\, .\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Goals and questions\n", "\n", "The goal of this notebook is to compute and study $\\chi_0$. We will investigate the following questions:\n", "\n", "- How many operations are saved by using fast Fourier transforms rather than evaluating the convolutions directly?\n", "\n", "\n", "- For the half-filled square lattice, at what momenta $\\mathbf{q}$ does $\\chi_0$ have a maximum at zero frequency?\n", "\n", "\n", "- How is the position of the maximum related to the Fermi surface?\n", " " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:03.695000Z", "iopub.status.busy": "2023-08-29T09:09:03.694777Z", "iopub.status.idle": "2023-08-29T09:09:03.962544Z", "shell.execute_reply": "2023-08-29T09:09:03.962296Z" } }, "outputs": [], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_format = 'svg'\n", "from triqs.plot.mpl_interface import plt, oplot\n", "\n", "import numpy as np\n", "from triqs.gf import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Compute the susceptibility $\\chi_0(\\mathbf{q}, i\\omega_n)$\n", "\n", "The effective Fourier transform based routine for computing the susceptibility is implemented in TPRF in the function `triqs_trpf.lattice_utils.imtime_bubble_chi0_wk`. To construct $\\chi_0$ as defined above it can be called using the lattice Green's function `g0_wk` from the previous notebook.\n", "\n", "```python\n", "from triqs_tprf.lattice_utils import imtime_bubble_chi0_wk\n", "chi0_wk = 2 * imtime_bubble_chi0_wk(g0_wk, nw=100) # Factor of 2 for spin\n", "```\n", "\n", "Read `g0_wk` from file, compute `chi0_wk`, and store it to disk in the file `chi0_wk.h5` so that we can reuse it later." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:03.964664Z", "iopub.status.busy": "2023-08-29T09:09:03.964123Z", "iopub.status.idle": "2023-08-29T09:09:04.805972Z", "shell.execute_reply": "2023-08-29T09:09:04.805721Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning: could not identify MPI environment!\n", "\n", "╔╦╗╦═╗╦╔═╗ ╔═╗ ┌┬┐┌─┐┬─┐┌─┐\n", " ║ ╠╦╝║║═╬╗╚═╗ │ ├─┘├┬┘├┤ \n", " ╩ ╩╚═╩╚═╝╚╚═╝ ┴ ┴ ┴└─└ \n", "Two-Particle Response Function tool-box \n", "\n", "beta = 2.5\n", "nk = 16384\n", "nw = 64\n", "norb = 1\n", "\n", "Approx. Memory Utilization: 0.06 GB\n", "\n", "--> fourier_wk_to_wr\n", "--> fourier_wr_to_tr\n", "--> chi0_tr_from_grt_PH (bubble in tau & r)\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Starting serial run at: 2023-08-29 11:09:04.009086\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "--> chi_wr_from_chi_tr\n", "--> chi_wk_from_chi_wr (r->k)\n" ] } ], "source": [ "# Write your code here\n", "\n", "from h5 import HDFArchive\n", "\n", "with HDFArchive(\"g0_wk.h5\",'r') as R:\n", " g0_wk = R['g0_wk']\n", "\n", "from triqs_tprf.lattice_utils import imtime_bubble_chi0_wk\n", "chi0_wk = 2 * imtime_bubble_chi0_wk(g0_wk, nw=16)\n", "\n", "# Save it for later reuse\n", "with HDFArchive(\"chi0_wk.h5\", \"w\") as R:\n", " R['chi0_wk'] = chi0_wk" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Static susceptibility $\\chi_0(\\mathbf{q}, \\omega=0)$ and perfect nesting\n", "\n", "As you saw in the previous notebook, the square lattice with nearest-neighbour hopping $t$ has a perfectly nested Fermi surface at half-filling. In other words, large parts of the Fermi surface are mapped on to each other by a single momentum transfer $\\mathbf{Q}$, called the *nesting vector*. Go back to the previous notebook and the plot of $-\\frac{1}{\\pi} Im G_0(\\mathbf{k}, i\\omega_0)$ and remind your self about the nesting vector $\\mathbf{Q} = (\\pi, \\pi)$. The perfect nesting greatly enhances the susceptibility $\\chi_0$ which has a dominant peak at $\\chi_0(\\mathbf{Q}, \\omega=0)$.\n", "\n", "Analytically this can be derived using the expression for the Greens function and performing the Matsubara frequency sum, giving\n", "\n", "\\begin{equation}\n", " \\chi_0(\\mathbf{q}, \\omega=0) = \n", " 2\\frac{1}{N}\\sum_{\\mathbf{k}, m} \n", " G_0(\\mathbf{k}, i\\nu_m)G_0(\\mathbf{k}+\\mathbf{q}, i\\nu_m)= \\frac{2}{N}\\sum_{\\mathbf{k}}\\frac{f(\\epsilon(\\mathbf{k}))-f(\\epsilon(\\mathbf{k+q}))}{\\epsilon(\\mathbf{k})-\\epsilon(\\mathbf{k+q})}.\n", "\\end{equation}\n", "\n", "For the square lattice the dispersion\n", "\n", "$$\\epsilon(\\mathbf{k}) = -2t (\\cos(k_x) + \\cos(k_y) ) $$\n", "\n", "has the property that $\\epsilon(\\mathbf{k+Q})=-\\epsilon(\\mathbf{k})$ for $\\mathbf{Q}=(\\pi,\\pi)$. Hence, at $\\mathbf{q} = \\mathbf{Q}$ we get\n", "\n", "\\begin{equation}\n", " \\chi_0(\\mathbf{Q}, \\omega=0) = \n", " \\frac{1}{N}\\sum_{\\mathbf{k}}\\frac{\\tanh(\\beta\\epsilon(\\mathbf{k})/2)}{\\epsilon(\\mathbf{k})}\n", "\\end{equation}\n", "which diverges as $T \\rightarrow 0$ (i.e. when $\\beta \\rightarrow \\infty$)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 1\n", "\n", "Investigate the momentum structure of the susceptibility $\\chi_0$ by making a two-dinensional color plot of $\\chi_0(\\mathbf{q}, \\omega=0)$ over the Brillouin zone." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:04.807570Z", "iopub.status.busy": "2023-08-29T09:09:04.807493Z", "iopub.status.idle": "2023-08-29T09:09:04.982656Z", "shell.execute_reply": "2023-08-29T09:09:04.982426Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:04.951200\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", "\n", "k = np.linspace(0, 2*np.pi, num=100, endpoint=True)\n", "kx, ky = np.meshgrid(k, k)\n", "\n", "chi_interp = np.vectorize(lambda kx, ky: chi0_wk(0, (kx, ky, 0)).real)\n", "\n", "plt.pcolormesh(kx, ky, chi_interp(kx, ky), rasterized=True)\n", "\n", "plt.title('Static susceptibility $\\chi_0(\\mathbf{q}, \\omega=0)$')\n", "ticks, labels = [0, np.pi, 2*np.pi], [r\"0\",r\"$\\pi$\",r\"$2\\pi$\"]\n", "plt.xticks(ticks, labels); plt.yticks(ticks, labels);\n", "plt.xlabel(r'$q_x$'); plt.ylabel(r'$q_y$')\n", "plt.colorbar();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Hint**: Use the code to plot the dispersion $\\epsilon(\\mathbf{k})$ in the previous notebook as a starting point.\n", "\n", "**Questions**\n", "\n", "- Does the extrema of $\\chi_0$ appear at the suggested nesting vector $\\mathbf{Q}$?\n", "- Is it possible to see any additional momentum structure in $\\chi_0$?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercice 2\n", "\n", "Plot the static susceptibility $\\chi_0(\\mathbf{q}, \\omega=0)$ along the high symmetry path\n", "$\\Gamma \\rightarrow X \\rightarrow M \\rightarrow \\Gamma$ in the Brillouin zone. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:04.984043Z", "iopub.status.busy": "2023-08-29T09:09:04.983975Z", "iopub.status.idle": "2023-08-29T09:09:05.035486Z", "shell.execute_reply": "2023-08-29T09:09:05.035258Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:05.023254\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", "\n", "G = [0.0, 0.0, 0.0]\n", "X = [0.5, 0.0, 0.0]\n", "M = [0.5, 0.5, 0.0]\n", "\n", "path = [(G, X), (X, M), (M, G)]\n", "\n", "from triqs_tprf.lattice_utils import k_space_path\n", "\n", "k_vecs, k_plot, k_ticks = k_space_path(path, num=32, bz=chi0_wk.mesh[1].bz)\n", " \n", "chi0_k_interp = np.vectorize(lambda k : chi0_wk(0, k).real, signature='(n)->()')\n", " \n", "plt.plot(k_plot, chi0_k_interp(k_vecs))\n", "plt.xticks(k_ticks, labels=[r'$\\Gamma$', '$X$', '$M$', r'$\\Gamma$'])\n", "plt.ylabel(r'$\\chi_0(\\mathbf{q},\\omega=0)$'); plt.grid()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Hint**: Re-purpose the code for the high symmetry path plot of $\\epsilon(\\mathbf{k})$ in the previous notebook.\n", "\n", "**Questions**\n", "\n", "- How is the perfect nesting manifest in the plot?\n", "- Is it possible to understand also the additional fine structure in $\\chi_0$?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 3\n", "\n", "So far you we have only been studying the susecptibility $\\chi_0$ in the \"static\" zero frequency limit $\\omega=0$. However, the Matsubara frequency dependence of $\\chi_0(\\mathbf{q}, i\\omega_n)$ encodes information about the dynamical response properties of the system.\n", "\n", "Here we will take a close look at the frequency depdendence at the high-symmetry momentum points. \n", "\n", "To get the Matsubara frequency dependent suceptibility at a given momentum $k$ we use the partial interpolation feature of TRIQS using the keyword `all` to select all Matsubara frequencies at a fixed momenta:\n", "\n", "```python\n", "k = np.array([np.pi, 0., 0.]) # A vector in momentum space\n", "chi0_at_k_w = chi0_wk(all, k) # Get the frequency dependence of \\chi_0 at k\n", "```\n", "\n", "Plot the frequency dependence of the susceptibility $\\chi_0(\\mathbf{q}, i\\omega_n)$ for the high symmetry points $\\Gamma$, $X$, $M$ in momentum space." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:05.036853Z", "iopub.status.busy": "2023-08-29T09:09:05.036773Z", "iopub.status.idle": "2023-08-29T09:09:05.132044Z", "shell.execute_reply": "2023-08-29T09:09:05.131783Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:05.113166\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", "\n", "k_G = np.array([0., 0., 0.]) * 2 * np.pi\n", "k_X = np.array([0.5, 0., 0.]) * 2 * np.pi\n", "k_M = np.array([0.5, 0.5, 0.]) * 2 * np.pi\n", "\n", "k_pts = [k_G, k_X, k_M]\n", "labels = ['$\\mathbf{q}_\\Gamma$', '$\\mathbf{q}_X$', '$\\mathbf{q}_M$']\n", "\n", "for k, label in zip(k_pts, labels):\n", " oplot(chi0_wk(all, k), mode='R', label=label)\n", "\n", "plt.ylabel(r'$\\chi_0(\\mathbf{q}, i\\omega_n)$');" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Questions**\n", "\n", "- Does the large static susceptibilty at $\\mathbf{Q} = (\\pi, \\pi)$ manifest itself at all frequencies?\n", "- How does the frequency behaviour at the $M$ point differ to the $X$ and $\\Gamma$ points?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 4\n", "\n", "Let's check the analytical expression for the nesting response given above \n", "\n", "\\begin{equation}\n", " \\chi_0(\\mathbf{Q}, \\omega=0) = \n", " \\frac{1}{N}\\sum_{\\mathbf{k}}\\frac{\\tanh(\\beta\\epsilon(\\mathbf{k})/2)}{\\epsilon(\\mathbf{k})}\n", "\\end{equation}\n", "\n", "using the numerical dispersion $\\epsilon(k)$. \n", "\n", "Go back to the first notebook where you constructed the dispersion and write it to disk and read it back into this notebook.\n", "\n", "The analytical formula can be implemented in numpy using\n", "```\n", "kmesh = e_k.mesh\n", "beta = chi0_wk.mesh[0].beta\n", "chi_Q_ref = np.sum(np.nan_to_num(np.tanh(e_k.data.real * beta/2) / e_k.data.real, nan=0.)) / len(kmesh) \n", "```\n", "\n", "Make a combined plot of the Matsubara frequency dependent susceptibility at $\\mathbf{Q}$ and the analytical value of the static response. " ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:05.133429Z", "iopub.status.busy": "2023-08-29T09:09:05.133360Z", "iopub.status.idle": "2023-08-29T09:09:05.199582Z", "shell.execute_reply": "2023-08-29T09:09:05.199347Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/var/folders/64/_1fkps792lsc0txclg5ky4300000gq/T/ipykernel_50793/228374747.py:8: RuntimeWarning: invalid value encountered in divide\n", " chi_Q_ref = np.sum(np.nan_to_num(np.tanh(e_k.data.real * beta/2) / e_k.data.real, nan=0.)) / len(kmesh)\n" ] }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:05.183396\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", "\n", "with HDFArchive(\"e_k.h5\",'r') as R:\n", " e_k = R['e_k']\n", "\n", "kmesh = e_k.mesh\n", "beta = chi0_wk.mesh[0].beta\n", "chi_Q_ref = np.sum(np.nan_to_num(np.tanh(e_k.data.real * beta/2) / e_k.data.real, nan=0.)) / len(kmesh) \n", "\n", "oplot(chi0_wk(all, k_M), mode='R', label='$\\mathbf{q}_M$')\n", "plt.plot(0, chi_Q_ref, 'ro', label='Analytic')\n", "\n", "plt.ylabel(r'$\\chi_0(\\mathbf{q}, i\\omega_n)$'); plt.legend();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Question**\n", "\n", "- Does the analytic formula agree with the numerical susceptibility at $\\mathbf{Q}$?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 5\n", "\n", "From the Matsubara frequency dependence of the susceptibility it is also possible to (approximately) determine the real frequency behaviour using analytical continuation.\n", "\n", "TRIQS provides Padé based routines for analytical continuation as a member function of a real-fequency Green's function:\n", "\n", "```python\n", "fmesh = MeshReFreq(w_min=-10, w_max=10, n_w=100)\n", "chi_f = Gf(mesh=fmesh, target_shape=chi0_wk.target_shape)\n", "chi_f.set_from_pade(chi0_wk(all, k), n_points=32, freq_offset=0.1)\n", "```\n", "\n", "Use this to plot the real-frequency dependence of the susceptibility for the high symmetry points $\\Gamma$, $X$, and $M$ in the Brillouin zone." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:05.200936Z", "iopub.status.busy": "2023-08-29T09:09:05.200866Z", "iopub.status.idle": "2023-08-29T09:09:05.275075Z", "shell.execute_reply": "2023-08-29T09:09:05.274861Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:05.257372\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", "\n", "fmesh = MeshReFreq(w_min=-10, w_max=10, n_w=100)\n", "chi_f = Gf(mesh=fmesh, target_shape=chi0_wk.target_shape)\n", "\n", "for label, k in zip(labels, [k_G, k_X, k_M]):\n", " chi_f.set_from_pade(chi0_wk(all, k), n_points=16, freq_offset=0.1)\n", " oplot(chi_f, mode='I', label=label)\n", " \n", "plt.ylabel(r'$\\chi_0(\\mathbf{q}, \\omega)$');" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Question**\n", "\n", "- Is the largest peak value in real-frequency correlated with the largest static response?\n", "- Why is $\\chi_0$ approximately equal to zero at $\\Gamma$?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 6\n", "\n", "While analytical continuation is numerically unstable in general, it can be useful to get a rough picture of the real-frequency dependence, as we saw above.\n", "\n", "In TPRF there is a helper routine `triqs_tprf.lattice_utils.pade_analytical_continuation_wk` that performs analytical continuation on lattice response functions for all momenta at once through:\n", "\n", "```python\n", "from triqs_tprf.lattice_utils import pade_analytical_continuation_wk\n", "chi0_fk = pade_analytical_continuation_wk(chi0_wk, fmesh, n_points=32, freq_offset=0.1)\n", "```\n", "\n", "Make a color plot of `chi0_fk` along the high symmetry path in k-space with the frequency on the y-axis." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2023-08-29T09:09:05.276453Z", "iopub.status.busy": "2023-08-29T09:09:05.276385Z", "iopub.status.idle": "2023-08-29T09:09:09.175434Z", "shell.execute_reply": "2023-08-29T09:09:09.175176Z" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2023-08-29T11:09:09.147308\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.7.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Write your code here\n", " \n", "from triqs_tprf.lattice_utils import pade_analytical_continuation_wk\n", "chi0_fk = pade_analytical_continuation_wk(chi0_wk, fmesh, n_points=16, freq_offset=0.1)\n", "\n", "f = np.array([ float(f) for f in fmesh ])\n", "chi0_fk_interp = np.vectorize(lambda k : np.squeeze(chi0_fk(all, k).data).imag, signature='(n)->(m)')\n", "\n", "plt.pcolormesh(k_plot, f, chi0_fk_interp(k_vecs).T, rasterized=True, cmap='RdBu')\n", "\n", "plt.xticks(k_ticks, labels=[r'$\\Gamma$', '$X$', '$M$', r'$\\Gamma$'])\n", "plt.ylabel(r'$\\chi_0(\\mathbf{q},\\omega=0)$'); plt.grid();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Questions**\n", "\n", "- Where is the strongest response in momentum and frequency?\n", "- How can one see where the static susceptibilitiy has its maximum?" ] } ], "metadata": { "@webio": { "lastCommId": null, "lastKernelId": null }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.5" } }, "nbformat": 4, "nbformat_minor": 4 }