Commit cb0be03b by Marco Govoni

### Updated tutorial 100

parent 2804e1d1
 %% Cell type:markdown id: tags: This tutorial can be downloaded [link](http://greatfire.uchicago.edu/west-devel/westpy/blob/master/doc/westpy_100.ipynb). This tutorial can be downloaded [link](http://greatfire.uchicago.edu/west-public/westpy/blob/master/doc/westpy_100.ipynb). %% Cell type:markdown id: tags: # 1 Getting Started: Ground State %% Cell type:markdown id: tags: We are going to generate an input file for the QuantumEspresso code or Qbox. Each code will compute the ground state electronic stucture for the methane molecule using Density Functional Theory. %% Cell type:markdown id: tags: ## Step 1: Load westpy %% Cell type:code id: tags: ``` python from westpy import * ``` %%%% Output: stream _ _ _____ _____ _____ | | | | ___/ ___|_ _| | | | | |__ \ `--. | |_ __ _ _ | |/\| | __| `--. \ | | '_ \| | | | \ /\ / |___/\__/ / | | |_) | |_| | \/ \/\____/\____/ \_/ .__/ \__, | | | __/ | |_| |___/ WEST version : 3.1.0 Today : 2018-06-24 20:14:52.640543 %% Cell type:markdown id: tags: ## Step 1: Geometry %% Cell type:code id: tags: ``` python geom = Geometry() ``` %% Cell type:markdown id: tags: Let's define a cubic cell of edge 25 Bohr. %% Cell type:code id: tags: ``` python geom.setCell((25,0,0),(0,25,0),(0,0,25)) ``` %% Cell type:markdown id: tags: We load the atomic positions from a XYZ file, available online. %% Cell type:code id: tags: ``` python geom.addAtomsFromOnlineXYZ( "http://www.west-code.org/database/gw100/xyz/CH4.xyz" ) ``` %% Cell type:markdown id: tags: We associate pseudopotential files to each species. %% Cell type:code id: tags: ``` python geom.addSpecies( "C", "C_ONCV_PBE-1.0.upf", "http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.0.upf") 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 id: tags: ## Step 2: Ground State %% Cell type:markdown id: tags: 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 id: tags: ``` python gs = GroundState(geom,xc="PBE",ecut=40.0) ``` %% Cell type:markdown id: tags: We are now able to generate the input file for QuantumEspresso. %% Cell type:code id: tags: ``` python gs.generateInputPW() ``` %%%% Output: stream Generated file: pw.in %% Cell type:markdown id: tags: We can inspect the file pw.in %% Cell type:code id: tags: ``` python with open("pw.in","r") as file : data = file.read() print(data) ``` %%%% Output: stream &CONTROL calculation = 'scf' restart_mode = 'from_scratch' pseudo_dir = './' outdir = './' prefix = 'calc' wf_collect = .TRUE. / &SYSTEM ibrav = 0 nat = 5 ntyp = 2 ecutwfc = 40.0 nbnd = 8 input_dft = 'PBE' nosym = .TRUE. noinv = .TRUE. / &ELECTRONS diago_full_acc = .TRUE. conv_tol = 1.d-8 / ATOMIC_SPECIES C 12.011 C_ONCV_PBE-1.0.upf H 1.008 H_ONCV_PBE-1.0.upf ATOMIC_POSITIONS {bohr} C 0.0 0.0 0.0 H 1.185992116575257 -1.185803143962673 1.185992116575257 H -1.185992116575257 1.185992116575257 1.185992116575257 H -1.185992116575257 -1.185992116575257 -1.185992116575257 H 1.185992116575257 1.185992116575257 -1.185992116575257 K_POINTS {gamma} CELL_PARAMETERS {bohr} 25.0 0.0 0.0 0.0 25.0 0.0 0.0 0.0 25.0 %% Cell type:markdown id: tags: We can optionally also download the pseudopotentials files. %% Cell type:code id: tags: ``` python gs.downloadPseudopotentials() ``` %%%% Output: stream 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 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 %% Cell type:markdown id: tags: ## Step 3: Ground State with Qbox %% Cell type:markdown id: tags: To generate the input for Qbox we can simply update Species to use the xml formats. %% Cell type:code id: tags: ``` python gs.updateSpecies("C", "C_ONCV_PBE-1.0.xml", "http://www.quantum-simulation.org/potentials/sg15_oncv/xml/C_ONCV_PBE-1.0.xml") gs.updateSpecies("H", "H_ONCV_PBE-1.0.xml", "http://www.quantum-simulation.org/potentials/sg15_oncv/xml/H_ONCV_PBE-1.0.xml") ``` %% Cell type:markdown id: tags: We are now able to generate the input file for QuantumEspresso. %% Cell type:code id: tags: ``` python gs.generateInputQbox() ``` %%%% Output: stream Generated file: qbox.in %% Cell type:markdown id: tags: We can inspect the file qbox.in %% Cell type:code id: tags: ``` python with open("qbox.in","r") as file : data = file.read() print(data) ``` %%%% Output: stream set cell 25.0 0.0 0.0 0.0 25.0 0.0 0.0 0.0 25.0 species Carbon C_ONCV_PBE-1.0.xml species Hydrogen H_ONCV_PBE-1.0.xml atom C1 Carbon 0.0 0.0 0.0 atom H2 Hydrogen 1.185992116575257 -1.185803143962673 1.185992116575257 atom H3 Hydrogen -1.185992116575257 1.185992116575257 1.185992116575257 atom H4 Hydrogen -1.185992116575257 -1.185992116575257 -1.185992116575257 atom H5 Hydrogen 1.185992116575257 1.185992116575257 -1.185992116575257 set ecut 40.0 set wf_dyn JD set xc PBE set scf_tol 1.e-8 randomize_wf run -atomic_density 0 100 5 save gs.xml %% Cell type:markdown id: tags: We can optionally also download the pseudopotentials files. %% Cell type:code id: tags: ``` python gs.downloadPseudopotentials() ``` %%%% Output: stream Downloaded file: C_ONCV_PBE-1.0.xml , from url: http://www.quantum-simulation.org/potentials/sg15_oncv/xml/C_ONCV_PBE-1.0.xml Downloaded file: H_ONCV_PBE-1.0.xml , from url: http://www.quantum-simulation.org/potentials/sg15_oncv/xml/H_ONCV_PBE-1.0.xml %% Cell type:code id: tags: ``` python ``` ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment