|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "source": [ |
| 6 | + "# Slabs of SrTiO3(011) with specified terminations\n", |
| 7 | + "\n", |
| 8 | + "## 0. Introduction\n", |
| 9 | + "\n", |
| 10 | + "This notebook demonstrates how to create slabs of SrTiO3(011) with specified terminations following the manuscript:\n", |
| 11 | + "\n", |
| 12 | + "> **R. I. Eglitis and David Vanderbilt**\n", |
| 13 | + "> *First-principles calculations of atomic and electronic structure of SrTiO3 (001) and (011) surfaces*\n", |
| 14 | + "> Phys. Rev. B 77, 195408 (2008)\n", |
| 15 | + "> [DOI: 10.1103/PhysRevB.77.195408](https://doi.org/10.1103/PhysRevB.77.195408)\n", |
| 16 | + "\n", |
| 17 | + "Replicating the material from the FIG. 2. with 2 different terminations:\n", |
| 18 | + "\n", |
| 19 | + " \n", |
| 20 | + "\n" |
| 21 | + ], |
| 22 | + "metadata": { |
| 23 | + "collapsed": false |
| 24 | + }, |
| 25 | + "id": "95a274d80df28ccd" |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "source": [ |
| 30 | + "## 1. Prepare the Environment\n", |
| 31 | + "### 1.1. Set up defect parameters " |
| 32 | + ], |
| 33 | + "metadata": { |
| 34 | + "collapsed": false |
| 35 | + }, |
| 36 | + "id": "d55eaee8bc55bffd" |
| 37 | + }, |
| 38 | + { |
| 39 | + "cell_type": "code", |
| 40 | + "outputs": [], |
| 41 | + "source": [ |
| 42 | + "MILLER_INDICES = (0, 1, 1)\n", |
| 43 | + "THICKNESS = 3 # in atomic layers\n", |
| 44 | + "VACUUM = 10.0 # in angstroms\n", |
| 45 | + "XY_SUPERCELL_MATRIX = [[1, 0], [0, 1]]\n", |
| 46 | + "USE_ORTHOGONAL_Z = True\n", |
| 47 | + "USE_CONVENTIONAL_CELL = True\n" |
| 48 | + ], |
| 49 | + "metadata": { |
| 50 | + "collapsed": false |
| 51 | + }, |
| 52 | + "id": "4b64735060047bec", |
| 53 | + "execution_count": null |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "markdown", |
| 57 | + "source": [ |
| 58 | + "### 1.2. Install Packages\n", |
| 59 | + "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))." |
| 60 | + ], |
| 61 | + "metadata": { |
| 62 | + "collapsed": false |
| 63 | + }, |
| 64 | + "id": "5e0ce05f6f031b3f" |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "code", |
| 68 | + "outputs": [], |
| 69 | + "source": [ |
| 70 | + "import sys\n", |
| 71 | + "\n", |
| 72 | + "if sys.platform == \"emscripten\":\n", |
| 73 | + " import micropip\n", |
| 74 | + "\n", |
| 75 | + " await micropip.install('mat3ra-api-examples', deps=False)\n", |
| 76 | + " from utils.jupyterlite import install_packages\n", |
| 77 | + "\n", |
| 78 | + " await install_packages(\"\")" |
| 79 | + ], |
| 80 | + "metadata": { |
| 81 | + "collapsed": false |
| 82 | + }, |
| 83 | + "id": "b457673560550933", |
| 84 | + "execution_count": null |
| 85 | + }, |
| 86 | + { |
| 87 | + "cell_type": "markdown", |
| 88 | + "source": [ |
| 89 | + "### 1.3. Get input materials" |
| 90 | + ], |
| 91 | + "metadata": { |
| 92 | + "collapsed": false |
| 93 | + }, |
| 94 | + "id": "1659a8e9afe434fb" |
| 95 | + }, |
| 96 | + { |
| 97 | + "cell_type": "code", |
| 98 | + "outputs": [], |
| 99 | + "source": [ |
| 100 | + "from mat3ra.made.material import Material\n", |
| 101 | + "from mat3ra.standata.materials import Materials\n", |
| 102 | + "from mat3ra.made.tools.modify import rotate\n", |
| 103 | + "\n", |
| 104 | + "material = Material(Materials.get_by_name_first_match(\"SrTiO3\"))\n", |
| 105 | + "# Rotate material to correctly identify multiple terminations.\n", |
| 106 | + "# Without the rotation, the current implementation only finds a single termination (as of 2024-12).\n", |
| 107 | + "material = rotate(material, axis=[1, 0, 0], angle=10)" |
| 108 | + ], |
| 109 | + "metadata": { |
| 110 | + "collapsed": false |
| 111 | + }, |
| 112 | + "id": "b588ccfe51967a86", |
| 113 | + "execution_count": null |
| 114 | + }, |
| 115 | + { |
| 116 | + "cell_type": "markdown", |
| 117 | + "source": [ |
| 118 | + "### 1.4. Preview the material" |
| 119 | + ], |
| 120 | + "metadata": { |
| 121 | + "collapsed": false |
| 122 | + }, |
| 123 | + "id": "8c13970a869adfa9" |
| 124 | + }, |
| 125 | + { |
| 126 | + "cell_type": "code", |
| 127 | + "outputs": [], |
| 128 | + "source": [ |
| 129 | + "from utils.visualize import visualize_materials as visualize\n", |
| 130 | + "\n", |
| 131 | + "visualize(material, repetitions=[3, 3, 3], rotation=\"0x\")\n", |
| 132 | + "visualize(material, repetitions=[3, 3, 3], rotation=\"-90x\")" |
| 133 | + ], |
| 134 | + "metadata": { |
| 135 | + "collapsed": false |
| 136 | + }, |
| 137 | + "id": "c4f6e2697f97965f", |
| 138 | + "execution_count": null |
| 139 | + }, |
| 140 | + { |
| 141 | + "cell_type": "markdown", |
| 142 | + "source": [ |
| 143 | + "## 2. Configure slab\n", |
| 144 | + "\n", |
| 145 | + "### 2.1. Create slab configuration\n", |
| 146 | + "Slab Configuration lets define the slab thickness, vacuum, and the Miller indices of the interfacial plane and get the slabs with possible terminations.\n" |
| 147 | + ], |
| 148 | + "metadata": { |
| 149 | + "collapsed": false |
| 150 | + }, |
| 151 | + "id": "6634dae92a6c07b9" |
| 152 | + }, |
| 153 | + { |
| 154 | + "cell_type": "code", |
| 155 | + "outputs": [], |
| 156 | + "source": [ |
| 157 | + "\n", |
| 158 | + "from mat3ra.made.tools.build.slab import SlabConfiguration\n", |
| 159 | + "\n", |
| 160 | + "slab_configuration = SlabConfiguration(\n", |
| 161 | + " bulk=material,\n", |
| 162 | + " miller_indices=MILLER_INDICES,\n", |
| 163 | + " thickness=THICKNESS, # in atomic layers\n", |
| 164 | + " vacuum=VACUUM, # in angstroms\n", |
| 165 | + " xy_supercell_matrix=XY_SUPERCELL_MATRIX,\n", |
| 166 | + " use_orthogonal_z=USE_ORTHOGONAL_Z,\n", |
| 167 | + " use_conventional_cell=USE_CONVENTIONAL_CELL,\n", |
| 168 | + ")" |
| 169 | + ], |
| 170 | + "metadata": { |
| 171 | + "collapsed": false |
| 172 | + }, |
| 173 | + "id": "3ad6765249610aa4", |
| 174 | + "execution_count": null |
| 175 | + }, |
| 176 | + { |
| 177 | + "cell_type": "markdown", |
| 178 | + "source": [ |
| 179 | + "### 2.2. Get possible terminations for the slabs" |
| 180 | + ], |
| 181 | + "metadata": { |
| 182 | + "collapsed": false |
| 183 | + }, |
| 184 | + "id": "afb4c9bb89c8690b" |
| 185 | + }, |
| 186 | + { |
| 187 | + "cell_type": "code", |
| 188 | + "outputs": [], |
| 189 | + "source": [ |
| 190 | + "from mat3ra.made.tools.build.slab import get_terminations\n", |
| 191 | + "\n", |
| 192 | + "slab_terminations = get_terminations(slab_configuration)\n", |
| 193 | + "print(\"Terminations\")\n", |
| 194 | + "for idx, termination in enumerate(slab_terminations):\n", |
| 195 | + " print(f\" {idx}: {termination}\")" |
| 196 | + ], |
| 197 | + "metadata": { |
| 198 | + "collapsed": false |
| 199 | + }, |
| 200 | + "id": "70bec9d69d58b28a", |
| 201 | + "execution_count": null |
| 202 | + }, |
| 203 | + { |
| 204 | + "cell_type": "markdown", |
| 205 | + "source": [ |
| 206 | + "## 3. Visualize slabs for all possible terminations" |
| 207 | + ], |
| 208 | + "metadata": { |
| 209 | + "collapsed": false |
| 210 | + }, |
| 211 | + "id": "c6e2e18452972b21" |
| 212 | + }, |
| 213 | + { |
| 214 | + "cell_type": "code", |
| 215 | + "outputs": [], |
| 216 | + "source": [ |
| 217 | + "from mat3ra.made.tools.build.slab import create_slab\n", |
| 218 | + "\n", |
| 219 | + "slabs = [create_slab(slab_configuration, termination) for termination in slab_terminations]\n", |
| 220 | + "\n", |
| 221 | + "visualize([{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in slabs], repetitions=[3, 3, 1])\n", |
| 222 | + "visualize([{\"material\": slab, \"title\": slab.metadata[\"build\"][\"termination\"]} for slab in slabs], repetitions=[3, 3, 1],\n", |
| 223 | + " rotation=\"-90x\")" |
| 224 | + ], |
| 225 | + "metadata": { |
| 226 | + "collapsed": false |
| 227 | + }, |
| 228 | + "id": "246cb1f0437dbde0", |
| 229 | + "execution_count": null |
| 230 | + }, |
| 231 | + { |
| 232 | + "cell_type": "markdown", |
| 233 | + "source": [ |
| 234 | + "## 4. Download materials" |
| 235 | + ], |
| 236 | + "metadata": { |
| 237 | + "collapsed": false |
| 238 | + }, |
| 239 | + "id": "d667623ad5f2e061" |
| 240 | + }, |
| 241 | + { |
| 242 | + "cell_type": "code", |
| 243 | + "outputs": [], |
| 244 | + "source": [ |
| 245 | + "from utils.jupyterlite import download_content_to_file\n", |
| 246 | + "\n", |
| 247 | + "for slab in slabs:\n", |
| 248 | + " download_content_to_file(slab, f\"{slab.name}.json\")" |
| 249 | + ], |
| 250 | + "metadata": { |
| 251 | + "collapsed": false |
| 252 | + }, |
| 253 | + "id": "3705115f04ac0010", |
| 254 | + "execution_count": null |
| 255 | + } |
| 256 | + ], |
| 257 | + "metadata": { |
| 258 | + "kernelspec": { |
| 259 | + "display_name": "Python 3", |
| 260 | + "language": "python", |
| 261 | + "name": "python3" |
| 262 | + }, |
| 263 | + "language_info": { |
| 264 | + "codemirror_mode": { |
| 265 | + "name": "ipython", |
| 266 | + "version": 2 |
| 267 | + }, |
| 268 | + "file_extension": ".py", |
| 269 | + "mimetype": "text/x-python", |
| 270 | + "name": "python", |
| 271 | + "nbconvert_exporter": "python", |
| 272 | + "pygments_lexer": "ipython2", |
| 273 | + "version": "2.7.6" |
| 274 | + } |
| 275 | + }, |
| 276 | + "nbformat": 4, |
| 277 | + "nbformat_minor": 5 |
| 278 | +} |
0 commit comments