vasppy.procar module
- class KPoint(index, frac_coords, weight)[source]
Bases:
object- cart_coords(reciprocal_lattice)[source]
Convert the reciprocal fractional coordinates for this k-point to reciprocal Cartesian coordinates.
- Parameters:
reciprocal_lattice (np.array(float)) – 3x3 numpy array containing the Cartesian reciprocal lattice.
- Returns:
The reciprocal Cartesian coordinates of this k-point.
- Return type:
np.array
- class Procar(spin=1, negative_occupancies='warn')[source]
Bases:
objectObject for working with PROCAR data.
- data
A 5D numpy array that stores the projection data.
Axes are k-points, bands, spin-channels, ions and sum over ions, lm-projections.
- Type:
numpy.array(float)
- bands
A numpy array of
Bandobjects, that contain band index, energy, and occupancy data.- Type:
numpy.array(
Band)
- k_points
A numpy array of
KPointobjects, that contain fractional coordinates and weights for each k-point.- Type:
numpy.array(
KPoint)
- number_of_k_points
The number of k-points.
- Type:
int
- number_of_bands
The number of bands.
- Type:
int
- spin_channels
Number of spin channels in the PROCAR data:
1 for non-spin-polarised calculations.
2 for spin-polarised calculations.
4 for non-collinear calculations.
- Type:
int
- number_of_ions
The number of ions.
- Type:
int
- number_of_projections
The number of projections, e.g. TODO
- Type:
int
- calculation
Dictionary of True | False values describing the calculation type.
Dictionary keys are ‘non_spin_polarised’, ‘non_collinear’, and ‘spin_polarised’.
- Type:
dict
- property bands
- effective_mass_calc(k_point_indices, band_index, reciprocal_lattice, spin=1, printing=False)[source]
- classmethod from_file(filename, negative_occupancies='warn', select_zero_weighted_k_points=False)[source]
Create a
Procarobject by reading the projected wavefunction character of each band from a VASPPROCARfile.- Parameters:
filename (str) – Filename of the
PROCARfile.negative_occupancies (
Str, optional) –Select how negative occupancies are handled. Options are:
warn(default): Warn that some partial occupancies are negative.raise: Raise an AttributeError.ignore: Do nothing.zero: Negative partial occupancies will be set to zero.
select_zero_weighted_k_points (
bool, optional) – Set toTrueto only read in zero-weighted k-points from thePROCARfile. Default isFalse.
- Returns:
(
vasppy.Procar)
- classmethod from_files(filenames, **kwargs)[source]
Create a
Procarobject by reading the projected wavefunction character of each band from a series of VASPPROCARfiles.Useful when e.g. a band-structure calculation has been split over multiple VASP calculations, for example, when using hybrid functionals.
- Parameters:
filename (str) – Filename of the
PROCARfile.**kwargs – See the
from_file()method for a description of keyword arguments.
- Returns:
(
vasppy.Procar)
- property k_points
- property occupancy
- print_weighted_band_structure(spins=None, ions=None, orbitals=None, scaling=1.0, e_fermi=0.0, reciprocal_lattice=None)[source]
- weighted_band_structure(spins=None, ions=None, orbitals=None, scaling=1.0, e_fermi=0.0, reciprocal_lattice=None)[source]
- x_axis(reciprocal_lattice: ndarray | None = None) ndarray[source]
Generate the x-axis values for a band-structure plot.
Returns an array of cumulative distances in reciprocal space between sequential k-points.
- Parameters:
reciprocal_lattice (
np.array, optional) – 3x3 Cartesian reciprocal lattice. Default isNone. If no reciprocal lattice is provided, the returned x-axis values will be sequential integers, giving even spacings between sequential k-points.- Returns:
An array of x-axis values.
- Return type:
np.array
- area_of_a_triangle_in_cartesian_space(a: ndarray, b: ndarray, c: ndarray) float[source]
Returns the area of a triangle defined by three points in Cartesian space.
- Parameters:
a (np.array) – Cartesian coordinates of point A.
b (np.array) – Cartesian coordinates of point B.
c (np.array) – Cartesian coordinates of point C.
- Returns:
the area of the triangle.
- Return type:
float
- k_point_parser(string: str) list[KPoint][source]
Parse k-point data from a PROCAR string.
Finds all lines of the form:
k-point 1 : 0.50000000 0.25000000 0.75000000 weight = 0.00806452
and extracts the k-point index, reciprocal fractional coordinates, and weight into a
procar.KPointobject.- Parameters:
string (str) – String containing a full PROCAR file.
- Returns:
A list of
procar.KPointobjects.- Return type:
list(
procar.KPoint)
- least_squares_effective_mass(cartesian_k_points: ndarray, eigenvalues: ndarray) float[source]
Calculate the effective mass using a least squares quadratic fit.
- Parameters:
cartesian_k_points (np.array) – Cartesian reciprocal coordinates for the k-points.
eigenvalues (np.array) – Energy eigenvalues at each k-point to be used in the fit.
- Returns:
The fitted effective mass.
- Return type:
float
- Raises:
ValueError – If the k-points do not sit on a straight line.
- points_are_in_a_straight_line(points, tolerance=1e-07)[source]
Check whether a set of points fall on a straight line. Calculates the areas of triangles formed by triplets of the points. Returns False is any of these areas are larger than the tolerance.
- Parameters:
points (list(np.array)) – list of Cartesian coordinates for each point.
(optional (tolerance) – float): the maximum triangle size for these points to be considered colinear. Default is 1e-7.
- Returns:
True if all points fall on a straight line (within the allowed tolerance).
- Return type:
(bool)
- two_point_effective_mass(cartesian_k_points: ndarray, eigenvalues: ndarray) float[source]
Calculate the effective mass given eigenvalues at two k-points.
Reimplemented from Aron Walsh’s original effective mass Fortran code.
- Parameters:
cartesian_k_points (np.array) – 2D numpy array containing the k-points in (reciprocal) Cartesian coordinates.
eigenvalues (np.array) – numpy array containing the eigenvalues at each k-point.
- Returns:
The effective mass.
- Return type:
float