Skip to content

Commit

Permalink
Revert "pre-commit auto-fixes"
Browse files Browse the repository at this point in the history
This reverts commit f6a7275.
  • Loading branch information
DanielYang59 committed Aug 5, 2024
1 parent 91b1ea6 commit 5a923af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/pymatgen/electronic_structure/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def get_band_filling(

# Only integrate up to Fermi level
energies = dos.energies - dos.efermi
return np.trapezoid(dos_densities[energies < 0], x=energies[energies < 0]) / np.trapezoid(
return np.trapz(dos_densities[energies < 0], x=energies[energies < 0]) / np.trapz(
dos_densities, x=energies
)

Expand Down Expand Up @@ -1101,7 +1101,7 @@ def get_n_moment(
p = energies

# Take the nth moment
return np.trapezoid(p**n * dos_densities, x=energies) / np.trapezoid(dos_densities, x=energies)
return np.trapz(p**n * dos_densities, x=energies) / np.trapz(dos_densities, x=energies)

def get_hilbert_transform(
self,
Expand Down
10 changes: 5 additions & 5 deletions src/pymatgen/phonon/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def csch2(x):
return 1.0 / (np.sinh(x) ** 2)

wd2kt = freqs / (2 * BOLTZ_THZ_PER_K * temp)
cv = np.trapezoid(wd2kt**2 * csch2(wd2kt) * dens, x=freqs)
cv = np.trapz(wd2kt**2 * csch2(wd2kt) * dens, x=freqs)
cv *= const.Boltzmann * const.Avogadro

if structure:
Expand Down Expand Up @@ -228,7 +228,7 @@ def entropy(self, temp: float | None = None, structure: Structure | None = None,
dens = self._positive_densities

wd2kt = freqs / (2 * BOLTZ_THZ_PER_K * temp)
entropy = np.trapezoid((wd2kt * 1 / np.tanh(wd2kt) - np.log(2 * np.sinh(wd2kt))) * dens, x=freqs)
entropy = np.trapz((wd2kt * 1 / np.tanh(wd2kt) - np.log(2 * np.sinh(wd2kt))) * dens, x=freqs)

entropy *= const.Boltzmann * const.Avogadro

Expand Down Expand Up @@ -263,7 +263,7 @@ def internal_energy(self, temp: float | None = None, structure: Structure | None
dens = self._positive_densities

wd2kt = freqs / (2 * BOLTZ_THZ_PER_K * temp)
e_phonon = np.trapezoid(freqs * 1 / np.tanh(wd2kt) * dens, x=freqs) / 2
e_phonon = np.trapz(freqs * 1 / np.tanh(wd2kt) * dens, x=freqs) / 2

e_phonon *= THZ_TO_J * const.Avogadro

Expand Down Expand Up @@ -298,7 +298,7 @@ def helmholtz_free_energy(self, temp: float | None = None, structure: Structure
dens = self._positive_densities

wd2kt = freqs / (2 * BOLTZ_THZ_PER_K * temp)
e_free = np.trapezoid(np.log(2 * np.sinh(wd2kt)) * dens, x=freqs)
e_free = np.trapz(np.log(2 * np.sinh(wd2kt)) * dens, x=freqs)

e_free *= const.Boltzmann * const.Avogadro * temp

Expand All @@ -325,7 +325,7 @@ def zero_point_energy(self, structure: Structure | None = None) -> float:
freqs = self._positive_frequencies
dens = self._positive_densities

zpe = 0.5 * np.trapezoid(freqs * dens, x=freqs)
zpe = 0.5 * np.trapz(freqs * dens, x=freqs)
zpe *= THZ_TO_J * const.Avogadro

if structure:
Expand Down

0 comments on commit 5a923af

Please sign in to comment.