{ "cells": [ { "cell_type": "markdown", "id": "a6d5515e", "metadata": {}, "source": [ "# BigDFT for solid state systems\n", "\n", "In this notebook, a simple example of a solid state calculation is given by considering two-dimensional (2D) materials. In order to demonstrate the robustness and the flexibility of BigDFT, two case studies of graphene are presented, i.e. with cubic and linear scaling. \n", "Each calculation is initialized with the proper boundary conditions as the code natively handles dimensionality. The density of states (DoS) and the band structure are then computed within the cubic scaling approach, while the former is compared to the DoS obtained by linear scaling calculation" ] }, { "cell_type": "code", "execution_count": 27, "id": "a145be73", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "sq3 = np.sqrt(3)" ] }, { "cell_type": "markdown", "id": "32b33f2c", "metadata": {}, "source": [ "## Graphene\n", "\n", "[Graphene](https://en.wikipedia.org/wiki/Graphene) is a 2D carbon allotrope in the form of a honeycomb network that consists of a two inequivalent triangular lattices, with a C-C bond of 1.42$~$angstroem, or equivalently, a lattice parameter such that $a_0 = 2.46~$angstroem.\n", "\n", "In BigDFT, the $y$-axis is set to infinity to simulate a 2D materials (or slabs) while orthorombic cells are employed to model hexagonal lattices. Note that the yaml input format requires `float` when using numpy data types." ] }, { "cell_type": "code", "execution_count": 28, "id": "88fbeccc", "metadata": {}, "outputs": [], "source": [ "from BigDFT.UnitCells import UnitCell\n", "\n", "a0 = 2.5 # A\n", "cell = UnitCell([float(a0*sq3),float(np.inf),a0], units='angstroem')" ] }, { "cell_type": "markdown", "id": "bea42050", "metadata": {}, "source": [ "The position of the atoms are then specified in fractional coordinates, while reduced coordinates should be preferably employed when using fully periodic boundary conditions." ] }, { "cell_type": "code", "execution_count": 29, "id": "38d58500", "metadata": {}, "outputs": [], "source": [ "from BigDFT.Atoms import Atom\n", "\n", "at1 = Atom({'r':[0.000000,0.0,a0/2], 'sym':'C', 'units':'angstroem'})\n", "at2 = Atom({'r':[a0/2/sq3,0.0,0.00], 'sym':'C', 'units':'angstroem'})\n", "at3 = Atom({'r':[a0*sq3/2,0.0,0.00], 'sym':'C', 'units':'angstroem'})\n", "at4 = Atom({'r':[a0*2/sq3,0.0,a0/2], 'sym':'C', 'units':'angstroem'})" ] }, { "cell_type": "markdown", "id": "3e869782", "metadata": {}, "source": [ "The system is then constructed from the cell and the atomic coordinates, where we divide the two sublattices into a fragment each." ] }, { "cell_type": "code", "execution_count": 30, "id": "16d3d7ae", "metadata": {}, "outputs": [], "source": [ "from BigDFT.Systems import System\n", "from BigDFT.Fragments import Fragment\n", "\n", "graphene = System()\n", "graphene.cell = cell\n", "graphene['C:0'] = Fragment([at1,at3])\n", "graphene['C:1'] = Fragment([at2,at4])" ] }, { "cell_type": "markdown", "id": "952c2c1b", "metadata": {}, "source": [ "For clarity, the atomic positions are printed and displayed." ] }, { "cell_type": "code", "execution_count": 31, "id": "6c14106c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'C': [0.0, 0.0, 1.25], 'frag': ['C', '0']}\n", "{'C': [2.1650635094610964, 0.0, 0.0], 'frag': ['C', '0']}\n", "{'C': [0.7216878364870323, 0.0, 0.0], 'frag': ['C', '1']}\n", "{'C': [2.886751345948129, 0.0, 1.25], 'frag': ['C', '1']}\n" ] } ], "source": [ "[print(i) for i in graphene.get_posinp()['positions']];" ] }, { "cell_type": "code", "execution_count": 32, "id": "8c20fbdd", "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol