3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +01:00

Bugfix if using bloch_basis = True and multiple inequivalent shells

This commit is contained in:
phibeck 2021-06-17 11:15:42 -04:00
parent ec1b336f75
commit 17ac9209e3

View File

@ -456,8 +456,16 @@ class Wannier90Converter(ConverterTools):
# corresponds to W90 result
wannier_ham = self.fourier_ham(hamr_full[isp])
for ik in range(self.n_k):
proj_mat_flattened = proj_mat[ik, isp].reshape(self.nwfs, numpy.max(n_orbitals))
proj_mat_flattened = numpy.zeros((numpy.max(n_orbitals), numpy.max(n_orbitals)), dtype=complex)
iorb = 0
for icrsh in range(n_corr_shells):
dim = corr_shells[icrsh]['dim']
proj_mat_flattened[iorb:iorb+dim,:] = proj_mat[ik, isp][icrsh,0:dim,:].reshape(dim, numpy.max(n_orbitals))
iorb += dim
downfolded_ham = proj_mat_flattened.dot(hamk[ik].dot(proj_mat_flattened.conj().T))
if dim_corr_shells < numpy.max(n_orbitals):
downfolded_ham = downfolded_ham[:dim_corr_shells,:dim_corr_shells]
wannier_ham[ik] = wannier_ham[ik][:dim_corr_shells,:dim_corr_shells]
if not numpy.allclose(downfolded_ham, wannier_ham[ik], atol=1e-4, rtol=0):
mpi.report('WARNING: mismatch between downfolded Hamiltonian and '