# ChargedPointDefect¶

class ChargedPointDefect(bulk_configuration, filename, object_id, formation_energy_calculator=None, relaxation_calculator=None, point_defect=None, charge_states=None, atomic_chemical_potentials=None, supercell_repetitions_list=None, relax_atomic_coordinates=None, dielectric_constant=None, log_filename_prefix=None, number_of_processes_per_task=None, elastic_correction_method=None, optimize_geometry_parameters=None)

Constructor for the ChargedPointDefect object.

Parameters: bulk_configuration (BulkConfiguration) – The reference bulk unit cell configuration to be used to generate the supercell configurations. filename (str) – The full or relative filename path the Study object should be saved to. See nlsave(). object_id (str) – The name of the study that the Study object should be saved to within the file. This needs to be a unique name in this file. See nlsave(). formation_energy_calculator (Calculator) – The calculator used for calculating the formation energy of the defect charge states. All total energies, band positions and finite-size corrections are calculated using this calculator. The calculator must contain a basis set for the elements in both the defect and pristine configurations. Note that the calculator is taken as a reference corresponding to the bulk unit cell given in bulk_configuration; the density_mesh_cutoff and k_point_sampling parameters of the NumericalAccuracyParameters of the calculator will be scaled consistently with the supercell size. The k_point_sampling will be scaled to maintain the k-point density approximately equal to the reference. The k-point grid will always be shifted such that the Gamma point is included, i.e., shift_to_gamma=True. Default: The calculator given in relaxation_calculator. At least one of the two calculators must be provided. relaxation_calculator (Calculator) – The calculator used for relaxing the atomic coordinates of the defect supercells. The calculator must contain a basis set for the elements in the defect configuration. Note that the calculator is taken as a reference corresponding to the bulk unit cell given in bulk_configuration; the density_mesh_cutoff and k_point_sampling parameters of the NumericalAccuracyParameters of the calculator will be scaled consistently with the supercell size. The k_point_sampling will be scaled to maintain the k-point density approximately equal to the reference. The k-point grid will always be shifted such that the Gamma point is included, i.e., shift_to_gamma=True. Default: The calculator given in formation_energy_calculator. At least one of the two calculators must be provided. point_defect (Vacancy | Substitutional | Interstitial | DefectCluster) – The point defect to embed in the host supercell. Default: Vacancy() charge_states – The list of charge states of the defect, as a discrete multiple of elementary charge. A charge of -1 corresponds to one extra electron. Default: 0 atomic_chemical_potentials (sequence of AtomicChemicalPotential) – The chemical potentials for the atomic species involved in the creation of the defect (i.e., any species for which the number of atoms changes between the pristine and defect supercell). Default: All necessary atomic chemical potentials will be calculated using the pristine configuration (when possible) or a default elemental reference configuration. supercell_repetitions_list (sequence (size 3) of int | sequence of sequence (size 3) of int) – The list of supercells of the bulk unit cell to calculate, each given as the number of repetitions of the bulk unit cell along the (a, b, c) directions. Default: [(1, 1, 1)] relax_atomic_coordinates (bool) – Whether to relax the atomic coordinates of the defect supercells. Default: True dielectric_constant (float) – The dielectric constant of the host material. Only needed to calculate the finite-size correction terms. Default: 1.0 log_filename_prefix (str | LogToStdOut) – Filename prefix for the logging output of charged point defect calculations. If LogToStdOut, all logging will instead be sent to standard output. Default: 'chargedpointdefect_' number_of_processes_per_task (int) – The number of processes that will be used to execute each task. If this value is greater than or equal to the total number of available processes, each single task will be executed collaboratively over all processes. Otherwise, a delegator-worker scheme is used; in this case, one process will be set aside as the delegator, and the remaining ones will be grouped into workers and execute tasks concurrently. Default: All available processes execute each task collaboratively. elastic_correction_method (ImageStressCorrection) – Specify a finite size elastic energy correction. If not specified, no finite size elastic energy correction will be applied. Default: None optimize_geometry_parameters –
The parameters to use for optimizing the geometry. Note that constraints,
pre_step_hook andpost_step_hook must be left unset. Also note that max_stress and target_stress do not have any effect since stress is not optimized.
Default: OptimizeGeometryParameters()
atomNumberDifferences()
Returns: The atom number differences for each element. dict of type {PeriodicTableElement : int}
atomicChemicalPotentials()
Returns: The atomic chemical potential for all the required elements. If an element for which the atomic chemical potential needs to be calculated is not present, it is calculated from the pristine cell at each supercell size. list of AtomicChemicalPotential
bandShift(supercell_repetitions, charge_state)

