Skip to content
Snippets Groups Projects
Commit a73af517 authored by Pavel Ondračka's avatar Pavel Ondračka Committed by Markus Scheidgen
Browse files

Parse k-points from the *.klist file

parent be14ddf2
Branches
No related tags found
No related merge requests found
...@@ -201,6 +201,26 @@ class Wien2kContext(object): ...@@ -201,6 +201,26 @@ class Wien2kContext(object):
else: else:
backend.addValue("number_of_spin_channels", 1) backend.addValue("number_of_spin_channels", 1)
mainFile = self.parser.fIn.fIn.name
#read kpoints from the klist file
klistFile = mainFile[:-4] + ".klist"
if os.path.exists(klistFile):
with open(klistFile) as f:
kMeshWeights=[]
weightsSum=0.0
kMeshPoints=[]
for l in f:
tmp = l.split()
if len(tmp) >= 6:
kMeshWeights.append(float(tmp[5]))
weightsSum += kMeshWeights[-1]
kMeshPoints.append([float(tmp[1])/float(tmp[4]), float(tmp[2])/float(tmp[4]), float(tmp[3])/float(tmp[4])])
elif tmp[0] == 'END': break
kMeshWeights = [w/weightsSum for w in kMeshWeights]
backend.addArrayValues("k_mesh_points", np.asarray(kMeshPoints))
backend.addArrayValues("k_mesh_weights", np.asarray(kMeshWeights))
def onClose_section_scf_iteration(self, backend, gIndex, section): def onClose_section_scf_iteration(self, backend, gIndex, section):
#Trigger called when section_scf_iteration is closed. #Trigger called when section_scf_iteration is closed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment