calculations='bands' now does exactly what it is expected to do

LDA+U yields normalized values for projections even if the
atomic wavefunctions are not correctly normalized (Matteo C)


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@2942 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2006-03-22 18:58:38 +00:00
parent 76ffc6c49a
commit 0f1182cb72
4 changed files with 94 additions and 93 deletions

View File

@ -1510,8 +1510,6 @@ MODULE read_namelists_module
CHARACTER(LEN=20) :: sub_name = ' fixval '
!
!
IF( prog == 'PW' ) startingpot = 'atomic'
!
SELECT CASE( TRIM( calculation ) )
CASE ('scf')
IF( prog == 'CP' ) THEN
@ -1522,12 +1520,10 @@ MODULE read_namelists_module
CASE ('nscf', 'bands')
IF( prog == 'CP' ) occupations = 'bogus'
IF( prog == 'CP' ) electron_dynamics = 'damp'
IF( prog == 'PW' ) startingpot = 'file'
CASE ('phonon')
IF( prog == 'CP' ) &
CALL errore( sub_name,' calculation '//TRIM(calculation)// &
& ' not implemented ',1)
IF( prog == 'PW' ) startingpot = 'file'
CASE ('raman')
CALL errore( sub_name,' calculation '//TRIM(calculation)// &
& ' no longer implemented ',1)
@ -1613,7 +1609,14 @@ MODULE read_namelists_module
!
IF ( prog == 'PW' ) THEN
!
IF ( restart_mode == "from_scratch" ) THEN
IF ( calculation == 'nscf' .OR. &
calculation == 'bands'.OR. &
calculation == 'phonon' ) THEN
!
startingpot = 'file'
startingwfc = 'atomic'
!
ELSE IF ( restart_mode == "from_scratch" ) THEN
!
startingwfc = 'atomic'
startingpot = 'atomic'
@ -1625,14 +1628,6 @@ MODULE read_namelists_module
!
END IF
!
IF ( calculation == 'nscf' .OR. &
calculation == 'phonon' ) THEN
!
startingpot = 'file'
startingwfc = 'atomic'
!
END IF
!
END IF
!
IF ( TRIM( sic ) /= 'none' ) THEN

View File

@ -778,7 +778,7 @@ SUBROUTINE iosys()
!
IF ( .NOT. lscf .AND. startingpot /= 'file' ) THEN
!
CALL infomsg( 'iosys', 'wrong startingpot: use default', -1 )
CALL infomsg( 'iosys', 'wrong startingpot: use default', -2 )
!
startingpot = 'file'
!

View File

@ -122,58 +122,63 @@ SUBROUTINE orthoatwfc
CALL s_psi (npwx, npw, natomwfc, wfcatom, swfcatom)
ENDIF
IF (orthogonalize_wfc) THEN
!
! calculate overlap matrix
!
IF (noncolin) THEN
CALL ZGEMM ('c', 'n', natomwfc, natomwfc, npwx*npol, (1.d0, 0.d0), &
wfcatom_nc,npwx,swfcatom_nc,npwx,(0.d0,0.d0),overlap,natomwfc)
ELSE
CALL ZGEMM ('c', 'n', natomwfc, natomwfc, npw, (1.d0, 0.d0) , &
wfcatom, npwx, swfcatom, npwx, (0.d0, 0.d0) , overlap, natomwfc)
END IF
!
! calculate overlap matrix
!
IF (noncolin) THEN
CALL ZGEMM ('c', 'n', natomwfc, natomwfc, npwx*npol, (1.d0, 0.d0), &
wfcatom_nc,npwx,swfcatom_nc,npwx,(0.d0,0.d0),overlap,natomwfc)
ELSE
CALL ZGEMM ('c', 'n', natomwfc, natomwfc, npw, (1.d0, 0.d0) , &
wfcatom, npwx, swfcatom, npwx, (0.d0, 0.d0) , overlap, natomwfc)
END IF
#ifdef __PARA
CALL reduce (2 * natomwfc * natomwfc, overlap)
CALL reduce (2 * natomwfc * natomwfc, overlap)
#endif
!
! find O^-.5
!
CALL cdiagh (natomwfc, overlap, natomwfc, e, work)
IF (.not.orthogonalize_wfc) THEN
DO i = 1, natomwfc
e (i) = 1.d0 / dsqrt (e (i) )
ENDDO
DO i = 1, natomwfc
DO j = i, natomwfc
temp = (0.d0, 0.d0)
DO k = 1, natomwfc
temp = temp + e (k) * work (j, k) * CONJG (work (i, k) )
ENDDO
overlap (i, j) = temp
IF (j.NE.i) overlap (j, i) = CONJG (temp)
DO j = i+1, natomwfc
overlap(i,j) = cmplx(0.d0,0.d0)
overlap(j,i) = cmplx(0.d0,0.d0)
ENDDO
ENDDO
!
! trasform atomic orbitals O^-.5 psi
!
DO i = 1, npw
work(:,1) = (0.d0,0.d0)
IF (noncolin) THEN
DO ipol=1,npol
CALL ZGEMV ('n',natomwfc,natomwfc,(1.d0,0.d0),overlap, &
natomwfc,swfcatom_nc(i,ipol,1),npwx*npol, &
(0.d0,0.d0),work,1)
CALL ZCOPY (natomwfc,work,1,swfcatom_nc(i,ipol,1),npwx*npol)
END DO
ELSE
CALL ZGEMV ('n', natomwfc, natomwfc, (1.d0, 0.d0) , overlap, &
natomwfc, swfcatom (i, 1) , npwx, (0.d0, 0.d0) , work, 1)
CALL ZCOPY (natomwfc, work, 1, swfcatom (i, 1), npwx)
END IF
ENDDO
END IF
!
! find O^-.5
!
CALL cdiagh (natomwfc, overlap, natomwfc, e, work)
DO i = 1, natomwfc
e (i) = 1.d0 / dsqrt (e (i) )
ENDDO
DO i = 1, natomwfc
DO j = i, natomwfc
temp = (0.d0, 0.d0)
DO k = 1, natomwfc
temp = temp + e (k) * work (j, k) * CONJG (work (i, k) )
ENDDO
overlap (i, j) = temp
IF (j.NE.i) overlap (j, i) = CONJG (temp)
ENDDO
ENDDO
!
! trasform atomic orbitals O^-.5 psi
!
DO i = 1, npw
work(:,1) = (0.d0,0.d0)
IF (noncolin) THEN
DO ipol=1,npol
CALL ZGEMV ('n',natomwfc,natomwfc,(1.d0,0.d0),overlap, &
natomwfc,swfcatom_nc(i,ipol,1),npwx*npol, &
(0.d0,0.d0),work,1)
CALL ZCOPY (natomwfc,work,1,swfcatom_nc(i,ipol,1),npwx*npol)
END DO
ELSE
CALL ZGEMV ('n', natomwfc, natomwfc, (1.d0, 0.d0) , overlap, &
natomwfc, swfcatom (i, 1) , npwx, (0.d0, 0.d0) , work, 1)
CALL ZCOPY (natomwfc, work, 1, swfcatom (i, 1), npwx)
END IF
ENDDO
IF (noncolin) THEN
CALL davcio (swfcatom_nc, nwordatwfc, iunat, ik, 1)
ELSE

