Skip to content

Commit

Permalink
Merge pull request #169 from SMTG-UCL/fix-bandstats
Browse files Browse the repository at this point in the history
Fix k-point indicies in sumo-bandstats
  • Loading branch information
utf authored Jul 14, 2022
2 parents 7a7e44f + 31d8f4d commit e95398b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log
==========

Unreleased
----------

Bugfixes:

- `sumo-bandstats` now reports the correct k-point indices for the VBM and CBM.


v2.3.1
------

Expand Down
2 changes: 1 addition & 1 deletion sumo/cli/bandstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def bandstats(
vr = BSVasprun(vr_file, parse_projected_eigen=False)
bs = vr.get_band_structure(line_mode=True)
bandstructures.append(bs)
bs = get_reconstructed_band_structure(bandstructures)
bs = get_reconstructed_band_structure(bandstructures, force_kpath_branches=False)

if bs.is_metal():
logging.error("ERROR: System is metallic!")
Expand Down
9 changes: 7 additions & 2 deletions sumo/electronic_structure/bandstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get_projections(bs, selection, normalise=None):
return spec_proj


def get_reconstructed_band_structure(list_bs, efermi=None):
def get_reconstructed_band_structure(list_bs, efermi=None, force_kpath_branches=True):
"""Combine a list of band structures into a single band structure.
This is typically very useful when you split non self consistent
Expand All @@ -210,6 +210,8 @@ def get_reconstructed_band_structure(list_bs, efermi=None):
efermi (:obj:`float`, optional): The Fermi energy of the reconstructed
band structure. If `None`, an average of all the Fermi energies
across all band structures is used.
force_kpath_branches (bool): Force a linemode band structure to contain
branches by adding repeated high-symmetry k-points in the path.
Returns:
:obj:`pymatgen.electronic_structure.bandstructure.BandStructure` or \
Expand Down Expand Up @@ -244,7 +246,10 @@ def get_reconstructed_band_structure(list_bs, efermi=None):
structure=list_bs[0].structure,
projections=projections,
)
return force_branches(bs)
if force_kpath_branches:
return force_branches(bs)
else:
return bs


def force_branches(bandstructure):
Expand Down

0 comments on commit e95398b

Please sign in to comment.