Retrieve the band shift for a given defect supercell with respect to the pristine supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The band shift for the supercell. If not available, returns None. PhysicalQuantity of type energy | None
calculatedChargeStates(supercell_repetitions=None)

Retrieve the list of calculated charge states, either for the entire study or for a given supercell.

Parameters: supercell_repetitions (sequence (size 3) of int | ExtrapolationScheme) – The supercell given as the number of repetitions of the bulk unit cell along the (a, b, c) directions for which to return the list of calculated charge states. For an extrapolation scheme, the charge states for all supercells are returned. Default: All supercells. The list of calculated charge states. The charge states are ordered from the most positive to the most negative. list of int
calculatedSupercells(charge_state=None)

Retrieve the list of calculated supercells, either for the entire study or for a given charge state.

Parameters: charge_state (int) – The charge state for which to return the list of calculated supercells. Default: All charge states. The list of calculated supercells, each given as the number of repetitions of the bulk unit cell along the (a, b, c) directions. The supercells are ordered from the smallest to the largest in terms of the number of atoms; if multiple supercells have the same number of atoms they are ordered according to the repetitions in the (a, b, c) directions, in that order. list of tuple (size 3) of int
chargeStates()
Returns: The list of all calculated and not calculated charge states. Any charge state which has not yet been calculated will be calculated the next time the object is updated. list of int
conductionBandMinimum(supercell_repetitions)

Retrieve the conduction band minimum of the pristine unit cell configuration associated with a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. The conduction band minimum of the pristine unit cell configuration. If not available, returns None. PhysicalQuantity of type energy | None
defectConfiguration(supercell_repetitions, charge_state)

Retrieve the defect supercell configuration for a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The defect supercell configuration. If not available, returns None. BulkConfiguration | None
defectConfigurationCalculator(supercell_repetitions, charge_state)

Retrieve the calculator of the defect supercell configuration for a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The calculator of the defect supercell configuration. If not available, returns None. Calculator | None
defectTotalEnergy(supercell_repetitions, charge_state)

Retrieve the total energy of the defect supercell configuration for a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The total energy of the defect supercell configuration. If not available, returns None. TotalEnergy | None
dielectricConstant()
Returns: The dielectric constant of the host material is updated. float
elasticCorrectionEnergy(supercell_repetitions, charge_state)

Retrieve the value of the elastic energy correction for a given supercell. This result will only be available after the calculation ran successfully. If no correction was applied, None is returned.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The image stress correction. If not available, returns None. PhysicalQuantity of type energy | None
elasticCorrectionMethod()
Returns: The method used to evaluate the finite size elastic energy correction. None | ImageStressCorrection
filename()
Returns: The filename where the study object is stored. str
formationEnergy(charge_state, electronic_chemical_potential=None, supercell_repetitions=None, enable_finite_size_corrections=None)

The formation energy for a given charge state $$q$$ of the defect, defined as

$$E_f^q = E^{\mathrm{def}, q} - E^{\mathrm{bulk}, q} + E^{\mathrm{strain}, q} - \sum_i \Delta n_i \mu_i + q \left ( \varepsilon^\mathrm{VBM} + \Delta \mu_e \right )$$.

The first two terms are the total energy of the supercell with and without the defect, respectively. The third term is the strain correction to the formation energy, which is zero unless elastic_correction_method has been set to ImageStressCorrection. $$\Delta n_i$$ is the difference in the number of atoms between the two supercells for species $$i$$, and $$\mu_i$$ is the atomic chemical potential for that species. $$\varepsilon^\mathrm{VBM}$$ is the absolute position of the valence band maximum, and $$\Delta \mu_e$$ is the electronic chemical potential relative to it.

Parameters: charge_state (int) – The charge state of the defect. electronic_chemical_potential (PhysicalQuantity of type energy) – The electronic chemical potential relative to the valence band maximum. Default: 0.0 * eV supercell_repetitions (sequence (size 3) of int | ExtrapolationScheme) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. If ExtrapolationScheme, the extrapolation to the infinite supercell size limit is used. Default: The largest calculated supercell. enable_finite_size_corrections (bool) – Whether to include finite size corrections for the supercell in the calculation of the formation energy. Default: True The calculated formation energy. PhysicalQuantity of type energy
logFilenamePrefix()
Returns: The filename prefix for the logging output of the study. str | LogToStdOut
modelChargeCorrection(supercell_repetitions, charge_state)

