vasp_dos

The get_data_path function

get_data_path()[source]

Get default paths to package data.

Returns

data_path – path to package data

Return type

str

The get_example_data function

get_example_data()[source]

Get default path to vasp_dos data

Returns

data_path – path to example VASP data

Return type

str

The get_all_VASP_files function

get_all_VASP_files(directory)[source]

Get all DOSCAR and CONTCAR file paths

Parameters

directory (str) – root directory to look for DOSCAR files

Returns

  • DOSCAR_files (list) – list of all DOSCAR files

  • CONTCAR_files (list) – list of all CONTCAR files

The get_band_center function

get_band_center(energies, densities, max_energy=None, min_energy=None, axis=- 1)[source]

Get band center given energies and densities

Parameters
  • energies (numpy.ndarray) – discretized orbital energies

  • densities (numpy.ndarray) – projected state densities

  • max_energy (float) – cutoff energy (often the fermi energy)

  • min_energy (float) – cutoff energy (often the fermi energy)

  • axis (int) – axis of densities on which to integrate

Returns

band_center – center of the band(s) up to max_energy

Return type

numpy.float64 or numpy.ndarray

Notes

trapezoidal rule is better for narrow gaussian peaks and for “rough” functions https://doi.org/10.1016/j.chemolab.2018.06.001 http://emis.icm.edu.pl/journals/JIPAM/v3n4/031_02.html

The get_bond_energy function

get_bond_energy(energies, densities, e_fermi)[source]

Get bond energy from density

Parameters
  • energies (numpy.ndarray) – discretized orbital energies

  • densities (numpy.ndarray) – projected state densities

  • e_fermi (float) – highest occupied energy level

Returns

bond_energy – total energy in the bonds

Return type

numpy.float64 or numpy.ndarray

The get_band_width function

get_band_width(energies, densities, fraction=0)[source]

Get band width given energies and densities

Parameters
  • energies (numpy.ndarray) – discretized orbital energies

  • densities (numpy.ndarray) – projected state densities

  • fraction (float) – maximum projected density considered part of a band

Returns

band_width – width of the band(s)

Return type

numpy.float64 or numpy.ndarray

The get_orbital_proximity function

get_orbital_proximity(energies, densities, energy, moment=1)[source]

Get width between to band centers given a division

Parameters
  • energies (numpy.ndarray) – discretized orbital energies

  • densities (numpy.ndarray) – projected state densities

  • energy (int) – some energy with which the proximity of states is calculated

  • moment (int) – moment with which to calculate the orbital proximity

Returns

orbital_proximity – proximity of orbitals to some energy

Return type

numpy.float64 or numpy.ndarray

The get_second_moment function

get_second_moment(energies, densities)[source]

Get the second moment

Parameters
Returns

second_moment – second moment of the densities

Return type

numpy.float64 or numpy.ndarray

Notes

Utilizeds get_orbital_proximity

The get_filling function

get_filling(energies, densities, max_energy=None, min_energy=None, axis=- 1)[source]

Get band center given energies and densities

Parameters
  • energies (numpy.ndarray) – discretized orbital energies

  • densities (numpy.ndarray) – projected state densities

  • max_energy (float) – cutoff energy (often the fermi energy)

  • min_energy (float) – cutoff energy (often the fermi energy)

  • axis (int) – axis of densities on which to integrate

Returns

Integrated_Filling – Total filling between min and max energy

Return type

float or numpy.ndarray

Notes

trapezoidal rule is better for narrow gaussian peaks and for “rough” functions https://doi.org/10.1016/j.chemolab.2018.06.001 http://emis.icm.edu.pl/journals/JIPAM/v3n4/031_02.html

The VASP_DOS class

class VASP_DOS(file_name='DOSCAR', no_negatives=True, add_p2s=False)[source]

Class for extracting projected density of states from VASP

Parameters
  • file_name (str) – full DOSCAR file location

  • no_negatives (bool) – Indicates wheather negative occupances will be converted to zero. Negative occupances can occur if Methfessel-Paxton is used.

Variables
  • no_negatives (bool) – Indicates wheather negative occupances will be converted to zero. Negative occupances can occur if Methfessel-Paxton is used.

  • natoms (int) – number of atoms in the system

  • emax (float) – maximum energy level

  • emin (float) – minimum energy level

  • ndos (int) – number of descritized energy levels

  • e_fermi (float) – highest occupied energy level

  • is_spin (bool) – indicates if projected density is spin resolved

  • m_projected (bool) – indicates if projected density is orbital resolved

  • orbital_dictionary (dict) – dictionary that maps resolved sublevels/orbitals to indices

  • add_p2s (bool) – if true adds the p density to the s density (useful for metals)

Methods

_read_doscar(file_name='DOSCAR', no_negatives=True)[source]

Read VASP DOSCAR and extract projected densities

Parameters
  • file_name (str) – file location of the DOSCAR file

  • no_negatives (bool) – Indicates wheather negative occupances will be converted to zero. Negative occupances can occur if Methfessel-Paxton is used.

Variables
  • _total_dos (numpy.ndarray) – numpy array that contains the energy of the orbitals and the total projected and integrated density

  • _site_dos (numpy.ndarray) – numpy array that contains the energy of the orbitals and the site and orbital projected density of states. Only available if a site projected calculation was performed.

