bandgap

py4vasp.calculation.bandgap

(*args, **kwargs)

This class describes the band extrema during the relaxation or MD simulation.

The bandgap represents the energy difference between the highest energy electrons in the valence band and the lowest energy electrons in the conduction band of a material. The fundamental gap occurs between the energy states of electrons in the valence and conduction bands irrespective of the k point. In contrast, the direct gap means that transition from valence to conduction band does not change the k momentum.

To study bandgap the extrema of the valence and conduction band play an important role. This class reports the valence band maximum as well as the conduction band minimum. For collinear calculations (ISPIN = 2) all values are reported separately for both spins as well as ignoring the spin. This simplifies comparison to experimental data, where the transitions either conserve the spin or not.

Examples

If you access a method of this class, the result will depend on the steps that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.read()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].read()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].read()
>>> calculation.bandgap[1:6].read()

conduction_band_minimum

() → np.ndarray

Return the conduction band minimum.

Returns

np.ndarray
The value of the conduction band minimum for all selected steps.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.conduction_band_minimum()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].conduction_band_minimum()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].conduction_band_minimum()
>>> calculation.bandgap[1:6].conduction_band_minimum()

direct

() → np.ndarray

Return the direct bandgap.

The direct bandgap is the minimal distance between a valence and conduction band at a single k point and for a single spin.

Returns

np.ndarray
The value of the bandgap for all selected steps.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.direct()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].direct()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].direct()
>>> calculation.bandgap[1:6].direct()

fundamental

() → np.ndarray

Return the fundamental bandgap.

The fundamental bandgap is between the maximum of the valence band and the minimum of the conduction band.

Returns

np.ndarray
The value of the bandgap for all selected steps.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.fundamental()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].fundamental()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].fundamental()
>>> calculation.bandgap[1:6].fundamental()

path

Returns the path from which the output is obtained.

plot

(*args, **kwargs)

Almost same as the to_graph() function.

All arguments will be passed to to_graph. If the to_graph() would produce multiple graphs this method will merge them into a single one.

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.

to_csv

(

  • *args,
  • filename: str | Path = None,
  • **kwargs

)

Writes the data to a csv file.

Writes out a csv file for data stored in a dataframe generated with the to_frame() method. Useful for creating external plots for further analysis.

If no filename is provided a default filename is deduced from the name of the class.

Note that the filename must be a keyword argument, i.e., you explicitly need to write filename=”name_of_file” because the arguments are passed on to the to_graph() method. Please check the documentation of that method to learn which arguments are allowed.

Parameters

filename: str | Path = None
Name of the csv file which the data is exported to.

to_dict

() → dict

Read the bandgap data from a VASP relaxation or MD trajectory.

Returns

dict
Contains the fundamental and direct gap as well as the coordinates of the k points where the relevant points in the band structure are.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.to_dict()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].to_dict()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].to_dict()
>>> calculation.bandgap[1:6].to_dict()

to_frame

(*args, **kwargs) → Dataframe

Convert data to pandas dataframe.

This will first convert use the to_graph() method to convert to a Graph. All arguments are passed to that method. The resulting graph is then converted to a dataframe.

Returns

Dataframe
Pandas dataframe corresponding to data in the graph

to_graph

(selection: str = ‘fundamental, direct’) → Graph

Plot the direct and fundamental bandgap along the trajectory.

Parameters

selection: str = ‘fundamental, direct’
Select which bandgap to include in the plot. By default the fundamental and the direct one are included. In spin-polarized calculations, you can also select up or down to obtain the bandgap without spin flips.

Returns

Graph
Figure with the ionic step on the x axis and the value of the bandgap on the y axis.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.to_graph()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].to_graph()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].to_graph()
>>> calculation.bandgap[1:6].to_graph()

to_image

(

  • *args,
  • filename = None,
  • **kwargs

)

Read the data and generate an image writing to the given filename.

The filetype is automatically deduced from the filename; possible are common raster (png, jpg) and vector (svg, pdf) formats. If no filename is provided a default filename is deduced from the name of the class and the picture has png format.

Note that the filename must be a keyword argument, i.e., you explicitly need to write filename=”name_of_file” because the arguments are passed on to the to_graph() method. Please check the documentation of that method to learn which arguments are allowed.

to_plotly

(*args, **kwargs)

Produces a graph and convertes it to a plotly figure.

The arguments to this function are passed on to the to_graph() method. Takes the resulting graph and converts it to a plotly figure.

valence_band_maximum

() → np.ndarray

Return the valence band maximum.

Returns

np.ndarray
The value of the valence band maximum for all selected steps.

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calculation.bandgap.valence_band_maximum()

To select the results for all steps, you don’t specify the array boundaries.

>>> calculation.bandgap[:].valence_band_maximum()

You can also select specific steps or a subset of steps as follows

>>> calculation.bandgap[5].valence_band_maximum()
>>> calculation.bandgap[1:6].valence_band_maximum()