Commit 03da79a1 authored by Oleksandr Motornyi's avatar Oleksandr Motornyi

Final modification for USPP+SOC feature in turbo_eels

parent 1cd81d81
!
! Copyright (C) 2001-2016 Quantum ESPRESSO group
! Copyright (C) 2001-2018 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,
......@@ -24,7 +24,7 @@ SUBROUTINE lr_sm1_psi_tpw (ik, lda, n, m, psi, spsi)
! Original routine written by R. Gebauer
! Modified by Osman Baris Malcioglu (2009)
! Modified by Iurii Timrov (2013)
! Simplified and generalized to relativistic case by Andrea Dal Corso (2018)
! Simplified and generalized to the relativistic case by Andrea Dal Corso (2018)
!
USE kinds, ONLY : DP
USE control_flags, ONLY : gamma_only
......@@ -39,7 +39,7 @@ SUBROUTINE lr_sm1_psi_tpw (ik, lda, n, m, psi, spsi)
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
!
IMPLICIT NONE
INTEGER, INTENT(in) :: lda, n, m, ik
INTEGER, INTENT(in) :: ik, lda,n,m
COMPLEX(DP), INTENT(in) :: psi(lda*npol,m)
COMPLEX(DP), INTENT(out) :: spsi(lda*npol,m)
!
......@@ -89,7 +89,16 @@ CONTAINS
!
IF ( nkb == 0 .OR. .NOT. okvan ) RETURN
!
CALL calbec(n,vkb,psi,becp,m)
IF (real_space) THEN
!
DO ibnd=1,m,2
CALL invfft_orbital_gamma(psi,ibnd,m)
CALL calbec_rs_gamma(ibnd,m,becp%r)
ENDDO
!
ELSE
CALL calbec(n,vkb,psi,becp,m)
ENDIF
!
! Use the array ps as a workspace
ALLOCATE(ps(nkb,m))
......@@ -287,6 +296,7 @@ COMPLEX(DP), ALLOCATABLE :: ps(:,:), bbnc_nc(:,:)
IF (gamma_only) THEN
bbg = 0.0d0
ALLOCATE(psr(nkb,nkb))
psr(:,:) = (0.d0,0.d0)
ELSE
IF (noncolin) THEN
ALLOCATE(bbnc_nc(nkb,nkb))
......@@ -295,6 +305,7 @@ ELSE
bbk = (0.0d0,0.0d0)
ENDIF
ALLOCATE(ps(nkb*npol,nkb*npol))
ps(:,:) = (0.d0,0.d0)
ENDIF
DO ik1 = 1, nksq
......@@ -323,7 +334,6 @@ DO ik1 = 1, nksq
CALL mp_sum(bbk(:,:,ik1), intra_bgrp_comm)
ENDIF
!
ps(:,:) = (0.d0,0.d0)
!
! Calculate the product of q_nm and B_ij of Eq.(16).
!
......@@ -424,7 +434,7 @@ DO ik1 = 1, nksq
!
IF (gamma_only) THEN
bbg(ii,jkb) = bbg(ii,jkb) &
- ps(ii,ikb) * qq_nt(ih,jh,nt)
- psr(ii,ikb) * qq_nt(ih,jh,nt)
ELSEIF (noncolin) THEN
kjs = 0
......
......@@ -18,24 +18,31 @@
!----------------------------------------------------------------------
SUBROUTINE lr_addus_dvpsi (npwq, ik,psi,dvpsi)
!----------------------------------------------------------------------
!---------------------------------------------------------------------------
!
! ... Calculate the ultrasoft term of the perturbation exp(iq*r),
! ... and then sum up the input wavefunction and the ultrasoft term.
!
! ... input:
!
! ... ik given k point
! ... lda leading dimension of the array psi
! ... n true dimension of psi
! ... m number of bands of psi
!
! This routine computes the contribution of the Fourier transform
! of the augmentation function at the given q, and adds it to
! dvpsi.
! Written by Iurii Timrov (2015)
! Generalized to the relativistic case by Andrea Dal Corso (2018)
!
USE kinds, ONLY : DP
USE uspp_param, ONLY : upf, nh
USE uspp, ONLY : vkb, okvan
! modules from pwcom
USE lsda_mod, ONLY : lsda, current_spin, isk
USE ions_base, ONLY : ntyp => nsp, nat, ityp
USE wvfct, ONLY : nbnd, npwx
USE noncollin_module, ONLY : noncolin, npol
! modules from phcom
USE qpoint, ONLY : ikks
USE lr_variables, ONLY : intq, intq_nc
USE lrus, ONLY : becp1
! USE eqv, ONLY : dvpsi
IMPLICIT NONE
!
! The dummy variables
......@@ -64,7 +71,7 @@ SUBROUTINE lr_addus_dvpsi (npwq, ik,psi,dvpsi)
! auxiliary variable
IF (.NOT.okvan) RETURN
CALL start_clock ('dveqpsi_us_only')
CALL start_clock ('lr_addus_dvpsi')
dvpsi=psi
ikk = ikks(ik)
IF (lsda) current_spin = isk (ikk)
......@@ -120,6 +127,6 @@ SUBROUTINE lr_addus_dvpsi (npwq, ik,psi,dvpsi)
ENDIF
ENDDO
CALL stop_clock ('dveqpsi_us_only')
CALL stop_clock ('lr_addus_dvpsi')
RETURN
END SUBROUTINE lr_addus_dvpsi
......@@ -154,12 +154,13 @@ SUBROUTINE lr_alloc_init()
ENDIF
!
! Optical case: allocate the response charge-density
!
!
IF (.NOT.eels) THEN
!
IF (gamma_only) THEN
ALLOCATE(rho_1(dfftp%nnr,nspin_mag))
rho_1(:,:)=0.0d0
ALLOCATE(bbg(nkb,nkb))
ELSE
ALLOCATE(rho_1c(dfftp%nnr,nspin_mag))
rho_1c(:,:)=(0.0d0,0.0d0)
......
......@@ -298,6 +298,8 @@ SUBROUTINE lr_apply_liouvillian( evc1, evc1_new, interaction )
!
CALL lr_sm1_psi_tpw ( ik, npwx, ngk(ik), nbnd, &
& sevc1_new(1,1,ik), evc1_new(1,1,ik))
! CALL lr_sm1_psi (.FALSE., ik, npwx, ngk(ik), nbnd, &
! & sevc1_new(1,1,ik), evc1_new(1,1,ik))
!
ENDDO
!
......
......@@ -148,7 +148,8 @@ SUBROUTINE lr_dvpsi_e(ik,ipol,dvpsi)
IF (okvan) THEN
ALLOCATE (spsi ( npwx*npol, nbnd))
CALL lr_sm1_initialize()
CALL lr_sm1_psi_tpw (,ik,npwx,ngk(ik),nbnd,dvpsi,spsi)
CALL lr_sm1_psi_tpw (ik,npwx,ngk(ik),nbnd,dvpsi,spsi)
! CALL lr_sm1_psi(.TRUE.,ik,npwx,ngk(ik),nbnd,dvpsi,spsi)
dvpsi(:,:) = spsi(:,:)
DEALLOCATE(spsi)
ENDIF
......
......@@ -118,7 +118,6 @@ SUBROUTINE lr_dvpsi_eels (ik, dvpsi1, dvpsi2)
! Calculate beta-functions vkb at point k+q
CALL init_us_2(npwq, igk_k(1,ikq), xk(1,ikq), vkb)
!
! CALL lr_addus_dvpsi (ik, npwx, npwq, nbnd_occ(ikk), dvpsi1, dpsi)
CALL lr_addus_dvpsi ( npwq,ik, dvpsi1, dpsi)
!
dvpsi1 = dpsi
......
......@@ -534,7 +534,6 @@ CONTAINS
!
IF (eels) THEN
!
! IF (okvan .AND. noncolin) CALL errore( 'lr_readin', 'Ultrasoft PP + noncolin is not fully implemented', 1 )
IF (gamma_only) CALL errore( 'lr_readin', 'gamma_only is not supported', 1 )
!
! Tamm-Dancoff approximation is not recommended to be used with EELS, and
......
......@@ -75,9 +75,9 @@ SUBROUTINE lr_restart(iter_restart,rflag)
ENDIF
!
! Reading Lanczos coefficients
IF (okvan) CALL lr_sm1_initialize()
!
IF (eels) THEN
IF (okvan) CALL lr_sm1_initialize()
filename = trim(prefix) // trim(bgz_suffix) // trim("dat")
ELSE
filename = trim(prefix) // trim(bgz_suffix) // trim(int_to_char(LR_polarization))
......
......@@ -59,15 +59,13 @@ SUBROUTINE lr_solve_e
!
! EELS case
IF (okvan) THEN
ALLOCATE (intq (nhm, nhm, nat) )
IF (noncolin) THEN
IF (okvan) THEN
ALLOCATE (intq (nhm, nhm, nat) )
IF (noncolin) THEN
ALLOCATE(intq_nc( nhm, nhm, nat, nspin))
ENDIF
CALL compute_intq()
ENDIF
CALL compute_intq()
ENDIF
!
DO ik = 1, nksq
CALL lr_dvpsi_eels(ik, d0psi(:,:,ik,1), d0psi2(:,:,ik,1))
......
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