Skip to content

Commit

Permalink
tools: Remove DOS function
Browse files Browse the repository at this point in the history
* Not used
  • Loading branch information
wangenau committed Feb 9, 2024
1 parent 7c4e924 commit 9cdaea6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ v2.7.0 - Jan 19, 2024
- Small performance improvements, e.g, in Atoms object creation
- Experimental
- Smearing functionalities
- Density of states function

----

Expand Down
31 changes: 0 additions & 31 deletions eminus/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,34 +501,3 @@ def electronic_entropy(E, mu, kbT):
return 0
f = fermi_distribution(E, mu, kbT)
return f * np.log(f) + (1 - f) * np.log(1 - f)


def get_dos(epsilon, wk, spin=0, npts=201, width=0.1):
"""Calculate the total density of states.
Reference: https://gitlab.com/gpaw/gpaw/-/blob/master/gpaw/calculator.py
Args:
epsilon (ndarray): Eigenenergies.
wk (ndarray): Chemical energy or Fermi energy.
Keyword Args:
spin (int): Spin channel.
npts (int): Number of energy discretizations.
width (float): Gaussian width.
Returns:
tuple[ndarray, ndarray]: Eigenenergies and DOS.
"""
def delta(x, x0, width):
"""Gaussian of given width centered at x0."""
return np.exp(np.clip(-((x - x0) / width)**2, -100, 100)) / (np.sqrt(np.pi) * width)

energies = epsilon[:, spin].flatten()
emin = np.min(energies) - 5 * width
emax = np.max(energies) + 5 * width
e = np.linspace(emin, emax, npts)
dos_e = np.zeros(npts)
for e0, w in zip(energies, wk):
dos_e += w * delta(e, e0, width)
return e, dos_e

0 comments on commit 9cdaea6

Please sign in to comment.