Retrieve the model charge correction parameters for the FNV correction for a given supercell and charge state.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. charge_state (int) – The charge state of the defect. The parameters used to define the model charge correction. If not available, returns None.
nlprint(stream=None)

Print a string containing an ASCII table useful for plotting the Study object.

Parameters: stream (python stream) – The stream the table should be written to. Default: NLPrintLogger()
numberOfProcessesPerTask()
Returns: The number of processes to be used to execute each task. If None, all available processes should execute each task collaboratively. int | None
objectId()
Returns: The name of the study object in the file. str
optimizeGeometryParameters()
Returns: Parameters required to optimize the geometry. OptimizeGeometryParameters
periodicChargeCorrection(supercell_repetitions, charge_state)

Retrieve the periodic charge correction for a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. defect_charge_state (int) – The charge state of the defect. The periodic charge correction for the supercell. If not available, returns None. PhysicalQuantity of type energy | None
pointDefect()
Returns: The point defect associated with the charged point defect study. Vacancy | Substitutional | Interstitial | DefectCluster
pristineConfiguration(supercell_repetitions)

Retrieve the pristine unit cell configuration associated with a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. The pristine unit cell configuration. If not available, returns None. BulkConfiguration | None
pristineConfigurationCalculator(supercell_repetitions)

Retrieve the calculator of the pristine unit cell configuration associated with a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. The calculator of the pristine unit cell configuration. If not available, returns None. Calculator | None
pristineTotalEnergy(supercell_repetitions)

Retrieve the total energy of the pristine unit cell configuration associated with a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. The total energy of the pristine unit cell configuration. If not available, returns None. TotalEnergy | None
relaxAtomicCoordinates()
Returns: Whether the atomic coordinates of the defect supercells are relaxed. bool
setModelChargeCorrection(supercell_repetitions, charge_state, model_charge_correction=None)

Set the model charge correction parameters for the FNV correction for a given supercell and charge state.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. charge_state (int) – The charge state of the defect. model_charge_correction (ModelChargeCorrection) – The parameters used to define the model charge correction. Default: ModelChargeCorrection()
stableChargeState(electronic_chemical_potential, supercell_repetitions=None, enable_finite_size_corrections=None)

The stable charge state at a given electronic chemical potential.

Parameters: electronic_chemical_potential (PhysicalQuantity of type energy) – The electronic chemical potential relative to the valence band maximum. supercell_repetitions (sequence (size 3) of int | ExtrapolationScheme) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. If ExtrapolationScheme, the extrapolation to the infinite supercell size limit is used. Default: The largest calculated supercell. enable_finite_size_corrections (bool) – Whether to include finite size corrections for the supercell in the calculation of the formation energy. Default: True The calculated stable charge state. int
stableTransitions(supercell_repetitions=None, enable_finite_size_corrections=None)

The list of transitions between stable charge states across the whole range of the electronic chemical potential.

Parameters: supercell_repetitions (sequence (size 3) of int | ExtrapolationScheme) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. If ExtrapolationScheme, the extrapolation to the infinite supercell size limit is used. Default: The largest calculated supercell. enable_finite_size_corrections (bool) – Whether to include finite size corrections for the supercell in the calculation of the formation energy. Default: True The list of transitions between stable charge states in order as the electronic chemical potential is increased. list of list (size 2) of int
supercellRepetitionsList()
Returns: The list of all calculated and not calculated supercells of the bulk unit cell, each given as the number of repetitions of the bulk unit cell along the (a, b, c) directions. Any supercell which has not yet been calculated will be calculated the next time the object is updated. list of tuple (size 3) of int
transitionLevel(charge_states, supercell_repetitions=None, enable_finite_size_corrections=None)

The transition level between two calculated charge states $$m$$ and $$n$$, defined as

$$E \left ( m/n \right ) = \frac{E_f^n \left ( \Delta \mu_e = 0 \right ) - E_f^m \left ( \Delta \mu_e = 0 \right )}{m - n}$$.

The transition level is given relative to the position of the valence band maximum.

Parameters: charge_states (sequence (size 2) of int) – The two charge states to calculate the transition level for. supercell_repetitions (sequence (size 3) of int | ExtrapolationScheme) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. If ExtrapolationScheme, the extrapolation to the infinite supercell size limit is used. Default: The largest calculated supercell. enable_finite_size_corrections (bool) – Whether to include finite size corrections for the supercell in the calculation of the formation energy. Default: True The calculated transition level. PhysicalQuantity of type energy
update()

