aiida_vasp.utils.bands#
Utils for bands structures.
Utilities for working with band structures. Currently this is legacy and will be rewritten or moved.
Module Contents#
Functions#
Get the dimensions from the bands array of a BandsData node. |
|
Get Kpoint labels with their x-positions in matplotlib compatible format. |
|
Get the fermi energy from a finished calculation. |
|
Use matplotlib to plot the bands stored in a BandsData node. |
|
Plot a bandstructure node using matplotlib. |
API#
- aiida_vasp.utils.bands.get_bs_dims(bands_array: numpy.ndarray) tuple[int, int, int][source]#
Get the dimensions from the bands array of a BandsData node.
- Parameters:
bands_array (numpy.array) – an array with bands as stored in an array.bands data node
- Returns:
a tuple containing num_bands, num_kp, num_spins. if the array is only 2d, num_spins = 0
- Rtype tuple:
- aiida_vasp.utils.bands.get_kp_labels(bands_node: aiida.orm.BandsData, kpoints_node: aiida.orm.KpointsData | None = None) tuple[list[int], list[str]][source]#
Get Kpoint labels with their x-positions in matplotlib compatible format.
A KpointsData node can optionally be given to fall back to if no labels are found on the BandsData node. The caller is responsible for ensuring the nodes match. This should be the case if you take the kpoints from the input and the bands from the output of a calculation node.
- Parameters:
bands_node (BandsData) – The BandsData node will be searched labels first
kpoints_node (KpointsData) – The optional KpointsData node will be searched only if no labels are present on the BandsData node. No consistency checks are performed.
- Returns:
(kpx, kpl), the x-coordinates and text labels
- Return type:
- Raises:
AttributeError – if neither of the given nodes have a labels attribute
- aiida_vasp.utils.bands.get_efermi(calc: aiida.orm.CalcJobNode) float | None[source]#
Get the fermi energy from a finished calculation.
- aiida_vasp.utils.bands.get_kp_node(calc: aiida.orm.CalcJobNode) aiida.orm.KpointsData | None[source]#
- aiida_vasp.utils.bands.plot_bstr(bands_node: aiida.orm.BandsData, kpoints_node: aiida.orm.KpointsData | None = None, title: str | None = None, efermi: float | None = None, use_parent_calc: bool = False, **kwargs: Any)[source]#
Use matplotlib to plot the bands stored in a BandsData node.
A KpointsData node can optionally be given as a fallback for kpoint labels. The caller is responsible for giving a node with matching labels (as in they are in/out nodes of the same calculation).
- Parameters:
bands_node (BandsData) – The BandsData node will be searched labels first
kpoints_node (KpointsData) – The optional KpointsData node will be searched only if no labels are present on the BandsData node. No consistency checks are performed.
- Returns:
the matplotlib figure containing the plot