Skip to content

Commit f3e7f9a

Browse files
Hotfix to allow multiple smearing factors when calculating DOS from eigenvalues
1 parent 171bd33 commit f3e7f9a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

mala/targets/dos.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,12 @@ def read_from_qe_out(self, path=None, smearing_factor=2):
502502
Path to the QE out file. If None, the QE output that was loaded
503503
via read_additional_calculation_data will be used.
504504
505-
smearing_factor : int
505+
smearing_factor : int or List
506506
Smearing factor relative to the energy grid spacing. Default is 2.
507+
If list, DOS splitting is assumed. In this case, the length
508+
of the list must be consistent with the length of
509+
parameters.targets.ldos_gridspacing_ev, which is a list in this
510+
case as well.
507511
508512
Returns
509513
-------
@@ -525,9 +529,16 @@ def read_from_qe_out(self, path=None, smearing_factor=2):
525529
if isinstance(self.parameters.ldos_gridspacing_ev, list):
526530
grid_spacings = self.parameters.ldos_gridspacing_ev
527531
grid_sizes = self.parameters.ldos_gridsize
532+
_smearing_factors = smearing_factor
533+
if len(_smearing_factors) != len(grid_spacings):
534+
raise Exception(
535+
"Length of smearing factor list must be consistent with "
536+
"the length of the grid spacing list."
537+
)
528538
else:
529539
grid_spacings = [self.parameters.ldos_gridspacing_ev]
530540
grid_sizes = [self.parameters.ldos_gridsize]
541+
_smearing_factors = [smearing_factor]
531542

532543
# Get the gaussians for all energy values and calculate the DOS per
533544
# band.
@@ -543,7 +554,7 @@ def read_from_qe_out(self, path=None, smearing_factor=2):
543554
atoms_object.get_calculator()
544555
.band_structure()
545556
.energies[0, :, :],
546-
smearing_factor * grid_spacing,
557+
_smearing_factors[spacing_idx] * grid_spacing,
547558
)
548559
dos_per_band = kweights[:, np.newaxis, np.newaxis] * dos_per_band
549560

0 commit comments

Comments
 (0)