Run the calculations for the study object.

valenceBandMaximum(supercell_repetitions)

Retrieve the valence band maximum of the pristine unit cell configuration associated with a given supercell.

This result will only be available after the calculation ran successfully.

Parameters: supercell_repetitions (sequence (size 3) of int) – The number of repetitions of the bulk unit cell along the (a, b, c) directions. The valence band maximum of the pristine unit cell configuration. If not available, returns None. PhysicalQuantity of type energy | None

## Notes¶

Note

Study objects behave differently from analysis objects. See the Study object overview for more details.

The ChargedPointDefect object can be used to perform a detailed study of a single point defect in bulk material in its various charge states. The defect can be a simple vacancy, substitutional, or interstitial, or a more complex defect cluster made from multiple simple defects.

The main results are the formation energy of the defect for different charge states as a function of the electronic chemical potential, and the corresponding stable charge transition levels (sometimes referred to as the thermodynamic transition levels or occupancy levels).

Performing accurate simulations of point defects, especially for non-neutral charge states, can be challenging. In particular, it is generally very important to ensure that the physical quantities of interest are properly converged with respect to the size of the supercell of bulk crystal in which the point defect is placed (as periodic boundary conditions are used, there will be spurious interactions between periodic replicas of the defect site). ChargedPointDefect aims to assist the user in automatically simulating a range of supercell sizes and analyzing the convergence with size for each charge state. It will also apply the correction by Freysoldt, Neugebauer and Van De Walle (FNV) [FNVanDWalle09] to mitigate the effects of these finite size interactions.

The object is initialized by specifying the primitive unit cell of the host crystal (without the defect) as a BulkConfiguration, the list of supercells of this primitive cell to generate for the study, and the defect to study as an instance of the desired defect class (Vacancy | Substitutional | Interstitial | DefectCluster). The defect will be inserted into each supercell of the bulk material. The list of charge states of the defect to simulate must also be given.

The calculator which is used to calculate the formation energy is given by formation_energy_calculator. The atomic coordinates of the defect supercells are relaxed by default (this is controlled with relax_atomic_coordinates); it is possible to specify a separate calculator to perform the relaxations with relaxation_calculator, as these usually represent the most computationally intensive part of the study. Both calculators are automatically adjusted for each supercell to ensure a consistent level of accuracy.

One can optionally calculate an elastic strain correction to the formation energy by using a ImageStressCorrection object as the elastic_correction_method. The correction is described is more detail in Section Finite-size scaling and correction terms.

Note

The calculators must contain a basis/pseudopotential for all species in both the pristine and defect supercells.

## Defining the point defect¶

This is specified by point_defect. The defect is defined in an abstract way, independently of the material it is embedded in or the supercell size. The study will combine it with the reference unit cell of the pristine material (bulk_configuration) and the various supercell sizes (supercell_repetitions_list) to create the defect supercells.

There are three simple point defect types: Vacancy, Substitutional, and Interstitial. The first two require a site_index at which to create the defect; the index refers to the atom index of the list of atoms of the reference unit cell. The third, instead, is not tied to a site but is defined by specifying a position in space (either in absolute coordinates or as fractional coordinates of the reference unit cell).

More complex defects can also be specified by using a DefectCluster; this is defined by providing a list of simple defects which will be combined together to form a composite defect. Examples of this include a divacancy (2 vacancies) or a Frenkel pair (vacancy + interstitial). Larger clusters can also be defined.

Although a DefectCluster can still be considered a point defect (it is not periodic in any direction), it has a size depending on the largest distance between any of the constituent defects. It is therefore possible for a cluster to be larger than the reference unit cell. In order to define such clusters, one can make use of the unit_cell_index argument for Vacancy and Substitutional, which allows for the constituent defects to be shifted to different unit cells. Similarly, Interstitial defects can be defined by giving a position outside of the unit cell. When the study generates the actual defect supercell configuration, the constituent defects are wrapped within the supercell. Therefore, all supercells used in the study must be large enough to accommodate the cluster.

## Atomic Chemical Potentials¶

The chemical potentials for the atomic species involved in the creation of the defect (i.e., any species for which the number of atoms changes between the pristine and defect supercell) need to be determined in order to calculate the formation energy. Note that the atomic chemical potentials are only used for the final post-processing calculation of the formation energy; although the absolute value of the formation energy is affected, the differences between charge states (and, hence, the transition levels) are not.

The study will automatically try to make a reasonable choice for the values of the atomic chemical potentials. The default choice taken by the study for each element is as follows:

