Merge pull request #143 from jkarp314/unstable

optionally give Fermi energy in Wannier90 converter
This commit is contained in:
Manuel Zingl 2020-06-04 22:43:18 -04:00 committed by GitHub
commit 0724d9d50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3937 additions and 1 deletions

View File

@ -84,6 +84,8 @@ In our `Pnma`-LaVO\ :sub:`3` example, for instance, we could use::
where the ``x=-1,1,0`` option indicates that the V--O bonds in the octahedra are
rotated by (approximatively) 45 degrees with respect to the axes of the `Pbnm` cell.
The last line of :file:`seedname.inp` is the DFT Fermi energy (in eV), which is subtracted from the onsite terms in the :file:`seedname_hr.dat` file. This is recommended since some functions in DFTTools implicitly assume a Fermi energy of 0 eV.
The converter will analyse the matrix elements of the local Hamiltonian
to find the symmetry matrices `rot_mat` needed for the global-to-local
transformation of the basis set for correlated orbitals

View File

@ -5,3 +5,4 @@
1 0 2 3 0 0 # atom, sort, l, dim, SO, irep
2 0 2 3 0 0 # atom, sort, l, dim, SO, irep
3 0 2 3 0 0 # atom, sort, l, dim, SO, irep
0.0 # DFT Fermi Energy (optional)

View File

@ -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:
self.fermi_energy = R.next()
except:
self.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]) - self.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)

8
test/LaVO3-Pnma_ef.inp Normal file
View File

@ -0,0 +1,8 @@
0 3 2 3
8.0
4
0 0 2 3 0 0
1 0 2 3 0 0
2 0 2 3 0 0
3 0 2 3 0 0
10.3

3893
test/LaVO3-Pnma_ef_hr.dat Normal file

File diff suppressed because it is too large Load Diff

25
test/test_w90_ef.py Normal file
View File

@ -0,0 +1,25 @@
import unittest
import numpy as np
import sys
sys.path.insert(1, '../python/converters/')
from wannier90_converter import Wannier90Converter
from triqs_dft_tools import SumkDFT
class test_w90_conv(unittest.TestCase):
def test_hopping(self):
conv1 = Wannier90Converter(seedname='LaVO3-Pnma')
conv1.convert_dft_input()
SK1 = SumkDFT(hdf_file='LaVO3-Pnma.h5')
conv2 = Wannier90Converter(seedname='LaVO3-Pnma_ef')
conv2.convert_dft_input()
SK2 = SumkDFT(hdf_file='LaVO3-Pnma_ef.h5')
for ik in range(SK1.n_k):
self.assertTrue(np.all(SK1.hopping[ik,0] - conv2.fermi_energy*np.identity(SK1.n_orbitals[ik][0]) - SK2.hopping[ik,0] < 1e-12))
if __name__ == '__main__':
unittest.main()