Function that calculates and returns the self-consistent real-space electron density.
List of arguments
An object returned from a previously performed self-consistent calculation.
Default:
None
The returned object from calculateElectronDensity() has the following two query methods:
Array toArray()
: Returns
the real-space representation of the electron density in a NumPy array with
dimension
(n1,n2,n3)
for a spin-unpolarized calculation and
(2,n1,n2,n3)
for a spin-polarized calculation where the spin-up components are the first
entry.
PhysicalUnit toUnit()
:
Returns the unit of the electron density.
from ATK.KohnSham import * atomic_configuration = ... self_consistent_calculation = KohnShamMethod().apply(atomic_configuration) electron_density = calculateElectronDensity(self_consistent_calculation) f.addToSample(configuration,"My sample") f.addToSample(electron_density,"My sample")
By default ATK uses (norm-conserving) pseudo-potentials for all supported elements.
Therefore, the electron density calculated by calculateElectronDensity() is the one which includes only
the valence
electrons.
As shown in the example above, the returned object from this function can be placed in a VNL file, which may then be visualized in the Nanoscope in Virtual NanoLab.
The dimension of the returned array is for
spin-polarized calculations and
otherwise. The size of
the array, i.e. the numbers
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:
electron_density = calculateElectronDensity(self_consistent_calculation) electron_density_array = electron_density.toArray() unit = electron_density.toUnit() array_shape = electron_density_array.shape print array_shape (2,100,124,226) # example output
The output example refers to a spin-polarized calculation, where the leading
dimension thus is 2. Note that shape
is a property
(i.e. there are no parentheses), and not a method like
toUnit()
!