• If possible, the atomic chemical potential is calculated as the energy per atom of the pristine configuration at each supercell size. This will be the case if (a) the element is present in the pristine configuration, and (b) all the elements of the pristine configuration are either added or removed in their stoichiometric ratio in the creation of the defect.
• Otherwise, the atomic chemical potential is calculated as the energy per atom of a default elemental reference configuration. This default configuration is taken from the $$\Delta$$-test [LBBjorkman+16] suite of elemental crystals. Note that the calculation is performed with the same calculator parameters as specified in formation_energy_calculator.

These automatic values can, however, be changed for one or more elements by providing an AtomicChemicalPotential object for each element in atomic_chemical_potentials. This allows the user to provide either an explicit hard-coded value of the energy per atom, or an alternative elemental reference configuration for the study to use in calculating the atomic chemical potential.

For a detailed physical discussion on the choice of atomic chemical potentials, see Van de Walle and Neugebauer [VandWalleN04].

## Results¶

The study provides a number of methods for processing the available results and returning the physical quantities of interest:

• formationEnergy: the formation energy for a given charge state as a function of the electronic chemical potential. The mathematical definition is given in the method description above.
• stableChargeState: the stable charge state at a given electronic chemical potential.
• transitionLevel: the transition level between two charge states. The mathematical definition is given in the method description above.
• stableTransitions: the list of transitions between stable charge states across the whole range of the electronic chemical potential.

## Finite-size scaling and correction terms¶

All the post-processing methods given above take two optional arguments, supercell_repetitions and enable_finite_size_corrections. By default, the largest supercell is used and finite-size corrections are automatically included.

As previously mentioned, the FNV correction scheme [FNVanDWalle09] is used. This scheme introduces two additional terms in the definition of the formation energy: a correction for the electrostatic interaction between periodic replicas of the charged defect center, and a band shift correction to the defect supercell to align the bands to a common reference with the neutral bulk. Moreover, we add an optional strain correction, which accounts for the elastic distortion of the surrounding lattice due to the defect.

The first correction term is added to the total energy of the defect supercell $$E^{\mathrm{def}, q}$$, while the second is substracted from the absolute position of the valence band maximum $$\varepsilon^\mathrm{VBM}$$. The complete definition of the formation energy therefore becomes

$\begin{split}E_f^q &= E^{\mathrm{def}, q} + E^{\mathrm{FNV}, q}_1 + E^{\mathrm{strain}, q} - E^{\mathrm{bulk}, q} \\ &- \sum_i \Delta n_i \mu_i + q \left ( \varepsilon^\mathrm{VBM} - E^{\mathrm{FNV}, q}_2 + \Delta \mu_e \right ),\end{split}$

where $$E^{\mathrm{FNV}, q}_{1, 2}$$ are the two FNV correction terms, which depend both on the charge state and the supercell. The term $$E^{\mathrm{strain}, q}$$ is the optional strain energy correction, which is given by

$E^{\mathrm{strain}, q} = -\frac{V}{2 K} (P^{\mathrm{def}} - P^{\mathrm{bulk}})^2,$

where $$V$$ is the volume of the supercell, $$K$$ is the bulk modulus of the host material, $$P^{\mathrm{def}}$$ is the external hydrostatic pressure in the supercell with the defect, and $$P^{\mathrm{bulk}}$$ is the external hydrostatic pressure for the pristine system. See equation 57 and related discussion in [FGH+14] for a more detailed description of the elastic correction and the underlying approximations.

Note

The elastic strain correction is only calculated if the parameter elastic_correction_method is explicitly set. If the parameter is not specified, $$E^{\mathrm{strain}, q}$$ is set to zero in the formation energy calculation.

Note

The FNV correction terms only apply to non-neutral charge states. The neutral charge state results will be unaffected by the use of the correction.

The FNV correction works by approximating the additional charge on the defect site with a Gaussian distribution in a dielectric background. The width of this distribution can be set manually with the setModelChargeCorrection method; by default, it is fitted for each charge state and supercell size so as to best reproduce the long-range electrostatic potential profile of the defect supercell far away from the defect.

Note

In some cases it is not possible to reproduce the calculated potential profile with a Gaussian charge; the fitting procedure will then set an infinite width, effectively switching off the first correction term.

## Extrapolating to infinite size¶

In addition to the finite-size corrections, it is possible to attempt an extrapolation of the formation energy to the limit of infinite system size. This can be specified by providing an instance of ExtrapolationScheme as supercell_repetitions in the post-processing methods. The extrapolation scheme will use the available results at different supercell sizes to fit a polynomial.

