{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_format = 'svg'\n", "\n", "import warnings \n", "warnings.filterwarnings(\"ignore\") #ignore some matplotlib warnings\n", "\n", "import numpy as np\n", "\n", "from triqs.plot.mpl_interface import plt\n", "plt.rcParams[\"figure.figsize\"] = (6,5) # set default size for all figures\n", "\n", "from triqs.utility.redirect import start_redirect\n", "start_redirect()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Dynamical spin-spin susceptibility $\\chi_{S_z S_z}(\\tau)$\n", "\n", "CTHYB can measure dynamical susceptibilities $\\chi_{\\hat{O}_1 \\hat{O}_2}(\\tau)$ of operators $\\hat{O}_i$ that commute with the local Hamiltonian $[H_{loc}, \\hat{O}_i] = 0$. This is performed using \"sampling by insertion\".\n", "\n", "Here we reuse the Anderson model in a Wilson bath from the first tutorail and sample its spin-spin susceptibility\n", "\n", "$$\\chi_{S_z S_z} = \\langle S_z(\\tau) S_z(0) \\rangle$$ \n", "\n", "using the ``measure_O_tau`` parameter, by passing the pair of operators to sample. In this case the spin-z operator $S_z = (n_\\uparrow - n_\\downarrow)/2$.\n", "\n", "The one-orbital Anderson impurity embedded in a flat (Wilson) conduction 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\n", "$H_\\mathrm{int} = U n_\\uparrow n_\\downarrow$, with Hubbard $U$, local energy $\\epsilon_f$, bandwidth $D$ and hybridization $V$ at the inverse temperature of $\\beta$." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "╔╦╗╦═╗╦╔═╗ ╔═╗ ┌─┐┌┬┐┬ ┬┬ ┬┌┐ \n", " ║ ╠╦╝║║═╬╗╚═╗ │ │ ├─┤└┬┘├┴┐\n", " ╩ ╩╚═╩╚═╝╚╚═╝ └─┘ ┴ ┴ ┴ ┴ └─┘\n", "\n", "The local Hamiltonian of the problem:\n", "(-2.5,0)*c_dag('down',0)*c('down',0) + (-2.5,0)*c_dag('up',0)*c('up',0) + (5,0)*c_dag('down',0)*c_dag('up',0)*c('up',0)*c('down',0)\n", "Using autopartition algorithm to partition the local Hilbert space\n", "Found 4 subspaces.\n", "\n", "Warming up ...\n", "\n", "Accumulating ...\n", "17:19:09 1% ETA 00:00:07 cycle 140 of 10000\n", "17:19:11 35% ETA 00:00:03 cycle 3587 of 10000\n", "17:19:14 78% ETA 00:00:01 cycle 7869 of 10000\n", "\n", "\n", "[Rank 0] Collect results: Waiting for all mpi-threads to finish accumulating...\n", "[Rank 0] Timings for all measures:\n", "Measure | seconds \n", "Average sign | 0.00148106\n", "G_tau measure | 0.0117463 \n", "O_tau insertion measure | 4.88952 \n", "Total measure time | 4.90274 \n", "[Rank 0] Acceptance rate for all moves:\n", "Move set Insert two operators: 0.0881532\n", " Move Insert Delta_up: 0.0870787\n", " Move Insert Delta_down: 0.0892352\n", "Move set Remove two operators: 0.0876721\n", " Move Remove Delta_up: 0.0871474\n", " Move Remove Delta_down: 0.0881937\n", "Move Shift one operator: 0.441899\n", "[Rank 0] Warmup lasted: 0.0381063 seconds [00:00:00]\n", "[Rank 0] Simulation lasted: 5.81935 seconds [00:00:05]\n", "[Rank 0] Number of measures: 10000\n", "Total number of measures: 10000\n", "Average sign: (1,0)\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Starting on 1 Nodes at : 2019-06-05 17:19:09.074932\n" ] } ], "source": [ "from triqs.operators import n\n", "from h5 import HDFArchive\n", "from triqs.gf import inverse, iOmega_n, Wilson\n", "\n", "from triqs_cthyb import Solver\n", "\n", "U, e_f, D, V, beta = 5., -2.5, 1., 1., 10.\n", "Sz = 0.5 * ( n('up', 0) - n('down', 0) )\n", "\n", "S = Solver(\n", " beta=beta, gf_struct=[('up',[0]), ('down',[0])],\n", " n_tau=400, n_iw=50,)\n", "\n", "S.G0_iw << inverse(iOmega_n - e_f - V**2 * Wilson(D))\n", "\n", "S.solve(\n", " h_int=U*n('up',0)*n('down',0),\n", " n_cycles=10000,\n", " length_cycle=20,\n", " n_warmup_cycles=100,\n", " measure_O_tau=(Sz, Sz),\n", " measure_O_tau_min_ins=100,\n", " )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The measured susceptibility is stored in the member property ``S.O_tau`` and can be plotted using the TRIQS ``oplot`` command." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0, 0.25)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \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": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "from triqs.plot.mpl_interface import oplot, oplotr, plt\n", "\n", "oplotr(S.O_tau)\n", "plt.ylabel(r'$\\chi_{S_z S_z}(\\tau)$');\n", "plt.ylim([0, 0.25])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Author: H. U.R. Strand (2019)" ] } ], "metadata": { "celltoolbar": "Edit 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" } }, "nbformat": 4, "nbformat_minor": 2 }