From f8f5c4c5b07d353dc3835a4fdf95f343ca9349cd Mon Sep 17 00:00:00 2001 From: Jae-Mo Lihm Date: Mon, 21 Mar 2022 10:49:45 +0900 Subject: [PATCH] Fix bugs in pw2wannier90 - mmn for gamma-only case should be symmetrized but it wasnt (bug introduced in 6bde39407) - In write_parity, selection of k point was not correctly done for LSDA --- PP/src/pw2wannier90.f90 | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/PP/src/pw2wannier90.f90 b/PP/src/pw2wannier90.f90 index 973051811..9939c5240 100644 --- a/PP/src/pw2wannier90.f90 +++ b/PP/src/pw2wannier90.f90 @@ -2280,6 +2280,8 @@ SUBROUTINE compute_mmn Mkb(m,n) = Mkb(m,n) + & phase1 * qb(ih,jh,nt,ind) * & becp%r(ikb,m) * rbecp2(jkb,n) + ! fill other half of matrix by symmetry + IF (m/=n) Mkb(n,m) = Mkb(m,n) ENDDO else if (noncolin) then DO n=1,nbnd @@ -4822,6 +4824,7 @@ SUBROUTINE write_parity USE gvect, ONLY : g, ngm USE cell_base, ONLY : at USE constants, ONLY : eps6 + USE lsda_mod, ONLY : lsda, isk IMPLICIT NONE ! @@ -4843,19 +4846,13 @@ SUBROUTINE write_parity ! IF (.not. gamma_only) THEN DO ik=ikstart,ikstop - IF ( (xk(1,ik)/= 0.d0) .or. (xk(2,ik)/= 0.d0) .or. (xk(3,ik)/= 0.d0) ) THEN - IF (ik == ikstop) CALL errore('write_parity',& - ' parity calculation may only be performed at the gamma point.',1) - CYCLE - ELSE - ! NP: spin unpolarized or "up" component of spin - IF (ispinw == 0 .or. ispinw == 1) THEN - kgamma=ik - ELSE ! NP: "down" component - kgamma=ik+1 - ENDIF - exit + IF ( (xk(1,ik) == 0.d0) .AND. (xk(2,ik) == 0.d0) .AND. (xk(3,ik) == 0.d0) & + .AND. (ispinw == 0 .OR. isk(ik) == ispinw) ) THEN + kgamma = ik + EXIT ENDIF + IF (ik == ikstop) CALL errore('write_parity',& + ' parity calculation may only be performed at the gamma point',1) ENDDO ELSE ! NP: spin unpolarized or "up" component of spin