The form of the extrapolating function is somewhat empirical; the rationale behind it and its reliability for some practical test cases are discussed by Lany and Zunger [LZ08]. Care should be taken when making use of the extrapolation results.

## Usage Example¶

This example script shows how to perform a simple study of the vacancy in bulk silicon and display a summary of results:

from SMW import *

# Setup the reference bulk unit cell configuration.
lattice = FaceCenteredCubic(5.4306*Angstrom)

elements = [Silicon, Silicon]

fractional_coordinates = [[ 0.  ,  0.  ,  0.  ],
[ 0.25,  0.25,  0.25]]

bulk_configuration = BulkConfiguration(
bravais_lattice=lattice,
elements=elements,
fractional_coordinates=fractional_coordinates,
)

# Setup the calculator.
basis_set = getattr(LDABasis, 'Silicon_SingleZeta')
calculator = LCAOCalculator(
basis_set=basis_set,
exchange_correlation=LDA.PZ,
numerical_accuracy_parameters=NumericalAccuracyParameters(
k_point_sampling=MonkhorstPackGrid(1, 1, 1))
)

# Initialize the ChargedPointDefect object.
charged_point_defect = ChargedPointDefect(
bulk_configuration=bulk_configuration,
filename='chargedpointdefect.hdf5',
formation_energy_calculator=calculator,
object_id='Si_vacancy',
point_defect=Vacancy(0),
charge_states=[2, 1, 0, -1, -2],
supercell_repetitions_list=[(1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4)],
relax_atomic_coordinates=False,
dielectric_constant=11.68,
)

# Run the calculation.
charged_point_defect.update()

# Print a summary of results.
nlprint(charged_point_defect)


charged_point_defect.py

No stress correction is used in this example. Here is the resulting output from the nlprint command:

