{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Estimate the ZPR of band edges with generalized Frohlich model\n\nFlow to estimate the zero-point renormalization at the band edges\nusing the generalized Frohlich model. The flow uses DFPT to compute\nthe effective masses at the band edges (automatically detected by performing a NSCF run with a k-path),\nand uses an external DDB file providing BECS, eps_inf and phonon frequencies at Gamma.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import sys\nimport os\nimport abipy.data as abidata\nimport abipy.abilab as abilab\nimport abipy.flowtk as flowtk\n\n\ndef build_flow(options):\n\n # Set working directory (default is the name of the script with '.py' removed and \"run_\" replaced by \"flow_\")\n if not options.workdir:\n options.workdir = os.path.basename(sys.argv[0]).replace(\".py\", \"\").replace(\"run_\", \"flow_\")\n\n # Get structure from DDB file.\n ddb_path = abidata.ref_file(\"refs/mgo_v8t57/mgo_zpr_t57o_DS3_DDB\")\n with abilab.abiopen(ddb_path) as ddb:\n structure = ddb.structure\n\n # Build SCF input using structure from DDB file.\n pseudos = abidata.pseudos(\"Ca.psp8\", \"O.psp8\")\n scf_input = abilab.AbinitInput(structure=structure, pseudos=pseudos)\n\n # Set other input variables. These quantities are system-depedent.\n # Here we use parameters similar to https://docs.abinit.org/tests/v8/Input/t57.in\n scf_input.set_vars(\n nband=12,\n nbdbuf=2,\n diemac=6,\n ecut=30, # Underconverged ecut.\n #ecut=15,\n nstep=100,\n tolvrs=1e-16,\n kptrlatt=[-2, 2, 2, # In cartesian coordinates, this grid is simple cubic\n 2, -2, 2,\n 2, 2, -2],\n )\n\n # Build the flow to detect band edges, compute effective masses and finally obtain an estimate for the ZPR\n # BECS/phonons/eps_inf are taken from ddb_node.\n from abipy.flowtk.effmass_works import FrohlichZPRFlow\n flow = FrohlichZPRFlow.from_scf_input(options.workdir, scf_input, ddb_node=ddb_path, ndivsm=2, tolwfr=1e-14,\n manager=options.manager)\n return flow\n\n\n# This block generates the thumbnails in the Abipy gallery.\n# You can safely REMOVE this part if you are using this script for production runs.\nif os.getenv(\"READTHEDOCS\", False):\n __name__ = None\n import tempfile\n options = flowtk.build_flow_main_parser().parse_args([\"-w\", tempfile.mkdtemp()])\n build_flow(options).graphviz_imshow()\n\n\n@flowtk.flow_main\ndef main(options):\n \"\"\"\n This is our main function that will be invoked by the script.\n flow_main is a decorator implementing the command line interface.\n Command line args are stored in `options`.\n \"\"\"\n return build_flow(options)\n\n\nif __name__ == \"__main__\":\n sys.exit(main())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run the script with:\n\n run_frohlich_zpr_from_ddb.py -s\n\n\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.8.0" } }, "nbformat": 4, "nbformat_minor": 0 }