3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-09 22:13:43 +01:00

Removed k-phases from projectors and fixed tests

The k-phases turned out to be already included at VASP level.
The previous changes are commented out. However, the dependence
of `ProjectorShell` on `kmesh` and `struct` remains and the tests
are fixed accordingly.
This commit is contained in:
Oleg E. Peil 2016-12-31 10:51:38 +01:00
parent 0ae83d18b3
commit 0de5b930f1
6 changed files with 27 additions and 12 deletions

View File

@ -227,12 +227,13 @@ class ProjectorShell:
for io, ion in enumerate(self.ion_list):
proj_k = np.zeros((ns, nlm, nb), dtype=np.complex128)
qcoord = structure['qcoords'][ion]
kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord))
# kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord))
# kphase = 1.0
for m in xrange(nlm):
# Here we search for the index of the projector with the given isite/l/m indices
for ip, par in enumerate(proj_params):
if par['isite'] - 1 == ion and par['l'] == self.lorb and par['m'] == m:
proj_k[:, m, :] = proj_raw[ip, :, ik, :] * kphase
proj_k[:, m, :] = proj_raw[ip, :, ik, :] #* kphase
break
for isp in xrange(ns):
self.proj_arr[io, isp, ik, :, :] = np.dot(self.tmatrices[io, :, :], proj_k[isp, :, :])
@ -246,10 +247,12 @@ class ProjectorShell:
# Here we search for the index of the projector with the given isite/l/m indices
for ip, par in enumerate(proj_params):
if par['isite'] - 1 == ion and par['l'] == self.lorb and par['m'] == m:
for ik in xrange(nk):
kp = kmesh['kpoints'][ik]
kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord))
self.proj_arr[io, :, :, m, :] = proj_raw[ip, :, :, :] * kphase
self.proj_arr[io, :, :, m, :] = proj_raw[ip, :, :, :]
# for ik in xrange(nk):
# kp = kmesh['kpoints'][ik]
## kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord))
# kphase = 1.0
# self.proj_arr[io, :, :, m, :] = proj_raw[ip, :, :, :] # * kphase
break

View File

@ -48,6 +48,10 @@ class TestBlockMap(mytest.MyTestCase):
self.mock_proj_params[ip]['l'] = 1
self.mock_proj_params[ip]['m'] = im
ip += 1
# Mock k-mesh
self.mock_kmesh = {'kpoints': np.zeros((1, 3))}
# Mock structure
self.mock_struct = {'qcoords': np.zeros((4, 3))}
# Scenario 1
def test_normion_false(self):
@ -57,7 +61,7 @@ class TestBlockMap(mytest.MyTestCase):
shells = []
for sh_par in self.pars.shells:
shells.append(ProjectorShell(sh_par, self.mock_plo, self.mock_proj_params, 0))
shells.append(ProjectorShell(sh_par, self.mock_plo, self.mock_proj_params, self.mock_kmesh, self.mock_struct, 0))
proj_gr = ProjectorGroup(self.pars.groups[0], shells, self.mock_eigvals)
@ -81,7 +85,7 @@ class TestBlockMap(mytest.MyTestCase):
shells = []
for sh_par in self.pars.shells:
shells.append(ProjectorShell(sh_par, self.mock_plo, self.mock_proj_params, 0))
shells.append(ProjectorShell(sh_par, self.mock_plo, self.mock_proj_params, self.mock_kmesh, self.mock_struct, 0))
proj_gr = ProjectorGroup(self.pars.groups[0], shells, self.mock_eigvals)

View File

@ -35,8 +35,10 @@ class TestProjectorGroup(mytest.MyTestCase):
efermi = self.el_struct.efermi
self.eigvals = self.el_struct.eigvals - efermi
struct = self.el_struct.structure
kmesh = self.el_struct.kmesh
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, 0)
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, kmesh, struct, 0)
self.proj_gr = ProjectorGroup(self.pars.groups[0], [self.proj_sh], self.eigvals)
# Scenario 1

View File

@ -36,8 +36,10 @@ class TestSelectBands(mytest.MyTestCase):
efermi = self.el_struct.efermi
self.eigvals = self.el_struct.eigvals - efermi
struct = self.el_struct.structure
kmesh = self.el_struct.kmesh
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, 0)
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, kmesh, struct, 0)
self.proj_gr = ProjectorGroup(self.pars.groups[0], [self.proj_sh], self.eigvals)
# Scenario 1

View File

@ -37,8 +37,10 @@ class TestProjectorGroupTwoSite(mytest.MyTestCase):
efermi = self.el_struct.efermi
self.eigvals = self.el_struct.eigvals - efermi
struct = self.el_struct.structure
kmesh = self.el_struct.kmesh
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, 0)
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, kmesh, struct, 0)
self.proj_gr = ProjectorGroup(self.pars.groups[0], [self.proj_sh], self.eigvals)
# Scenario 1

View File

@ -40,8 +40,10 @@ class TestProjectorShell(mytest.MyTestCase):
efermi = self.el_struct.efermi
eigvals = self.el_struct.eigvals - efermi
emin, emax = self.pars.groups[0]['ewindow']
struct = self.el_struct.structure
kmesh = self.el_struct.kmesh
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, 0)
self.proj_sh = ProjectorShell(self.pars.shells[0], vasp_data.plocar.plo, vasp_data.plocar.proj_params, kmesh, struct, 0)
self.proj_gr = ProjectorGroup(self.pars.groups[0], [self.proj_sh], eigvals)
# Scenario 1