Variable 'time_reversal' added. It contains information that was already

present but somewhat hidden. I hope that everything works as before
(matdyn doesn't work with spin-orbit or noncolinear case, but I think
it didn't already) but it is a good idea to check. The choice of a single
q-point in phonon via iq1,iq2,iq3 is presently disabled.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4484 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2007-11-29 15:39:29 +00:00
parent fe243a29d8
commit 165498def4
8 changed files with 60 additions and 76 deletions

View File

@ -1561,8 +1561,8 @@ SUBROUTINE gen_qpoints (ibrav, at, bg, nat, tau, ityp, nk1, nk2, nk3, &
REAL(DP) :: q(3,nqx)
! local
INTEGER :: nrot, nsym, s(3,3,48), ftau(3,48), irt(48,nat)
INTEGER :: t_rev = 0
LOGICAL :: minus_q, invsym
INTEGER :: t_rev(48) = 0
LOGICAL :: minus_q, invsym, time_reversal = .TRUE.
REAL(DP) :: xqq(3), wk(nqx), mdum(3,nat)
CHARACTER(LEN=45) :: sname(48)
!
@ -1592,7 +1592,8 @@ SUBROUTINE gen_qpoints (ibrav, at, bg, nat, tau, ityp, nk1, nk2, nk3, &
CALL errore ('gen_qpoints', 'wrong ibrav', 1)
ENDIF
!
CALL kpoint_grid ( nrot, s, bg, nqx, 0,0,0, nk1,nk2,nk3, nq, q, wk)
CALL kpoint_grid ( nrot, time_reversal, s, t_rev, bg, nqx, &
0,0,0, nk1,nk2,nk3, nq, q, wk)
!
CALL sgama (nrot, nat, s, sname, t_rev, at, bg, tau, ityp, nsym, 6, &
6, 6, irt, ftau, nqx, nq, q, wk, invsym, minus_q, xqq, &

View File

@ -54,7 +54,7 @@ subroutine phq_setup
USE scf, ONLY : v, vrs, vltot, rho, rho_core, kedtau
USE gvect, ONLY : nrxx, ngm
USE gsmooth, ONLY : doublegrid
USE symme, ONLY : nsym, s, ftau, irt, t_rev
USE symme, ONLY : nsym, s, ftau, irt, t_rev, time_reversal
USE uspp_param, ONLY : upf
USE spin_orb, ONLY : domag
USE constants, ONLY : degspin, pi
@ -251,6 +251,8 @@ subroutine phq_setup
!
! 7) set all the variables needed to use the pattern representation
!
time_reversal = .NOT.noncolin .OR. .NOT.domag
!
! allocate and calculate rtau, the rotated position of each atom
!
do isym = 1, nsym

View File

@ -14,16 +14,14 @@ SUBROUTINE q_points ( )
USE disp, ONLY : nqmax, nq1, nq2, nq3, x_q, nqs
USE disp, ONLY : iq1, iq2, iq3
USE output, ONLY : fildyn
USE symme, ONLY : nsym, s
USE symme, ONLY : nsym, s, time_reversal, t_rev
USE cell_base, ONLY : bg
implicit none
integer :: i, iq, ierr, iudyn = 26
real(DP), allocatable, dimension(:) :: wq
logical :: exist_gamma
real(DP), allocatable, dimension(:) :: wq
!
! calculates the Monkhorst-Pack grid
@ -38,8 +36,9 @@ SUBROUTINE q_points ( )
allocate (wq(nqmax))
allocate (x_q(3,nqmax))
call kpoint_grid( nsym, s, bg, nqmax, 2*iq1, 2*iq2, 2*iq3, &
nq1, nq2, nq3, nqs, x_q, wq )
call kpoint_grid( nsym, time_reversal, s, t_rev, bg, nqmax, &
0,0,0, nq1,nq2,nq3, nqs, x_q, wq )
deallocate (wq)
!
! Check if the Gamma point is one of the points and put

View File

@ -5,8 +5,8 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
SUBROUTINE kp_strings &
( nppstr,gdir,nrot,s,bg,npk,k1,k2,k3,nk1,nk2,nk3,nks,xk,wk)
SUBROUTINE kp_strings ( nppstr, gdir, nrot, s, bg, npk, &
k1,k2,k3, nk1,nk2,nk3, nks, xk, wk )
#include "f_defs.h"
@ -39,26 +39,25 @@ SUBROUTINE kp_strings &
INTEGER :: ipar
INTEGER :: iort
INTEGER :: kindex
! time reversal and no magnetic symmetries assumed
INTEGER :: t_rev(48) = 0
LOGICAL :: time_reversal = .true.
REAL(dp) :: dk(3)
REAL(dp) :: xk0(3,npk)
REAL(dp) :: wk0(npk)
! --- Generate a k-point grid in the two dimensions other than gdir ---
IF (gdir == 1) THEN
CALL kpoint_grid(nrot,s,bg,npk,k1,k2,k3,1,nk2,nk3,nks,xk0,wk0)
! DO i=1,nk2*nk3
! xk0(1,i)=0.0
! END DO
CALL kpoint_grid (nrot, time_reversal, s, t_rev, bg, npk, &
k1,k2,k3, 1,nk2,nk3, nks, xk0, wk0 )
ELSE IF (gdir == 2) THEN
CALL kpoint_grid(nrot,s,bg,npk,k1,k2,k3,nk1,1,nk3,nks,xk0,wk0)
! DO i=1,nk1*nk3
! xk0(2,i)=0.0
! END DO
CALL kpoint_grid (nrot, time_reversal, s, t_rev, bg, npk, &
k1,k2,k3, nk1,1,nk3, nks, xk0, wk0 )
ELSE IF (gdir == 3) THEN
CALL kpoint_grid(nrot,s,bg,npk,k1,k2,k3,nk1,nk2,1,nks,xk0,wk0)
! DO i=1,nk1*nk2
! xk0(3,i)=0.0
! END DO
CALL kpoint_grid (nrot, time_reversal, s, t_rev, bg, npk, &
k1,k2,k3, nk1,nk2,1, nks, xk0, wk0 )
ELSE
CALL errore('kp_strings','gdir different from 1, 2, or 3',1)
END IF

View File

@ -1,5 +1,5 @@
!
! Copyright (C) 2001 PWSCF group
! Copyright (C) 2001-2007 Quantum-Espresso group
! 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,
@ -7,45 +7,32 @@
!
#include "f_defs.h"
!-----------------------------------------------------------------------
subroutine kpoint_grid &
( nrot, s, bg, npk, k1i,k2i,k3i, nk1,nk2,nk3, nks, xk, wk)
subroutine kpoint_grid ( nrot, time_reversal, s, t_rev, bg, npk, &
k1,k2,k3, nk1,nk2,nk3, nks, xk, wk)
!-----------------------------------------------------------------------
!
! Automatic generation of a uniform grid of k-points
!
USE kinds, only: DP
USE noncollin_module, ONLY: noncolin
USE spin_orb, ONLY : domag
USE symme, ONLY : t_rev
implicit none
! INPUT:
integer k1i, k2i, k3i, ik1, ik2, ik3, nsingle
integer nrot, s(3,3,48), npk, k1, k2, k3, nk1, nk2, nk3
real(DP) bg(3,3)
! OUTPUT:
integer nks
real(DP) xk(3,npk), wk(npk)
!
integer, intent(in):: nrot, npk, k1, k2, k3, nk1, nk2, nk3, &
t_rev(48), s(3,3,48)
logical, intent(in):: time_reversal
real(DP), intent(in):: bg(3,3)
!
integer, intent(out) :: nks
real(DP), intent(out):: xk(3,npk)
real(DP), intent(out):: wk(npk)
! LOCAL:
real(DP), parameter :: eps=1.0d-5
real(DP) xkr(3), deltap(3), deltam(3), fact, xx, yy, zz
real(DP) :: xkr(3), deltap(3), deltam(3), fact, xx, yy, zz
real(DP), allocatable:: xkg(:,:), wkk(:)
integer nkr, i,j,k, ns, n, nk, nkr1, nkr2
integer :: nkr, i,j,k, ns, n, nk
integer, allocatable :: equiv(:)
logical :: in_the_list
!
! 0 or 1 in k1i is for half-step shift
! the rest is for choosing a specific grid point (ik1, ik2, ik3)
nkr=nk1*nk2*nk3
k1 = mod(k1i,2)
k2 = mod(k2i,2)
k3 = mod(k3i,2)
ik1 = k1i/2
ik2 = k2i/2
ik3 = k3i/2
nsingle = 0
if (ik1.gt.0.and.ik2.gt.0.and.ik3.gt.0) &
nsingle = (ik3-1) + (ik2-1)*nk3 + (ik1-1)*nk2*nk3 + 1
if (nsingle.gt.nkr) nsingle = 0
allocate (xkg( 3,nkr),wkk(nkr))
allocate (equiv( nkr))
!
@ -71,7 +58,7 @@ subroutine kpoint_grid &
do nk=1,nkr
! check if this k-point has already been found equivalent to another
if (equiv(nk).eq.nk) then
if (equiv(nk) == nk) then
wkk(nk) = 1.0d0
! check if there are equivalent k-point to this in the list
! (excepted those previously found to be equivalent to another)
@ -87,8 +74,9 @@ subroutine kpoint_grid &
xx = xkr(1)*nk1 - 0.5d0*k1
yy = xkr(2)*nk2 - 0.5d0*k2
zz = xkr(3)*nk3 - 0.5d0*k3
in_the_list = abs(xx-nint(xx)).le.eps .and. abs(yy-nint(yy)).le.eps &
.and. abs(zz-nint(zz)).le.eps
in_the_list = abs(xx-nint(xx)).le.eps .and. &
abs(yy-nint(yy)).le.eps .and. &
abs(zz-nint(zz)).le.eps
if (in_the_list) then
i = mod ( nint ( xkr(1)*nk1 - 0.5d0*k1 + 2*nk1), nk1 ) + 1
j = mod ( nint ( xkr(2)*nk2 - 0.5d0*k2 + 2*nk2), nk2 ) + 1
@ -102,7 +90,7 @@ subroutine kpoint_grid &
'something wrong in the checking algorithm',1)
end if
end if
if (.not. noncolin.or. .not.domag) then
if ( time_reversal ) then
xx =-xkr(1)*nk1 - 0.5d0*k1
yy =-xkr(2)*nk2 - 0.5d0*k2
zz =-xkr(3)*nk3 - 0.5d0*k3
@ -130,17 +118,7 @@ subroutine kpoint_grid &
nks=0
fact=0.0d0
if (nsingle.eq.0) then
nkr1 = 1
nkr2 = nkr
else
nkr1 = equiv(nsingle)
nkr2 = nkr1
! nks=nks+1
! wk(nks) = 1.0d0
! xk(:,nks) = 0.0d0
endif
do nk=nkr1,nkr2
do nk=1,nkr
if (equiv(nk).eq.nk) then
nks=nks+1
if (nks.gt.npk) call errore('kpoint_grid','too many k-points',1)

View File

@ -199,15 +199,16 @@ MODULE symme
SAVE
!
INTEGER :: &
s(3,3,48), &! simmetry matrices
ftau(3,48), &! fractional translations
nsym ! number of symmetries
s(3,3,48), &! simmetry matrices
ftau(3,48), &! fractional translations
nsym ! number of symmetries
INTEGER :: &
t_rev(48) = 0 ! time reversal flag, for noncolinear magnetisation
t_rev(48) = 0 ! time reversal flag, for noncolinear magnetisation
INTEGER, ALLOCATABLE :: &
irt(:,:) ! symmetric atom for each atom and sym.op.
irt(:,:) ! symmetric atom for each atom and sym.op.
LOGICAL :: &
invsym ! if .TRUE. the system has inversion symmetry
time_reversal=.true., &! if .TRUE. the system has time_reversal symmetry
invsym ! if .TRUE. the system has inversion symmetry
REAL(DP),TARGET :: &
d1(3,3,48), &! matrices for rotating spherical
d2(5,5,48), &! harmonics (d1 for l=1, ...)

View File

@ -60,7 +60,8 @@ SUBROUTINE setup()
USE electrons_base, ONLY : set_nelup_neldw
USE ktetra, ONLY : nk1, nk2, nk3, k1, k2, k3, &
tetra, ntetra, ltetra
USE symme, ONLY : s, t_rev, irt, ftau, nsym, invsym, d1,d2,d3
USE symme, ONLY : s, t_rev, irt, ftau, nsym, invsym, d1,d2,d3, &
time_reversal
USE wvfct, ONLY : nbnd, nbndx
USE control_flags, ONLY : tr2, ethr, lscf, lmd, lpath, lphonon, david, &
isolve, niter, noinv, nosym, modenum, lbands, &
@ -534,6 +535,8 @@ SUBROUTINE setup()
!
IF ( nosym ) nrot = 1
!
time_reversal = .NOT. noncolin .OR. .NOT. domag
!
! ... Automatic generation of k-points (if required)
!
IF ( nkstot < 0 ) THEN
@ -554,8 +557,8 @@ SUBROUTINE setup()
!
ELSE
!
CALL kpoint_grid( nrot, s, bg, npk, k1, k2, k3, &
nk1, nk2, nk3, nkstot, xk, wk )
CALL kpoint_grid ( nrot, time_reversal, s, t_rev, bg, npk, &
k1,k2,k3, nk1,nk2,nk3, nkstot, xk, wk)
!
END IF
!

View File

@ -300,9 +300,10 @@ IF (lda_plus_u) call errore('do_cond','PWCOND not working with LDA+U',1)
#endif
IF (nkpts==0) THEN
time_reversal = .NOT. noncolin
IF (ionode) THEN
CALL kpoint_grid( nsym, s, bg, npk, k1ts, k2ts, 0, &
nk1ts, nk2ts, 1, nkpts, xk, wkpt )
CALL kpoint_grid( nsym, time_reversal, s, t_rev, bg, npk, &
k1ts, k2ts, 0, nk1ts, nk2ts, 1, nkpts, xk, wkpt )
DO ik=1,nkpts
xyk(1,ik)=xk(1,ik)
xyk(2,ik)=xk(2,ik)