# Localised electrostatic charges in non-uniform dielectric media: Theory¶

For examples, see Calculating the formation energies of charged defects.

## Introduction¶

The purpose of this section is to enable us to calculate the formation energy of charged defects. In the Zhang-Northrup formula, this is given by

In this formula, \(X\) labels the type of defect and \(q\) its charge state, i.e. the net charge contained in some volume surrounding the defect. \(q\) is defined such that \(q=-1\) for an electron. \(E[X^q]\) is the total energy of the sample with the defect, and \(E_0\) the energy of the pristine (bulklike) sample.

These quantities are usually calculated in a supercell approach with periodic boundary conditions. That is, we create the defect we are interested in, and place it in an environment containing many repetitions of the pristine unit cell. In the infinite supercell limit, we can describe the properties of the isolated defect.

When we employ periodic boundary conditions, our calculation includes spurious electrostatic interactions between localised charge distribution of the defect state, and all its periodically repeated images. These long-ranged interactions mean that the convergence with respect to supercell size is slow.

To accelerate this convergence, we employ an electrostatic correction scheme, and write

This assumes that DFT describes the bonding and energies of the system well, but contains errors in the electrostatics. The correction thus consists in subtracting the spurious interactions between the periodic images (the term included in the DFT calculation) and adding in the energy of an isolated charge distribution in the given dielectric environment. Finally, the potentials between the charged and neutral states must be aligned to the same reference.

Implementing this scheme consists of the following steps, which will be described in further detail in the sections below. First, we determine the \(z\)-dependent dielectric function of the 2D layers. Knowing this, we use a model charge distribution to emulate the behaviour of the defect charge state, and find the potential associated with this model distribution by solving the Poisson equation. We do this twice: first with periodic boundary conditions, and then with zero boundary conditions. The electrostatic energy associated with the charge distribution in a given potential can then be found from the usual formula,

## Defining the dielectric response of 2D layers¶

In two dimensions, the bulk dielectric response is poorly defined, and some model must be used.

The approach used here, following Ref [1] is to assume that the dielectric function of the isolated layer is isotropic in plane, and varies only in the \(z\) direction. Additionally, the screening is assumed to follow the density distribution of the system so that we can write

Where \(i\) varies over “in-plane” and “out-of-plane”, and \(n\) is the in-plane averaged density of the system. The normalization constants, \(k^i\), are chosen such that

## Calculating the energy of the periodic images¶

Once we have the dielectric response, we proceed by solving the poisson equation

Here \(\odot\) is the elementwise (Hadamard) product, and \(\boldsymbol{\varepsilon} = (\varepsilon^{\parallel}, \varepsilon^{\parallel}, \varepsilon^{\perp})\). \(\rho(\mathbf r)\) is a model charge distribution that we use to describe the charge distribution of the defect state. For convenience, a Gaussian is often chosen, so that

In terms of the coordinate axes, the poisson equation reduces to

Since we wish to solve this equation with periodic boundary conditions, we Fourier transform the above equation, giving

where \(*\) denotes a convolution along the \(z\) axis. Writing out these convolutions, we finally arrive at the expression

For each value of \((G_x, G_y)\), we can thus calculate the corresponding potential \(V_{G_z}\) through a matrix inversion, and use that to calculate the energy of the model charge distribution.

We can also use the potential \(V_{G_z}\) to calculate the alignment term, \(\Delta V\). We can Fourier transform this to get real-space potential of the model charge distribution. If we have described the electrostatics of the system well, this potential should be similar to the true potential of the defect charge distribution, up to a constant shift. Defining

We set

## Calculating the energy of the isolated system¶

We start as before, with the Poisson equation, but since we would like to describe the energy of the isolated defect, we do not impose periodic boundary conditions and Fourier transform. Instead, following Ref. [2] we can exploit the in-plane symmetry of the problem and expand \(\phi\) using cylindrical Bessel functions.

Inserting this into the above equation and using the orthogonality relation \(\int \rho\mathrm{d}\rho J_0(\rho k)J_0(\rho k') = \delta(k - k') / k\) we find that \(\varphi_k\) must obey the Poisson equation

where \(z_0\) is the center of the gaussian density along the \(z\) direction. The normalization of \(\varphi_k\) defined above was chosen precisely so that the right hand side of this equation is a normalized gaussian along the \(z\) direction.

We solve this equation by separating the response into two components: The bulk response, describing the screening far away from the material, and the remaining \(z\) -dependent response close to the system. We thus define \(\Delta \varepsilon^i(z) = \varepsilon^i(z) - \varepsilon^{i}_{\mathrm{bulk}}\) and the Green’s function of the bulk response \(\hat K = (-\varepsilon^{\perp}_{\mathrm{bulk}} \frac{\partial^2}{\partial z^2} + k^2\varepsilon^{\parallel}_{\mathrm{bulk}})^{-1}\). As an implementation detail, we note that for 2D materials, the bulk response is generally 1.

The equation for \(\varphi_k\) can then be written as

Only the first term on the left hand side is affected by the boundary conditions on \(\varphi_k\). We can solve this by Fourier transforming along the \(z\) axis and wigner-seitz truncating the Green’s function, which yields the following equation

with the matrix \(D\) given by

Finding \(\varphi_k\) is thus just a simple matrix inversion. Once we have solved the poisson equation, we calculate the total energy.

with

Using the solution to the Poisson equation, this reduces to

With \(D\) defined as above.