From 4cc530a129156de6f0fd0e95168e592d0abc28b3 Mon Sep 17 00:00:00 2001 From: jkarp314 Date: Thu, 28 May 2020 15:53:41 -0400 Subject: [PATCH] Update wannier90_converter.py Can specify DFT Fermi energy in the inp file and it's subtracted from the r = 0 term when reading the hr file. --- python/converters/wannier90_converter.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/converters/wannier90_converter.py b/python/converters/wannier90_converter.py index 925d14e3..842085fd 100644 --- a/python/converters/wannier90_converter.py +++ b/python/converters/wannier90_converter.py @@ -142,6 +142,10 @@ class Wannier90Converter(ConverterTools): # l, dim, SO flag, irep): corr_shells = [{name: int(val) for name, val in zip( corr_shell_entries, R)} for icrsh in range(n_corr_shells)] + try: + fermi_energy = R.next() + except: + fermi_energy = 0. except StopIteration: # a more explicit error if the file is corrupted. mpi.report(self._name + ": reading input file %s failed!" % self.inp_file) @@ -443,7 +447,10 @@ class Wannier90Converter(ConverterTools): "Inconsistent indices for R vector n. %s" % ir) # fill h_of_r with the matrix elements of the Hamiltonian - h_of_r[ir][ii, jj] = complex(float(cline[5]), float(cline[6])) + if not numpy.any(rcurr) and ii == jj: + h_of_r[ir][ii, jj] = complex(float(cline[5]) - fermi_energy, float(cline[6])) + else: + h_of_r[ir][ii, jj] = complex(float(cline[5]), float(cline[6])) except ValueError: mpi.report("Wrong data or structure in file %s" % hr_filename)