Name

calculateElectrostaticDifferencePotential Calculates the real-space electrostatic difference potential.

Synopsis

Namespace: ATK.KohnSham or ATK.TwoProbe
LocalPotential calculateElectrostaticDifferencePotential(self_consistent_calculation)

Description

Function that calculates and returns the real-space self-consistent electrostatic difference potential. This is defined as the solution to the Poisson equation where the electron density is the difference between the self-consistent density and the neutral atom density.

List of arguments

self_consistent_calculation

An object returned from a previously performed self-consistent calculation.

Default: None

Returned object methods

The returned object from calculateElectrostaticDifferencePotential() has the following two query methods:

  • Array toArray(): Returns the real-space representation of the electrostatic difference potential in a NumPy array with dimensions (n1,n2,n3) for a spin-unpolarized calculation and (2,n1,n2,n3) for a spin-polarized calculation with the spin-up component as the first entry.

  • PhysicalUnit toUnit(): Returns the unit of the electrostatic difference potential.

Usage examples

from ATK.KohnSham import *

configuration = ...
scf = executeSelfConsistentCalculation(...)
diff_pot = calculateElectrostaticDifferencePotential(scf)

f = VNLFile("results.vnl")
f.addToSample(configuration,"My sample")
f.addToSample(diff_pot,"My sample")

Notes

As shown in the example above, the returned object from this function can be placed in a VNL file, and then be visualized in the Nanoscope in Virtual NanoLab.

The dimension of the returned array is (2,n_1,n_2,n_3) for spin-polarized calculations and (n_1,n_2,n_3) otherwise. The size of the array, i.e. the numbers n_i (for i=1,2,3) depends on the mesh cut-off. The shape of the array can be obtained using the shape property, for example, in order to perform calculations using the raw data:

diff_pot_object = calculateElectrostaticDifferencePotential(scf)
diff_pot = diff_pot_object.toArray()
unit = diff_pot_object.toUnit()
array_shape = diff_pot.shape
print array_shape
(2,100,124,226)  # example output

The output example refers to a spin-polarized calculation, with a leading dimension of 2. Note that shape is an object property (i.e. there are no parentheses), and not an object method like toUnit().

The object returned from this function supports basic algebraic operations such as addition and subtraction. This, for example, makes it possible to calculate the difference in effective potential between two calculations using different approximations, as long as the arrays have the same size (i.e. the mesh cut-off is the same). (Naturally, the unit cell should also be the same, i.e. the atomic coordinates should not be different, but there is no active checking of this in ATK, since this information is not stored on the array object.) In this case, the neutral atom density contribution cancels out, the only contribution being the difference between the full electrostatic potentials. The result of the operation is still of the type LocalPotential and can be added to a VNL file as the following example illustrates:

method1 = KohnShamMethod(exchange_correlation_type=LDA.PZ)
method2 = KohnShamMethod(exchange_correlation_type=GGA.PBE)

scf1 = method1.apply(configuration)
scf2 = method2.apply(configuration)

effpot1 = calculateElectrostaticDifferencePotential(scf1)
effpot2 = calculateElectrostaticDifferencePotential(scf2)
diff = effpot1 - effpot2

f = VNLFile("results.vnl")
f.addToSample(diff,"My sample")