Skip to content

Commit

Permalink
added 3 siesta tutorials
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Nov 6, 2018
1 parent aeb5763 commit 781a531
Show file tree
Hide file tree
Showing 11 changed files with 5,797 additions and 15 deletions.
1,779 changes: 1,779 additions & 0 deletions S_01/C.psf

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions S_01/RUN.fdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Diag.ParallelOverK true
%block kgrid.MonkhorstPack
21 0 0 0.
0 21 0 0.
0 0 1 0.
%endblock kgrid.MonkhorstPack

# This is the remaining default SIESTA options
PAO.BasisSize SZP

XC.functional GGA
XC.authors PBE
MeshCutoff 250.000000 Ry
FilterCutoff 150.000000 Ry

ElectronicTemperature 300 K

MinSCFIterations 3
SCF.DM.Tolerance 0.0001
# Mixing parameters:
SCF.Mixer.Weight 0.10
SCF.Mixer.History 12
SCF.Mix.First true
DM.UseSaveDM true

MD.NumCGSteps 0

SaveHS true
TS.HS.Save true

%include STRUCT.fdf
152 changes: 152 additions & 0 deletions S_01/run.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from __future__ import print_function\n",
"import sisl\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First Siesta example for analyzing output.\n",
"\n",
"This example will calculate the electronic structure of graphene using Siesta and we will post-process the data to calculate band-structures etc.\n",
"\n",
"We remark that settings during the Siesta/TranSiesta tutorials are not necessarily converged or proper settings. Users need to invest time in understanding the intrinsics of Siesta before performing real calculations!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"graphene = sisl.geom.graphene(1.44)\n",
"graphene.write('STRUCT.fdf')\n",
"graphene.write('STRUCT.xyz')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercises\n",
"\n",
"As this is your first example of running Siesta there are a few things you should know:\n",
"\n",
"1. Start by calculating the electronic structure using Siesta\n",
"\n",
" siesta RUN.fdf > RUN.out\n",
"\n",
" - Go through the output of Siesta to get used to it, also to assert that it has runned without errors (always do this!) ((always, **always** do THIS!))\n",
" - Ensure the SCF has indeed converged, Siesta will, by default, die if it hasn't converged the SCF.\n",
" \n",
"2. Use `sisl` to read in the electronic structure (the Hamiltonian), there are several ways of doing this, for now you should try these two methods:\n",
"\n",
" H_fdf = sisl.Hamiltonian.read('RUN.fdf')\n",
" H_TSHS = sisl.Hamiltonian.read('siesta.TSHS')\n",
" \n",
" print the objects and note the difference between the two objects.\n",
" What do you think these differences mean?\n",
" \n",
"3. Calculate the $\\Gamma$-point eigen spectrum using both above Hamiltonians (search the sisl documentation for `eigh`), are they different? If so, why, if not, why not? Once answered, you should know which of the two above methods is the *best* way to read the electronic structure. \n",
"\n",
"4. Calculate the band-structure using the DFT electronic structure using `sisl`. Also calculate the band-structure using the tight-binding Hamiltonian ([TB 1](../TB_01/run.ipynb)) and compare the two. \n",
"HINT: zoom in on an energy-range from $-3$ eV to $3$ eV and plot both the DFT bands and the TB bands in the same plot. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Read Hamiltonians using two different methods\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Calculate eigenspectrum at the \\Gamma-point\n",
"eig_fdf = H_fdf.<>\n",
"eig_TSHS = H_TSHS.<>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Calculate band-structure from DFT Hamiltonian and TB Hamiltonian\n",
"band = sisl.BandStructure(graphene, <fill-in correct points and labels>)\n",
"xtick, xtick_label = band.lineartick()\n",
"lk = band.lineark()\n",
"\n",
"ax = plt.gca()\n",
"ax.xaxis.set_ticks(xtick)\n",
"ax.set_xticklabels(xtick_label)\n",
"\n",
"# Define limits of the y-axis (Energy!)\n",
"# Play with this if you want! :)\n",
"ax.set_ylim(-3, 3)\n",
"ax.set_ylabel('Eigenspectrum [eV]')\n",
"\n",
"# Plot x-major lines at the ticks\n",
"ymin, ymax = ax.get_ylim()\n",
"for tick in xtick:\n",
" ax.plot([tick,tick], [ymin, ymax], 'k')\n",
"\n",
"# Plot band-structures\n",
"band.set_parent(<DFT Hamiltonian>)\n",
"eigs = band.eigh()\n",
"ax.plot(lk, eigs)\n",
" \n",
"# You need to create the TB Hamiltonian, see e.g. example TB 1\n",
"band.set_parent(<TB Hamiltonian>)\n",
"eigs = band.eigh()\n",
"ax.plot(lk, eigs, '--')"
]
},
{
"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.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 781a531

Please sign in to comment.