Commit ede869ef authored by Pardini, Lorenzo (lopa)'s avatar Pardini, Lorenzo (lopa)
Browse files

fixed small bug in bandstructure and GW

parent d35be7b3
......@@ -21,7 +21,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
def endDocument(self):
self.inBand = False
self.backend.closeSection("section_k_band",self.bandSectionGIndex)
self.backend.closeSection("section_k_band_segment",self.normBandSectionGIndex)
# self.backend.closeSection("section_k_band_segment",self.normBandSectionGIndex)
self.bandSectionGIndex = -1
self.normBandSectionGIndex = -1
......@@ -29,7 +29,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
if name == "bandstructure":
self.bandSectionGIndex = self.backend.openSection("section_k_band")
self.backend.addValue("band_structure_kind","electronic")
self.normBandSectionGIndex = self.backend.openSection("section_k_band_segment")
# self.normBandSectionGIndex = self.backend.openSection("section_k_band_segment")
self.inBand = True
elif name == "band":
self.energy.append([])
......@@ -146,6 +146,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
self.bandEnergies[0][i].append(self.energySpin[0][i][numkPointsPerSemIncr[j]:numkPointsPerSemIncr[j+1]])
self.bandEnergies[1][i].append(self.energySpin[1][i][numkPointsPerSemIncr[j]:numkPointsPerSemIncr[j+1]])
for i in range (0,vertexNum-1):
self.normBandSectionGIndex = self.backend.openSection("section_k_band_segment")
for j in range(0,bands):
for k in range(0,numkPointsPerSegmL[i]):
bandEnergiesBE[i][0][k].append(self.bandEnergies[0][j][i][k])
......@@ -157,6 +158,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("number_of_k_points_per_segment",numkPointsPerSegmL[i])
self.backend.addValue("band_segm_labels",self.vertexLabels[i:i+2])
self.backend.addValue("band_energies",bandEnergiesBE[i])
self.backend.closeSection("section_k_band_segment",self.normBandSectionGIndex)
else: #### check for spin polarized!!!!
self.energySpin[0] = self.energy[0:bands2]
self.energySpin[1] = self.energy[bands2:bands]
......@@ -167,6 +169,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
self.bandEnergies[0][i].append(self.energySpin[0][i][numkPointsPerSemIncr[j]:numkPointsPerSemIncr[j+1]])
self.bandEnergies[1][i].append(self.energySpin[1][i][numkPointsPerSemIncr[j]:numkPointsPerSemIncr[j+1]])
for i in range (0,vertexNum-1):
self.normBandSectionGIndex = self.backend.openSection("section_k_band_segment")
for j in range(0,bands):
for k in range(0,numkPointsPerSegmL[i]):
bandEnergiesBE[i][0][k].append(self.bandEnergies[0][j][i][k])
......@@ -178,6 +181,7 @@ class BandHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("number_of_k_points_per_segment",numkPointsPerSegmL[i])
self.backend.addValue("band_segm_labels",self.vertexLabels[i:i+2])
self.backend.addValue("band_energies",bandEnergiesBE[i])
self.backend.closeSection("section_k_band_segment",self.normBandSectionGIndex)
def startElementNS(self, name, qname, attrs):
attrDict={}
......
......@@ -39,6 +39,7 @@ class GWContext(object):
bandGWFile = os.path.join(dirPath, "bandstructure-qp.dat")
vertexGWFile = os.path.join(dirPath, "BANDLINES.OUT")
vertexLabGWFile = os.path.join(dirPath, "bandstructure.xml")
selfCorGWFile = os.path.join(dirPath, "SELFC.DAT")
if os.path.exists(vertexGWFile):
with open(vertexGWFile) as g:
......@@ -63,7 +64,19 @@ class GWContext(object):
if s[0] == "<vertex":
f = s[4].split("\"")
self.vertexLabels.append(f[1])
if os.path.exists(selfCorGWFile):
selfGWGIndex = backend.openSection("x_exciting_section_GW_self_energy")
with open(selfCorGWFile) as g:
while 1:
s = g.readline()
if not s: break
s = s.strip()
backend.closeSection("x_exciting_section_GW_self_energy",selfGWGIndex)
if os.path.exists(eigvalGWFile):
eigvalGWGIndex = backend.openSection("x_exciting_section_GW_qp_eigenvalues")
with open(eigvalGWFile) as g:
......@@ -144,7 +157,7 @@ class GWContext(object):
if os.path.exists(bandGWFile):
bandGWGIndex = backend.openSection("x_exciting_section_GW_k_band")
bandGWSegmGIndex = backend.openSection("x_exciting_section_GW_k_band_segment")
# bandGWSegmGIndex = backend.openSection("x_exciting_section_GW_k_band_segment")
fromH = unit_conversion.convert_unit_function("hartree", "J")
with open(bandGWFile) as g:
......@@ -234,9 +247,10 @@ class GWContext(object):
# print("bandGWBE=",bandGWBE)
for i in range(0,len(Kindex)-1):
bandGWSegmGIndex = backend.openSection("x_exciting_section_GW_k_band_segment")
backend.addValue("x_exciting_GW_band_energies", bandGWBE[i])
backend.closeSection("x_exciting_section_GW_k_band_segment",bandGWSegmGIndex)
backend.closeSection("x_exciting_section_GW_k_band_segment",bandGWSegmGIndex)
backend.closeSection("x_exciting_section_GW_k_band",bandGWGIndex)
# backend.closeSection("x_exciting_section_GW_k_band_segment",bandGWSegmGIndex)
......@@ -245,7 +259,7 @@ def buildGWMatchers():
name = 'root',
weak = True,
startReStr = "\*\s*GW input parameters\s*\*",
sections = ["x_exciting_section_GW_method", "x_exciting_section_GW"],
sections = ["x_exciting_section_GW", "x_exciting_section_GW_method"],
subMatchers = [
# SM(name = 'GWinput',
# startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment