2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2001 PWSCF 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,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine compute_dvloc (mode, dvlocin)
|
2003-01-20 05:58:50 +08:00
|
|
|
!----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine calculates dV_bare/dtau * psi for one perturbation
|
|
|
|
! with a given q. The displacements are described by a vector u.
|
|
|
|
! The result is stored in dvpsi. The routine is called for each k point
|
|
|
|
! and for each pattern u. It computes simultaneously all the bands.
|
|
|
|
!
|
|
|
|
#include "machine.h"
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
use pwcom
|
|
|
|
use parameters, only : DP
|
|
|
|
use phcom
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! The dummy variables
|
|
|
|
!
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: mode
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the actual perturbation
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP) :: dvlocin (nrxxs)
|
2003-01-20 05:58:50 +08:00
|
|
|
! output: the change of the local potential
|
|
|
|
!
|
|
|
|
! And the local variables
|
|
|
|
!
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: na, nt, mu, ig, ibnd, ir
|
2003-01-20 05:58:50 +08:00
|
|
|
! counter on atoms
|
|
|
|
! the type of atom
|
|
|
|
! counter on modes
|
|
|
|
! counter on G vectors
|
|
|
|
! counter on bands
|
|
|
|
! counter on real mesh
|
|
|
|
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP) :: gtau, gu
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary variable
|
|
|
|
! auxiliary variable
|
|
|
|
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP) :: fact, u1, u2, u3, gu0
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliaty factor
|
|
|
|
! auxiliary factors
|
|
|
|
! auxiliary term
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call start_clock ('com_dvloc')
|
|
|
|
call setv (2 * nrxxs, 0.d0, dvlocin, 1)
|
|
|
|
do na = 1, nat
|
|
|
|
fact = tpiba * (0.d0, - 1.d0) * eigqts (na)
|
|
|
|
mu = 3 * (na - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
if (abs (u (mu + 1, mode) ) + abs (u (mu + 2, mode) ) + abs (u ( &
|
|
|
|
mu + 3, mode) ) .gt.1.0d-12) then
|
2003-02-08 00:04:36 +08:00
|
|
|
nt = ityp (na)
|
|
|
|
u1 = u (mu + 1, mode)
|
|
|
|
u2 = u (mu + 2, mode)
|
|
|
|
u3 = u (mu + 3, mode)
|
|
|
|
gu0 = xq (1) * u1 + xq (2) * u2 + xq (3) * u3
|
|
|
|
do ig = 1, ngms
|
2003-01-20 05:58:50 +08:00
|
|
|
gtau = eigts1 (ig1 (ig), na) * eigts2 (ig2 (ig), na) * eigts3 ( &
|
|
|
|
ig3 (ig), na)
|
2003-02-08 00:04:36 +08:00
|
|
|
gu = gu0 + g (1, ig) * u1 + g (2, ig) * u2 + g (3, ig) * u3
|
2003-01-20 05:58:50 +08:00
|
|
|
dvlocin (nls (ig) ) = dvlocin (nls (ig) ) + vlocq (ig, nt) &
|
|
|
|
* gu * fact * gtau
|
2003-02-08 00:04:36 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Now we compute dV_loc/dtau in real space
|
|
|
|
!
|
|
|
|
|
|
|
|
call cft3s (dvlocin, nr1s, nr2s, nr3s, nrx1s, nrx2s, nrx3s, &
|
|
|
|
+ 1)
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call stop_clock ('com_dvloc')
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine compute_dvloc
|