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

fixed small bug in parser bandstructure

parent fe893445
...@@ -52,14 +52,17 @@ class BandHandler(xml.sax.handler.ContentHandler): ...@@ -52,14 +52,17 @@ class BandHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("x_exciting_band_vertex_coordinates", self.vertexCoord) self.backend.addValue("x_exciting_band_vertex_coordinates", self.vertexCoord)
self.backend.addValue("x_exciting_band_k_points",self.distance[-1]) self.backend.addValue("x_exciting_band_k_points",self.distance[-1])
if not self.spinTreat: if not self.spinTreat:
self.energySpin[0] = self.energy[0:bands]
self.energySpin[1] = self.energy[0:bands]
self.backend.addValue("x_exciting_band_number_of_eigenvalues",bands) self.backend.addValue("x_exciting_band_number_of_eigenvalues",bands)
self.backend.addArrayValues("x_exciting_band_energies",np.asarray([self.energy])) self.backend.addValue("x_exciting_band_energies",self.energySpin)
# print("self.energySpin=",self.energySpin)
else: else:
self.energySpin[0] = self.energy[0:bands2] self.energySpin[0] = self.energy[0:bands2]
self.energySpin[1] = self.energy[bands2:bands] self.energySpin[1] = self.energy[bands2:bands]
self.backend.addValue("x_exciting_band_number_of_eigenvalues",bands2) self.backend.addValue("x_exciting_band_number_of_eigenvalues",bands2)
self.backend.addArrayValues("x_exciting_band_energies",np.asarray(self.energy)) self.backend.addValue("x_exciting_band_energies",self.energySpin)
def startElementNS(self, name, qname, attrs): def startElementNS(self, name, qname, attrs):
attrDict={} attrDict={}
for name in attrs.getNames(): for name in attrs.getNames():
......
...@@ -95,7 +95,7 @@ class ExcitingParserContext(object): ...@@ -95,7 +95,7 @@ class ExcitingParserContext(object):
# exciting_parser_input.parseInput(f, backend) # exciting_parser_input.parseInput(f, backend)
if os.path.exists(dosFile): if os.path.exists(dosFile):
with open(dosFile) as f: with open(dosFile) as f:
exciting_parser_dos.parseDos(f, backend) exciting_parser_dos.parseDos(f, backend, self.spinTreat)
if os.path.exists(bandFile): if os.path.exists(bandFile):
with open(bandFile) as g: with open(bandFile) as g:
exciting_parser_bandstructure.parseBand(g, backend, self.spinTreat) exciting_parser_bandstructure.parseBand(g, backend, self.spinTreat)
...@@ -136,17 +136,27 @@ class ExcitingParserContext(object): ...@@ -136,17 +136,27 @@ class ExcitingParserContext(object):
eigvalVal[-1].append(fromH(float(e))) eigvalVal[-1].append(fromH(float(e)))
eigvalOcc[-1].append(float(occ)) eigvalOcc[-1].append(float(occ))
if not self.spinTreat: if not self.spinTreat:
backend.addArrayValues("eigenvalues_values", np.asarray([eigvalVal])) for i in range(0,nkpt):
backend.addArrayValues("eigenvalues_occupation", np.asarray([eigvalOcc])) eigvalValSpin[0].append(eigvalVal[i][0:nstsv])
eigvalOccSpin[0].append(eigvalOcc[i][0:nstsv])
eigvalValSpin[1].append(eigvalVal[i][0:nstsv])
eigvalOccSpin[1].append(eigvalOcc[i][0:nstsv])
# backend.addArrayValues("eigenvalues_values", np.asarray(eigvalValSpin))
# backend.addArrayValues("eigenvalues_occupation", np.asarray(eigvalOccSpin))
backend.addValue("eigenvalues_values", eigvalValSpin)
backend.addValue("eigenvalues_occupation", eigvalOccSpin)
else: else:
for i in range(0,nkpt): for i in range(0,nkpt):
eigvalValSpin[0].append(eigvalVal[i][0:nstsv2]) eigvalValSpin[0].append(eigvalVal[i][0:nstsv2])
eigvalOccSpin[0].append(eigvalOcc[i][0:nstsv2]) eigvalOccSpin[0].append(eigvalOcc[i][0:nstsv2])
eigvalValSpin[1].append(eigvalVal[i][nstsv2:nstsv]) eigvalValSpin[1].append(eigvalVal[i][nstsv2:nstsv])
eigvalOccSpin[1].append(eigvalOcc[i][nstsv2:nstsv]) eigvalOccSpin[1].append(eigvalOcc[i][nstsv2:nstsv])
backend.addArrayValues("eigenvalues_values", np.asarray(eigvalValSpin)) backend.addValue("eigenvalues_values", eigvalValSpin)
backend.addArrayValues("eigenvalues_occupation", np.asarray(eigvalOccSpin)) backend.addValue("eigenvalues_occupation", eigvalOccSpin)
backend.addArrayValues("eigenvalues_kpoints", np.asarray(eigvalKpoint)) backend.addValue("eigenvalues_kpoints", eigvalKpoint)
# backend.addArrayValues("eigenvalues_values", np.asarray(eigvalValSpin))
# backend.addArrayValues("eigenvalues_occupation", np.asarray(eigvalOccSpin))
# backend.addArrayValues("eigenvalues_kpoints", np.asarray(eigvalKpoint))
backend.closeSection("section_eigenvalues",eigvalGIndex) backend.closeSection("section_eigenvalues",eigvalGIndex)
##########################Parsing Fermi surface################## ##########################Parsing Fermi surface##################
......
Supports Markdown
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