Skip to content

Commit de35cd1

Browse files
committed
fixed notebooks and amended another change
Signed-off-by: Nick Papior <[email protected]>
1 parent 4aa46e7 commit de35cd1

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

S_01/run.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"import sisl\n",
1010
"import numpy as np\n",
1111
"import matplotlib.pyplot as plt\n",
12+
"\n",
1213
"%matplotlib inline"
1314
]
1415
},
@@ -58,7 +59,7 @@
5859
"metadata": {},
5960
"outputs": [],
6061
"source": [
61-
"# Read Hamiltonians using two different methods\n"
62+
"# Read Hamiltonians using two different methods"
6263
]
6364
},
6465
{
@@ -99,12 +100,12 @@
99100
"\n",
100101
"# Plot band-structures\n",
101102
"band.set_parent(<DFT Hamiltonian>)\n",
102-
"eigs = band.eigh()\n",
103+
"eigs = band.apply.ndarray.eigh()\n",
103104
"ax.plot(lk, eigs)\n",
104105
" \n",
105106
"# You need to create the TB Hamiltonian, see e.g. TB_01\n",
106107
"band.set_parent(<TB Hamiltonian>)\n",
107-
"eigs = band.eigh()\n",
108+
"eigs = band.apply.ndarray.eigh()\n",
108109
"ax.plot(lk, eigs, '--')"
109110
]
110111
},
@@ -118,7 +119,7 @@
118119
],
119120
"metadata": {
120121
"kernelspec": {
121-
"display_name": "Python 3",
122+
"display_name": "Python 3 (ipykernel)",
122123
"language": "python",
123124
"name": "python3"
124125
},
@@ -132,7 +133,7 @@
132133
"name": "python",
133134
"nbconvert_exporter": "python",
134135
"pygments_lexer": "ipython3",
135-
"version": "3.11.6"
136+
"version": "3.11.7"
136137
}
137138
},
138139
"nbformat": 4,

S_02/run.ipynb

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"import sisl\n",
1010
"import numpy as np\n",
1111
"import matplotlib.pyplot as plt\n",
12+
"\n",
1213
"%matplotlib inline"
1314
]
1415
},
@@ -38,8 +39,8 @@
3839
"outputs": [],
3940
"source": [
4041
"graphene = sisl.geom.graphene(1.44)\n",
41-
"graphene.write('STRUCT.fdf')\n",
42-
"graphene.write('STRUCT.xyz')"
42+
"graphene.write(\"STRUCT.fdf\")\n",
43+
"graphene.write(\"STRUCT.xyz\")"
4344
]
4445
},
4546
{
@@ -55,7 +56,8 @@
5556
"metadata": {},
5657
"outputs": [],
5758
"source": [
58-
"open('PDOS.fdf', 'w').write(\"\"\"\n",
59+
"open(\"PDOS.fdf\", \"w\").write(\n",
60+
" \"\"\"\n",
5961
"# K-point sampling\n",
6062
"%block PDOS.kgrid.MonkhorstPack\n",
6163
" 63 0 0\n",
@@ -70,7 +72,8 @@
7072
"%block Projected.DensityOfStates\n",
7173
"-20.00 15.00 0.200 3500 eV\n",
7274
"%endblock\n",
73-
"\"\"\");"
75+
"\"\"\"\n",
76+
")"
7477
]
7578
},
7679
{
@@ -99,7 +102,7 @@
99102
"metadata": {},
100103
"outputs": [],
101104
"source": [
102-
"geometry, E, PDOS = sisl.get_sile('siesta.PDOS.xml').read_data()"
105+
"geometry, E, PDOS = sisl.get_sile(\"siesta.PDOS.xml\").read_data()"
103106
]
104107
},
105108
{
@@ -108,7 +111,7 @@
108111
"metadata": {},
109112
"outputs": [],
110113
"source": [
111-
"# Examine output by printing shapes and geometry\n"
114+
"# Examine output by printing shapes and geometry"
112115
]
113116
},
114117
{
@@ -123,16 +126,20 @@
123126
"3. Figure out which orbital contributes to the Dirac cone by plotting the PDOS for all orbitals\n",
124127
"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",
125128
"\n",
126-
" mp = sisl.MonkhorstPack(H, [nx, ny, 1])\n",
127-
" def wrap_multiple(eigenstate):\n",
128-
" DOS = eigenstate.DOS(E)\n"
129-
" PDOS = eigenstate.PDOS(E)\n"
130-
" return sisl.oplist([DOS, PDOS])\n",
131-
" DOS, PDOS = mp.apply.average.eigenstate(wrap=wrap_multiple, eta=True)\n",
129+
" ```python\n",
130+
" mp = sisl.MonkhorstPack(H, [nx, ny, 1])\n",
131+
" def wrap_multiple(eigenstate):\n",
132+
" DOS = eigenstate.DOS(E)\n",
133+
" PDOS = eigenstate.PDOS(E)\n",
134+
" return sisl.oplist([DOS, PDOS])\n",
135+
" DOS, PDOS = mp.apply.average.eigenstate(wrap=wrap_multiple, eta=True)\n",
136+
" \n",
137+
" ```\n",
132138
"\n",
133139
" 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",
134-
"5. Compare the Siesta PDOS with sisl PDOS, why are they different? \n",
135-
" *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)."
140+
"5. Ensure that the `DOS` and the summed `PDOS` (use Eq. 2) are equivalent.\n",
141+
"6. Compare the Siesta PDOS with sisl PDOS, why are they different? \n",
142+
" *HINT*: $\\sigma$. Check the API for the `PDOS` method in the Siesta manual, provided via this tutorial (`../siesta.pdf`)."
136143
]
137144
},
138145
{
@@ -141,9 +148,9 @@
141148
"metadata": {},
142149
"outputs": [],
143150
"source": [
144-
"plt.plot(E, PDOS.sum(0), label='DOS')\n",
145-
"plt.xlabel(r'$E - E_F$ [eV]')\n",
146-
"plt.ylabel(r'DOS [1/eV]')\n",
151+
"plt.plot(E, PDOS.sum(0), label=\"DOS\")\n",
152+
"plt.xlabel(r\"$E - E_F$ [eV]\")\n",
153+
"plt.ylabel(r\"DOS [1/eV]\")\n",
147154
"\n",
148155
"# Add more plots for individual PDOS\n",
149156
"\n",
@@ -169,7 +176,7 @@
169176
"name": "python",
170177
"nbconvert_exporter": "python",
171178
"pygments_lexer": "ipython3",
172-
"version": "3.11.6"
179+
"version": "3.11.7"
173180
}
174181
},
175182
"nbformat": 4,

tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
],
234234
"metadata": {
235235
"kernelspec": {
236-
"display_name": "Python 3",
236+
"display_name": "Python 3 (ipykernel)",
237237
"language": "python",
238238
"name": "python3"
239239
},
@@ -247,7 +247,7 @@
247247
"name": "python",
248248
"nbconvert_exporter": "python",
249249
"pygments_lexer": "ipython3",
250-
"version": "3.11.6"
250+
"version": "3.11.7"
251251
}
252252
},
253253
"nbformat": 4,

0 commit comments

Comments
 (0)