hungpham2017 / mcu

Modeling and Crystallographic Utilities
https://hungqpham.com/mcu/index.html
Apache License 2.0
45 stars 20 forks source link

Results are different between interpolate_ham_kpts() and get_hamiltonian_kpts() #9

Closed lyglst closed 4 years ago

lyglst commented 4 years ago

https://github.com/hungpham2017/mcu/blob/bfee9348befa87afc1a826cdc630c7535f18f281/mcu/wannier90/pywannier90_vasp.py#L811

The hamiltonian from interpolate_ham_kpts() is exact conjugate of get_hamiltonian_kpts(), might be due to the phase problem.

lyglst commented 4 years ago

Might be fixed by:

hamiltonian_kpts = np.einsum('kso,ko,kto->kst', self.U_matrix.conj(), eigenvals_in_window, self.U_matrix)

hamiltonian_kpts = np.einsum('kto,ko,kso->kst', self.U_matrix.conj(), eigenvals_in_window, self.U_matrix)
hungpham2017 commented 4 years ago

Indeed, there is a bug in the interpolate_ham_kpts function due to the inverse index of the hamiltonian_R0 tensor line 849. This was fixed in the last commit https://github.com/hungpham2017/mcu/commit/d34da531810d21c9d165c468e8aab21692f3e356 to the dev branch. The phase convention is now also matching that of wannier90 in this commit. Thank you for reporting the bug