Bug in sequential corrected.

Changed nbnd into nmodes in dynwan2bloch to reflect the physics. 



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12900 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
sponce 2016-09-01 10:55:44 +00:00
parent 2a317b44e8
commit b4baf5bac8
3 changed files with 33 additions and 30 deletions

View File

@ -7,7 +7,7 @@
! present distribution, or http://www.gnu.org/copyleft.gpl.txt .
!
!--------------------------------------------------------------------------
SUBROUTINE dynwan2bloch ( nbnd, nrr, irvec, ndegen, xxq, cuf, eig)
SUBROUTINE dynwan2bloch ( nmodes, nrr, irvec, ndegen, xxq, cuf, eig)
!--------------------------------------------------------------------------
!!
!!
@ -22,15 +22,6 @@
!! From the Hamiltonian in Wannier representation, find the corresponding
!! Hamiltonian in Bloch representation for a given k point
!!
!! input : number of bands nbnd
!! number of WS vectors, coordinates and degeneracy
!! Hamiltonian in Wannier representation chw(nbnd, nbnd, nrr)
!! qpoint coordinate xq(3)
!!
!! output : rotation matrix cuf (nbnd, nbnd)
!! interpolated hamiltonian eigenvalues eig(nbnd)
!!
!!
!--------------------------------------------------------------------------
!
USE kinds, ONLY : DP
@ -43,8 +34,8 @@
!
implicit none
!
INTEGER, INTENT (in) :: nbnd
!! number of bands (possibly of the optimal subspace)
INTEGER, INTENT (in) :: nmodes
!! number of modes (possibly of the optimal subspace)
INTEGER, INTENT (in) :: nrr
!! kpoint number for the interpolation
INTEGER, INTENT (in) :: irvec (3, nrr)
@ -54,22 +45,22 @@
!
REAL(kind=DP), INTENT (in) :: xxq (3)
!! kpoint coordinates for the interpolation
REAL(kind=DP), INTENT (out) :: eig (nbnd)
REAL(kind=DP), INTENT (out) :: eig (nmodes)
!! interpolated hamiltonian eigenvalues for this kpoint
COMPLEX(kind=DP), INTENT (out) :: cuf(nbnd, nbnd)
COMPLEX(kind=DP), INTENT (out) :: cuf(nmodes, nmodes)
!! Rotation matrix, fine mesh
!
! work variables
! variables for lapack ZHPEVX
integer :: neig, info, ifail( nbnd ), iwork( 5*nbnd )
real(kind=DP) :: w( nbnd ), rwork( 7*nbnd )
complex(kind=DP) :: champ( nbnd*(nbnd+1)/2 ), &
cwork( 2*nbnd ), cz( nbnd, nbnd)
integer :: neig, info, ifail( nmodes ), iwork( 5*nmodes )
real(kind=DP) :: w( nmodes ), rwork( 7*nmodes )
complex(kind=DP) :: champ( nmodes*(nmodes+1)/2 ), &
cwork( 2*nmodes ), cz( nmodes, nmodes)
!
real(kind=DP) :: xq (3)
complex(kind=DP) :: chf(nbnd, nbnd)
complex(kind=DP) :: chf(nmodes, nmodes)
! Hamiltonian in Bloch basis, fine mesh
integer :: ibnd, jbnd, ir, na, nb
integer :: imode, jmode, ir, na, nb
real(kind=DP) :: rdotk, massfac
complex(kind=DP) :: cfac
!
@ -81,8 +72,8 @@
! H~_k' = sum_R 1/ndegen(R) e^{-ik'R } H_k(R)
! H~_k'+q = sum_R 1/ndegen(R) e^{-i(k'+q)R} H_k+q(R)
!
! H~_k is chf ( nbnd, nbnd, 2*ik-1 )
! H~_k+q is chf ( nbnd, nbnd, 2*ik )
! H~_k is chf ( nmodes, nmodes, 2*ik-1 )
! H~_k+q is chf ( nmodes, nmodes, 2*ik )
!
xq = xxq
chf (:,:) = czero
@ -127,15 +118,15 @@
! champ: complex hamiltonian packed (upper triangular part for zhpevx)
! after hermitian-ization
!
DO jbnd = 1, nbnd
DO ibnd = 1, jbnd
champ (ibnd + (jbnd - 1) * jbnd/2 ) = &
( chf ( ibnd, jbnd) + conjg ( chf ( jbnd, ibnd) ) ) / 2.d0
DO jmode = 1, nmodes
DO imode = 1, jbnd
champ (imode + (jmode - 1) * jmode/2 ) = &
( chf ( imode, jmode) + conjg ( chf ( jmode, imode) ) ) / 2.d0
ENDDO
ENDDO
!
CALL zhpevx ('V', 'A', 'U', nbnd, champ , 0.0, 0.0, &
0, 0,-1.0, neig, w, cz, nbnd, cwork, &
CALL zhpevx ('V', 'A', 'U', nmodes, champ , 0.0, 0.0, &
0, 0,-1.0, neig, w, cz, nmodes, cwork, &
rwork, iwork, ifail, info)
!
! rotation matrix and Ham eigenvalues

View File

@ -62,10 +62,17 @@
INTEGER :: ierr
!! Return if there is an error
!integer(kind=8) :: lrepmatw, lrepmatw2
#ifdef __MPI
INTEGER (kind=MPI_OFFSET_KIND) :: lrepmatw
!! Offset to tell where to start reading the file
INTEGER (kind=MPI_OFFSET_KIND) :: lrepmatw2
!! Offset to tell where to start reading the file
#else
INTEGER(kind=8) :: lrepmatw
!! Offset to tell where to start reading the file
INTEGER(kind=8) :: lrepmatw2
!! Offset to tell where to start reading the file
#endif
!
REAL(kind=DP) :: rdotk
!! Exponential for the FT
@ -130,11 +137,15 @@
ALLOCATE(epmatw ( nbnd, nbnd, nrr_k, nmodes))
!
!lrepmatw2 = 2 * nbnd * nbnd * nrr_k * nmodes
#ifdef __MPI
! Although this should almost never be problematic (see explaination below)
lrepmatw2 = 2_MPI_OFFSET_KIND * INT( nbnd , kind = MPI_OFFSET_KIND ) * &
INT( nbnd , kind = MPI_OFFSET_KIND ) * &
INT( nrr_k , kind = MPI_OFFSET_KIND ) * &
INT( nmodes, kind = MPI_OFFSET_KIND )
#else
lrepmatw2 = INT( 2 * nbnd * nbnd * nrr_k * nmodes, kind = 8)
#endif
!
DO ir = ir_start, ir_stop
#ifdef __MPI

View File

@ -143,7 +143,6 @@
!! Rotation matrix for phonons
COMPLEX(kind=DP), ALLOCATABLE :: bmatf ( :, :)
!! overlap U_k+q U_k^\dagger in smooth Bloch basis, fine mesh
COMPLEX(kind=DP), ALLOCATABLE :: aux ( : )
!
IF (nbndsub.ne.nbnd) &
WRITE(stdout, '(/,14x,a,i4)' ) 'band disentanglement is used: nbndsub = ', nbndsub
@ -959,7 +958,6 @@
IF ( ALLOCATED(gamma_all) ) DEALLOCATE( gamma_all )
IF ( ALLOCATED(sigmai_all) ) DEALLOCATE( sigmai_all )
IF ( ALLOCATED(sigmai_mode) ) DEALLOCATE( sigmai_mode )
IF ( ALLOCATED(aux)) DEALLOCATE ( aux )
!
CALL stop_clock ( 'ephwann' )
!
@ -1488,5 +1486,8 @@
!
ENDIF
!
! ----------------------------------------------------------------------
end subroutine rwepmatw
! ----------------------------------------------------------------------