+------------------------------------------------------------------------------+
| Charged Point Defect Report                                                  |
+------------------------------------------------------------------------------+
| Finite size scaling:                                                         |
| (Formation energies are given at zero electronic chemical potential and      |
| including the correction terms. The band shift correction is given by the    |
| band shift multiplied by the charge times minus one.)                        |
+------------------------------------------------------------------------------+
| Charge: +2                                                                   |
+------------------------------------------------------------------------------+
|   Number   Inverse length        Formation      Finite size                  |
| of atoms     (1/Angstrom)      energy (eV)  correction (eV)                  |
|        2      2.92307e-01     -3.56904e+00      2.86730e+00                  |
|       16      1.46153e-01     -1.52429e+00      7.57940e-02                  |
|       54      9.74356e-02      1.94982e+00      5.62643e-01                  |
|      128      7.30767e-02      3.16854e+00      4.35393e-01                  |
|      Inf      0.00000e+00      5.70826e+00  (corrected)                      |
|      Inf      0.00000e+00      6.45299e+00  (uncorrected)                    |
|                                                                              |
| Finite size correction contributions:                                        |
|                                                                              |
|   Number             Band  Periodic charge     Image stress                  |
| of atoms       shift (eV)  correction (eV)  correction (eV)                  |
|        2     -4.01568e-01      2.06417e+00                -                  |
|       16     -3.78970e-02      0.00000e+00                -                  |
|       54      5.72778e-02      6.77198e-01                -                  |
|      128      5.13730e-03      4.45668e-01                -                  |
+------------------------------------------------------------------------------+
| Charge: +1                                                                   |
+------------------------------------------------------------------------------+
|   Number   Inverse length        Formation      Finite size                  |
| of atoms     (1/Angstrom)      energy (eV)  correction (eV)                  |
|        2      2.92307e-01     -3.55135e+00      1.04229e+00                  |
|       16      1.46153e-01     -6.72596e-01     -5.61343e-02                  |
|       54      9.74356e-02      2.07451e+00      1.19878e-01                  |
|      128      7.30767e-02      3.23208e+00      1.03283e-01                  |
|      Inf      0.00000e+00      6.23957e+00  (corrected)                      |
|      Inf      0.00000e+00      6.41137e+00  (uncorrected)                    |
|                                                                              |
| Finite size correction contributions:                                        |
|                                                                              |
|   Number             Band  Periodic charge     Image stress                  |
| of atoms       shift (eV)  correction (eV)  correction (eV)                  |
|        2     -5.27329e-01      5.14962e-01                -                  |
|       16      5.61343e-02      0.00000e+00                -                  |
|       54      5.00438e-02      1.69922e-01                -                  |
|      128      2.67978e-02      1.30081e-01                -                  |
+------------------------------------------------------------------------------+
| Charge: 0                                                                    |
+------------------------------------------------------------------------------+
|   Number   Inverse length        Formation      Finite size                  |
| of atoms     (1/Angstrom)      energy (eV)  correction (eV)                  |
|        2      2.92307e-01     -2.13008e+00      0.00000e+00                  |
|       16      1.46153e-01      7.62129e-01      0.00000e+00                  |
|       54      9.74356e-02      2.87491e+00      0.00000e+00                  |
|      128      7.30767e-02      3.87204e+00      0.00000e+00                  |
|      Inf      0.00000e+00      6.73582e+00  (corrected)                      |
|      Inf      0.00000e+00      6.73582e+00  (uncorrected)                    |
|                                                                              |
| Finite size correction contributions:                                        |
|                                                                              |
|   Number             Band  Periodic charge     Image stress                  |
| of atoms       shift (eV)  correction (eV)  correction (eV)                  |
|        2     -6.41716e-01      0.00000e+00                -                  |
|       16      1.28916e-01      0.00000e+00                -                  |
|       54      4.77929e-02      0.00000e+00                -                  |
|      128      2.66264e-02      0.00000e+00                -                  |
+------------------------------------------------------------------------------+
| Charge: -1                                                                   |
+------------------------------------------------------------------------------+
|   Number   Inverse length        Formation      Finite size                  |
| of atoms     (1/Angstrom)      energy (eV)  correction (eV)                  |
|        2      2.92307e-01      4.17083e-01     -6.04335e-01                  |
|       16      1.46153e-01      2.65180e+00      3.14123e-01                  |
|       54      9.74356e-02      4.14399e+00      7.96451e-02                  |
|      128      7.30767e-02      5.13477e+00      1.57463e-01                  |
|      Inf      0.00000e+00      8.63413e+00  (corrected)                      |
|      Inf      0.00000e+00      7.82309e+00  (uncorrected)                    |
|                                                                              |
| Finite size correction contributions:                                        |
|                                                                              |
|   Number             Band  Periodic charge     Image stress                  |
| of atoms       shift (eV)  correction (eV)  correction (eV)                  |
|        2     -6.04335e-01      0.00000e+00                -                  |
|       16      6.02071e-02      2.53916e-01                -                  |
|       54      7.96451e-02      0.00000e+00                -                  |
|      128      2.98200e-02      1.27643e-01                -                  |
+------------------------------------------------------------------------------+
| Charge: -2                                                                   |
+------------------------------------------------------------------------------+
|   Number   Inverse length        Formation      Finite size                  |
| of atoms     (1/Angstrom)      energy (eV)  correction (eV)                  |
|        2      2.92307e-01      3.81898e+00     -1.11445e+00                  |
|       16      1.46153e-01      4.95059e+00      9.49127e-01                  |
|       54      9.74356e-02      6.01975e+00      6.15873e-01                  |
|      128      7.30767e-02      6.92347e+00      5.41905e-01                  |
|      Inf      0.00000e+00      1.04297e+01  (corrected)                      |
|      Inf      0.00000e+00      9.91014e+00  (uncorrected)                    |
|                                                                              |
| Finite size correction contributions:                                        |
|                                                                              |
|   Number             Band  Periodic charge     Image stress                  |
| of atoms       shift (eV)  correction (eV)  correction (eV)                  |
|        2     -5.57226e-01      0.00000e+00                -                  |
|       16     -3.31693e-02      1.01547e+00                -                  |
|       54      7.41950e-02      4.67483e-01                -                  |
|      128      3.81477e-02      4.65610e-01                -                  |
+------------------------------------------------------------------------------+
| Transition levels between stable charge states:                              |
| (All values are calculated using the corrected formation energies.)          |
+------------------------------------------------------------------------------+
| Supercell: 2 atoms (1x1x1 unit cells)                                        |
+------------------------------------------------------------------------------+
| Transition    Level (eV)                                                     |
|      +2/+1   1.76875e-02                                                     |
|       +1/0   1.42127e+00                                                     |
|       0/-1   2.54716e+00                                                     |
|      -1/-2   3.40190e+00                                                     |
+------------------------------------------------------------------------------+
| Supercell: 16 atoms (2x2x2 unit cells)                                       |
+------------------------------------------------------------------------------+
| Transition    Level (eV)                                                     |
|      +2/+1   8.51697e-01                                                     |
|       +1/0   1.43472e+00                                                     |
|       0/-1   1.88967e+00                                                     |
|      -1/-2   2.29879e+00                                                     |
+------------------------------------------------------------------------------+
| Supercell: 54 atoms (3x3x3 unit cells)                                       |
+------------------------------------------------------------------------------+
| Transition    Level (eV)                                                     |
|      +2/+1   1.24691e-01                                                     |
|       +1/0   8.00392e-01                                                     |
|       0/-1   1.26908e+00                                                     |
|      -1/-2   1.87577e+00                                                     |
+------------------------------------------------------------------------------+
| Supercell: 128 atoms (4x4x4 unit cells)                                      |
+------------------------------------------------------------------------------+
| Transition    Level (eV)                                                     |
|      +2/+1   6.35398e-02                                                     |
|       +1/0   6.39961e-01                                                     |
|       0/-1   1.26272e+00                                                     |
|      -1/-2   1.78871e+00                                                     |
+------------------------------------------------------------------------------+
| Extrapolation to infinite limit                                              |
+------------------------------------------------------------------------------+
| Transition    Level (eV)                                                     |
|       +2/0   5.13780e-01                                                     |
|       0/-2   1.84694e+00                                                     |
+------------------------------------------------------------------------------+
`

It is important to note that this example is only intended to give an overview of the capabilities of ChargedPointDefect; it does not relax the atomic coordinates of the defect supercell, and makes use of a fast calculator.

# References¶

 [FGH+14] Christoph Freysoldt, Blazej Grabowski, Tilmann Hickel, Jörg Neugebauer, Georg Kresse, Anderson Janotti, and Chris G. Van De Walle. First-principles calculations for point defects in solids. Rev. Mod. Phys., 86(1):253–305, 2014. doi:10.1103/RevModPhys.86.253.
 [FNVanDWalle09] (1, 2) Christoph Freysoldt, Jörg Neugebauer, and Chris G. Van De Walle. Fully Ab Initio finite-size corrections for charged-defect supercell calculations. Phys. Rev. Lett., 102:016402, 2009. doi:10.1103/PhysRevLett.102.016402.
 [LZ08] Stephan Lany and Alex Zunger. Assessment of correction methods for the band-gap problem and for finite-size effects in supercell defect calculations: Case studies for ZnO and GaAs. Phys. Rev. B, 78:235104, 2008. doi:10.1103/PhysRevB.78.235104.
 [LBBjorkman+16] Kurt Lejaeghere, Gustav Bihlmayer, Torbjörn Björkman, Peter Blaha, Stefan Blügel, Volker Blum, Damien Caliste, Ivano E. Castelli, Stewart J. Clark, Andrea Dal Corso, Stefano de Gironcoli, Thierry Deutsch, John Kay Dewhurst, Igor Di Marco, Claudia Draxl, Marcin Dułak, Olle Eriksson, José A. Flores-Livas, Kevin F. Garrity, Luigi Genovese, Paolo Giannozzi, Matteo Giantomassi, Stefan Goedecker, Xavier Gonze, Oscar Gr\r anäs, E. K. U. Gross, Andris Gulans, François Gygi, D. R. Hamann, Phil J. Hasnip, N. A. W. Holzwarth, Diana Iuşan, Dominik B. Jochym, François Jollet, Daniel Jones, Georg Kresse, Klaus Koepernik, Emine Küçükbenli, Yaroslav O. Kvashnin, Inka L. M. Locht, Sven Lubeck, Martijn Marsman, Nicola Marzari, Ulrike Nitzsche, Lars Nordström, Taisuke Ozaki, Lorenzo Paulatto, Chris J. Pickard, Ward Poelmans, Matt I. J. Probert, Keith Refson, Manuel Richter, Gian-Marco Rignanese, Santanu Saha, Matthias Scheffler, Martin Schlipf, Karlheinz Schwarz, Sangeeta Sharma, Francesca Tavazza, Patrik Thunström, Alexandre Tkatchenko, Marc Torrent, David Vanderbilt, Michiel J. van Setten, Veronique Van Speybroeck, John M. Wills, Jonathan R. Yates, Guo-Xu Zhang, and Stefaan Cottenier. Reproducibility in density functional theory calculations of solids. Science, 2016. doi:10.1126/science.aad3000.
 [VandWalleN04] Chris G. Van de Walle and Jörg Neugebauer. First-principles calculations for defects and impurities: Applications to III-nitrides. J. Appl. Phys., 95:3851–3879, 2004. doi:10.1063/1.1682673.