View File

@ -266,8 +266,8 @@ SUBROUTINE setup()
#endif
!
DO ibnd = 1, nbnd
if (f_inp(ibnd,is).gt.2.d0/nspin.or.f_inp(ibnd,is).lt.0.d0) call &
errore('setup','wrong fixed occupations',1)
if (f_inp(ibnd,is) > 2.d0/nspin .or. f_inp(ibnd,is) < 0.d0) &
call errore('setup','wrong fixed occupations',1)
END DO
END DO
!
@ -688,42 +688,43 @@ SUBROUTINE setup()
! ... "sgama" eliminates rotations that are not symmetry operations
! ... Input k-points are assumed to be given in the IBZ of the Bravais
! ... lattice, with the full point symmetry of the lattice.
! ... If some symmetries are missing in the crystal, "sgama" computes
! ... the missing k-points. If nosym is true (see above) or if calculating
! ... bands, we do not use any point-group symmetry and leave k-points unchanged.
! ... If some symmetries of the lattice are missing in the crystal,
! ... "sgama" computes the missing k-points.
!
IF ( .NOT. lbands ) THEN
input_nks = nks
!
CALL sgama( nrot, nat, s, sname, t_rev, at, bg, tau, ityp, nsym, nr1,&
nr2, nr3, irt, ftau, npk, nks, xk, wk, invsym, minus_q, &
xqq, modenum, noncolin, m_loc )
!
CALL checkallsym( nsym, s, nat, tau, ityp, at, &
bg, nr1, nr2, nr3, irt, ftau )
!
! ... if dynamics is done the system should have no symmetries
! ... (inversion symmetry alone is allowed)
!
IF ( lmd .AND. ( nsym == 2 .AND. .NOT. invsym .OR. nsym > 2 ) &
.AND. .NOT. ( calc == 'mm' .OR. calc == 'nm' ) ) &
CALL infomsg( 'setup', 'Dynamics, you should have no symmetries', -1 )
!
ntetra = 0
!
IF ( lbands ) THEN
!
CALL sgama( nrot, nat, s, sname, t_rev, at, bg, tau, ityp, nsym, nr1,&
nr2, nr3, irt, ftau, npk, nks, xk, wk, invsym, minus_q, &
xqq, modenum, noncolin, m_loc )
! ... if calculating bands, we leave k-points unchanged
!
CALL checkallsym( nsym, s, nat, tau, ityp, at, &
bg, nr1, nr2, nr3, irt, ftau )
nks = input_nks
!
! ... if dynamics is done the system should have no symmetries
! ... (inversion symmetry alone is allowed)
!
IF ( lmd .AND. ( nsym == 2 .AND. .NOT. invsym .OR. nsym > 2 ) &
.AND. .NOT. ( calc == 'mm' .OR. calc == 'nm' ) ) &
CALL infomsg( 'setup', 'Dynamics, you should have no symmetries', -1 )
ELSE IF ( ltetra ) THEN
!
! ... Calculate quantities used in tetrahedra method
!
IF ( ltetra ) THEN
!
ntetra = 6 * nk1 * nk2 * nk3
!
ALLOCATE( tetra( 4, ntetra ) )
!
CALL tetrahedra( nsym, s, minus_q, at, bg, npk, k1, k2, k3, &
nk1, nk2, nk3, nks, xk, wk, ntetra, tetra )
!
ELSE
!
ntetra = 0
!
END IF
ntetra = 6 * nk1 * nk2 * nk3
!
ALLOCATE( tetra( 4, ntetra ) )
!
CALL tetrahedra( nsym, s, minus_q, at, bg, npk, k1, k2, k3, &
nk1, nk2, nk3, nks, xk, wk, ntetra, tetra )
!
END IF
!
@ -1067,11 +1068,11 @@ SUBROUTINE check_para_diag_efficiency()
!
EXIT
!
ELSE IF ( .NOT. lfirst .AND. delta_t > delta_t_old ) THEN
ELSE IF ( .NOT. lfirst ) THEN
!
! ... the parallel diagonalizer is getting slower and slower
!
EXIT
IF ( delta_t > delta_t_old ) EXIT
!
END IF
!