2003-01-20 05:58:50 +08:00
|
|
|
!
|
2007-11-23 05:28:22 +08:00
|
|
|
! Copyright (C) 2001-2007 Quantum-Espresso group
|
2003-01-20 05:58:50 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
SUBROUTINE s_psi( lda, n, m, psi, spsi )
|
|
|
|
!----------------------------------------------------------------------------
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2005-04-08 23:22:02 +08:00
|
|
|
! ... This routine applies the S matrix to m wavefunctions psi
|
|
|
|
! ... and puts the results in spsi.
|
|
|
|
! ... Requires the products of psi with all beta functions
|
2007-12-05 22:14:12 +08:00
|
|
|
! ... in array becp(nkb,m) (calculated in h_psi or by calbec)
|
2005-04-08 23:22:02 +08:00
|
|
|
!
|
|
|
|
! ... input:
|
|
|
|
!
|
|
|
|
! ... lda leading dimension of arrays psi, spsi
|
|
|
|
! ... n true dimension of psi, spsi
|
|
|
|
! ... m number of states psi
|
|
|
|
! ... psi
|
|
|
|
!
|
|
|
|
! ... output:
|
|
|
|
!
|
|
|
|
! ... spsi S*psi
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2004-06-12 21:44:18 +08:00
|
|
|
USE kinds, ONLY : DP
|
2005-03-28 21:55:19 +08:00
|
|
|
USE uspp, ONLY : vkb, nkb, qq, okvan
|
The following pseudopotential-related variables in module uspp_param:
zp, psd, dion, betar, jjj, qqq, qfunc, qfcoef, vloc_at, rinner,
nbeta, kkbeta, nqf, nqlc, lll, tvanp
have been replaced by the corresponding variables in structure 'upf'.
There shouldn't be any side effects, but who knows. There is still a
copy of the above variables that will be removed sooner or later.
Basically : variable([i,j,k,..,]n) => upf(n)%variable [(i,j,k,..)]
Note that upf%qfunc has for the time being three indices instead of two,
and that upf%kkbeta is the analogous of kkbeta and not what it used to be.
The logic of this operation will be clearer when it will be completed
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4308 c92efa57-630b-4861-b058-cf58834340f0
2007-10-05 17:26:23 +08:00
|
|
|
USE uspp_param, ONLY : upf, nh
|
2003-12-10 22:57:07 +08:00
|
|
|
USE wvfct, ONLY : igk, g2kin
|
|
|
|
USE gsmooth, ONLY : nls, nr1s, nr2s, nr3s, nrx1s, nrx2s, nrx3s, nrxxs
|
|
|
|
USE ldaU, ONLY : lda_plus_u
|
2005-04-08 23:22:02 +08:00
|
|
|
USE ions_base, ONLY : nat, nsp, ityp
|
2007-11-23 05:28:22 +08:00
|
|
|
USE control_flags, ONLY: gamma_only
|
|
|
|
USE noncollin_module, ONLY: npol, noncolin
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
IMPLICIT NONE
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
! ... First the dummy variables
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
INTEGER :: lda, n, m
|
2007-11-23 05:28:22 +08:00
|
|
|
COMPLEX(DP) :: psi(lda*npol,m), spsi(lda*npol,m)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2009-02-17 19:43:48 +08:00
|
|
|
! ... initialize spsi
|
|
|
|
!
|
|
|
|
spsi = psi
|
|
|
|
!
|
|
|
|
IF ( nkb == 0 .OR. .NOT. okvan ) RETURN
|
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL start_clock( 's_psi' )
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2009-02-17 19:43:48 +08:00
|
|
|
! ... The product with the beta functions
|
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
IF ( gamma_only ) THEN
|
|
|
|
!
|
|
|
|
CALL s_psi_gamma()
|
|
|
|
!
|
2007-11-23 05:28:22 +08:00
|
|
|
ELSE IF ( noncolin ) THEN
|
|
|
|
!
|
2009-02-17 19:43:48 +08:00
|
|
|
CALL s_psi_nc()
|
2007-11-23 05:28:22 +08:00
|
|
|
!
|
|
|
|
ELSE
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
CALL s_psi_k()
|
|
|
|
!
|
|
|
|
END IF
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CALL stop_clock( 's_psi' )
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
RETURN
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-12-10 22:57:07 +08:00
|
|
|
CONTAINS
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
SUBROUTINE s_psi_gamma()
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! ... gamma version
|
|
|
|
!
|
2004-06-13 04:37:01 +08:00
|
|
|
USE becmod, ONLY : rbecp
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
|
|
|
! ... here the local variables
|
|
|
|
!
|
|
|
|
INTEGER :: ikb, jkb, ih, jh, na, nt, ijkb0, ibnd
|
2005-04-08 23:22:02 +08:00
|
|
|
! counters
|
2005-08-28 22:09:42 +08:00
|
|
|
REAL(DP), ALLOCATABLE :: ps(:,:)
|
2005-04-08 23:22:02 +08:00
|
|
|
! the product vkb and psi
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
!
|
|
|
|
ALLOCATE( ps( nkb, m ) )
|
|
|
|
!
|
|
|
|
ps(:,:) = 0.D0
|
|
|
|
!
|
|
|
|
ijkb0 = 0
|
2005-04-08 23:22:02 +08:00
|
|
|
DO nt = 1, nsp
|
The following pseudopotential-related variables in module uspp_param:
zp, psd, dion, betar, jjj, qqq, qfunc, qfcoef, vloc_at, rinner,
nbeta, kkbeta, nqf, nqlc, lll, tvanp
have been replaced by the corresponding variables in structure 'upf'.
There shouldn't be any side effects, but who knows. There is still a
copy of the above variables that will be removed sooner or later.
Basically : variable([i,j,k,..,]n) => upf(n)%variable [(i,j,k,..)]
Note that upf%qfunc has for the time being three indices instead of two,
and that upf%kkbeta is the analogous of kkbeta and not what it used to be.
The logic of this operation will be clearer when it will be completed
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4308 c92efa57-630b-4861-b058-cf58834340f0
2007-10-05 17:26:23 +08:00
|
|
|
IF ( upf(nt)%tvanp ) THEN
|
2003-12-10 22:57:07 +08:00
|
|
|
DO na = 1, nat
|
|
|
|
IF ( ityp(na) == nt ) THEN
|
|
|
|
DO ibnd = 1, m
|
|
|
|
DO jh = 1, nh(nt)
|
|
|
|
jkb = ijkb0 + jh
|
|
|
|
DO ih = 1, nh(nt)
|
|
|
|
ikb = ijkb0 + ih
|
|
|
|
ps(ikb,ibnd) = ps(ikb,ibnd) + &
|
2004-06-13 04:37:01 +08:00
|
|
|
qq(ih,jh,nt) * rbecp(jkb,ibnd)
|
2003-12-10 22:57:07 +08:00
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
ijkb0 = ijkb0 + nh(nt)
|
|
|
|
END IF
|
|
|
|
END DO
|
|
|
|
ELSE
|
|
|
|
DO na = 1, nat
|
|
|
|
IF ( ityp(na) == nt ) ijkb0 = ijkb0 + nh(nt)
|
|
|
|
END DO
|
|
|
|
END IF
|
|
|
|
END DO
|
|
|
|
!
|
2005-04-08 23:22:02 +08:00
|
|
|
IF ( m == 1 ) THEN
|
|
|
|
!
|
|
|
|
CALL DGEMV( 'N', 2 * n, nkb, 1.D0, vkb, &
|
|
|
|
2 * lda, ps, 1, 1.D0, spsi, 1 )
|
|
|
|
!
|
|
|
|
ELSE
|
|
|
|
!
|
|
|
|
CALL DGEMM( 'N', 'N', 2 * n, m, nkb, 1.D0, vkb, &
|
|
|
|
2 * lda, ps, nkb, 1.D0, spsi, 2 * lda )
|
|
|
|
!
|
|
|
|
END IF
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
DEALLOCATE( ps )
|
|
|
|
!
|
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE s_psi_gamma
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
SUBROUTINE s_psi_k()
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! ... k-points version
|
|
|
|
!
|
|
|
|
USE becmod, ONLY : becp
|
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
|
|
|
! ... local variables
|
|
|
|
!
|
|
|
|
INTEGER :: ikb, jkb, ih, jh, na, nt, ijkb0, ibnd
|
2005-04-08 23:22:02 +08:00
|
|
|
! counters
|
2005-08-28 22:09:42 +08:00
|
|
|
COMPLEX(DP), ALLOCATABLE :: ps(:,:)
|
2005-04-08 23:22:02 +08:00
|
|
|
! the product vkb and psi
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
ALLOCATE( ps( nkb, m ) )
|
|
|
|
!
|
2005-04-08 23:22:02 +08:00
|
|
|
ps(:,:) = ( 0.D0, 0.D0 )
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
ijkb0 = 0
|
2005-04-08 23:22:02 +08:00
|
|
|
DO nt = 1, nsp
|
The following pseudopotential-related variables in module uspp_param:
zp, psd, dion, betar, jjj, qqq, qfunc, qfcoef, vloc_at, rinner,
nbeta, kkbeta, nqf, nqlc, lll, tvanp
have been replaced by the corresponding variables in structure 'upf'.
There shouldn't be any side effects, but who knows. There is still a
copy of the above variables that will be removed sooner or later.
Basically : variable([i,j,k,..,]n) => upf(n)%variable [(i,j,k,..)]
Note that upf%qfunc has for the time being three indices instead of two,
and that upf%kkbeta is the analogous of kkbeta and not what it used to be.
The logic of this operation will be clearer when it will be completed
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4308 c92efa57-630b-4861-b058-cf58834340f0
2007-10-05 17:26:23 +08:00
|
|
|
IF ( upf(nt)%tvanp ) THEN
|
2003-12-10 22:57:07 +08:00
|
|
|
DO na = 1, nat
|
|
|
|
IF ( ityp(na) == nt ) THEN
|
|
|
|
DO ibnd = 1, m
|
|
|
|
DO jh = 1, nh(nt)
|
|
|
|
jkb = ijkb0 + jh
|
|
|
|
DO ih = 1, nh(nt)
|
|
|
|
ikb = ijkb0 + ih
|
|
|
|
ps(ikb,ibnd) = ps(ikb,ibnd) + &
|
|
|
|
qq(ih,jh,nt) * becp(jkb,ibnd)
|
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
ijkb0 = ijkb0 + nh(nt)
|
|
|
|
END IF
|
|
|
|
END DO
|
|
|
|
ELSE
|
|
|
|
DO na = 1, nat
|
|
|
|
IF ( ityp(na) == nt ) ijkb0 = ijkb0 + nh(nt)
|
|
|
|
END DO
|
|
|
|
END IF
|
|
|
|
END DO
|
|
|
|
!
|
2005-04-08 23:22:02 +08:00
|
|
|
IF ( m == 1 ) THEN
|
|
|
|
!
|
|
|
|
CALL ZGEMV( 'N', n, nkb, ( 1.D0, 0.D0 ), vkb, &
|
|
|
|
lda, ps, 1, ( 1.D0, 0.D0 ), spsi, 1 )
|
|
|
|
!
|
|
|
|
ELSE
|
|
|
|
!
|
|
|
|
CALL ZGEMM( 'N', 'N', n, m, nkb, ( 1.D0, 0.D0 ), vkb, &
|
|
|
|
lda, ps, nkb, ( 1.D0, 0.D0 ), spsi, lda )
|
|
|
|
!
|
|
|
|
END IF
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
DEALLOCATE( ps )
|
|
|
|
!
|
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE s_psi_k
|
|
|
|
!
|
2009-02-17 19:43:48 +08:00
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
SUBROUTINE s_psi_nc ( )
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
USE uspp, ONLY: qq_so
|
|
|
|
USE becmod, ONLY: becp_nc
|
|
|
|
USE spin_orb, ONLY: lspinorb
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
|
|
|
! here the local variables
|
|
|
|
!
|
|
|
|
INTEGER :: ikb, jkb, ih, jh, na, nt, ijkb0, ibnd, ipol
|
|
|
|
! counters
|
|
|
|
COMPLEX (DP), ALLOCATABLE :: ps (:,:,:)
|
|
|
|
! the product vkb and psi
|
|
|
|
!
|
|
|
|
ALLOCATE (ps(nkb,npol,m))
|
|
|
|
ps(:,:,:) = (0.D0,0.D0)
|
|
|
|
!
|
|
|
|
ijkb0 = 0
|
|
|
|
do nt = 1, nsp
|
|
|
|
if ( upf(nt)%tvanp ) then
|
|
|
|
do na = 1, nat
|
|
|
|
if (ityp (na) == nt) then
|
|
|
|
do ih = 1,nh(nt)
|
|
|
|
ikb = ijkb0 + ih
|
|
|
|
do ibnd = 1, m
|
|
|
|
do jh = 1, nh (nt)
|
|
|
|
jkb = ijkb0 + jh
|
|
|
|
if (lspinorb) then
|
|
|
|
ps(ikb,1,ibnd)=ps(ikb,1,ibnd) + &
|
2007-11-23 05:28:22 +08:00
|
|
|
qq_so(ih,jh,1,nt)*becp_nc(jkb,1,ibnd)+ &
|
|
|
|
qq_so(ih,jh,2,nt)*becp_nc(jkb,2,ibnd)
|
2009-02-17 19:43:48 +08:00
|
|
|
ps(ikb,2,ibnd)=ps(ikb,2,ibnd) + &
|
2007-11-23 05:28:22 +08:00
|
|
|
qq_so(ih,jh,3,nt)*becp_nc(jkb,1,ibnd)+ &
|
|
|
|
qq_so(ih,jh,4,nt)*becp_nc(jkb,2,ibnd)
|
2009-02-17 19:43:48 +08:00
|
|
|
else
|
|
|
|
do ipol=1,npol
|
|
|
|
ps(ikb,ipol,ibnd)=ps(ikb,ipol,ibnd) + &
|
2007-11-23 05:28:22 +08:00
|
|
|
qq(ih,jh,nt)*becp_nc(jkb,ipol,ibnd)
|
2009-02-17 19:43:48 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
ijkb0 = ijkb0 + nh (nt)
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
else
|
|
|
|
do na = 1, nat
|
|
|
|
if (ityp (na) == nt) ijkb0 = ijkb0 + nh (nt)
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
call ZGEMM ('N', 'N', n, m*npol, nkb, (1.d0, 0.d0) , vkb, &
|
|
|
|
lda, ps, nkb, (1.d0, 0.d0) , spsi(1,1), lda)
|
2007-11-23 05:28:22 +08:00
|
|
|
|
2009-02-17 19:43:48 +08:00
|
|
|
DEALLOCATE(ps)
|
|
|
|
|
|
|
|
RETURN
|
2007-11-23 05:28:22 +08:00
|
|
|
|
2009-02-17 19:43:48 +08:00
|
|
|
END SUBROUTINE s_psi_nc
|
2007-11-23 05:28:22 +08:00
|
|
|
|
2009-02-17 19:43:48 +08:00
|
|
|
END SUBROUTINE s_psi
|