|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "from __future__ import print_function\n", |
| 10 | + "import sisl\n", |
| 11 | + "import numpy as np\n", |
| 12 | + "import matplotlib.pyplot as plt\n", |
| 13 | + "%matplotlib inline" |
| 14 | + ] |
| 15 | + }, |
| 16 | + { |
| 17 | + "cell_type": "markdown", |
| 18 | + "metadata": {}, |
| 19 | + "source": [ |
| 20 | + "Example of the $k$-point sampling for TBtrans." |
| 21 | + ] |
| 22 | + }, |
| 23 | + { |
| 24 | + "cell_type": "code", |
| 25 | + "execution_count": null, |
| 26 | + "metadata": {}, |
| 27 | + "outputs": [], |
| 28 | + "source": [ |
| 29 | + "chain = sisl.Geometry([0]*3, sisl.Atom(1, R=1.), sc=[1, 1, 10])\n", |
| 30 | + "chain.set_nsc([3, 3, 1])\n", |
| 31 | + "\n", |
| 32 | + "# Transport along y-direction\n", |
| 33 | + "chain = chain.tile(20, 0)\n", |
| 34 | + "He = sisl.Hamiltonian(chain)\n", |
| 35 | + "He.construct(([0.1, 1.1], [0, -1]))\n", |
| 36 | + "Hd = He.tile(20, 1)\n", |
| 37 | + "He.write('ELEC.nc')\n", |
| 38 | + "Hd.write('DEVICE.nc')" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "code", |
| 43 | + "execution_count": null, |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "with open('RUN.fdf', 'w') as f:\n", |
| 48 | + " f.write(\"\"\"\n", |
| 49 | + "TBT.k [ 3 1 1 ]\n", |
| 50 | + "\n", |
| 51 | + "TBT.DOS.A\n", |
| 52 | + "TBT.Current.Orb\n", |
| 53 | + "\n", |
| 54 | + "TBT.HS DEVICE.nc\n", |
| 55 | + "%block TBT.Elec.Left\n", |
| 56 | + " HS ELEC.nc\n", |
| 57 | + " semi-inf-direction -a2\n", |
| 58 | + " electrode-position 1\n", |
| 59 | + "%endblock\n", |
| 60 | + "%block TBT.Elec.Right\n", |
| 61 | + " HS ELEC.nc\n", |
| 62 | + " semi-inf-direction +a2\n", |
| 63 | + " electrode-position end -1\n", |
| 64 | + "%endblock\n", |
| 65 | + " \"\"\")" |
| 66 | + ] |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "markdown", |
| 70 | + "metadata": {}, |
| 71 | + "source": [ |
| 72 | + "Run these two executables:\n", |
| 73 | + "\n", |
| 74 | + " tbtrans -D TRS RUN.fdf\n", |
| 75 | + " tbtrans -D NO_TRS -fdf TBT.Symmetry.TimeReversal:f RUN.fdf" |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "cell_type": "code", |
| 80 | + "execution_count": null, |
| 81 | + "metadata": {}, |
| 82 | + "outputs": [], |
| 83 | + "source": [ |
| 84 | + "trs = sisl.get_sile('TRS/siesta.TBT.nc')\n", |
| 85 | + "no_trs = sisl.get_sile('NO_TRS/siesta.TBT.nc')" |
| 86 | + ] |
| 87 | + }, |
| 88 | + { |
| 89 | + "cell_type": "code", |
| 90 | + "execution_count": null, |
| 91 | + "metadata": {}, |
| 92 | + "outputs": [], |
| 93 | + "source": [ |
| 94 | + "def plot_bond(tbt, E):\n", |
| 95 | + " xy = tbt.geometry.xyz[:, :2]\n", |
| 96 | + " vector = tbt.vector_current(0, E)[:, :2]\n", |
| 97 | + " atom = tbt.atom_current(0, E)\n", |
| 98 | + " # Normalize atomic current\n", |
| 99 | + " atom += 1\n", |
| 100 | + " atom *= 10 / atom.max()\n", |
| 101 | + " plt.scatter(xy[:, 0], xy[:, 1], atom);\n", |
| 102 | + " plt.quiver(xy[:, 0], xy[:, 1], vector[:, 0], vector[:, 1]);\n", |
| 103 | + " plt.gca().get_xaxis().set_visible(False)\n", |
| 104 | + " plt.gca().get_yaxis().set_visible(False)\n", |
| 105 | + " plt.tight_layout()" |
| 106 | + ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "cell_type": "code", |
| 110 | + "execution_count": null, |
| 111 | + "metadata": {}, |
| 112 | + "outputs": [], |
| 113 | + "source": [ |
| 114 | + "plot_bond(trs, 1.)\n", |
| 115 | + "plt.savefig('fig/trs.png')" |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "code", |
| 120 | + "execution_count": null, |
| 121 | + "metadata": {}, |
| 122 | + "outputs": [], |
| 123 | + "source": [ |
| 124 | + "plot_bond(no_trs, 1.)\n", |
| 125 | + "plt.savefig('fig/no_trs.png')" |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "cell_type": "code", |
| 130 | + "execution_count": null, |
| 131 | + "metadata": {}, |
| 132 | + "outputs": [], |
| 133 | + "source": [] |
| 134 | + } |
| 135 | + ], |
| 136 | + "metadata": { |
| 137 | + "kernelspec": { |
| 138 | + "display_name": "Python 2", |
| 139 | + "language": "python", |
| 140 | + "name": "python2" |
| 141 | + }, |
| 142 | + "language_info": { |
| 143 | + "codemirror_mode": { |
| 144 | + "name": "ipython", |
| 145 | + "version": 2 |
| 146 | + }, |
| 147 | + "file_extension": ".py", |
| 148 | + "mimetype": "text/x-python", |
| 149 | + "name": "python", |
| 150 | + "nbconvert_exporter": "python", |
| 151 | + "pygments_lexer": "ipython2", |
| 152 | + "version": "2.7.14" |
| 153 | + } |
| 154 | + }, |
| 155 | + "nbformat": 4, |
| 156 | + "nbformat_minor": 2 |
| 157 | +} |
0 commit comments