{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Dipole-Dipole effect at second order\n", "\n", "The detailed equations can be found in papers Phys. Rev. B 50, 13035(R) (1994) and Phys. Rev. B 55, 10355 (1997).\n", "\n", "The code not-only provides the dipole-dipole effects on the dynamic matrices at second order, \n", "but also the derivative of the effect with respect to q-vector.\n", "\n", "The code is developed quite recently, it is in pretty good shape and probably only requires minor variables renaming. \n", "One point of concern is that there is a Fortran version of the code developed to improve the speed of the calculation. It is written in Fortran for its easier handling of matrices than C/C++. But it should be discussed whether a C/C++ version is needed, and which is better.\n", "\n", "#### class DipoleDipole(struct, zeu=None, epsilon=None, dataset=None, G_ran=5, Lambda=0.20, factor=1.0, tol=1.0E-6)\n", "\n", "- struct: periodica compatible structure\n", "- zeu: array of floats, Born effective charges\n", "- epsilon: array of floats, dielectric constants\n", "- dataset: string, path a yaml file containing data including zeu, epsilon, G_ran, Lambda and factor\n", "- G_ran: integer, range of G vectors\n", "- Lambda: float, $\\lambda$ in the equation\n", "- factor: float, unit conversion factor (for VASP the factor is ~14.40)\n", "- tol: float, error tolerance.\n", "\n", "There are 2 ways to instantiate the object:\n", "``` python\n", "dp = DipoleDipole(\n", " struct=\"path to struct file\", # or a periodica object\n", " dataset=\"path to epsilon.yml\",\n", ")\n", "dp = DipoleDipole(\n", " struct=\"path to struct file\",\n", " zeu=zeu,\n", " epsilon=epsilon,\n", " factor=factor,\n", ")\n", "```" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "np.set_printoptions(linewidth=180, suppress=True)\n", "from dipole_dipole import DipoleDipole" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "poscar = \"\"\"\\\n", "PuO2 Fluorite\n", "1.0\n", "0.00000000 2.76451179 2.76451179\n", "2.76451179 0.00000000 2.76451179\n", "2.76451179 2.76451179 0.00000000\n", "1 2\n", "d\n", "0.00000000 0.00000000 0.00000000 Th:p\n", "0.25000000 0.25000000 0.25000000 O:p\n", "0.75000000 0.75000000 0.75000000 O:p\"\"\"\n", "factor = 14.40\n", "epsilon = [\n", " [ 4.883362, 0.000000, 0.000000],\n", " [ 0.000000, 4.883362, 0.000000],\n", " [ 0.000000, 0.000000, 4.883362],\n", "]\n", "zeu = [\n", " [[ 5.407510, 0.000000, 0.000000],\n", " [ 0.000000, 5.407790, 0.000000],\n", " [ 0.000000, 0.000000, 5.409020],],\n", " [[ -2.705480, 0.000000, 0.000000],\n", " [ 0.000000, -2.705730, 0.000000],\n", " [ 0.000000, 0.000000, -2.705850],],\n", " [[ -2.705480, 0.000000, 0.000000],\n", " [ 0.000000, -2.705730, 0.000000],\n", " [ 0.000000, 0.000000, -2.705850],],\n", " ]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dp = DipoleDipole(\n", " struct=poscar,\n", " zeu=zeu,\n", " epsilon=epsilon,\n", " factor=factor,\n", ")" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "real part\n", "[[ 6.607385 -6.697344 -6.698868 -1.830306 3.397245 3.397396 1.830306 -3.397245 -3.397396]\n", " [-6.697344 6.608032 6.699215 3.397107 -1.83057 -3.397572 -3.397107 1.83057 3.397572]\n", " [-6.698868 6.699215 6.611206 3.39788 -3.398194 -1.831067 -3.39788 3.398194 1.831067]\n", " [-1.830306 3.397107 3.39788 2.038075 -1.676541 -1.676616 0. -0. -0. ]\n", " [ 3.397245 -1.83057 -3.398194 -1.676541 2.03847 1.676771 -0. -0. 0. ]\n", " [ 3.397396 -3.397572 -1.831067 -1.676616 1.676771 2.038567 -0. 0. 0. ]\n", " [ 1.830306 -3.397107 -3.39788 0. -0. -0. 2.038075 -1.676541 -1.676616]\n", " [-3.397245 1.83057 3.398194 -0. -0. 0. -1.676541 2.03847 1.676771]\n", " [-3.397396 3.397572 1.831067 -0. 0. 0. -1.676616 1.676771 2.038567]]\n", "imaginary part\n", "[[ 0. -0. -0. -0. -0. 0. -0. -0. 0.]\n", " [-0. -0. -0. -0. -0. -0. -0. 0. -0.]\n", " [-0. -0. -0. 0. -0. 0. 0. -0. -0.]\n", " [ 0. 0. -0. -0. -0. 0. -0. -0. -0.]\n", " [ 0. 0. 0. -0. -0. -0. -0. -0. -0.]\n", " [-0. 0. -0. 0. -0. 0. -0. -0. 0.]\n", " [ 0. 0. -0. 0. 0. 0. 0. 0. -0.]\n", " [ 0. -0. 0. 0. 0. 0. 0. 0. 0.]\n", " [-0. 0. 0. 0. 0. -0. -0. 0. 0.]]\n" ] } ], "source": [ "dd = np.round(dp.c_dd(\"1/2 0 0\"), 6)\n", "print \"real part\"\n", "print dd.real\n", "print \"imaginary part\"\n", "print dd.imag" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "real part\n", "[[-0.911526 0. 0. 0.455763 0. 0. 0.455763 -0. -0. ]\n", " [ 0. -0.911658 0. 0. 0.455829 0. -0. 0.455829 -0. ]\n", " [ 0. 0. -0.911905 0. 0. 0.455953 -0. -0. 0.455953]\n", " [ 0.455763 0. 0. 0.155948 -0. -0. -0.611711 -0. 0. ]\n", " [ 0. 0.455829 0. -0. 0.155995 -0. -0. -0.611824 -0. ]\n", " [ 0. 0. 0.455953 -0. -0. 0.155925 0. -0. -0.611878]\n", " [ 0.455763 -0. -0. -0.611711 -0. 0. 0.155948 0. 0. ]\n", " [-0. 0.455829 -0. -0. -0.611824 -0. 0. 0.155995 0. ]\n", " [-0. -0. 0.455953 0. -0. -0.611878 0. 0. 0.155925]]\n", "imaginary part\n", "[[ 0. -0. -0. -0. -0. 0. 0. 0. -0.]\n", " [-0. -0. -0. -0. -0. -0. 0. 0. 0.]\n", " [-0. -0. -0. 0. -0. 0. -0. 0. 0.]\n", " [ 0. 0. -0. -0. -0. 0. -0. -0. 0.]\n", " [ 0. 0. 0. -0. -0. -0. -0. -0. -0.]\n", " [-0. 0. -0. 0. -0. 0. 0. -0. 0.]\n", " [-0. -0. 0. 0. 0. -0. 0. 0. -0.]\n", " [-0. -0. -0. 0. 0. 0. 0. 0. 0.]\n", " [ 0. -0. -0. -0. 0. -0. -0. 0. 0.]]\n" ] } ], "source": [ "dd = np.round(dp.c_dd(\"0 0 0\"), 6)\n", "print \"real part\"\n", "print dd.real\n", "print \"imaginary part\"\n", "print dd.imag" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "real part\n", "[[ 7.636021 -8.54799 -8.549934 -3.820737 4.276895 4.277085 -3.820737 4.276895 4.277085]\n", " [-8.54799 7.636775 8.550377 4.276722 -3.821288 -4.277307 4.276722 -3.821288 -4.277307]\n", " [-8.549934 8.550377 7.640416 4.277694 -4.27809 -3.822327 4.277694 -4.27809 -3.822327]\n", " [-3.820737 4.276722 4.277694 2.295562 -2.139812 -2.139907 1.527904 -2.139812 -2.139907]\n", " [ 4.276895 -3.821288 -4.27809 -2.139812 2.296005 2.140105 -2.139812 1.528186 2.140105]\n", " [ 4.277085 -4.277307 -3.822327 -2.139907 2.140105 2.296125 -2.139907 2.140105 1.528322]\n", " [-3.820737 4.276722 4.277694 1.527904 -2.139812 -2.139907 2.295562 -2.139812 -2.139907]\n", " [ 4.276895 -3.821288 -4.27809 -2.139812 1.528186 2.140105 -2.139812 2.296005 2.140105]\n", " [ 4.277085 -4.277307 -3.822327 -2.139907 2.140105 1.528322 -2.139907 2.140105 2.296125]]\n", "imaginary part\n", "[[ 0. -0. -0. -0. -0. 0. 0. 0. -0.]\n", " [-0. -0. -0. -0. -0. -0. 0. 0. 0.]\n", " [-0. -0. -0. 0. -0. 0. -0. 0. 0.]\n", " [ 0. 0. -0. -0. -0. 0. -0. -0. 0.]\n", " [ 0. 0. 0. -0. -0. -0. -0. -0. -0.]\n", " [-0. 0. -0. 0. -0. 0. 0. -0. 0.]\n", " [-0. -0. 0. 0. 0. -0. 0. 0. -0.]\n", " [-0. -0. -0. 0. 0. 0. 0. 0. 0.]\n", " [ 0. -0. -0. -0. 0. -0. -0. 0. 0.]]\n" ] } ], "source": [ "# The limit of the dipole dipole effect with q->0 from (1, 0, 0) direction (primitive convention)\n", "dd = np.round(dp.c_dd(\"0 0 0\", q_direction=\"1 0 0\"), 6)\n", "print \"real part\"\n", "print dd.real\n", "print \"imaginary part\"\n", "print dd.imag" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Including LO-TO from command line\n", "\n", "In order to execute LO-TO splitting on some calculation from the command line, do the following:\n", "\n", "1. you can make the epsilon (dielectric constants + born effective charges) file from the OUTCAR using the following command:\n", "\n", "```\n", "~/git_repos/software/phonons/examples/fourier_interp_Dqn/parse_epsilon.py struct=poscar > epsilon.yml\n", "```\n", "\n", "2. Run the Fourier interpolation using the above generated epsilon file:\n", "\n", "```\n", "fourier_interp_Dqn.py epsilon=\n", "```\n", "\n", "3. Regenerate the band structure along the desired path throught k-space using the new force constants and the epsilon file:\n", "\n", "```\n", "band_plot_phonons.py epsilon= pos=poscar units=THz band=kinput phi=PhiN_WS.pkl\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.17" } }, "nbformat": 4, "nbformat_minor": 2 }