Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
docs

docs

docs
  • Loading branch information
jmmshn committed Feb 9, 2024
1 parent 37fea59 commit cdefd48
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: ^(docs|tests)
exclude: ^(tests)

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down Expand Up @@ -35,7 +35,7 @@ repos:
--skip, "*.ipynb,./tests,*paper*",
]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
args: [
Expand Down
8 changes: 4 additions & 4 deletions docs/source/content/defect-finder.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "22bb4abc-3e14-40c0-92af-6269729a4d3a",
"id": "0",
"metadata": {},
"source": [
"# Defect Finder\n",
Expand All @@ -18,7 +18,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b6e1d6fa",
"id": "1",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -46,7 +46,7 @@
},
{
"cell_type": "markdown",
"id": "873288d3",
"id": "2",
"metadata": {},
"source": [
"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",
Expand All @@ -58,7 +58,7 @@
},
{
"cell_type": "markdown",
"id": "01e7e997",
"id": "3",
"metadata": {},
"source": [
"## How does it work?\n",
Expand Down
84 changes: 74 additions & 10 deletions docs/source/content/defining-defects.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -33,7 +32,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from pathlib import Path\n",
Expand All @@ -44,7 +45,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from pymatgen.analysis.defects.core import DefectComplex, Substitution, Vacancy\n",
Expand All @@ -58,7 +61,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -93,7 +95,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -134,7 +135,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -155,7 +155,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -184,7 +183,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -207,7 +205,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -228,6 +225,73 @@
"#sc_struct_smaller = mg_ga_defect0.get_supercell_structure(max_atoms=100)\n",
"#sc_struct_smaller.num_sites"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generating Defects\n",
"\n",
"Intersitial defects are usually hard to define due to a lack of reference points for the site.\n",
"Extensive symmetry can be done to identifiy highly symmetric sites in the structure for interstitial insertion.\n",
"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",
"\n",
"For more details, check out this [paper].(https://www.nature.com/articles/s41524-020-00422-3)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from pymatgen.io.vasp import Chgcar\n",
"from pymatgen.analysis.defects.generators import ChargeInterstitialGenerator, generate_all_native_defects\n",
"\n",
"chgcar = Chgcar.from_file(TEST_FILES / \"CHGCAR.Fe3O4.vasp\")\n",
"cig = ChargeInterstitialGenerator()\n",
"for defect in cig.generate(chgcar, insert_species=[\"H\"]):\n",
" print(defect)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can geneate all native defects in an atomic structure using the `generate_all_native_defects` function."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"for defect in generate_all_native_defects(chgcar):\n",
" print(defect)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you have access the to materials project charge density API,\n",
"you can obtain the data from the API directly:\n",
"\n",
"```python\n",
"\n",
"from pymatgen.ext.matproj import MPRester\n",
"with MPRester() as mpr:\n",
" chgcar = mpr.get_charge_density_from_material_id(\"mp-804\")\n",
" \n",
"for defect in generate_all_native_defects(chgcar):\n",
" print(defect)\n",
"```"
]
}
],
"metadata": {
Expand All @@ -241,7 +305,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
41 changes: 18 additions & 23 deletions docs/source/content/nonradiative.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "6930b94a-4443-45b0-94a5-452f6280fd5a",
"id": "0",
"metadata": {},
"source": [
"# Shockley-Read-Hall Recombination\n",
Expand All @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "239c7281-3a24-49cb-a161-64124c59dbc4",
"id": "1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -31,7 +31,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2d5264bc-c907-4d74-bb70-bc79c9050e7a",
"id": "2",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -40,7 +40,7 @@
},
{
"cell_type": "markdown",
"id": "e410b507-e465-438b-95e3-64dce28f6f00",
"id": "3",
"metadata": {},
"source": [
"## Read a single Harmonic Defect\n",
Expand All @@ -55,7 +55,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ceaa50d4-57d2-4438-80e7-7cb4491985c1",
"id": "4",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -74,7 +74,7 @@
},
{
"cell_type": "markdown",
"id": "8e0c86ec-8fa4-4399-9900-c161b8149fbe",
"id": "5",
"metadata": {},
"source": [
"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",
Expand All @@ -88,7 +88,7 @@
},
{
"cell_type": "markdown",
"id": "43e620e9-93be-4883-b3a0-ecf5218a6355",
"id": "6",
"metadata": {},
"source": [
"### Potential energy surface\n",
Expand All @@ -103,7 +103,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c4226814-ccfc-41f9-8eeb-5ad6a2d58eeb",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -122,7 +122,7 @@
},
{
"cell_type": "markdown",
"id": "d169180d",
"id": "8",
"metadata": {},
"source": [
"The band structure of the relaxed structure has a state that can be identified as the defect state using the inverse participation ratio."
Expand All @@ -131,7 +131,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a8b9111d-40dd-4be5-ac24-2140c4ce7570",
"id": "9",
"metadata": {
"tags": []
},
Expand All @@ -149,7 +149,7 @@
},
{
"cell_type": "markdown",
"id": "104ac837",
"id": "10",
"metadata": {},
"source": [
"## Evaluating the Electron-Phonon Matrix Element with PAWs\n",
Expand Down Expand Up @@ -179,7 +179,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7c149d93",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -191,7 +191,7 @@
},
{
"cell_type": "markdown",
"id": "d7f9b645",
"id": "12",
"metadata": {},
"source": [
"The epME is computed by the `HarmonicDefect.get_elph_me` method, which requires the defect band index.\n",
Expand All @@ -201,7 +201,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "433f5f29",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -214,7 +214,7 @@
},
{
"cell_type": "markdown",
"id": "66aafe95",
"id": "14",
"metadata": {},
"source": [
"## Calculating the SRH Capture Coefficient\n",
Expand All @@ -225,7 +225,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "133e213c",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -238,7 +238,7 @@
},
{
"cell_type": "markdown",
"id": "a7d97c23",
"id": "16",
"metadata": {},
"source": [
"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."
Expand All @@ -247,7 +247,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2f08c3b9",
"id": "17",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -260,11 +260,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "mp",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand Down
Loading

0 comments on commit cdefd48

Please sign in to comment.