Skip to content

Commit

Permalink
Formatting and minor robustness update (materialsproject/pymatgen#4240)
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Dec 29, 2024
1 parent d3dac17 commit 45c4cd9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions doped/thermodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3714,23 +3714,23 @@ def get_e_h_concs(fermi_dos: FermiDos, fermi_level: float, temperature: float) -
# correct DOS integral) and better handle exponential overflows (by editing `f0` in `pymatgen`)
idx_mid_gap = int(fermi_dos.idx_vbm + (fermi_dos.idx_cbm - fermi_dos.idx_vbm) / 2)
e_conc: float = np.sum(
fermi_dos.tdos[idx_mid_gap:]
fermi_dos.tdos[max(idx_mid_gap, fermi_dos.idx_vbm + 1) :]
* f0(
fermi_dos.energies[idx_mid_gap:],
fermi_dos.energies[max(idx_mid_gap, fermi_dos.idx_vbm + 1) :],
fermi_level, # type: ignore
temperature,
)
* fermi_dos.de[idx_mid_gap:],
* fermi_dos.de[max(idx_mid_gap, fermi_dos.idx_vbm + 1) :],
axis=0,
) / (fermi_dos.volume * fermi_dos.A_to_cm**3)
h_conc: float = np.sum(
fermi_dos.tdos[: idx_mid_gap + 1]
fermi_dos.tdos[: min(idx_mid_gap, fermi_dos.idx_cbm - 1) + 1]
* f0(
-fermi_dos.energies[: idx_mid_gap + 1],
-fermi_dos.energies[: min(idx_mid_gap, fermi_dos.idx_cbm - 1) + 1],
-fermi_level, # type: ignore
temperature,
)
* fermi_dos.de[: idx_mid_gap + 1],
* fermi_dos.de[: min(idx_mid_gap, fermi_dos.idx_cbm - 1) + 1],
axis=0,
) / (fermi_dos.volume * fermi_dos.A_to_cm**3)

Expand Down Expand Up @@ -3923,11 +3923,11 @@ def _get_py_sc_fermi_dos_from_fermi_dos(
attribute is used.
nelect (int):
The total number of electrons in the system. If not provided, the
number of electrons will be taken from the FermiDos object (which
number of electrons will be taken from the ``FermiDos`` object (which
usually takes this value from the ``vasprun.xml(.gz)`` when parsing).
bandgap (float):
Band gap of the system in eV. If not provided, the band gap will be
taken from the FermiDos object. When this function is used internally
taken from the ``FermiDos`` object. When this function is used internally
in ``doped``, the ``DefectThermodynamics.band_gap`` attribute is used.
Returns:
Expand Down

0 comments on commit 45c4cd9

Please sign in to comment.