Skip to content

Commit

Permalink
fixed notebooks and amended another change
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Aug 29, 2024
1 parent 4aa46e7 commit de35cd1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
11 changes: 6 additions & 5 deletions S_01/run.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"import sisl\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"%matplotlib inline"
]
},
Expand Down Expand Up @@ -58,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Read Hamiltonians using two different methods\n"
"# Read Hamiltonians using two different methods"
]
},
{
Expand Down Expand Up @@ -99,12 +100,12 @@
"\n",
"# Plot band-structures\n",
"band.set_parent(<DFT Hamiltonian>)\n",
"eigs = band.eigh()\n",
"eigs = band.apply.ndarray.eigh()\n",
"ax.plot(lk, eigs)\n",
" \n",
"# You need to create the TB Hamiltonian, see e.g. TB_01\n",
"band.set_parent(<TB Hamiltonian>)\n",
"eigs = band.eigh()\n",
"eigs = band.apply.ndarray.eigh()\n",
"ax.plot(lk, eigs, '--')"
]
},
Expand All @@ -118,7 +119,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -132,7 +133,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
43 changes: 25 additions & 18 deletions S_02/run.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"import sisl\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"%matplotlib inline"
]
},
Expand Down Expand Up @@ -38,8 +39,8 @@
"outputs": [],
"source": [
"graphene = sisl.geom.graphene(1.44)\n",
"graphene.write('STRUCT.fdf')\n",
"graphene.write('STRUCT.xyz')"
"graphene.write(\"STRUCT.fdf\")\n",
"graphene.write(\"STRUCT.xyz\")"
]
},
{
Expand All @@ -55,7 +56,8 @@
"metadata": {},
"outputs": [],
"source": [
"open('PDOS.fdf', 'w').write(\"\"\"\n",
"open(\"PDOS.fdf\", \"w\").write(\n",
" \"\"\"\n",
"# K-point sampling\n",
"%block PDOS.kgrid.MonkhorstPack\n",
" 63 0 0\n",
Expand All @@ -70,7 +72,8 @@
"%block Projected.DensityOfStates\n",
"-20.00 15.00 0.200 3500 eV\n",
"%endblock\n",
"\"\"\");"
"\"\"\"\n",
")"
]
},
{
Expand Down Expand Up @@ -99,7 +102,7 @@
"metadata": {},
"outputs": [],
"source": [
"geometry, E, PDOS = sisl.get_sile('siesta.PDOS.xml').read_data()"
"geometry, E, PDOS = sisl.get_sile(\"siesta.PDOS.xml\").read_data()"
]
},
{
Expand All @@ -108,7 +111,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Examine output by printing shapes and geometry\n"
"# Examine output by printing shapes and geometry"
]
},
{
Expand All @@ -123,16 +126,20 @@
"3. Figure out which orbital contributes to the Dirac cone by plotting the PDOS for all orbitals\n",
"4. Read in the Hamiltonian (as done in [S 1](../S_01/run.ipynb)) and create a Monkhorst-Pack grid as the one in Siesta input. Use this snippet to calculate the PDOS using `sisl`\n",
"\n",
" mp = sisl.MonkhorstPack(H, [nx, ny, 1])\n",
" def wrap_multiple(eigenstate):\n",
" DOS = eigenstate.DOS(E)\n"
" PDOS = eigenstate.PDOS(E)\n"
" return sisl.oplist([DOS, PDOS])\n",
" DOS, PDOS = mp.apply.average.eigenstate(wrap=wrap_multiple, eta=True)\n",
" ```python\n",
" mp = sisl.MonkhorstPack(H, [nx, ny, 1])\n",
" def wrap_multiple(eigenstate):\n",
" DOS = eigenstate.DOS(E)\n",
" PDOS = eigenstate.PDOS(E)\n",
" return sisl.oplist([DOS, PDOS])\n",
" DOS, PDOS = mp.apply.average.eigenstate(wrap=wrap_multiple, eta=True)\n",
" \n",
" ```\n",
"\n",
" Search the API documentation for the `MonkhorstPack.apply.average` method and figure out what it does. Note, there are other `MonkhorstPack.apply.*` methods - these are all extremely useful when calculating many quantities of data in a Brillouin-zone object.\n",
"5. Compare the Siesta PDOS with sisl PDOS, why are they different? \n",
" *HINT*: $\\sigma$. Check the API for the `PDOS` method in the Siesta manual (https://siesta-project.org/SIESTA_MATERIAL/Docs/Manuals/siesta-4.1.5.pdf)."
"5. Ensure that the `DOS` and the summed `PDOS` (use Eq. 2) are equivalent.\n",
"6. Compare the Siesta PDOS with sisl PDOS, why are they different? \n",
" *HINT*: $\\sigma$. Check the API for the `PDOS` method in the Siesta manual, provided via this tutorial (`../siesta.pdf`)."
]
},
{
Expand All @@ -141,9 +148,9 @@
"metadata": {},
"outputs": [],
"source": [
"plt.plot(E, PDOS.sum(0), label='DOS')\n",
"plt.xlabel(r'$E - E_F$ [eV]')\n",
"plt.ylabel(r'DOS [1/eV]')\n",
"plt.plot(E, PDOS.sum(0), label=\"DOS\")\n",
"plt.xlabel(r\"$E - E_F$ [eV]\")\n",
"plt.ylabel(r\"DOS [1/eV]\")\n",
"\n",
"# Add more plots for individual PDOS\n",
"\n",
Expand All @@ -169,7 +176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -247,7 +247,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit de35cd1

Please sign in to comment.