{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1.1 Getting Started" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We are going to generate an input file for the code QuantumEspresso, that computes the ground state electronic stucture for the methane molecule." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1: Load westpy" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " \n", " _ _ _____ _____ _____ \n", "| | | | ___/ ___|_ _| \n", "| | | | |__ \\ `--. | |_ __ _ _ \n", "| |/\\| | __| `--. \\ | | '_ \\| | | | \n", "\\ /\\ / |___/\\__/ / | | |_) | |_| | \n", " \\/ \\/\\____/\\____/ \\_/ .__/ \\__, | \n", " | | __/ | \n", " |_| |___/ \n", " \n", "WEST version : 3.1.0\n", "Today : 2018-06-24 17:42:02.396114\n" ] } ], "source": [ "from westpy import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1: Geometry" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "geom = Geometry()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's define a cubic cell of edge 25 Bohr." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "geom.setCell((25,0,0),(0,25,0),(0,0,25))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We load the atomic positions from a XYZ file, available online. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "geom.addAtomsFromOnlineXYZ( \"http://www.west-code.org/database/gw100/xyz/CH4.xyz\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We associate pseudopotential files to each species." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "geom.addSpecies( \"C\", \"C_ONCV_PBE-1.0.upf\", \"http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.0.upf\")\n", "geom.addSpecies( \"H\", \"H_ONCV_PBE-1.0.upf\", \"http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.0.upf\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can optionally download locally the pseudopotential files. " ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloaded file: C_ONCV_PBE-1.0.upf , from url: http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.0.upf\n", "Downloaded file: H_ONCV_PBE-1.0.upf , from url: http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.0.upf\n" ] } ], "source": [ "geom.downloadPseudopotentials()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 2: Ground State" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ground state calculation is defined by the geometry, a choice of the exchange-correlation functional, and by setting an energy cutoff for the wavefunctions. " ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "gs = GroundState(geom,xc=\"PBE\",ecut=40.0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We are now able to generate the input file for QuantumEspresso." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Generated file: pw.in\n" ] } ], "source": [ "gs.generateInputPW()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can inspect the file pw.in" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "&CONTROL\r\n", "calculation = 'scf'\r\n", "restart_mode = 'from_scratch'\r\n", "pseudo_dir = './'\r\n", "outdir = './'\r\n", "prefix = 'calc'\r\n", "wf_collect = .TRUE.\r\n", "/\r\n", "&SYSTEM\r\n", "ibrav = 0\r\n", "nat = 5\r\n", "ntyp = 2\r\n", "ecutwfc = 40.0\r\n", "nbnd = 8\r\n", "input_dft = 'PBE'\r\n", "nosym = .TRUE.\r\n", "noinv = .TRUE.\r\n", "/\r\n", "&ELECTRONS\r\n", "diago_full_acc = .TRUE.\r\n", "conv_tol = 1.d-8\r\n", "/\r\n", "ATOMIC_SPECIES\r\n", "C 12.011 C_ONCV_PBE-1.0.upf\r\n", "H 1.008 H_ONCV_PBE-1.0.upf\r\n", "ATOMIC_POSITIONS {bohr}\r\n", "C 0.0 0.0 0.0\r\n", "H 1.185992116575257 -1.185803143962673 1.185992116575257\r\n", "H -1.185992116575257 1.185992116575257 1.185992116575257\r\n", "H -1.185992116575257 -1.185992116575257 -1.185992116575257\r\n", "H 1.185992116575257 1.185992116575257 -1.185992116575257\r\n", "K_POINTS {gamma}\r\n", "CELL_PARAMETERS {bohr}\r\n", "25.0 0.0 0.0\r\n", "0.0 25.0 0.0\r\n", "0.0 0.0 25.0\r\n" ] } ], "source": [ "!cat pw.in" ] } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 2 }