Commit 853d1da2 authored by giannozz's avatar giannozz

Merge branch 'wannier90_in_QEv6.4' into 'develop'

Bugfix in pw2wannier90.f90 introduced recently when reading data from projection block in .nnkp files. Removed CR/LF

See merge request !363
parents a24be2fe 657abdd3
......@@ -946,10 +946,41 @@ SUBROUTINE read_nnkp
ALLOCATE( spin_eig(n_proj),spin_qaxis(3,n_proj) )
endif
IF (ionode) THEN ! read from ionode only
DO iw=1,n_proj
READ(iun_nnkp,*) (center_w(i,iw), i=1,3), l_w(iw), mr_w(iw), r_w(iw)
READ(iun_nnkp,*) (zaxis(i,iw),i=1,3),(xaxis(i,iw),i=1,3),alpha_w(iw)
xnorm = sqrt(xaxis(1,iw)*xaxis(1,iw) + xaxis(2,iw)*xaxis(2,iw) + &
xaxis(3,iw)*xaxis(3,iw))
IF (xnorm < eps6) CALL errore ('read_nnkp',' |xaxis| < eps ',1)
znorm = sqrt(zaxis(1,iw)*zaxis(1,iw) + zaxis(2,iw)*zaxis(2,iw) + &
zaxis(3,iw)*zaxis(3,iw))
IF (znorm < eps6) CALL errore ('read_nnkp',' |zaxis| < eps ',1)
coseno = (xaxis(1,iw)*zaxis(1,iw) + xaxis(2,iw)*zaxis(2,iw) + &
xaxis(3,iw)*zaxis(3,iw))/xnorm/znorm
IF (abs(coseno) > eps6) &
CALL errore('read_nnkp',' xaxis and zaxis are not orthogonal !',1)
IF (alpha_w(iw) < eps6) &
CALL errore('read_nnkp',' zona value must be positive', 1)
! convert wannier center in cartesian coordinates (in unit of alat)
CALL cryst_to_cart( 1, center_w(:,iw), at, 1 )
if(noncolin.and..not.old_spinor_proj) then
READ(iun_nnkp,*) spin_eig(iw),(spin_qaxis(i,iw),i=1,3)
xnorm = sqrt(spin_qaxis(1,iw)*spin_qaxis(1,iw) + spin_qaxis(2,iw)*spin_qaxis(2,iw) + &
spin_qaxis(3,iw)*spin_qaxis(3,iw))
IF (xnorm < eps6) CALL errore ('read_nnkp',' |xaxis| < eps ',1)
spin_qaxis(:,iw)=spin_qaxis(:,iw)/xnorm
endif
ENDDO
ENDIF
! automatic projections
IF (ionode) THEN
CALL scan_file_to('auto_projections',found)
IF (found) THEN
READ (iun_nnkp, *) n_wannier
READ (iun_nnkp, *) tmp_auto
IF (scdm_proj) THEN
IF (n_proj > 0) THEN
WRITE(stdout,'(//, " ****** begin Error message ******",/)')
......@@ -959,8 +990,6 @@ SUBROUTINE read_nnkp
WRITE(stdout,'(/, " ****** end Error message ******",//)')
CALL errore( 'pw2wannier90', 'Inconsistent options for projections.', 1 )
ELSE
READ (iun_nnkp, *) n_wannier
READ (iun_nnkp, *) tmp_auto
IF (tmp_auto /= 0) CALL errore( 'pw2wannier90', 'Second entry in auto_projections block is not 0. ' // &
'See Wannier90 User Guide in the auto_projections section for clarifications.', 1 )
ENDIF
......@@ -978,34 +1007,6 @@ SUBROUTINE read_nnkp
ENDIF
ENDIF
IF (ionode) THEN ! read from ionode only
DO iw=1,n_proj
READ(iun_nnkp,*) (center_w(i,iw), i=1,3), l_w(iw), mr_w(iw), r_w(iw)
READ(iun_nnkp,*) (zaxis(i,iw),i=1,3),(xaxis(i,iw),i=1,3),alpha_w(iw)
xnorm = sqrt(xaxis(1,iw)*xaxis(1,iw) + xaxis(2,iw)*xaxis(2,iw) + &
xaxis(3,iw)*xaxis(3,iw))
IF (xnorm < eps6) CALL errore ('read_nnkp',' |xaxis| < eps ',1)
znorm = sqrt(zaxis(1,iw)*zaxis(1,iw) + zaxis(2,iw)*zaxis(2,iw) + &
zaxis(3,iw)*zaxis(3,iw))
IF (znorm < eps6) CALL errore ('read_nnkp',' |zaxis| < eps ',1)
coseno = (xaxis(1,iw)*zaxis(1,iw) + xaxis(2,iw)*zaxis(2,iw) + &
xaxis(3,iw)*zaxis(3,iw))/xnorm/znorm
IF (abs(coseno) > eps6) &
CALL errore('read_nnkp',' xaxis and zaxis are not orthogonal !',1)
IF (alpha_w(iw) < eps6) &
CALL errore('read_nnkp',' zona value must be positive', 1)
! convert wannier center in cartesian coordinates (in unit of alat)
CALL cryst_to_cart( 1, center_w(:,iw), at, 1 )
if(noncolin.and..not.old_spinor_proj) then
READ(iun_nnkp,*) spin_eig(iw),(spin_qaxis(i,iw),i=1,3)
xnorm = sqrt(spin_qaxis(1,iw)*spin_qaxis(1,iw) + spin_qaxis(2,iw)*spin_qaxis(2,iw) + &
spin_qaxis(3,iw)*spin_qaxis(3,iw))
IF (xnorm < eps6) CALL errore ('read_nnkp',' |xaxis| < eps ',1)
spin_qaxis(:,iw)=spin_qaxis(:,iw)/xnorm
endif
ENDDO
ENDIF
! Broadcast
CALL mp_bcast(n_wannier,ionode_id, world_comm)
CALL mp_bcast(center_w,ionode_id, world_comm)
......@@ -4952,5 +4953,3 @@ SUBROUTINE radialpart(ng, q, alfa, rvalue, lmax, radial)
DEALLOCATE (bes, func_r, r, rij, aux )
RETURN
END SUBROUTINE radialpart
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment