{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Calculation of Bader charges\n", "The approach uses additional tool developled in [Henkelman group](http://theory.cm.utexas.edu/henkelman/code/bader/).\n", "\n", "Download [binary 'bader'](http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz) for Bader analysis and put it to *~/tools/* folder on your cluster.\n", "\n", "Additionally, download [binary 'vtstscripts'](http://theory.cm.utexas.edu/code/vtstscripts.tgz) and uncompress it to *~/tools/* folder as vts/ on your cluster." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/aksenov/simanrc.py was read\n" ] } ], "source": [ "#Usual preamble\n", "from siman import header\n", "from siman.header import db\n", "from siman.SSHTools import SSHTools\n", "from siman.calc_manage import add_loop, res_loop\n", "from siman.set_functions import read_vasp_sets\n", "from siman.database import read_database, write_database\n", "from siman.analysis import calc_oxidation_states\n", "\n", "read_database()\n", "header.PATH2PROJECT = 'topologic' # path to project relative to your home folder on cluster\n", "header.PATH2POTENTIALS = '/home/aksenov/scientific_projects/PAW_PBE_VASP' #path to VASP POTENTIALS\n", "header.varset['static'].potdir = {83:'Bi_pv', 34:'Se'} #subfolders with required potentials\n", "header.ssh_object = SSHTools()\n", "header.ssh_object.setup(user=\"aksenov\",host=\"10.30.16.62\",pkey=\"/home/aksenov/.ssh/id_rsa\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Attention! You have chosen to override set bader\n", " \n", "\n", "Warning! You did not change NSW in bader set\n", " \n", "\n" ] }, { "data": { "text/plain": [ "{'dos': ,\n", " 'band': ,\n", " 'static': ,\n", " 'opt': ,\n", " 'bader': }" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Creating new set 'bader' with parameters for Bader charges calculation\n", "bader_pack = {'PREC':'Accurate', 'ADDGRID':'.TRUE.', 'EDIFF':1e-08, \n", " 'LAECHG':'.TRUE.', 'NELM':100, 'NSW':0, 'ICHARG':1, 'savefile' : 'acox'}\n", "read_vasp_sets([('bader', 'static', bader_pack, 'override')]) #new set 'bader' from 'static'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-- Attention!, cluster None is not found, using default cee \n", "\n", "-- check_kpoints(): Kpoint mesh is: [8, 8, 8] \n", "\n", "-- check_kpoints(): The actual k-spacings are [ 0.22 0.22 0.22] \n", "\n", "-- POSCAR was written to Bi2Se3//Bi2Se3.bader/1.POSCAR \n", "\n", "-- Attention! ngkpt = [8, 8, 8] is adopted from struct_des which you provided for it Bi2Se3 and kspacing = 0.235 \n", "\n", "\n", "Calculation ('Bi2Se3', 'bader', 1) successfully created\n", "\n", " \n", "\n", "JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)\n", " 169829 AMG KVPO516. aksenov R 2-23:23:45 1 node-amg01\n", " 168188 AMG LTP_sa2_ asergeev R 6-14:04:15 1 node-amg04\n", "Submitted batch job 180604\n", " JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)\n", " 180604 AMG Bi2Se3.b aksenov PD 0:00 1 (None)\n", " 169829 AMG KVPO516. aksenov R 2-23:23:45 1 node-amg01\n", " 168188 AMG LTP_sa2_ asergeev R 6-14:04:15 1 node-amg04 \n", "\n", "-- To read results use res_loop('Bi2Se3', ['bader'], [1], show = 'fo' ) # , on 2018-07-05 ; possible options for show: fit, fo, fop, en, mag, magp, smag, maga, occ, occ1, mep, mepp \n", "\n" ] }, { "data": { "text/plain": [ "'Bi2Se3'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "add_loop('Bi2Se3', 'bader', 1, input_geo_file = 'Bi2Se3_mp-541837_computed.POSCAR', run = 1) # Submitting VASP job" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Max. F. tot (meV/A) = \n", "[59]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- Bi2Se3.bader.1 | -20.1524 |10.27;10.27;10.27| -684,-684,-685 | 1,18, 18 \n", "\n", "Database has been successfully updated\n", "\n" ] } ], "source": [ "res_loop('Bi2Se3', 'bader', 1) #reading results after the job is finished\n", "write_database() # writing database" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Max. F. tot (meV/A) = \n", "[59]; \n", "\n", "-- name | energy(eV)| Vector lenghts (A) | Stresses (MPa) | N MD, N SCF \n", "-- Bi2Se3.bader.1 | -20.1524 |10.27;10.27;10.27| -684,-684,-685 | 1,18, 18 \n", "-- /home/aksenov/topologic/Bi2Se3//Bi2Se3.bader/1.CHGCAR_sum does not exist. trying to calculate it \n", "\n", "Atoms in file1: 5, Atoms in file2: 5\n", "Points in file1: 2744000, Points in file2: 2744000\n", " \n", "\n", "-- Warning! File /home/aksenov/topologic/Bi2Se3//Bi2Se3.bader/1.CHGCAR does not exist. Checking .gz .. \n", "\n", "\n", " \n", "\n", "ACF_text = X Y Z CHARGE MIN DIST ATOMIC VOL\n", " --------------------------------------------------------------------------------\n", " 1 2.416678 1.435730 11.588585 20.170149 0.923287 27.967000\n", " 2 3.648748 2.167694 17.496674 20.170148 0.923287 27.966944\n", " 3 0.000000 0.000000 0.000000 6.694249 0.990643 29.794916\n", " 4 1.308403 0.777313 6.274127 6.465561 0.934850 32.843083\n", " 5 4.757023 2.826111 22.811132 6.468233 0.934850 32.894469\n", " --------------------------------------------------------------------------------\n", " VACUUM CHARGE: 0.0317\n", " VACUUM VOLUME: 0.3114\n", " NUMBER OF ELECTRONS: 60.0000\n" ] }, { "data": { "text/plain": [ "[20.17, 20.17, 6.694, 6.466, 6.468]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "header.warnings = 'yY'\n", "# Calculate Bader charges on cluster \n", "db['Bi2Se3', 'bader', 1].get_bader_ACF()\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[20.17, 20.17, 6.694, 6.466, 6.468]\n" ] } ], "source": [ "print(db['Bi2Se3', 'bader', 1].charges) # print calculated Bader charges" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Bi 0.8\n", "Bi 0.8\n", "Se -0.7\n", "Se -0.5\n", "Se -0.5\n" ] } ], "source": [ "#Calculate oxidation states\n", "\n", "\n", "calc_oxidation_states( db['Bi2Se3', 'bader', 1] )\n" ] } ], "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.7.6" } }, "nbformat": 4, "nbformat_minor": 1 }