{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Back to the main [Index](../index.ipynb) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Aluminium
\n", "\n", "In this lesson, we discuss how to compute the phonon linewidths and the Eliashberg function in metals.\n", "We start with a very brief discussion of the basic equations and some technical details about the Abinit implementation. Then we show how to build an AbiPy flow to automate the multiple steps required \n", "by these calculations.\n", "
\n", "\n", "In the second part, we use the AbiPy objects to analyze the results. We start from the simplest case of a single calculation whose most important results are stored in the A2F.nc netcdf file. Then we show how to use the A2fRobot to handle multiple netcdf files and perform convergence studies. \n", "
\n", "def build_flow(options):\n",
" """\n",
" Build and return an AbiPy flow to compute phonon linewidths and Eliashberg function in Aluminium:\n",
"\n",
" 1. Compute DFPT phonons on a 4x4x4 q-mesh with a coarse 8x8x8 k-sampling\n",
"\n",
" 2. Generate 3 WFK files on a much denser k-mesh (x16, x24, x32)\n",
"\n",
" 3. Run the EPH code with:\n",
"\n",
" - one of the WFK files generated in point 2.\n",
" - interpolated DFPT potentials (from the initial 4x4x4 to a 8x8x8 q-mesh)\n",
"\n",
" 4. Analyze the convergence of the results wrt nkpt.\n",
"\n",
" Note that the q-point grid must be a sub-grid of the k-point grid\n",
" """\n",
" workdir = options.workdir if (options and options.workdir) else "flow_eph_al"\n",
"\n",
" # Create empty flow.\n",
" flow = flowtk.Flow(workdir=workdir)\n",
"\n",
" # Init structure. Use NC pseudo\n",
" structure = abilab.Structure.fcc(a=7.5, species=["Al"], units="bohr")\n",
" pseudos = abidata.pseudos("Al.oncvpsp")\n",
"\n",
" # Input for GS part.\n",
" gs_inp = abilab.AbinitInput(structure, pseudos)\n",
" gs_inp.set_vars(\n",
" istwfk="*1",\n",
" ecut=8.0,\n",
" nband=4,\n",
" occopt=7, # Include metallic occupation function with a small smearing\n",
" tsmear=0.04,\n",
" tolvrs=1e-7,\n",
" )\n",
"\n",
" # The k-grid is minimalistic to keep the calculation manageable.\n",
" gs_inp.set_kmesh(\n",
" ngkpt=[8, 8, 8],\n",
" shiftk=[0.0, 0.0, 0.0],\n",
" )\n",
"\n",
" # Build new input for NSCF calculation along k-path (automatically selected by AbiPy)\n",
" # Used to plot the KS band structure.\n",
" nscf_kpath_inp = gs_inp.new_with_vars(\n",
" nband=4,\n",
" tolwfr=1e-16,\n",
" iscf=-2,\n",
" )\n",
" nscf_kpath_inp.set_kpath(ndivsm=10)\n",
"\n",
" # Build NSCF inputs with denser k-meshes\n",
" # This step generates the WFK files used to compute the Eliashberg function.\n",
" # We have a cubic material so we only need to specify the first number of divisions.\n",
" nk_list = [16, 24, 32]\n",
"\n",
" nscf_kmesh_inputs = []\n",
" for nk in nk_list:\n",
" new_inp = gs_inp.new_with_vars(\n",
" tolwfr=1e-16,\n",
" iscf=-2,\n",
" ngkpt=[nk] * 3,\n",
" shiftk=[0.0, 0.0, 0.0],\n",
" )\n",
" nscf_kmesh_inputs.append(new_inp)\n",
"\n",
" # Register GS + NSCF kpath + NSCF with k-meshes in work0.\n",
" work0 = flowtk.BandStructureWork(gs_inp, nscf_kpath_inp, dos_inputs=nscf_kmesh_inputs)\n",
" flow.register_work(work0)\n",
"\n",
" # Generate Phonon work with 4x4x4 q-mesh\n",
" # Reuse the variables from GS input and let AbiPy handle the generation of the input files\n",
" # Note that the q-point grid is a sub-grid of the k-mesh so we do not need WFQ on k+q mesh.\n",
" ddb_ngqpt = [4, 4, 4]\n",
" ph_work = flowtk.PhononWork.from_scf_task(work0[0], ddb_ngqpt, is_ngqpt=True)\n",
" flow.register_work(ph_work)\n",
"\n",
" # Ssction for EPH calculation: compute linewidths with different WKK files.\n",
" eph_work = flowtk.Work()\n",
" for ik, nk in enumerate(nk_list):\n",
" # Each task uses a different WFK file. DDB and DBDB do not change.\n",
" eph_deps = {work0[2 + ik]: "WFK", ph_work: ["DDB", "DVDB"]}\n",
"\n",
" # Interpolate DFPT potentials 4x4x4 --> 8x8x8\n",
" eph_ngqpt_fine = (8, 8, 8)\n",
"\n",
" # Build input for E-PH run. See also v7/Input/t85.in\n",
" # The k-points must be in the WFK file\n",
" eph_inp = gs_inp.new_with_vars(\n",
" optdriver=7, # Enter EPH driver.\n",
" eph_task=1, # Compute phonon linewidths in metals.\n",
" ddb_ngqpt=ddb_ngqpt, # q-mesh used to produce the DDB file (must be consistent with DDB data)\n",
" eph_fsewin="0.8 eV", # Energy window around Ef (only states in this window are included)\n",
" eph_intmeth=2, # Tetra method\n",
" #eph_intmeth=1, # Gaussian\n",
" #eph_fsmear=eph_fsmear * abilab.units.eV_to_Ha, # Broadening\n",
" eph_ngqpt_fine=eph_ngqpt_fine, # Interpolate DFPT potentials if != ddb_ngqpt\n",
" eph_mustar=0.12, # mustar parameter\n",
" ngkpt=[nk] * 3,\n",
" shiftk=[0.0, 0.0, 0.0],\n",
" )\n",
"\n",
" # Set q-path to interpolate phonons and phonon linewidths.\n",
" eph_inp.set_qpath(10)\n",
"\n",
" # Set q-mesh for phonons DOS and a2F(w)\n",
" eph_inp.set_phdos_qmesh(nqsmall=24, method="tetra")\n",
" eph_work.register_eph_task(eph_inp, deps=eph_deps)\n",
"\n",
" flow.register_work(eph_work)\n",
"\n",
" # Avoid producing (big) output files that not required by children.\n",
" flow.allocate(use_smartio=True)\n",
"\n",
" return flow\n",
"
\n", " | ngkpt | \n", "class | \n", "
---|---|---|
w2_t0 | \n", "[16, 16, 16] | \n", "EphTask | \n", "
w2_t1 | \n", "[24, 24, 24] | \n", "EphTask | \n", "
w2_t2 | \n", "[32, 32, 32] | \n", "EphTask | \n", "
\n", " | nsppol | \n", "nspinor | \n", "nspden | \n", "nband | \n", "nkpt | \n", "ddb_nqbz | \n", "eph_nqbz_fine | \n", "ph_nqbz | \n", "eph_intmeth | \n", "eph_fsewin | \n", "eph_fsmear | \n", "eph_extrael | \n", "eph_fermie | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nkpt: 145 | \n", "1 | \n", "1 | \n", "1 | \n", "4 | \n", "145 | \n", "64 | \n", "512 | \n", "13824 | \n", "2 | \n", "0.029399 | \n", "0.01 | \n", "0.0 | \n", "0.0 | \n", "
nkpt: 413 | \n", "1 | \n", "1 | \n", "1 | \n", "4 | \n", "413 | \n", "64 | \n", "512 | \n", "13824 | \n", "2 | \n", "0.029399 | \n", "0.01 | \n", "0.0 | \n", "0.0 | \n", "
nkpt: 897 | \n", "1 | \n", "1 | \n", "1 | \n", "4 | \n", "897 | \n", "64 | \n", "512 | \n", "13824 | \n", "2 | \n", "0.029399 | \n", "0.01 | \n", "0.0 | \n", "0.0 | \n", "
\n", " | lambda_qcoarse | \n", "omegalog_qcoarse | \n", "lambda_qintp | \n", "omegalog_qintp | \n", "
---|---|---|---|---|
nkpt: 145 | \n", "0.248242 | \n", "0.029566 | \n", "0.262111 | \n", "0.027082 | \n", "
nkpt: 413 | \n", "0.373353 | \n", "0.029148 | \n", "0.401513 | \n", "0.025940 | \n", "
nkpt: 897 | \n", "0.386603 | \n", "0.028770 | \n", "0.417210 | \n", "0.025479 | \n", "