partial_density

py4vasp.calculation.partial_density

(

  • 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.

py4vasp.PartialDensity.STM_settings

(

  • sigma_z: float = 4.0,
  • sigma_xy: float = 4.0,
  • truncate: float = 3.0,
  • enhancement_factor: float = 1000,
  • interpolation_factor: int = 10

)

Settings for the STM simulation.

enhancement_factor

: float = 1000
The enhancement factor for the output of the constant height STM image. The default is 1000.

interpolation_factor

: int = 10
The interpolation factor for the z-direction in case of constant current mode. The default is 10.

sigma_xy

: float = 4.0
The standard deviation of the Gaussian filter in the xy-plane. The default is 4.0.

sigma_z

: float = 4.0
The standard deviation of the Gaussian filter in the z-direction. The default is 4.0.

truncate

: float = 3.0
The truncation of the Gaussian filter. The default is 3.0.

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.

path

Returns the path from which the output is obtained.

plot

(*args, **kwargs) → View

Wrapper around to_view() method.

This method will visualize the quantity in the structure. Please refer to the to_view() method for a documentation of the allowed arguments.

Returns

View
A visualization of the quantity within the crystal structure.

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

() → dict

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. Some quantities provide additional elements which can be passed as selection for other routines.

Returns

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

stm_settings

: STM_settings
Return the default STM settings.

to_dict

() → dict

Store the partial charges in a dictionary.

Returns

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

to_ngl

(*args, **kwargs) → NGLWidget

Convert the view to an NGL widget.

This method wraps the to_view() method and converts the resulting View to an NGL widget. The to_view() method documents all the possible arguments of this function.

Returns

NGLWidget
A widget to display the structure and other quantities in the unit cell.

to_numpy

(

  • selection: str = ’total',
  • band: int = 0,
  • kpoint: int = 0

) → np.array

Return the partial charge density as a 3D array.

Parameters

selection: str = ’total'
The spin channel to be used. The default is “total”. The other options are “up” and “down”.
band: int = 0
The band index. The default is 0, which means that all bands are summed.
kpoint: int = 0
The k-point index. The default is 0, which means that all k-points are summed.

Returns

np.array
The partial charge density as a 3D array.

to_stm

(

  • selection: str = ‘constant_height’,
  • tip_height: float = 2.0,
  • current: float = 1.0,
  • supercell: int | ndarray = 2,
  • stm_settings: STM_settings = STM_settings()

) → Graph

Generate STM image data from the partial charge density.

Parameters

selection: str = ‘constant_height’
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 = 2.0
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 = 1.0
The tunneling current in nA. The default is 1. Only used in “constant_current” mode.
supercell: int | np.ndarray = 2
The supercell to be used for plotting the STM. The default is 2.
stm_settings: STM_settings = STM_settings()
Settings for the STM simulation concerning smoothening parameters and interpolation. The default is STM_settings().

Returns

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

to_vasp_viewer

(*args, **kwargs) → VASPViewerWidget

Convert the view to a VASP Viewer widget.

This method wraps the to_view() method and converts the resulting View to a VASP Viewer widget. The to_view() method documents all the possible arguments of this function.

Returns

VASPViewerWidget
A widget to display the structure and other quantities in the unit cell.

to_view

(

  • selection: str = ’total',
  • supercell: int | np.ndarray = None,
  • **user_options

) → View

Plot the selected partial density as a 3d isosurface within the structure.

Parameters

selection: str = ’total'
Can be total, up or down.
supercell: int | np.ndarray = None
If present the data is replicated the specified number of times along each direction.
**user_options
Further arguments with keyword that get directly passed on to the visualizer. Most importantly, you can set isolevel to adjust the value at which the isosurface is drawn.

Returns

View
Visualize an isosurface of the density within the 3d structure.