Skip to content

Commit

Permalink
made compatible with WFstorage of irrep
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepan Tsirkin committed Apr 20, 2022
1 parent 7c07ca8 commit 77550ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions banduppy/unfolding_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from irrep.bandstructure import BandStructure
if irrep.__version__ <"1.6.2" :
raise ImportError("A critical bug was found in irrep-1.6.1, which caused incorrect results for unfolding with spin-orbit. Please ipdate irrep to 1.6.2 or newer (when available)")
if irrep.__version__ <"1.7" :
raise ImportError("this version of banduppy is compatible only with irrep>=1.7")

from collections import Iterable

Expand Down Expand Up @@ -49,7 +51,7 @@ def print_PBZ_SBZ(self):
j= self.kpointsPBZ_unique_index_SBZ[self.kpointsPBZ_index_in_unique[i]]
print (i,kp,j,self.kpointsSBZ[j])

def unfold(self,bandstructure,suffix="",write_to_file=True):
def unfold(self,bandstructure,suffix="",write_to_file=True,saveWF=False):
# first evaluate the path as line ad store it
if len(suffix)>0 :
suffix = "-"+suffix
Expand All @@ -67,7 +69,7 @@ def unfold(self,bandstructure,suffix="",write_to_file=True):
for ik,kpPBZu in enumerate(self.kpointsPBZ_unique):
jk=self.kpointsPBZ_unique_index_SBZ[ik]
if jk in kpSBZcalc:
unfolded_unique[ik]=kpSBZcalc[jk].unfold(supercell=self.supercell,kptPBZ=kpPBZu)
unfolded_unique[ik]=kpSBZcalc[jk].unfold(supercell=self.supercell,kptPBZ=kpPBZu,saveWF=saveWF)
unfolded_found={}
for ik,kpt in enumerate(self.kpointsPBZ):
jk=self.kpointsPBZ_index_in_unique[ik]
Expand Down Expand Up @@ -123,7 +125,7 @@ def __init__(self,supercell=np.eye(3,dtype=int),pathPBZ=[],nk=11,labels=None):
assert start.shape==end.shape==(3,)
kpointsPBZ=np.vstack( (kpointsPBZ,start[None,:]+np.linspace(0,1.,next(nkgen))[:,None]*(end-start)[None,:] ) )
self.i_labels[kpointsPBZ.shape[0]-1]=l2
super(UnfoldingPath,self).__init__(supercell,kpointsPBZ)
super().__init__(supercell,kpointsPBZ)


@property
Expand All @@ -134,9 +136,9 @@ def path_str(self):
result.append("{:10.6f} {:8s} {:12.8f} {:12.8f} {:12.8f}".format(kl[0],kl[1],n[0],n[1],n[2]))
return "".join("# "+l+"\n" for l in result)

def unfold(self,bandstructure,break_thresh=0.1,suffix=""):
def unfold(self,bandstructure,break_thresh=0.1,suffix="",saveWF=False):
# first evaluate the path as line ad store it
super(UnfoldingPath,self).unfold(bandstructure,write_to_file=False)
super().unfold(bandstructure,write_to_file=False,saveWF=saveWF)
if len(suffix)>0 :
suffix = "-"+suffix
self.kpline=bandstructure.KPOINTSline(kpred=self.kpointsPBZ,breakTHRESH=break_thresh)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
description="BandUPpy: Python interfaceof the BandUP code",
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=['numpy', 'scipy >= 1.0', 'matplotlib' ,'irrep>=1.6.2'],
install_requires=['numpy', 'scipy >= 1.0', 'matplotlib' ,'irrep>=1.7'],
url="https://www.ifm.liu.se/theomod/compphys/band-unfolding/",
packages=setuptools.find_packages(),
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions tutorials/QE-noSOC/run_banduppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
bands=banduppy.BandStructure(code="espresso", prefix="bulk_Si")
pickle.dump(bands,open("bandstructure.pickle","wb"))

unfold_path.unfold(bands,break_thresh=0.1,suffix="path")
unfold.unfold(bands,suffix="GL")
unfold_path.unfold(bands,break_thresh=0.1,suffix="path",saveWF=True)
unfold.unfold(bands,suffix="GL",saveWF=True)
pickle.dump(unfold_path,open("unfold-path.pickle","wb"))
pickle.dump(unfold,open("unfold.pickle","wb"))

Expand Down

0 comments on commit 77550ce

Please sign in to comment.