{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "({},\n", " {'static': ,\n", " 'opt': },\n", " 56)" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sys\n", "import numpy as np\n", "from siman import header\n", "from siman.header import db # database dictionary\n", "from siman.SSHTools import SSHTools\n", "from siman.calc_manage import smart_structure_read, add, res\n", "from siman.geo import supercell\n", "from siman.database import read_database, write_database\n", "\n", "read_database() # read saved results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 0. Configure Siman (Can be done in ~/simanrc.py or ./project_conf.py)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "#Instead of passwordless setup or for Windows you can use ssh_object (paramiko module is used):\n", "user = \"d.aksenov\"\n", "host = \"10.30.16.168\"\n", "header.ssh_object = SSHTools()\n", "header.ssh_object.setup(user=user, host=host, pkey=\"/home/aksenov/.ssh/id_rsa\")\n", "header.PATH2POTENTIALS = 'potcars/' # path to POTCAR files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Read structure and create supercell" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-- Calculating mul_matrix for ortho: [10, 10, 10] \n", "\n", "mul_matrix_float:\n", " [[2.91205591 0. 0. ]\n", " [0. 2.91205591 0. ]\n", " [0. 0. 2.91205591]] \n", "mul_matrix:\n", " [[3 0 0]\n", " [0 3 0]\n", " [0 0 3]] \n", "Old vectors (rprimd):\n", " [[3.4 0. 0. ]\n", " [0. 3.4 0. ]\n", " [0. 0. 3.4]] \n", "New vectors (rprimd) of supercell:\n", " [[10.3 0. 0. ]\n", " [ 0. 10.3 0. ]\n", " [ 0. 0. 10.3]] \n", "The supercell should contain 53.999999999999986 atoms ... \n", " -- OK \n", "\n" ] } ], "source": [ "st = smart_structure_read(input_geo_file = 'Li2/POSCAR') # read poscar\n", "sc = supercell(st, [10,10,10]) # create 3x3x3 supercell, sizes close to 10 10 10 A \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Create vacancy and interstitial defects" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "sc_vac = sc.del_atom(25) # create vacancy defect in supercell\n", "sc_oct = sc.add_atom([1/2 / 3, 1/2 / 3, 1 / 3], 'Li') # create interstitial defect in octahedral position\n", "sc_tet = sc.add_atom([1/4 / 3, 1/2 / 3, 1 / 3], 'Li') # create interstitial defect in tetrahedral position\n", "\n", "# sc_vac.write_poscar('Li_vac/POSCAR') # write POSCAR to check geometry\n", "# sc_oct.write_poscar('Li_oct/POSCAR') \n", "# sc_tet.write_poscar('Li_tet/POSCAR') " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3 Run calculations " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-- Attention!, cluster None is not found, using default CEE \n", "\n", "-- check_kpoints(): Kpoint mesh is: [4, 4, 4] \n", "\n", "-- check_kpoints(): The actual k-spacings are [0.15 0.15 0.15] \n", "\n", "-- POSCAR was written to /home/aksenov/recitations/Rec10_DS/recitationCD///Li333.opt/1.POSCAR \n", "\n", "-- Attention! ngkpt = [4, 4, 4] is adopted from struct_des which you provided for it Li333 and kspacing = 0.2 \n", "\n", "\n", "Calculation ('Li333', 'opt', 1) successfully created\n", "\n", " \n", "\n", "-- Attention!, cluster None is not found, using default CEE \n", "\n", "-- check_kpoints(): Kpoint mesh is: [4, 4, 4] \n", "\n", "-- check_kpoints(): The actual k-spacings are [0.15 0.15 0.15] \n", "\n", "-- POSCAR was written to /home/aksenov/recitations/Rec10_DS/recitationCD///Li333vac.opt/1.POSCAR \n", "\n", "-- Attention! ngkpt = [4, 4, 4] is adopted from struct_des which you provided for it Li333vac and kspacing = 0.2 \n", "\n", "\n", "Calculation ('Li333vac', 'opt', 1) successfully created\n", "\n", " \n", "\n", "-- Attention!, cluster None is not found, using default CEE \n", "\n", "-- check_kpoints(): Kpoint mesh is: [4, 4, 4] \n", "\n", "-- check_kpoints(): The actual k-spacings are [0.15 0.15 0.15] \n", "\n", "-- POSCAR was written to /home/aksenov/recitations/Rec10_DS/recitationCD///Li333tet.opt/1.POSCAR \n", "\n", "-- Attention! ngkpt = [4, 4, 4] is adopted from struct_des which you provided for it Li333tet and kspacing = 0.2 \n", "\n", "\n", "Calculation ('Li333tet', 'opt', 1) successfully created\n", "\n", " \n", "\n", "-- Attention!, cluster None is not found, using default CEE \n", "\n", "-- check_kpoints(): Kpoint mesh is: [4, 4, 4] \n", "\n", "-- check_kpoints(): The actual k-spacings are [0.15 0.15 0.15] \n", "\n", "-- POSCAR was written to /home/aksenov/recitations/Rec10_DS/recitationCD///Li333oct.opt/1.POSCAR \n", "\n", "-- Attention! ngkpt = [4, 4, 4] is adopted from struct_des which you provided for it Li333oct and kspacing = 0.2 \n", "\n", "\n", "Calculation ('Li333oct', 'opt', 1) successfully created\n", "\n", " \n", "\n" ] } ], "source": [ "if 1:\n", " it_folder = 'recitationCD/'\n", " add('Li333', 'opt', 1, up = 'up2', input_st = sc, it_folder = it_folder, run = 0, ) \n", " add('Li333vac', 'opt', 1, up = 'up2', input_st = sc_vac, it_folder = it_folder, run = 0) \n", " add('Li333tet', 'opt', 1, up = 'up2', input_st = sc_tet, it_folder = it_folder, run = 0) \n", " add('Li333oct', 'opt', 1, up = 'up2', input_st = sc_oct, it_folder = it_folder, run = 0) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Read results" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Max. F. tot (meV/A) = \n", "[0]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- db['Li333.opt.1'] | -102.3599 |10.30;10.30;10.30| 39,39,39 | 1,10, 10 \n", "\n", "\n", "Max. F. tot (meV/A) = \n", "[86 82 49 51 51 50 48 45 42 38 32 22 21 18 16 13 14 15 14 13]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- db['Li333vac.opt.1'] | -99.9640 |10.30;10.30;10.30| -89,-89,-89 | 20, 4, 86 \n", "\n", "\n", "Max. F. tot (meV/A) = \n", "[1865 1404 359 207 199 163 123 91 93 85 74 58 47 34\n", " 32 33 35 33 27 21]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- db['Li333tet.opt.1'] | -103.4905 |10.30;10.30;10.30| 389,358,358 | 20, 5,109 \n", "\n", "\n", "Max. F. tot (meV/A) = \n", "[2599 1950 352 164 156 128 111 132 125 102 77 46 38 38\n", " 35 28 22 20 23 21]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- db['Li333oct.opt.1'] | -103.3693 |10.30;10.30;10.30| 314,314,496 | 20, 5,109 \n" ] }, { "data": { "text/plain": [ "([\"db['Li333oct.opt.1'] | -103.3693 |10.30;10.30;10.30| 314,314,496 | 20, 5,109 \"],\n", " [])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "header.check_job = 0\n", "res('Li333', 'opt', 1, up = 'up1', show = 'fo') # try show = 'en', 'conv', 'est'\n", "res('Li333vac', 'opt', 1, up = 'up1', show = 'fo')\n", "res('Li333tet', 'opt', 1, up = 'up1',show = 'fo')\n", "res('Li333oct', 'opt', 1, up = 'up1',show = 'fo')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Write database to save results." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Database has been successfully updated\n", "\n" ] } ], "source": [ "write_database()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Calculate defect energies" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Vacancy formation energy = 0.500 eV, E(relax) = 0.093 eV\n", "Tet int formation energy = 0.765 eV, E(relax) = 1.870 eV\n", "Oct int formation energy = 0.886 eV, E(relax) = 1.822 eV\n" ] } ], "source": [ "Li333 = db['Li333', 'opt', 1] # short name for calculation\n", "Livac = db['Li333vac', 'opt', 1]\n", "Litet = db['Li333tet', 'opt', 1]\n", "Lioct = db['Li333oct', 'opt', 1]\n", "\n", "\n", "#1 Point defects formation energy\n", "natom = Li333.end.natom\n", "print('Vacancy formation energy = {:3.3f} eV, E(relax) = {:3.3f} eV'.format( \n", " Livac.e0 - Li333.e0 * (natom-1)/natom, Livac.list_e_sigma0[0] - Livac.e0 ) )\n", "\n", "print('Tet int formation energy = {:3.3f} eV, E(relax) = {:3.3f} eV'.format( \n", " Litet.e0 - Li333.e0 * (natom+1)/natom, Litet.list_e_sigma0[0] - Litet.e0 ) )\n", "\n", "print('Oct int formation energy = {:3.3f} eV, E(relax) = {:3.3f} eV'.format( Lioct.e0 - Li333.e0 * (natom+1)/natom,\n", " Lioct.list_e_sigma0[0] - Lioct.e0 ) )" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }