Skip to content

Commit cdefd48

Browse files
committed
docs
docs docs docs
1 parent 37fea59 commit cdefd48

6 files changed

+129
-70
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: ^(docs|tests)
1+
exclude: ^(tests)
22

33
repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
@@ -35,7 +35,7 @@ repos:
3535
--skip, "*.ipynb,./tests,*paper*",
3636
]
3737
- repo: https://github.com/kynan/nbstripout
38-
rev: 0.6.1
38+
rev: 0.7.1
3939
hooks:
4040
- id: nbstripout
4141
args: [

docs/source/content/defect-finder.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "22bb4abc-3e14-40c0-92af-6269729a4d3a",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Defect Finder\n",
@@ -18,7 +18,7 @@
1818
{
1919
"cell_type": "code",
2020
"execution_count": null,
21-
"id": "b6e1d6fa",
21+
"id": "1",
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"cell_type": "markdown",
49-
"id": "873288d3",
49+
"id": "2",
5050
"metadata": {},
5151
"source": [
5252
"The last structure (for `q=2`) demonstrates that doing this in a smaller simulation cell with large distortions can be problematic so always double-check your results.\n",
@@ -58,7 +58,7 @@
5858
},
5959
{
6060
"cell_type": "markdown",
61-
"id": "01e7e997",
61+
"id": "3",
6262
"metadata": {},
6363
"source": [
6464
"## How does it work?\n",

docs/source/content/defining-defects.ipynb

+74-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"cells": [
33
{
4-
"attachments": {},
54
"cell_type": "markdown",
65
"metadata": {},
76
"source": [
@@ -33,7 +32,9 @@
3332
{
3433
"cell_type": "code",
3534
"execution_count": null,
36-
"metadata": {},
35+
"metadata": {
36+
"tags": []
37+
},
3738
"outputs": [],
3839
"source": [
3940
"from pathlib import Path\n",
@@ -44,7 +45,9 @@
4445
{
4546
"cell_type": "code",
4647
"execution_count": null,
47-
"metadata": {},
48+
"metadata": {
49+
"tags": []
50+
},
4851
"outputs": [],
4952
"source": [
5053
"from pymatgen.analysis.defects.core import DefectComplex, Substitution, Vacancy\n",
@@ -58,7 +61,6 @@
5861
]
5962
},
6063
{
61-
"attachments": {},
6264
"cell_type": "markdown",
6365
"metadata": {},
6466
"source": [
@@ -93,7 +95,6 @@
9395
]
9496
},
9597
{
96-
"attachments": {},
9798
"cell_type": "markdown",
9899
"metadata": {},
99100
"source": [
@@ -134,7 +135,6 @@
134135
]
135136
},
136137
{
137-
"attachments": {},
138138
"cell_type": "markdown",
139139
"metadata": {},
140140
"source": [
@@ -155,7 +155,6 @@
155155
]
156156
},
157157
{
158-
"attachments": {},
159158
"cell_type": "markdown",
160159
"metadata": {},
161160
"source": [
@@ -184,7 +183,6 @@
184183
]
185184
},
186185
{
187-
"attachments": {},
188186
"cell_type": "markdown",
189187
"metadata": {},
190188
"source": [
@@ -207,7 +205,6 @@
207205
]
208206
},
209207
{
210-
"attachments": {},
211208
"cell_type": "markdown",
212209
"metadata": {},
213210
"source": [
@@ -228,6 +225,73 @@
228225
"#sc_struct_smaller = mg_ga_defect0.get_supercell_structure(max_atoms=100)\n",
229226
"#sc_struct_smaller.num_sites"
230227
]
228+
},
229+
{
230+
"cell_type": "markdown",
231+
"metadata": {},
232+
"source": [
233+
"## Generating Defects\n",
234+
"\n",
235+
"Intersitial defects are usually hard to define due to a lack of reference points for the site.\n",
236+
"Extensive symmetry can be done to identifiy highly symmetric sites in the structure for interstitial insertion.\n",
237+
"However, the recommended method to create interstitial defects is to use the `ChargeInterstitialGenerator` which analyzes the charge density to identify interstitial sites. The code snippet to generate the interstitial sites are given below.\n",
238+
"\n",
239+
"For more details, check out this [paper].(https://www.nature.com/articles/s41524-020-00422-3)\n"
240+
]
241+
},
242+
{
243+
"cell_type": "code",
244+
"execution_count": null,
245+
"metadata": {
246+
"tags": []
247+
},
248+
"outputs": [],
249+
"source": [
250+
"from pymatgen.io.vasp import Chgcar\n",
251+
"from pymatgen.analysis.defects.generators import ChargeInterstitialGenerator, generate_all_native_defects\n",
252+
"\n",
253+
"chgcar = Chgcar.from_file(TEST_FILES / \"CHGCAR.Fe3O4.vasp\")\n",
254+
"cig = ChargeInterstitialGenerator()\n",
255+
"for defect in cig.generate(chgcar, insert_species=[\"H\"]):\n",
256+
" print(defect)"
257+
]
258+
},
259+
{
260+
"cell_type": "markdown",
261+
"metadata": {},
262+
"source": [
263+
"You can geneate all native defects in an atomic structure using the `generate_all_native_defects` function."
264+
]
265+
},
266+
{
267+
"cell_type": "code",
268+
"execution_count": null,
269+
"metadata": {
270+
"tags": []
271+
},
272+
"outputs": [],
273+
"source": [
274+
"for defect in generate_all_native_defects(chgcar):\n",
275+
" print(defect)"
276+
]
277+
},
278+
{
279+
"cell_type": "markdown",
280+
"metadata": {},
281+
"source": [
282+
"If you have access the to materials project charge density API,\n",
283+
"you can obtain the data from the API directly:\n",
284+
"\n",
285+
"```python\n",
286+
"\n",
287+
"from pymatgen.ext.matproj import MPRester\n",
288+
"with MPRester() as mpr:\n",
289+
" chgcar = mpr.get_charge_density_from_material_id(\"mp-804\")\n",
290+
" \n",
291+
"for defect in generate_all_native_defects(chgcar):\n",
292+
" print(defect)\n",
293+
"```"
294+
]
231295
}
232296
],
233297
"metadata": {
@@ -241,7 +305,7 @@
241305
"name": "python",
242306
"nbconvert_exporter": "python",
243307
"pygments_lexer": "ipython3",
244-
"version": "3.9.16"
308+
"version": "3.11.7"
245309
}
246310
},
247311
"nbformat": 4,

docs/source/content/nonradiative.ipynb

+18-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "6930b94a-4443-45b0-94a5-452f6280fd5a",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Shockley-Read-Hall Recombination\n",
@@ -15,7 +15,7 @@
1515
{
1616
"cell_type": "code",
1717
"execution_count": null,
18-
"id": "239c7281-3a24-49cb-a161-64124c59dbc4",
18+
"id": "1",
1919
"metadata": {},
2020
"outputs": [],
2121
"source": [
@@ -31,7 +31,7 @@
3131
{
3232
"cell_type": "code",
3333
"execution_count": null,
34-
"id": "2d5264bc-c907-4d74-bb70-bc79c9050e7a",
34+
"id": "2",
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
@@ -40,7 +40,7 @@
4040
},
4141
{
4242
"cell_type": "markdown",
43-
"id": "e410b507-e465-438b-95e3-64dce28f6f00",
43+
"id": "3",
4444
"metadata": {},
4545
"source": [
4646
"## Read a single Harmonic Defect\n",
@@ -55,7 +55,7 @@
5555
{
5656
"cell_type": "code",
5757
"execution_count": null,
58-
"id": "ceaa50d4-57d2-4438-80e7-7cb4491985c1",
58+
"id": "4",
5959
"metadata": {},
6060
"outputs": [],
6161
"source": [
@@ -74,7 +74,7 @@
7474
},
7575
{
7676
"cell_type": "markdown",
77-
"id": "8e0c86ec-8fa4-4399-9900-c161b8149fbe",
77+
"id": "5",
7878
"metadata": {},
7979
"source": [
8080
"Note that `HarmonicDefect.defect_band` consists of multiple states presented as `(iband, ikpt, ispin)` index tuples, if `defect_band` was not provided to the constructor, the `relaxed_index` entry in the directory list will be checked for a Procar file, which will be parsed to give the \"best guess\" of the defect state in the band structure.\n",
@@ -88,7 +88,7 @@
8888
},
8989
{
9090
"cell_type": "markdown",
91-
"id": "43e620e9-93be-4883-b3a0-ecf5218a6355",
91+
"id": "6",
9292
"metadata": {},
9393
"source": [
9494
"### Potential energy surface\n",
@@ -103,7 +103,7 @@
103103
{
104104
"cell_type": "code",
105105
"execution_count": null,
106-
"id": "c4226814-ccfc-41f9-8eeb-5ad6a2d58eeb",
106+
"id": "7",
107107
"metadata": {},
108108
"outputs": [],
109109
"source": [
@@ -122,7 +122,7 @@
122122
},
123123
{
124124
"cell_type": "markdown",
125-
"id": "d169180d",
125+
"id": "8",
126126
"metadata": {},
127127
"source": [
128128
"The band structure of the relaxed structure has a state that can be identified as the defect state using the inverse participation ratio."
@@ -131,7 +131,7 @@
131131
{
132132
"cell_type": "code",
133133
"execution_count": null,
134-
"id": "a8b9111d-40dd-4be5-ac24-2140c4ce7570",
134+
"id": "9",
135135
"metadata": {
136136
"tags": []
137137
},
@@ -149,7 +149,7 @@
149149
},
150150
{
151151
"cell_type": "markdown",
152-
"id": "104ac837",
152+
"id": "10",
153153
"metadata": {},
154154
"source": [
155155
"## Evaluating the Electron-Phonon Matrix Element with PAWs\n",
@@ -179,7 +179,7 @@
179179
{
180180
"cell_type": "code",
181181
"execution_count": null,
182-
"id": "7c149d93",
182+
"id": "11",
183183
"metadata": {},
184184
"outputs": [],
185185
"source": [
@@ -191,7 +191,7 @@
191191
},
192192
{
193193
"cell_type": "markdown",
194-
"id": "d7f9b645",
194+
"id": "12",
195195
"metadata": {},
196196
"source": [
197197
"The epME is computed by the `HarmonicDefect.get_elph_me` method, which requires the defect band index.\n",
@@ -201,7 +201,7 @@
201201
{
202202
"cell_type": "code",
203203
"execution_count": null,
204-
"id": "433f5f29",
204+
"id": "13",
205205
"metadata": {},
206206
"outputs": [],
207207
"source": [
@@ -214,7 +214,7 @@
214214
},
215215
{
216216
"cell_type": "markdown",
217-
"id": "66aafe95",
217+
"id": "14",
218218
"metadata": {},
219219
"source": [
220220
"## Calculating the SRH Capture Coefficient\n",
@@ -225,7 +225,7 @@
225225
{
226226
"cell_type": "code",
227227
"execution_count": null,
228-
"id": "133e213c",
228+
"id": "15",
229229
"metadata": {},
230230
"outputs": [],
231231
"source": [
@@ -238,7 +238,7 @@
238238
},
239239
{
240240
"cell_type": "markdown",
241-
"id": "a7d97c23",
241+
"id": "16",
242242
"metadata": {},
243243
"source": [
244244
"With the initial and final potential energy surfaces, and the `WSWQ` data for the initial state, we can calculate the SRH capture coefficient using the `get_SRH_coefficient` function to compute the capture coefficient as a function of temperature."
@@ -247,7 +247,7 @@
247247
{
248248
"cell_type": "code",
249249
"execution_count": null,
250-
"id": "2f08c3b9",
250+
"id": "17",
251251
"metadata": {},
252252
"outputs": [],
253253
"source": [
@@ -260,11 +260,6 @@
260260
}
261261
],
262262
"metadata": {
263-
"kernelspec": {
264-
"display_name": "mp",
265-
"language": "python",
266-
"name": "python3"
267-
},
268263
"language_info": {
269264
"codemirror_mode": {
270265
"name": "ipython",

0 commit comments

Comments
 (0)