Returns

  • emax (float) – maximum energy level

  • emin (float) – minimum energy level

  • ndos (int) – number of descritized energy levels

  • e_fermi (float) – highest occupied energy level

  • is_spin (bool) – indicates if projected density is spin resolved

  • m_projected (bool) – indicates if projected density is orbital resolved

  • orbital_dictionary (dict) – dictionary that maps resolved sublevels/orbitals to indices

_read_lobster(file_name='DOSCAR.lobster', no_negatives=True)[source]

Read VASP DOSCAR and extract projected densities

Parameters
  • file_name (str) – file location of the DOSCAR file

  • no_negatives (bool) – Indicates wheather negative occupances will be converted to zero. Negative occupances can occur if Methfessel-Paxton is used.

Variables
  • _total_dos (numpy.ndarray) – numpy array that contains the energy of the orbitals and the total projected and integrated density

  • _site_dos (numpy.ndarray) – numpy array that contains the energy of the orbitals and the site and orbital projected density of states. Only available if a site projected calculation was performed.

Returns

  • emax (float) – maximum energy level

  • emin (float) – minimum energy level

  • ndos (int) – number of descritized energy levels

  • e_fermi (float) – highest occupied energy level

  • is_spin (bool) – indicates if projected density is spin resolved

  • m_projected (bool) – indicates if projected density is orbital resolved

  • orbital_dictionary (dict) – dictionary that maps resolved sublevels/orbitals to indices

apply_gaussian_filter(sigma)[source]

Applies Gaussian filter to self._total_dos and self._site_dos

Parameters

sigma (float) – standard deviation of Gaussian Kernel

Variables
  • _total_dos_original (numpy.ndarray) – self._total_dos array without filter

  • _site_dos_original (numpy.ndarray) – self._site_dos array without filter

get_band_center(atom_indices, orbital_list, sum_density=False, sum_spin=True, max_energy=None, min_energy=None, axis=- 1)[source]

Get band center for a given atom and list of orbitals

Parameters
  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

  • max_energy (float) – cutoff energy (often the fermi energy)

  • min_energy (float) – cutoff energy (often the fermi energy)

  • axis (int) – axis of densities on which to integrate

Returns

band_center – center of the band(s) up to max_energy

Return type

float or numpy.ndarray

get_band_width(atom_indices, orbital_list, sum_density=False, sum_spin=True, fraction=0)[source]

Get band width given energies and densities

Parameters
  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

  • fraction (float) – maximum projected density considered part of a band

Returns

band_width – width of the band(s)

Return type

float or numpy.ndarray

get_bond_energy(atom_indices, orbital_list, sum_density=False, sum_spin=True)[source]

Get second moment of the density projected onto atomic orbitals

Parameters
  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

Returns

bond_energy – bond enegy of the orbitals on atom_indices

Return type

float or numpy.ndarray

get_center_width(energy, atom_indices, orbital_list, sum_density=False, sum_spin=True)[source]

Get width between to band centers given a division

Parameters
  • energy (int) – energy that divides band centers

  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

Returns

center_width – width of two band centers separated by some ennergy

Return type

float or numpy.ndarray

get_energies()[source]

method for obtaining energy levels

Returns

energies – 1-D array of energies

Return type

numpy.ndarray

get_filling(atom_indices, orbital_list, sum_density=False, sum_spin=True, max_energy=None, min_energy=None, axis=- 1)[source]

Get band center for a given atom and list of orbitals

Parameters
  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

  • max_energy (float) – cutoff energy (often the fermi energy)

  • min_energy (float) – cutoff energy (often the fermi energy)

  • axis (int) – axis of densities on which to integrate

Returns

band_center – center of the band(s) up to max_energy

Return type

float or numpy.ndarray

get_integrated_dos(sum_spin=True)[source]

method for obtaining total integrated density of states

Returns

integrated_dos – 1-D or 2-D array of state integrated densities

Return type

numpy.ndarray

get_orbital_proximity(energy, atom_indices, orbital_list, moment=1, sum_density=False, sum_spin=True)[source]

Get width between to band centers given a division

Parameters
  • energy (int) – some energy with which the proximity of states is calculated

  • moment (int) – moment with which to calculate the orbital proximity

  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

Returns

orbital_proximity – proximity of orbitals to some energy

Return type

float or numpy.ndarray

get_second_moment(atom_indices, orbital_list, sum_density=False, sum_spin=True)[source]

Get second moment of the density projected onto atomic orbitals

Parameters
  • atom_indices (list[int]) – list of atom indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual sub-level densities should be summed

  • sum_spin (bool) – different spin densities are summed.

Returns

second_moment – width of two band centers separated by some ennergy

Return type

float or numpy.ndarray

get_site_dos(atom_indices, orbital_list=[], sum_density=False, sum_spin=True)[source]

Return an NDOSxM array with dos for the chosen atom and orbital(s).

Parameters
  • atom_list (list[int]) – List of atom index/indices

  • orbital_list (list[str]) – Which orbitals to return

  • sum_density (bool) – if a sub-level is provided instead of an orbital, sum_density indicates if the individual orbital densities should be summed

  • sum_spin (bool) – different spin densities are summed.

Returns

  • new_orbital_list (list[str]) – If sum_density is True, new_orbital_list is the same as orbital_list. If sum_density is False, new_orbital_list is resolved by both orbital and spin (if available)

  • projected_density (np.array) – Array of shape (len(new_orbital_list), ndos)

get_total_dos(sum_spin=True)[source]

method for obtaining total density of states

Returns

total_dos – 1-D or 2-D array of state densities

Return type

numpy.ndarray