# Intro to Defect Calculations

<img src="https://605547357-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgTsYhXxXGiBJhqMdKF6%2Fuploads%2FUZaQah34wzX1gQBYRlnZ%2Fprashun-gorai-cropped.png?alt=media&#x26;token=3a76ca7f-5121-480d-b9e5-7ea1967fe0e3" alt="" data-size="line"> *Written by Prashun Gorai*

This tutorial describes the step-by-step process for calculating point defect formation energy, defect concentrations, and associated carrier (electron, hole) concentrations. The workflows use open-source Python packages, [pylada](https://github.com/pylada/pylada-light) and [pylada-defects](https://github.com/pylada/pylada-defects). This tutorial is intended to be a practical guide. *Best practices and common pitfalls are discussed*. This tutorial does not cover the post-processing and interpretation of the results, nor does it cover the theory of defect calculations.&#x20;

{% hint style="info" %}
Pylada-defects is an open-source python package for automation of first-principles point defect calculations. For details, please read the paper:

<http://dx.doi.org/10.1016/j.commatsci.2016.12.040>
{% endhint %}

The formation energy of point defects is calculated using a supercell approach, and is given by

$$
\Delta E\_{D,q} = E\_{D,q} - E\_{H} + \sum\_i{n\_i \mu\_i} + qE\_\mathrm{F} + E\_{corr}
$$

The defect formation energies are obtained from a suite of calculations (e.g., supercell relaxations, phase stability etc.) and therefore, one must carefully strategize these calculations for efficiency and to avoid common pitfalls. A summary of step-by-step procedure:&#x20;

1. Perform geometry optimization (relaxation) of the unit cell.
2. Calculate the electronic structure with a dense k-point grid, using relaxed unit cell as input.
3. Calculate electronic structure with GW, if band gap correction is needed.&#x20;
4. Perform phase stability calculations to determine range of elemental chemical potentials.
5. Create defect supercells and perform geometry optimization (typically, ionic relaxation).
6. Identify likely sites for interstitials using Voronoi tessellation, and follow specific sequential procedure described below to calculate formation energy of interstitials.&#x20;
7. Calculate electronic and ionic contributions to dielectric constant.&#x20;

{% hint style="info" %}
**Steps 1** and **2** should be performed sequentially. **Steps 3-7** can be performed simultaneously. When handling hypothetical starting structures, it is recommended to perform **Step 4** after **Steps 1** and **2** to ensure phase stability.&#x20;
{% endhint %}

This tutorial focuses on defect calculation with density functional theory (DFT) as the electronic structure method. The choice of DFT functional should be carefully considered for the problem at hand. In this tutorial, it is assumed that DFT calculations are performed with a semi-local exchange correlation functional such GGA-PBE with the band gap "corrected" with quasiparticle energies obtained from GW.&#x20;

{% hint style="info" %} <mark style="color:orange;">The defect energetics are very sensitive to the band gap</mark>. The well-known band gap underestimation in semi-local DFT can lead to highly erroneous defect energetics.
{% endhint %}

<mark style="color:orange;">**Step 1: Structure Relaxation**</mark>&#x20;

Relax the primitive or conventional cell using the DFT functional of choice. Perform full geometry optimization i.e., volume, cell shape, and ionic positions. The relaxed structure will be used in all subsequent steps.&#x20;

<mark style="color:orange;">**Step 2: Electronic structure on dense k-point grids**</mark>&#x20;

The calculation of the electronic band structure is an important, but often overlooked, step in the defect calculation workflow.&#x20;

### **Under construction...**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://3d-materials-lab.gitbook.io/3dmaterialslab-tutorials/defects/intro-to-defect-calculations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
