{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Correcting for spin contamination in zero-field splitting calculations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The accuracy of the computed zero-field splitting (ZFS) tensor can be affected by spin contamination in spin-polarized density functional theory (DFT) calculations, where the Kohn–Sham states in the two spin channels have different energies and spatial distributions. [Biktagirov et al.](https://doi.org/10.1103/PhysRevResearch.2.022024) proposed a correction scheme that effectively cancels spin contamination errors, providing more accurate computation of ZFS tensors while reducing the dependence on the exchange-correlation functional employed in DFT calculations.\n", "\n", "In this tutorial, we demonstrate how to apply this correction to the negatively charged nitrogen-vacancy (NV$^-$) center in diamond." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/vwzyu/Soft/pyzfs/doc/tutorials/diamond_nv_qe_hdf5_correction_data\n" ] } ], "source": [ "%cd diamond_nv_qe_hdf5_correction_data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1 Compute magnetic dipolar interaction for triplet spin state" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we perform a regular PyZFS calculation for the triplet spin state ($S=1$) of the NV$^-$ center in diamond, obtaining the uncorrected spin-spin ZFS tensor $\\mathbf{D}^{\\mathrm{SS}} = \\frac{\\mathbf{d}}{S(S-1/2)}$. The magnetic dipolar interaction $\\mathbf{d}$ is a 3 $\\times$ 3 tensor defined as\n", "\n", "$d_{ab} = \\frac{\\alpha^2}{8} \\sum_{ij} \\chi_{ij} \\int \\frac{|\\mathbf{r} - \\mathbf{r}'|^2 \\delta_{ab} - 3(\\mathbf{r} - \\mathbf{r}')_a(\\mathbf{r} - \\mathbf{r}')_b}{|\\mathbf{r} - \\mathbf{r}'|^5} \\times [n_{ii}(\\mathbf{r}) n_{jj}^*(\\mathbf{r}') - n_{ij}(\\mathbf{r}) n_{ij}^*(\\mathbf{r}')] d\\mathbf{r}d\\mathbf{r}'$\n", "\n", "where $a, b = x, y, z$, $\\alpha$ is the fine-structure constant, $i, j$ are indices of occupied Kohn-Sham states $\\psi(\\mathbf{r})$, $n_{ij}(\\mathbf{r}) = \\psi_i(\\mathbf{r}) \\psi_j(\\mathbf{r})$, and $\\chi_{ij} = 1$ when $i$ and $j$ belong to the same spin channel, and $\\chi_{ij} = -1$ otherwise. The $\\mathbf{d}$ tensor will be used to carry out the correction for spin contamination errors.\n", "\n", "We run the `pw.x` code of Quantum ESPRESSO for the DFT calculation." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&CONTROL\n", "calculation = 'scf'\n", "pseudo_dir = './'\n", "prefix = 'triplet'\n", "/\n", "&SYSTEM\n", "ibrav = 0\n", "ntyp = 2\n", "nat = 215\n", "tot_charge = -1.0\n", "tot_magnetization = 2.0\n", "nspin = 2\n", "nbnd = 628\n", "ecutwfc = 60.0\n", "/\n", "&ELECTRONS\n", "diago_full_acc = .true.\n", "/\n", "ATOMIC_SPECIES\n", "C 12.01099968 C_ONCV_PBE-1.2.upf\n", "N 14.00699997 N_ONCV_PBE-1.2.upf\n", "CELL_PARAMETERS angstrom\n", "10.704 0.000 0.000\n", " 0.000 10.704 0.000\n", " 0.000 0.000 10.704\n", "K_POINTS gamma\n", "ATOMIC_POSITIONS crystal\n", "N 0.09152860 0.09152860 0.09152860\n", "C 0.00406095 0.16656435 0.16656435\n", "C 0.08375956 0.25132100 0.25132100\n", "C 0.16656435 0.00406095 0.16656435\n", "C 0.25132100 0.08375956 0.25132100\n", "C 0.16656435 0.16656435 0.00406095\n", "C 0.25132100 0.25132100 0.08375956\n", "C 0.00008479 0.00008479 0.33283360\n", "C 0.08339786 0.08339786 0.41672965\n", "C 0.00001566 0.16656881 0.50004871\n", "C 0.08326671 0.24989560 0.58351323\n", "C 0.16656881 0.00001566 0.50004871\n", "C 0.24989560 0.08326671 0.58351323\n", "C 0.16713153 0.16713153 0.33408428\n", "C 0.25020487 0.25020487 0.41712458\n", "C 0.99984338 0.99984338 0.66702816\n", "C 0.08281135 0.08281135 0.75072909\n", "C 0.99895986 0.16485431 0.83461141\n", "C 0.08251591 0.24836734 0.91825974\n", "C 0.16485431 0.99895986 0.83461141\n", "C 0.24836734 0.08251591 0.91825974\n", "C 0.16622186 0.16622186 0.66720992\n", "C 0.24953177 0.24953177 0.75057394\n", "C 0.00008479 0.33283360 0.00008479\n", "C 0.08339786 0.41672965 0.08339786\n", "C 0.00001566 0.50004871 0.16656881\n", "C 0.08326671 0.58351323 0.24989560\n", "C 0.16713153 0.33408428 0.16713153\n", "C 0.25020487 0.41712458 0.25020487\n", "C 0.16656881 0.50004871 0.00001566\n", "C 0.24989560 0.58351323 0.08326671\n", "C 0.00027688 0.33386603 0.33386603\n", "C 0.08336456 0.41697495 0.41697495\n", "C 0.00001683 0.49998105 0.49998105\n", "C 0.08321204 0.58306345 0.58306345\n", "C 0.16670944 0.33337114 0.50028918\n", "C 0.24993513 0.41657415 0.58357284\n", "C 0.16670944 0.50028918 0.33337114\n", "C 0.24993513 0.58357284 0.41657415\n", "C 0.99985602 0.33340447 0.66654379\n", "C 0.08316950 0.41622885 0.75039993\n", "C 0.99998161 0.49983489 0.83346972\n", "C 0.08322304 0.58335107 0.91669677\n", "C 0.16638542 0.33231108 0.83427654\n", "C 0.24992639 0.41652052 0.91689915\n", "C 0.16665894 0.49975729 0.66687415\n", "C 0.24993176 0.58319109 0.75005301\n", "C 0.99984338 0.66702816 0.99984338\n", "C 0.08281135 0.75072909 0.08281135\n", "C 0.99895986 0.83461141 0.16485431\n", "C 0.08251591 0.91825974 0.24836734\n", "C 0.16622186 0.66720992 0.16622186\n", "C 0.24953177 0.75057394 0.24953177\n", "C 0.16485431 0.83461141 0.99895986\n", "C 0.24836734 0.91825974 0.08251591\n", "C 0.99985602 0.66654379 0.33340447\n", "C 0.08316950 0.75039993 0.41622885\n", "C 0.99998161 0.83346972 0.49983489\n", "C 0.08322304 0.91669677 0.58335107\n", "C 0.16665894 0.66687415 0.49975729\n", "C 0.24993176 0.75005301 0.58319109\n", "C 0.16638542 0.83427654 0.33231108\n", "C 0.24992639 0.91689915 0.41652052\n", "C 0.00008183 0.66614375 0.66614375\n", "C 0.08289904 0.74902978 0.74902978\n", "C 0.00053850 0.83348289 0.83348289\n", "C 0.08713894 0.91048546 0.91048546\n", "C 0.16657469 0.66657430 0.83322405\n", "C 0.25035752 0.74957641 0.91684864\n", "C 0.16657469 0.83322405 0.66657430\n", "C 0.25035752 0.91684864 0.74957641\n", "C 0.33283360 0.00008479 0.00008479\n", "C 0.41672965 0.08339786 0.08339786\n", "C 0.33408428 0.16713153 0.16713153\n", "C 0.41712458 0.25020487 0.25020487\n", "C 0.50004871 0.00001566 0.16656881\n", "C 0.58351323 0.08326671 0.24989560\n", "C 0.50004871 0.16656881 0.00001566\n", "C 0.58351323 0.24989560 0.08326671\n", "C 0.33386603 0.00027688 0.33386603\n", "C 0.41697495 0.08336456 0.41697495\n", "C 0.33337114 0.16670944 0.50028918\n", "C 0.41657415 0.24993513 0.58357284\n", "C 0.49998105 0.00001683 0.49998105\n", "C 0.58306345 0.08321204 0.58306345\n", "C 0.50028918 0.16670944 0.33337114\n", "C 0.58357284 0.24993513 0.41657415\n", "C 0.33340447 0.99985602 0.66654379\n", "C 0.41622885 0.08316950 0.75039993\n", "C 0.33231108 0.16638542 0.83427654\n", "C 0.41652052 0.24992639 0.91689915\n", "C 0.49983489 0.99998161 0.83346972\n", "C 0.58335107 0.08322304 0.91669677\n", "C 0.49975729 0.16665894 0.66687415\n", "C 0.58319109 0.24993176 0.75005301\n", "C 0.33386603 0.33386603 0.00027688\n", "C 0.41697495 0.41697495 0.08336456\n", "C 0.33337114 0.50028918 0.16670944\n", "C 0.41657415 0.58357284 0.24993513\n", "C 0.50028918 0.33337114 0.16670944\n", "C 0.58357284 0.41657415 0.24993513\n", "C 0.49998105 0.49998105 0.00001683\n", "C 0.58306345 0.58306345 0.08321204\n", "C 0.33347050 0.33347050 0.33347050\n", "C 0.41673247 0.41673247 0.41673247\n", "C 0.33329711 0.50005503 0.50005503\n", "C 0.41664684 0.58334948 0.58334948\n", "C 0.50005503 0.33329711 0.50005503\n", "C 0.58334948 0.41664684 0.58334948\n", "C 0.50005503 0.50005503 0.33329711\n", "C 0.58334948 0.58334948 0.41664684\n", "C 0.33309935 0.33309935 0.66702679\n", "C 0.41654604 0.41654604 0.75010768\n", "C 0.33320910 0.49986185 0.83336463\n", "C 0.41672856 0.58316778 0.91673106\n", "C 0.49986185 0.33320910 0.83336463\n", "C 0.58316778 0.41672856 0.91673106\n", "C 0.49997743 0.49997743 0.66672237\n", "C 0.58336242 0.58336242 0.75004203\n", "C 0.33340447 0.66654379 0.99985602\n", "C 0.41622885 0.75039993 0.08316950\n", "C 0.33231108 0.83427654 0.16638542\n", "C 0.41652052 0.91689915 0.24992639\n", "C 0.49975729 0.66687415 0.16665894\n", "C 0.58319109 0.75005301 0.24993176\n", "C 0.49983489 0.83346972 0.99998161\n", "C 0.58335107 0.91669677 0.08322304\n", "C 0.33309935 0.66702679 0.33309935\n", "C 0.41654604 0.75010768 0.41654604\n", "C 0.33320910 0.83336463 0.49986185\n", "C 0.41672856 0.91673106 0.58316778\n", "C 0.49997743 0.66672237 0.49997743\n", "C 0.58336242 0.75004203 0.58336242\n", "C 0.49986185 0.83336463 0.33320910\n", "C 0.58316778 0.91673106 0.41672856\n", "C 0.33323057 0.66669044 0.66669044\n", "C 0.41664480 0.74999600 0.74999600\n", "C 0.33322293 0.83331221 0.83331221\n", "C 0.41644973 0.91672376 0.91672376\n", "C 0.49995303 0.66666581 0.83331752\n", "C 0.58318248 0.74995219 0.91666536\n", "C 0.49995303 0.83331752 0.66666581\n", "C 0.58318248 0.91666536 0.74995219\n", "C 0.66702816 0.99984338 0.99984338\n", "C 0.75072909 0.08281135 0.08281135\n", "C 0.66720992 0.16622186 0.16622186\n", "C 0.75057394 0.24953177 0.24953177\n", "C 0.83461141 0.99895986 0.16485431\n", "C 0.91825974 0.08251591 0.24836734\n", "C 0.83461141 0.16485431 0.99895986\n", "C 0.91825974 0.24836734 0.08251591\n", "C 0.66654379 0.99985602 0.33340447\n", "C 0.75039993 0.08316950 0.41622885\n", "C 0.66687415 0.16665894 0.49975729\n", "C 0.75005301 0.24993176 0.58319109\n", "C 0.83346972 0.99998161 0.49983489\n", "C 0.91669677 0.08322304 0.58335107\n", "C 0.83427654 0.16638542 0.33231108\n", "C 0.91689915 0.24992639 0.41652052\n", "C 0.66614375 0.00008183 0.66614375\n", "C 0.74902978 0.08289904 0.74902978\n", "C 0.66657430 0.16657469 0.83322405\n", "C 0.74957641 0.25035752 0.91684864\n", "C 0.83348289 0.00053850 0.83348289\n", "C 0.91048546 0.08713894 0.91048546\n", "C 0.83322405 0.16657469 0.66657430\n", "C 0.91684864 0.25035752 0.74957641\n", "C 0.66654379 0.33340447 0.99985602\n", "C 0.75039993 0.41622885 0.08316950\n", "C 0.66687415 0.49975729 0.16665894\n", "C 0.75005301 0.58319109 0.24993176\n", "C 0.83427654 0.33231108 0.16638542\n", "C 0.91689915 0.41652052 0.24992639\n", "C 0.83346972 0.49983489 0.99998161\n", "C 0.91669677 0.58335107 0.08322304\n", "C 0.66702679 0.33309935 0.33309935\n", "C 0.75010768 0.41654604 0.41654604\n", "C 0.66672237 0.49997743 0.49997743\n", "C 0.75004203 0.58336242 0.58336242\n", "C 0.83336463 0.33320910 0.49986185\n", "C 0.91673106 0.41672856 0.58316778\n", "C 0.83336463 0.49986185 0.33320910\n", "C 0.91673106 0.58316778 0.41672856\n", "C 0.66669044 0.33323057 0.66669044\n", "C 0.74999600 0.41664480 0.74999600\n", "C 0.66666581 0.49995303 0.83331752\n", "C 0.74995219 0.58318248 0.91666536\n", "C 0.83331221 0.33322293 0.83331221\n", "C 0.91672376 0.41644973 0.91672376\n", "C 0.83331752 0.49995303 0.66666581\n", "C 0.91666536 0.58318248 0.74995219\n", "C 0.66614375 0.66614375 0.00008183\n", "C 0.74902978 0.74902978 0.08289904\n", "C 0.66657430 0.83322405 0.16657469\n", "C 0.74957641 0.91684864 0.25035752\n", "C 0.83322405 0.66657430 0.16657469\n", "C 0.91684864 0.74957641 0.25035752\n", "C 0.83348289 0.83348289 0.00053850\n", "C 0.91048546 0.91048546 0.08713894\n", "C 0.66669044 0.66669044 0.33323057\n", "C 0.74999600 0.74999600 0.41664480\n", "C 0.66666581 0.83331752 0.49995303\n", "C 0.74995219 0.91666536 0.58318248\n", "C 0.83331752 0.66666581 0.49995303\n", "C 0.91666536 0.74995219 0.58318248\n", "C 0.83331221 0.83331221 0.33322293\n", "C 0.91672376 0.91672376 0.41644973\n", "C 0.66676564 0.66676564 0.66676564\n", "C 0.75009290 0.75009290 0.75009290\n", "C 0.66679851 0.83348831 0.83348831\n", "C 0.75027490 0.91667191 0.91667191\n", "C 0.83348831 0.66679851 0.83348831\n", "C 0.91667191 0.75027490 0.91667191\n", "C 0.83348831 0.83348831 0.66679851\n", "C 0.91667191 0.91667191 0.75027490\n" ] } ], "source": [ "%%bash\n", "cat pw_triplet.in\n", "\n", "mpirun -n 4 pw.x -i pw_triplet.in > pw_triplet.out" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we run PyZFS to compute the ZFS tensor." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "mpirun -n 4 pyzfs --wfcfmt qeh5 --prefix triplet --memory low > zfs_triplet.out\n", "mv zfs.xml zfs_triplet.xml" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From the XML output of PyZFS, we extract the uncorrected ZFS parameters D and E, as well as the magnetic dipolar interaction $\\mathbf{d}$ tensor." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "D = 3033.97 MHz\n", "E = -0.68 MHz\n", "d tensor:\n", "[[-1.37407286e-01 5.05645425e+02 5.05897945e+02]\n", " [ 5.05645425e+02 1.36650451e-01 5.05442520e+02]\n", " [ 5.05897945e+02 5.05442520e+02 7.56833945e-04]]\n" ] } ], "source": [ "import numpy as np\n", "import xml.etree.ElementTree as ET\n", "\n", "tree = ET.parse(\"zfs_triplet.xml\")\n", "root = tree.getroot()\n", "\n", "ZFS_D = float(root.find(\"D\").text)\n", "ZFS_E = float(root.find(\"E\").text)\n", "\n", "print(f\"D = {ZFS_D} MHz\")\n", "print(f\"E = {ZFS_E} MHz\")\n", "\n", "D_triplet = root.find(\"DTensor\").text\n", "D_triplet = D_triplet.replace(\"[\", \"\").replace(\"]\", \"\").replace(\"\\n\", \" \")\n", "D_triplet = np.fromstring(D_triplet, sep=\" \").reshape(3, 3)\n", "\n", "# PyZFS internally assumes S = 1, so d = D / 2\n", "d_triplet = D_triplet / 2\n", "\n", "print(\"d tensor:\")\n", "print(d_triplet)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2 Compute magnetic dipolar interaction for three singlet spin states" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To correct for spin contamination in the spin-spin ZFS tensor, we compute\n", "\n", "$\\tilde{\\mathbf{D}}^{\\mathrm{SS}} = \\frac{\\mathbf{d}_{(m_S=S)} - \\bar{\\mathbf{d}}_{(m_S=S-1)}}{2S-1}$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "where $\\bar{\\mathbf{d}}_{(m_S=S-1)}$ is the average $\\mathbf{d}_{(m_S=S−1)}$ among all the possible $m_S=S−1$ configurations. For our target triplet state ($S=1$), we compute and average $\\mathbf{d}$ for the singlet states ($S=0$).\n", "\n", "The unpaired electrons of the NV$^-$ center in diamond are\n", "equally distributed among the three carbon dangling bonds\n", "surrounding the vacancy. In an $m_S=0$ configuration, the spin up electron localizes at one of the three dangling bonds, while the spin down electron is shared by the other two adjacent carbon atoms, resulting in three configurations of singlet states.\n", "\n", "To simulate these singlet states, we change the `tot_magnetization` input keyword of `pw.x` from 2.0 to 0.0, and we initialize the magnetization by setting the `starting_magnetization` such that the spin up electron localizes at one of the three carbon atoms around the vacancy (for example, `C1` in the input file below), while the spin down electron is shared by the other two carbon atoms around the vacancy (`C2` and `C3`)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&CONTROL\n", "calculation = 'scf'\n", "pseudo_dir = './'\n", "prefix = 'singlet_1'\n", "/\n", "&SYSTEM\n", "ibrav = 0\n", "ntyp = 5\n", "nat = 215\n", "tot_charge = -1.0\n", "tot_magnetization = 0.0\n", "starting_magnetization(1) = 0.5 ! C1\n", "starting_magnetization(2) = -0.25 ! C2\n", "starting_magnetization(3) = -0.25 ! C3\n", "starting_magnetization(4) = 0.0 ! C\n", "starting_magnetization(5) = 0.0 ! N\n", "nspin = 2\n", "nbnd = 628\n", "ecutwfc = 60.0\n", "/\n", "&ELECTRONS\n", "diago_full_acc = .true.\n", "mixing_beta = 0.2\n", "/\n", "ATOMIC_SPECIES\n", "C1 12.01099968 C_ONCV_PBE-1.2.upf\n", "C2 12.01099968 C_ONCV_PBE-1.2.upf\n", "C3 12.01099968 C_ONCV_PBE-1.2.upf\n", "C 12.01099968 C_ONCV_PBE-1.2.upf\n", "N 14.00699997 N_ONCV_PBE-1.2.upf\n", "CELL_PARAMETERS angstrom\n", "10.704 0.000 0.000\n", " 0.000 10.704 0.000\n", " 0.000 0.000 10.704\n", "K_POINTS gamma\n", "ATOMIC_POSITIONS crystal\n", "N 0.09152860 0.09152860 0.09152860\n", "C 0.00406095 0.16656435 0.16656435\n", "C 0.08375956 0.25132100 0.25132100\n", "C 0.16656435 0.00406095 0.16656435\n", "C 0.25132100 0.08375956 0.25132100\n", "C 0.16656435 0.16656435 0.00406095\n", "C 0.25132100 0.25132100 0.08375956\n", "C 0.00008479 0.00008479 0.33283360\n", "C 0.08339786 0.08339786 0.41672965\n", "C 0.00001566 0.16656881 0.50004871\n", "C 0.08326671 0.24989560 0.58351323\n", "C 0.16656881 0.00001566 0.50004871\n", "C 0.24989560 0.08326671 0.58351323\n", "C 0.16713153 0.16713153 0.33408428\n", "C 0.25020487 0.25020487 0.41712458\n", "C 0.99984338 0.99984338 0.66702816\n", "C 0.08281135 0.08281135 0.75072909\n", "C 0.99895986 0.16485431 0.83461141\n", "C 0.08251591 0.24836734 0.91825974\n", "C 0.16485431 0.99895986 0.83461141\n", "C 0.24836734 0.08251591 0.91825974\n", "C 0.16622186 0.16622186 0.66720992\n", "C 0.24953177 0.24953177 0.75057394\n", "C 0.00008479 0.33283360 0.00008479\n", "C 0.08339786 0.41672965 0.08339786\n", "C 0.00001566 0.50004871 0.16656881\n", "C 0.08326671 0.58351323 0.24989560\n", "C 0.16713153 0.33408428 0.16713153\n", "C 0.25020487 0.41712458 0.25020487\n", "C 0.16656881 0.50004871 0.00001566\n", "C 0.24989560 0.58351323 0.08326671\n", "C 0.00027688 0.33386603 0.33386603\n", "C 0.08336456 0.41697495 0.41697495\n", "C 0.00001683 0.49998105 0.49998105\n", "C 0.08321204 0.58306345 0.58306345\n", "C 0.16670944 0.33337114 0.50028918\n", "C 0.24993513 0.41657415 0.58357284\n", "C 0.16670944 0.50028918 0.33337114\n", "C 0.24993513 0.58357284 0.41657415\n", "C 0.99985602 0.33340447 0.66654379\n", "C 0.08316950 0.41622885 0.75039993\n", "C 0.99998161 0.49983489 0.83346972\n", "C 0.08322304 0.58335107 0.91669677\n", "C 0.16638542 0.33231108 0.83427654\n", "C 0.24992639 0.41652052 0.91689915\n", "C 0.16665894 0.49975729 0.66687415\n", "C 0.24993176 0.58319109 0.75005301\n", "C 0.99984338 0.66702816 0.99984338\n", "C 0.08281135 0.75072909 0.08281135\n", "C 0.99895986 0.83461141 0.16485431\n", "C 0.08251591 0.91825974 0.24836734\n", "C 0.16622186 0.66720992 0.16622186\n", "C 0.24953177 0.75057394 0.24953177\n", "C 0.16485431 0.83461141 0.99895986\n", "C 0.24836734 0.91825974 0.08251591\n", "C 0.99985602 0.66654379 0.33340447\n", "C 0.08316950 0.75039993 0.41622885\n", "C 0.99998161 0.83346972 0.49983489\n", "C 0.08322304 0.91669677 0.58335107\n", "C 0.16665894 0.66687415 0.49975729\n", "C 0.24993176 0.75005301 0.58319109\n", "C 0.16638542 0.83427654 0.33231108\n", "C 0.24992639 0.91689915 0.41652052\n", "C 0.00008183 0.66614375 0.66614375\n", "C 0.08289904 0.74902978 0.74902978\n", "C 0.00053850 0.83348289 0.83348289\n", "C1 0.08713894 0.91048546 0.91048546\n", "C 0.16657469 0.66657430 0.83322405\n", "C 0.25035752 0.74957641 0.91684864\n", "C 0.16657469 0.83322405 0.66657430\n", "C 0.25035752 0.91684864 0.74957641\n", "C 0.33283360 0.00008479 0.00008479\n", "C 0.41672965 0.08339786 0.08339786\n", "C 0.33408428 0.16713153 0.16713153\n", "C 0.41712458 0.25020487 0.25020487\n", "C 0.50004871 0.00001566 0.16656881\n", "C 0.58351323 0.08326671 0.24989560\n", "C 0.50004871 0.16656881 0.00001566\n", "C 0.58351323 0.24989560 0.08326671\n", "C 0.33386603 0.00027688 0.33386603\n", "C 0.41697495 0.08336456 0.41697495\n", "C 0.33337114 0.16670944 0.50028918\n", "C 0.41657415 0.24993513 0.58357284\n", "C 0.49998105 0.00001683 0.49998105\n", "C 0.58306345 0.08321204 0.58306345\n", "C 0.50028918 0.16670944 0.33337114\n", "C 0.58357284 0.24993513 0.41657415\n", "C 0.33340447 0.99985602 0.66654379\n", "C 0.41622885 0.08316950 0.75039993\n", "C 0.33231108 0.16638542 0.83427654\n", "C 0.41652052 0.24992639 0.91689915\n", "C 0.49983489 0.99998161 0.83346972\n", "C 0.58335107 0.08322304 0.91669677\n", "C 0.49975729 0.16665894 0.66687415\n", "C 0.58319109 0.24993176 0.75005301\n", "C 0.33386603 0.33386603 0.00027688\n", "C 0.41697495 0.41697495 0.08336456\n", "C 0.33337114 0.50028918 0.16670944\n", "C 0.41657415 0.58357284 0.24993513\n", "C 0.50028918 0.33337114 0.16670944\n", "C 0.58357284 0.41657415 0.24993513\n", "C 0.49998105 0.49998105 0.00001683\n", "C 0.58306345 0.58306345 0.08321204\n", "C 0.33347050 0.33347050 0.33347050\n", "C 0.41673247 0.41673247 0.41673247\n", "C 0.33329711 0.50005503 0.50005503\n", "C 0.41664684 0.58334948 0.58334948\n", "C 0.50005503 0.33329711 0.50005503\n", "C 0.58334948 0.41664684 0.58334948\n", "C 0.50005503 0.50005503 0.33329711\n", "C 0.58334948 0.58334948 0.41664684\n", "C 0.33309935 0.33309935 0.66702679\n", "C 0.41654604 0.41654604 0.75010768\n", "C 0.33320910 0.49986185 0.83336463\n", "C 0.41672856 0.58316778 0.91673106\n", "C 0.49986185 0.33320910 0.83336463\n", "C 0.58316778 0.41672856 0.91673106\n", "C 0.49997743 0.49997743 0.66672237\n", "C 0.58336242 0.58336242 0.75004203\n", "C 0.33340447 0.66654379 0.99985602\n", "C 0.41622885 0.75039993 0.08316950\n", "C 0.33231108 0.83427654 0.16638542\n", "C 0.41652052 0.91689915 0.24992639\n", "C 0.49975729 0.66687415 0.16665894\n", "C 0.58319109 0.75005301 0.24993176\n", "C 0.49983489 0.83346972 0.99998161\n", "C 0.58335107 0.91669677 0.08322304\n", "C 0.33309935 0.66702679 0.33309935\n", "C 0.41654604 0.75010768 0.41654604\n", "C 0.33320910 0.83336463 0.49986185\n", "C 0.41672856 0.91673106 0.58316778\n", "C 0.49997743 0.66672237 0.49997743\n", "C 0.58336242 0.75004203 0.58336242\n", "C 0.49986185 0.83336463 0.33320910\n", "C 0.58316778 0.91673106 0.41672856\n", "C 0.33323057 0.66669044 0.66669044\n", "C 0.41664480 0.74999600 0.74999600\n", "C 0.33322293 0.83331221 0.83331221\n", "C 0.41644973 0.91672376 0.91672376\n", "C 0.49995303 0.66666581 0.83331752\n", "C 0.58318248 0.74995219 0.91666536\n", "C 0.49995303 0.83331752 0.66666581\n", "C 0.58318248 0.91666536 0.74995219\n", "C 0.66702816 0.99984338 0.99984338\n", "C 0.75072909 0.08281135 0.08281135\n", "C 0.66720992 0.16622186 0.16622186\n", "C 0.75057394 0.24953177 0.24953177\n", "C 0.83461141 0.99895986 0.16485431\n", "C 0.91825974 0.08251591 0.24836734\n", "C 0.83461141 0.16485431 0.99895986\n", "C 0.91825974 0.24836734 0.08251591\n", "C 0.66654379 0.99985602 0.33340447\n", "C 0.75039993 0.08316950 0.41622885\n", "C 0.66687415 0.16665894 0.49975729\n", "C 0.75005301 0.24993176 0.58319109\n", "C 0.83346972 0.99998161 0.49983489\n", "C 0.91669677 0.08322304 0.58335107\n", "C 0.83427654 0.16638542 0.33231108\n", "C 0.91689915 0.24992639 0.41652052\n", "C 0.66614375 0.00008183 0.66614375\n", "C 0.74902978 0.08289904 0.74902978\n", "C 0.66657430 0.16657469 0.83322405\n", "C 0.74957641 0.25035752 0.91684864\n", "C 0.83348289 0.00053850 0.83348289\n", "C2 0.91048546 0.08713894 0.91048546\n", "C 0.83322405 0.16657469 0.66657430\n", "C 0.91684864 0.25035752 0.74957641\n", "C 0.66654379 0.33340447 0.99985602\n", "C 0.75039993 0.41622885 0.08316950\n", "C 0.66687415 0.49975729 0.16665894\n", "C 0.75005301 0.58319109 0.24993176\n", "C 0.83427654 0.33231108 0.16638542\n", "C 0.91689915 0.41652052 0.24992639\n", "C 0.83346972 0.49983489 0.99998161\n", "C 0.91669677 0.58335107 0.08322304\n", "C 0.66702679 0.33309935 0.33309935\n", "C 0.75010768 0.41654604 0.41654604\n", "C 0.66672237 0.49997743 0.49997743\n", "C 0.75004203 0.58336242 0.58336242\n", "C 0.83336463 0.33320910 0.49986185\n", "C 0.91673106 0.41672856 0.58316778\n", "C 0.83336463 0.49986185 0.33320910\n", "C 0.91673106 0.58316778 0.41672856\n", "C 0.66669044 0.33323057 0.66669044\n", "C 0.74999600 0.41664480 0.74999600\n", "C 0.66666581 0.49995303 0.83331752\n", "C 0.74995219 0.58318248 0.91666536\n", "C 0.83331221 0.33322293 0.83331221\n", "C 0.91672376 0.41644973 0.91672376\n", "C 0.83331752 0.49995303 0.66666581\n", "C 0.91666536 0.58318248 0.74995219\n", "C 0.66614375 0.66614375 0.00008183\n", "C 0.74902978 0.74902978 0.08289904\n", "C 0.66657430 0.83322405 0.16657469\n", "C 0.74957641 0.91684864 0.25035752\n", "C 0.83322405 0.66657430 0.16657469\n", "C 0.91684864 0.74957641 0.25035752\n", "C 0.83348289 0.83348289 0.00053850\n", "C3 0.91048546 0.91048546 0.08713894\n", "C 0.66669044 0.66669044 0.33323057\n", "C 0.74999600 0.74999600 0.41664480\n", "C 0.66666581 0.83331752 0.49995303\n", "C 0.74995219 0.91666536 0.58318248\n", "C 0.83331752 0.66666581 0.49995303\n", "C 0.91666536 0.74995219 0.58318248\n", "C 0.83331221 0.83331221 0.33322293\n", "C 0.91672376 0.91672376 0.41644973\n", "C 0.66676564 0.66676564 0.66676564\n", "C 0.75009290 0.75009290 0.75009290\n", "C 0.66679851 0.83348831 0.83348831\n", "C 0.75027490 0.91667191 0.91667191\n", "C 0.83348831 0.66679851 0.83348831\n", "C 0.91667191 0.75027490 0.91667191\n", "C 0.83348831 0.83348831 0.66679851\n", "C 0.91667191 0.91667191 0.75027490\n" ] } ], "source": [ "%%bash\n", "cat pw_singlet_1.in\n", "\n", "mpirun -n 4 pw.x -i pw_singlet_1.in > pw_singlet_1.out" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we run PyZFS to compute the $\\mathbf{d}$ tensor." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "mpirun -n 4 pyzfs --wfcfmt qeh5 --prefix singlet_1 --memory low > zfs_singlet_1.out\n", "mv zfs.xml zfs_singlet_1.xml" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The same is done for the other two singlet configurations that have the spin up electron localized on `C2` or `C3`." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&CONTROL\n", "calculation = 'scf'\n", "pseudo_dir = './'\n", "prefix = 'singlet_2'\n", "/\n", "&SYSTEM\n", "ibrav = 0\n", "ntyp = 5\n", "nat = 215\n", "tot_charge = -1.0\n", "tot_magnetization = 0.0\n", "starting_magnetization(1) = -0.125 ! C1\n", "starting_magnetization(2) = 0.25 ! C2\n", "starting_magnetization(3) = -0.125 ! C3\n", "starting_magnetization(4) = 0.0 ! C\n", "starting_magnetization(5) = 0.0 ! N\n", "nspin = 2\n", "nbnd = 628\n", "ecutwfc = 60.0\n", "/\n", "&ELECTRONS\n", "diago_full_acc = .true.\n", "mixing_beta = 0.2\n", "/\n", "ATOMIC_SPECIES\n", "C1 12.01099968 C_ONCV_PBE-1.2.upf\n", "C2 12.01099968 C_ONCV_PBE-1.2.upf\n", "C3 12.01099968 C_ONCV_PBE-1.2.upf\n", "C 12.01099968 C_ONCV_PBE-1.2.upf\n", "N 14.00699997 N_ONCV_PBE-1.2.upf\n", "CELL_PARAMETERS angstrom\n", "10.704 0.000 0.000\n", " 0.000 10.704 0.000\n", " 0.000 0.000 10.704\n", "K_POINTS gamma\n", "ATOMIC_POSITIONS crystal\n", "N 0.09152860 0.09152860 0.09152860\n", "C 0.00406095 0.16656435 0.16656435\n", "C 0.08375956 0.25132100 0.25132100\n", "C 0.16656435 0.00406095 0.16656435\n", "C 0.25132100 0.08375956 0.25132100\n", "C 0.16656435 0.16656435 0.00406095\n", "C 0.25132100 0.25132100 0.08375956\n", "C 0.00008479 0.00008479 0.33283360\n", "C 0.08339786 0.08339786 0.41672965\n", "C 0.00001566 0.16656881 0.50004871\n", "C 0.08326671 0.24989560 0.58351323\n", "C 0.16656881 0.00001566 0.50004871\n", "C 0.24989560 0.08326671 0.58351323\n", "C 0.16713153 0.16713153 0.33408428\n", "C 0.25020487 0.25020487 0.41712458\n", "C 0.99984338 0.99984338 0.66702816\n", "C 0.08281135 0.08281135 0.75072909\n", "C 0.99895986 0.16485431 0.83461141\n", "C 0.08251591 0.24836734 0.91825974\n", "C 0.16485431 0.99895986 0.83461141\n", "C 0.24836734 0.08251591 0.91825974\n", "C 0.16622186 0.16622186 0.66720992\n", "C 0.24953177 0.24953177 0.75057394\n", "C 0.00008479 0.33283360 0.00008479\n", "C 0.08339786 0.41672965 0.08339786\n", "C 0.00001566 0.50004871 0.16656881\n", "C 0.08326671 0.58351323 0.24989560\n", "C 0.16713153 0.33408428 0.16713153\n", "C 0.25020487 0.41712458 0.25020487\n", "C 0.16656881 0.50004871 0.00001566\n", "C 0.24989560 0.58351323 0.08326671\n", "C 0.00027688 0.33386603 0.33386603\n", "C 0.08336456 0.41697495 0.41697495\n", "C 0.00001683 0.49998105 0.49998105\n", "C 0.08321204 0.58306345 0.58306345\n", "C 0.16670944 0.33337114 0.50028918\n", "C 0.24993513 0.41657415 0.58357284\n", "C 0.16670944 0.50028918 0.33337114\n", "C 0.24993513 0.58357284 0.41657415\n", "C 0.99985602 0.33340447 0.66654379\n", "C 0.08316950 0.41622885 0.75039993\n", "C 0.99998161 0.49983489 0.83346972\n", "C 0.08322304 0.58335107 0.91669677\n", "C 0.16638542 0.33231108 0.83427654\n", "C 0.24992639 0.41652052 0.91689915\n", "C 0.16665894 0.49975729 0.66687415\n", "C 0.24993176 0.58319109 0.75005301\n", "C 0.99984338 0.66702816 0.99984338\n", "C 0.08281135 0.75072909 0.08281135\n", "C 0.99895986 0.83461141 0.16485431\n", "C 0.08251591 0.91825974 0.24836734\n", "C 0.16622186 0.66720992 0.16622186\n", "C 0.24953177 0.75057394 0.24953177\n", "C 0.16485431 0.83461141 0.99895986\n", "C 0.24836734 0.91825974 0.08251591\n", "C 0.99985602 0.66654379 0.33340447\n", "C 0.08316950 0.75039993 0.41622885\n", "C 0.99998161 0.83346972 0.49983489\n", "C 0.08322304 0.91669677 0.58335107\n", "C 0.16665894 0.66687415 0.49975729\n", "C 0.24993176 0.75005301 0.58319109\n", "C 0.16638542 0.83427654 0.33231108\n", "C 0.24992639 0.91689915 0.41652052\n", "C 0.00008183 0.66614375 0.66614375\n", "C 0.08289904 0.74902978 0.74902978\n", "C 0.00053850 0.83348289 0.83348289\n", "C1 0.08713894 0.91048546 0.91048546\n", "C 0.16657469 0.66657430 0.83322405\n", "C 0.25035752 0.74957641 0.91684864\n", "C 0.16657469 0.83322405 0.66657430\n", "C 0.25035752 0.91684864 0.74957641\n", "C 0.33283360 0.00008479 0.00008479\n", "C 0.41672965 0.08339786 0.08339786\n", "C 0.33408428 0.16713153 0.16713153\n", "C 0.41712458 0.25020487 0.25020487\n", "C 0.50004871 0.00001566 0.16656881\n", "C 0.58351323 0.08326671 0.24989560\n", "C 0.50004871 0.16656881 0.00001566\n", "C 0.58351323 0.24989560 0.08326671\n", "C 0.33386603 0.00027688 0.33386603\n", "C 0.41697495 0.08336456 0.41697495\n", "C 0.33337114 0.16670944 0.50028918\n", "C 0.41657415 0.24993513 0.58357284\n", "C 0.49998105 0.00001683 0.49998105\n", "C 0.58306345 0.08321204 0.58306345\n", "C 0.50028918 0.16670944 0.33337114\n", "C 0.58357284 0.24993513 0.41657415\n", "C 0.33340447 0.99985602 0.66654379\n", "C 0.41622885 0.08316950 0.75039993\n", "C 0.33231108 0.16638542 0.83427654\n", "C 0.41652052 0.24992639 0.91689915\n", "C 0.49983489 0.99998161 0.83346972\n", "C 0.58335107 0.08322304 0.91669677\n", "C 0.49975729 0.16665894 0.66687415\n", "C 0.58319109 0.24993176 0.75005301\n", "C 0.33386603 0.33386603 0.00027688\n", "C 0.41697495 0.41697495 0.08336456\n", "C 0.33337114 0.50028918 0.16670944\n", "C 0.41657415 0.58357284 0.24993513\n", "C 0.50028918 0.33337114 0.16670944\n", "C 0.58357284 0.41657415 0.24993513\n", "C 0.49998105 0.49998105 0.00001683\n", "C 0.58306345 0.58306345 0.08321204\n", "C 0.33347050 0.33347050 0.33347050\n", "C 0.41673247 0.41673247 0.41673247\n", "C 0.33329711 0.50005503 0.50005503\n", "C 0.41664684 0.58334948 0.58334948\n", "C 0.50005503 0.33329711 0.50005503\n", "C 0.58334948 0.41664684 0.58334948\n", "C 0.50005503 0.50005503 0.33329711\n", "C 0.58334948 0.58334948 0.41664684\n", "C 0.33309935 0.33309935 0.66702679\n", "C 0.41654604 0.41654604 0.75010768\n", "C 0.33320910 0.49986185 0.83336463\n", "C 0.41672856 0.58316778 0.91673106\n", "C 0.49986185 0.33320910 0.83336463\n", "C 0.58316778 0.41672856 0.91673106\n", "C 0.49997743 0.49997743 0.66672237\n", "C 0.58336242 0.58336242 0.75004203\n", "C 0.33340447 0.66654379 0.99985602\n", "C 0.41622885 0.75039993 0.08316950\n", "C 0.33231108 0.83427654 0.16638542\n", "C 0.41652052 0.91689915 0.24992639\n", "C 0.49975729 0.66687415 0.16665894\n", "C 0.58319109 0.75005301 0.24993176\n", "C 0.49983489 0.83346972 0.99998161\n", "C 0.58335107 0.91669677 0.08322304\n", "C 0.33309935 0.66702679 0.33309935\n", "C 0.41654604 0.75010768 0.41654604\n", "C 0.33320910 0.83336463 0.49986185\n", "C 0.41672856 0.91673106 0.58316778\n", "C 0.49997743 0.66672237 0.49997743\n", "C 0.58336242 0.75004203 0.58336242\n", "C 0.49986185 0.83336463 0.33320910\n", "C 0.58316778 0.91673106 0.41672856\n", "C 0.33323057 0.66669044 0.66669044\n", "C 0.41664480 0.74999600 0.74999600\n", "C 0.33322293 0.83331221 0.83331221\n", "C 0.41644973 0.91672376 0.91672376\n", "C 0.49995303 0.66666581 0.83331752\n", "C 0.58318248 0.74995219 0.91666536\n", "C 0.49995303 0.83331752 0.66666581\n", "C 0.58318248 0.91666536 0.74995219\n", "C 0.66702816 0.99984338 0.99984338\n", "C 0.75072909 0.08281135 0.08281135\n", "C 0.66720992 0.16622186 0.16622186\n", "C 0.75057394 0.24953177 0.24953177\n", "C 0.83461141 0.99895986 0.16485431\n", "C 0.91825974 0.08251591 0.24836734\n", "C 0.83461141 0.16485431 0.99895986\n", "C 0.91825974 0.24836734 0.08251591\n", "C 0.66654379 0.99985602 0.33340447\n", "C 0.75039993 0.08316950 0.41622885\n", "C 0.66687415 0.16665894 0.49975729\n", "C 0.75005301 0.24993176 0.58319109\n", "C 0.83346972 0.99998161 0.49983489\n", "C 0.91669677 0.08322304 0.58335107\n", "C 0.83427654 0.16638542 0.33231108\n", "C 0.91689915 0.24992639 0.41652052\n", "C 0.66614375 0.00008183 0.66614375\n", "C 0.74902978 0.08289904 0.74902978\n", "C 0.66657430 0.16657469 0.83322405\n", "C 0.74957641 0.25035752 0.91684864\n", "C 0.83348289 0.00053850 0.83348289\n", "C2 0.91048546 0.08713894 0.91048546\n", "C 0.83322405 0.16657469 0.66657430\n", "C 0.91684864 0.25035752 0.74957641\n", "C 0.66654379 0.33340447 0.99985602\n", "C 0.75039993 0.41622885 0.08316950\n", "C 0.66687415 0.49975729 0.16665894\n", "C 0.75005301 0.58319109 0.24993176\n", "C 0.83427654 0.33231108 0.16638542\n", "C 0.91689915 0.41652052 0.24992639\n", "C 0.83346972 0.49983489 0.99998161\n", "C 0.91669677 0.58335107 0.08322304\n", "C 0.66702679 0.33309935 0.33309935\n", "C 0.75010768 0.41654604 0.41654604\n", "C 0.66672237 0.49997743 0.49997743\n", "C 0.75004203 0.58336242 0.58336242\n", "C 0.83336463 0.33320910 0.49986185\n", "C 0.91673106 0.41672856 0.58316778\n", "C 0.83336463 0.49986185 0.33320910\n", "C 0.91673106 0.58316778 0.41672856\n", "C 0.66669044 0.33323057 0.66669044\n", "C 0.74999600 0.41664480 0.74999600\n", "C 0.66666581 0.49995303 0.83331752\n", "C 0.74995219 0.58318248 0.91666536\n", "C 0.83331221 0.33322293 0.83331221\n", "C 0.91672376 0.41644973 0.91672376\n", "C 0.83331752 0.49995303 0.66666581\n", "C 0.91666536 0.58318248 0.74995219\n", "C 0.66614375 0.66614375 0.00008183\n", "C 0.74902978 0.74902978 0.08289904\n", "C 0.66657430 0.83322405 0.16657469\n", "C 0.74957641 0.91684864 0.25035752\n", "C 0.83322405 0.66657430 0.16657469\n", "C 0.91684864 0.74957641 0.25035752\n", "C 0.83348289 0.83348289 0.00053850\n", "C3 0.91048546 0.91048546 0.08713894\n", "C 0.66669044 0.66669044 0.33323057\n", "C 0.74999600 0.74999600 0.41664480\n", "C 0.66666581 0.83331752 0.49995303\n", "C 0.74995219 0.91666536 0.58318248\n", "C 0.83331752 0.66666581 0.49995303\n", "C 0.91666536 0.74995219 0.58318248\n", "C 0.83331221 0.83331221 0.33322293\n", "C 0.91672376 0.91672376 0.41644973\n", "C 0.66676564 0.66676564 0.66676564\n", "C 0.75009290 0.75009290 0.75009290\n", "C 0.66679851 0.83348831 0.83348831\n", "C 0.75027490 0.91667191 0.91667191\n", "C 0.83348831 0.66679851 0.83348831\n", "C 0.91667191 0.75027490 0.91667191\n", "C 0.83348831 0.83348831 0.66679851\n", "C 0.91667191 0.91667191 0.75027490\n" ] } ], "source": [ "%%bash\n", "cat pw_singlet_2.in\n", "\n", "mpirun -n 4 pw.x -i pw_singlet_2.in > pw_singlet_2.out\n", "mpirun -n 4 pyzfs --wfcfmt qeh5 --prefix singlet_2 --memory low > zfs_singlet_2.out\n", "mv zfs.xml zfs_singlet_2.xml" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&CONTROL\n", "calculation = 'scf'\n", "pseudo_dir = './'\n", "prefix = 'singlet_3'\n", "/\n", "&SYSTEM\n", "ibrav = 0\n", "ntyp = 5\n", "nat = 215\n", "tot_charge = -1.0\n", "tot_magnetization = 0.0\n", "starting_magnetization(1) = -0.125 ! C1\n", "starting_magnetization(2) = -0.125 ! C2\n", "starting_magnetization(3) = 0.25 ! C3\n", "starting_magnetization(4) = 0.0 ! C\n", "starting_magnetization(5) = 0.0 ! N\n", "nspin = 2\n", "nbnd = 628\n", "ecutwfc = 60.0\n", "/\n", "&ELECTRONS\n", "diago_full_acc = .true.\n", "mixing_beta = 0.2\n", "/\n", "ATOMIC_SPECIES\n", "C1 12.01099968 C_ONCV_PBE-1.2.upf\n", "C2 12.01099968 C_ONCV_PBE-1.2.upf\n", "C3 12.01099968 C_ONCV_PBE-1.2.upf\n", "C 12.01099968 C_ONCV_PBE-1.2.upf\n", "N 14.00699997 N_ONCV_PBE-1.2.upf\n", "CELL_PARAMETERS angstrom\n", "10.704 0.000 0.000\n", " 0.000 10.704 0.000\n", " 0.000 0.000 10.704\n", "K_POINTS gamma\n", "ATOMIC_POSITIONS crystal\n", "N 0.09152860 0.09152860 0.09152860\n", "C 0.00406095 0.16656435 0.16656435\n", "C 0.08375956 0.25132100 0.25132100\n", "C 0.16656435 0.00406095 0.16656435\n", "C 0.25132100 0.08375956 0.25132100\n", "C 0.16656435 0.16656435 0.00406095\n", "C 0.25132100 0.25132100 0.08375956\n", "C 0.00008479 0.00008479 0.33283360\n", "C 0.08339786 0.08339786 0.41672965\n", "C 0.00001566 0.16656881 0.50004871\n", "C 0.08326671 0.24989560 0.58351323\n", "C 0.16656881 0.00001566 0.50004871\n", "C 0.24989560 0.08326671 0.58351323\n", "C 0.16713153 0.16713153 0.33408428\n", "C 0.25020487 0.25020487 0.41712458\n", "C 0.99984338 0.99984338 0.66702816\n", "C 0.08281135 0.08281135 0.75072909\n", "C 0.99895986 0.16485431 0.83461141\n", "C 0.08251591 0.24836734 0.91825974\n", "C 0.16485431 0.99895986 0.83461141\n", "C 0.24836734 0.08251591 0.91825974\n", "C 0.16622186 0.16622186 0.66720992\n", "C 0.24953177 0.24953177 0.75057394\n", "C 0.00008479 0.33283360 0.00008479\n", "C 0.08339786 0.41672965 0.08339786\n", "C 0.00001566 0.50004871 0.16656881\n", "C 0.08326671 0.58351323 0.24989560\n", "C 0.16713153 0.33408428 0.16713153\n", "C 0.25020487 0.41712458 0.25020487\n", "C 0.16656881 0.50004871 0.00001566\n", "C 0.24989560 0.58351323 0.08326671\n", "C 0.00027688 0.33386603 0.33386603\n", "C 0.08336456 0.41697495 0.41697495\n", "C 0.00001683 0.49998105 0.49998105\n", "C 0.08321204 0.58306345 0.58306345\n", "C 0.16670944 0.33337114 0.50028918\n", "C 0.24993513 0.41657415 0.58357284\n", "C 0.16670944 0.50028918 0.33337114\n", "C 0.24993513 0.58357284 0.41657415\n", "C 0.99985602 0.33340447 0.66654379\n", "C 0.08316950 0.41622885 0.75039993\n", "C 0.99998161 0.49983489 0.83346972\n", "C 0.08322304 0.58335107 0.91669677\n", "C 0.16638542 0.33231108 0.83427654\n", "C 0.24992639 0.41652052 0.91689915\n", "C 0.16665894 0.49975729 0.66687415\n", "C 0.24993176 0.58319109 0.75005301\n", "C 0.99984338 0.66702816 0.99984338\n", "C 0.08281135 0.75072909 0.08281135\n", "C 0.99895986 0.83461141 0.16485431\n", "C 0.08251591 0.91825974 0.24836734\n", "C 0.16622186 0.66720992 0.16622186\n", "C 0.24953177 0.75057394 0.24953177\n", "C 0.16485431 0.83461141 0.99895986\n", "C 0.24836734 0.91825974 0.08251591\n", "C 0.99985602 0.66654379 0.33340447\n", "C 0.08316950 0.75039993 0.41622885\n", "C 0.99998161 0.83346972 0.49983489\n", "C 0.08322304 0.91669677 0.58335107\n", "C 0.16665894 0.66687415 0.49975729\n", "C 0.24993176 0.75005301 0.58319109\n", "C 0.16638542 0.83427654 0.33231108\n", "C 0.24992639 0.91689915 0.41652052\n", "C 0.00008183 0.66614375 0.66614375\n", "C 0.08289904 0.74902978 0.74902978\n", "C 0.00053850 0.83348289 0.83348289\n", "C1 0.08713894 0.91048546 0.91048546\n", "C 0.16657469 0.66657430 0.83322405\n", "C 0.25035752 0.74957641 0.91684864\n", "C 0.16657469 0.83322405 0.66657430\n", "C 0.25035752 0.91684864 0.74957641\n", "C 0.33283360 0.00008479 0.00008479\n", "C 0.41672965 0.08339786 0.08339786\n", "C 0.33408428 0.16713153 0.16713153\n", "C 0.41712458 0.25020487 0.25020487\n", "C 0.50004871 0.00001566 0.16656881\n", "C 0.58351323 0.08326671 0.24989560\n", "C 0.50004871 0.16656881 0.00001566\n", "C 0.58351323 0.24989560 0.08326671\n", "C 0.33386603 0.00027688 0.33386603\n", "C 0.41697495 0.08336456 0.41697495\n", "C 0.33337114 0.16670944 0.50028918\n", "C 0.41657415 0.24993513 0.58357284\n", "C 0.49998105 0.00001683 0.49998105\n", "C 0.58306345 0.08321204 0.58306345\n", "C 0.50028918 0.16670944 0.33337114\n", "C 0.58357284 0.24993513 0.41657415\n", "C 0.33340447 0.99985602 0.66654379\n", "C 0.41622885 0.08316950 0.75039993\n", "C 0.33231108 0.16638542 0.83427654\n", "C 0.41652052 0.24992639 0.91689915\n", "C 0.49983489 0.99998161 0.83346972\n", "C 0.58335107 0.08322304 0.91669677\n", "C 0.49975729 0.16665894 0.66687415\n", "C 0.58319109 0.24993176 0.75005301\n", "C 0.33386603 0.33386603 0.00027688\n", "C 0.41697495 0.41697495 0.08336456\n", "C 0.33337114 0.50028918 0.16670944\n", "C 0.41657415 0.58357284 0.24993513\n", "C 0.50028918 0.33337114 0.16670944\n", "C 0.58357284 0.41657415 0.24993513\n", "C 0.49998105 0.49998105 0.00001683\n", "C 0.58306345 0.58306345 0.08321204\n", "C 0.33347050 0.33347050 0.33347050\n", "C 0.41673247 0.41673247 0.41673247\n", "C 0.33329711 0.50005503 0.50005503\n", "C 0.41664684 0.58334948 0.58334948\n", "C 0.50005503 0.33329711 0.50005503\n", "C 0.58334948 0.41664684 0.58334948\n", "C 0.50005503 0.50005503 0.33329711\n", "C 0.58334948 0.58334948 0.41664684\n", "C 0.33309935 0.33309935 0.66702679\n", "C 0.41654604 0.41654604 0.75010768\n", "C 0.33320910 0.49986185 0.83336463\n", "C 0.41672856 0.58316778 0.91673106\n", "C 0.49986185 0.33320910 0.83336463\n", "C 0.58316778 0.41672856 0.91673106\n", "C 0.49997743 0.49997743 0.66672237\n", "C 0.58336242 0.58336242 0.75004203\n", "C 0.33340447 0.66654379 0.99985602\n", "C 0.41622885 0.75039993 0.08316950\n", "C 0.33231108 0.83427654 0.16638542\n", "C 0.41652052 0.91689915 0.24992639\n", "C 0.49975729 0.66687415 0.16665894\n", "C 0.58319109 0.75005301 0.24993176\n", "C 0.49983489 0.83346972 0.99998161\n", "C 0.58335107 0.91669677 0.08322304\n", "C 0.33309935 0.66702679 0.33309935\n", "C 0.41654604 0.75010768 0.41654604\n", "C 0.33320910 0.83336463 0.49986185\n", "C 0.41672856 0.91673106 0.58316778\n", "C 0.49997743 0.66672237 0.49997743\n", "C 0.58336242 0.75004203 0.58336242\n", "C 0.49986185 0.83336463 0.33320910\n", "C 0.58316778 0.91673106 0.41672856\n", "C 0.33323057 0.66669044 0.66669044\n", "C 0.41664480 0.74999600 0.74999600\n", "C 0.33322293 0.83331221 0.83331221\n", "C 0.41644973 0.91672376 0.91672376\n", "C 0.49995303 0.66666581 0.83331752\n", "C 0.58318248 0.74995219 0.91666536\n", "C 0.49995303 0.83331752 0.66666581\n", "C 0.58318248 0.91666536 0.74995219\n", "C 0.66702816 0.99984338 0.99984338\n", "C 0.75072909 0.08281135 0.08281135\n", "C 0.66720992 0.16622186 0.16622186\n", "C 0.75057394 0.24953177 0.24953177\n", "C 0.83461141 0.99895986 0.16485431\n", "C 0.91825974 0.08251591 0.24836734\n", "C 0.83461141 0.16485431 0.99895986\n", "C 0.91825974 0.24836734 0.08251591\n", "C 0.66654379 0.99985602 0.33340447\n", "C 0.75039993 0.08316950 0.41622885\n", "C 0.66687415 0.16665894 0.49975729\n", "C 0.75005301 0.24993176 0.58319109\n", "C 0.83346972 0.99998161 0.49983489\n", "C 0.91669677 0.08322304 0.58335107\n", "C 0.83427654 0.16638542 0.33231108\n", "C 0.91689915 0.24992639 0.41652052\n", "C 0.66614375 0.00008183 0.66614375\n", "C 0.74902978 0.08289904 0.74902978\n", "C 0.66657430 0.16657469 0.83322405\n", "C 0.74957641 0.25035752 0.91684864\n", "C 0.83348289 0.00053850 0.83348289\n", "C2 0.91048546 0.08713894 0.91048546\n", "C 0.83322405 0.16657469 0.66657430\n", "C 0.91684864 0.25035752 0.74957641\n", "C 0.66654379 0.33340447 0.99985602\n", "C 0.75039993 0.41622885 0.08316950\n", "C 0.66687415 0.49975729 0.16665894\n", "C 0.75005301 0.58319109 0.24993176\n", "C 0.83427654 0.33231108 0.16638542\n", "C 0.91689915 0.41652052 0.24992639\n", "C 0.83346972 0.49983489 0.99998161\n", "C 0.91669677 0.58335107 0.08322304\n", "C 0.66702679 0.33309935 0.33309935\n", "C 0.75010768 0.41654604 0.41654604\n", "C 0.66672237 0.49997743 0.49997743\n", "C 0.75004203 0.58336242 0.58336242\n", "C 0.83336463 0.33320910 0.49986185\n", "C 0.91673106 0.41672856 0.58316778\n", "C 0.83336463 0.49986185 0.33320910\n", "C 0.91673106 0.58316778 0.41672856\n", "C 0.66669044 0.33323057 0.66669044\n", "C 0.74999600 0.41664480 0.74999600\n", "C 0.66666581 0.49995303 0.83331752\n", "C 0.74995219 0.58318248 0.91666536\n", "C 0.83331221 0.33322293 0.83331221\n", "C 0.91672376 0.41644973 0.91672376\n", "C 0.83331752 0.49995303 0.66666581\n", "C 0.91666536 0.58318248 0.74995219\n", "C 0.66614375 0.66614375 0.00008183\n", "C 0.74902978 0.74902978 0.08289904\n", "C 0.66657430 0.83322405 0.16657469\n", "C 0.74957641 0.91684864 0.25035752\n", "C 0.83322405 0.66657430 0.16657469\n", "C 0.91684864 0.74957641 0.25035752\n", "C 0.83348289 0.83348289 0.00053850\n", "C3 0.91048546 0.91048546 0.08713894\n", "C 0.66669044 0.66669044 0.33323057\n", "C 0.74999600 0.74999600 0.41664480\n", "C 0.66666581 0.83331752 0.49995303\n", "C 0.74995219 0.91666536 0.58318248\n", "C 0.83331752 0.66666581 0.49995303\n", "C 0.91666536 0.74995219 0.58318248\n", "C 0.83331221 0.83331221 0.33322293\n", "C 0.91672376 0.91672376 0.41644973\n", "C 0.66676564 0.66676564 0.66676564\n", "C 0.75009290 0.75009290 0.75009290\n", "C 0.66679851 0.83348831 0.83348831\n", "C 0.75027490 0.91667191 0.91667191\n", "C 0.83348831 0.66679851 0.83348831\n", "C 0.91667191 0.75027490 0.91667191\n", "C 0.83348831 0.83348831 0.66679851\n", "C 0.91667191 0.91667191 0.75027490\n" ] } ], "source": [ "%%bash\n", "cat pw_singlet_3.in\n", "\n", "mpirun -n 4 pw.x -i pw_singlet_3.in > pw_singlet_3.out\n", "mpirun -n 4 pyzfs --wfcfmt qeh5 --prefix singlet_3 --memory low > zfs_singlet_3.out\n", "mv zfs.xml zfs_singlet_3.xml" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From the XML outputs of PyZFS, we extract the magnetic dipolar interaction $\\mathbf{d}$ tensors of the singlet states." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "d_singlet = {}\n", "\n", "for conf in range(1, 4):\n", " tree = ET.parse(f\"zfs_singlet_{conf}.xml\")\n", " root = tree.getroot()\n", "\n", " D_singlet = root.find(\"DTensor\").text\n", " D_singlet = D_singlet.replace(\"[\", \"\").replace(\"]\", \"\").replace(\"\\n\", \" \")\n", " D_singlet = np.fromstring(D_singlet, sep=\" \").reshape(3, 3)\n", "\n", " # PyZFS internally assumes S = 1, so d = D / 2\n", " d_singlet[conf] = D_singlet / 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3 Compute zero-field splitting with correction for spin contamination" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally we build and diagonalize the spin decontaminated spin-spin ZFS tensor $\\tilde{\\mathbf{D}}^{\\mathrm{SS}}$." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Uncorrected ZFS:\n", "D = 3033.97\n", "E = -0.68\n", "\n", "Corrected ZFS:\n", "D = 2544.28\n", "E = -0.59\n" ] } ], "source": [ "D_corrected = d_triplet - (d_singlet[1] + d_singlet[2] + d_singlet[3]) / 3\n", "\n", "ev, evc = np.linalg.eig(D_corrected)\n", "\n", "# For triplet states, compute D and E parameters:\n", "# Denote three eigenvalues as Dx, Dy, Dz: |Dz| > |Dx| > |Dy|\n", "# D = 3/2 Dz, E = 1/2(Dx - Dy)\n", "args = np.abs(ev).argsort()\n", "dy, dx, dz = ev[args]\n", "ZFS_D_corrected = 1.5 * dz\n", "ZFS_E_corrected = 0.5 * (dx - dy)\n", "\n", "# Summarize results\n", "print(\"Uncorrected ZFS:\")\n", "print(f\"D = {ZFS_D:.2f}\")\n", "print(f\"E = {ZFS_E:.2f}\")\n", "print()\n", "print(\"Corrected ZFS:\")\n", "print(f\"D = {ZFS_D_corrected:.2f}\")\n", "print(f\"E = {ZFS_E_corrected:.2f}\")" ] } ], "metadata": { "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.12.12" } }, "nbformat": 4, "nbformat_minor": 4 }