vasppy.doscar module

class Doscar(filename: str, ispin: int = 2, lmax: int = 2, lorbit: int = 11, spin_orbit_coupling: bool = False, read_pdos: bool = True, species: List[str] | None = None)[source]

Bases: object

Contains all the data in a VASP DOSCAR file, and methods for manipulating this.

Create a Doscar object from a VASP DOSCAR file.

Parameters:
  • filename (str) – Filename of the VASP DOSCAR file to read.

  • (optional (species) – int): ISPIN flag. Set to 1 for non-spin-polarised or to 2 for spin-polarised calculations. Default = 2.

  • (optional – int): Maximum l angular momentum. (d=2, f=3). Default is 2.

  • (optional – int): The VASP LORBIT flag. (Default=11).

  • (optional – bool): Spin-orbit coupling (Default=False).

  • (optional – bool): Set to True to read the atom-projected density of states (Default=True).

  • (optional – list(str)): List of atomic species strings, e.g. [‘Fe’, ‘Fe’, ‘O’, ‘O’, ‘O’]. Default=None.

property number_of_channels: int
number_of_header_lines: int = 6
pdos_select(atoms: int | List[int] | None = None, spin: str | None = None, l: str | None = None, m: List[str] | None = None) ndarray[source]

Returns a subset of the projected density of states array.

Parameters:
  • atoms (int or list(int)) – Atom numbers to include in the selection. Atom numbers count from 1. Default is to select all atoms.

  • spin (str) – Select up or down, or both spin channels to include in the selection. Accepted options are ‘up’, ‘down’, and ‘both’. Default is to select both spins.

  • l (str) – Select one angular momentum to include in the selectrion. Accepted options are ‘s’, ‘p’, ‘d’, and ‘f’. Default is to include all l-values. Setting l and not setting m will return all projections for that angular momentum value.

  • m (list(str)) – Select one or more m-values. Requires l to be set. The accepted values depend on the value of l: l=’s’: Only one projection. Not set. l=’p’: One or more of [‘x’, ‘y’, ‘z’] l=’d’: One or more of [‘xy’, ‘yz’, ‘z2-r2’, ‘xz’, ‘x2-y2’] l=’f’: One or more of [‘y(3x2-y2)’, ‘xyz’, ‘yz2’, ‘z3’, ‘xz2’, ‘z(x2-y2)’, ‘x(x2-3y2)’]

Returns:

A 4-dimensional numpy array containing the selected pdos values. The array dimensions are [ atom_no, energy_value, lm-projection, spin ]

Return type:

np.array

pdos_sum(atoms: int | List[int] | None = None, spin: str | None = None, l: str | None = None, m: List[str] | None = None) ndarray[source]
plot_pdos(ax: Axes | None = None, to_plot: Dict[str, List[str]] | None = None, colors: Iterable | None = None, plot_total_dos: bool | None = True, xrange: Tuple[float, float] | None = None, ymax: float | None = None, scaling: Dict[str, Dict[str, float]] | None = None, split: bool = False, title: str | None = None, title_loc: str = 'center', labels: bool = True, title_fontsize: int = 16, legend_pos: str = 'outside') Figure[source]
process_header() None[source]
read_atomic_dos_as_df(atom_number: int) DataFrame[source]
read_header() None[source]
read_projected_dos() None[source]

Read the projected density of states data

read_total_dos() DataFrame[source]
pdos_column_names(lmax: int, ispin: int) List[str][source]