partial_charge

py4vasp.calculation.partial_charge
class py4vasp.calculation._partial_charge.PartialCharge(data_context, **kwargs)

Partial charges describe the fraction of the charge density in a certain energy, band, or k-point range.

Partial charges are produced by a post-processing VASP run after self-consistent convergence is achieved. They are stored in an array of shape (ngxf, ngyf, ngzf, ispin, nbands, nkpts). The first three dimensions are the FFT grid dimensions, the fourth dimension is the spin index, the fifth dimension is the band index, and the sixth dimension is the k-point index. Both band and k-point arrays are also saved and accessible in the .bands() and kpoints() methods. If ispin=2, the second spin index is the magnetization density (up-down), not the down-spin density. Since this is postprocessing data for a fixed density, there are no ionic steps to separate the data.

bands()

Return the band array listing the contributing bands.

[2,4,5] means that the 2nd, 4th, and 5th bands are contributing while [0] means that all bands are contributing.

kpoints()

Return the k-points array listing the contributing k-points.

[2,4,5] means that the 2nd, 4th, and 5th k-points are contributing with all weights = 1. [0] means that all k-points are contributing.

print()

Print a string representation of this instance.

read(*args, **kwargs)

Convenient wrapper around to_dict. Check that function for examples and optional arguments.

selections()

Returns possible alternatives for this particular quantity VASP can produce.

The returned dictionary contains a single item with the name of the quantity mapping to all possible selections. Each of these selection may be passed to other functions of this quantity to select which output of VASP is used.

Returns:

The key indicates this quantity and the values possible choices for arguments to other functions of this quantity.

Return type:

dict

to_dict()

Store the partial charges in a dictionary.

Returns:

The dictionary contains the partial charges as well as the structural information for reference.

Return type:

dict

to_numpy(selection='total', band=0, kpoint=0)

Return the partial charge density as a 3D array.

Parameters:
  • selection (str) – The spin channel to be used. The default is “total”. The other options are “up” and “down”.

  • band (int) – The band index. The default is 0, which means that all bands are summed.

  • kpoint (int) – The k-point index. The default is 0, which means that all k-points are summed.

Returns:

The partial charge density as a 3D array.

Return type:

np.array

to_stm(selection: str = 'constant_height', *, tip_height: float = 2.0, current: float = 1.0, supercell: int | array = 2, stm_settings: STM_settings = STM_settings(sigma_z=4.0, sigma_xy=4.0, truncate=3.0, enhancement_factor=1000, interpolation_factor=10)) Graph

Generate STM image data from the partial charge density.

Parameters:
  • selection (str) – The mode in which the STM is operated and the spin channel to be used. Possible modes are “constant_height”(default) and “constant_current”. Possible spin selections are “total”(default), “up”, and “down”.

  • tip_height (float) – The height of the STM tip above the surface in Angstrom. The default is 2.0 Angstrom. Only used in “constant_height” mode.

  • current (float) – The tunneling current in nA. The default is 1. Only used in “constant_current” mode.

  • supercell (int | np.array) – The supercell to be used for plotting the STM. The default is 2.

  • stm_settings (STM_settings) – Settings for the STM simulation concerning smoothening parameters and interpolation. The default is STM_settings().

Returns:

The STM image as a graph object. The title is the label of the Contour object.

Return type:

Graph