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 drhodvloc (nu_i0, nper, drhoscf, wdyn)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
! following comment is obsolete
|
|
|
|
! This subroutine computes the electronic term
|
|
|
|
! <psi|dv|dpsi> of the dynamical matrix. It can be used both for KB
|
|
|
|
! and for US pseudopotentials.
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2004-06-12 21:44:18 +08:00
|
|
|
!
|
|
|
|
USE ions_base, ONLY : nat
|
2003-02-08 00:04:36 +08:00
|
|
|
use pwcom
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only : DP
|
2003-02-08 00:04:36 +08:00
|
|
|
use phcom
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nper, nu_i0
|
2004-03-07 21:47:42 +08:00
|
|
|
! input: the number of perturbation of this representations
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the initial position of the mode
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: drhoscf (nrxx, nspin, npertx), wdyn (3 * nat, 3 * nat)
|
2004-03-07 21:47:42 +08:00
|
|
|
! the change of density due to perturbations
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary matrix where drhodv is stored
|
|
|
|
|
2007-02-08 21:07:07 +08:00
|
|
|
integer :: ipert, is, nu_i, nu_j, nspin0
|
2003-01-20 05:58:50 +08:00
|
|
|
! counter on perturbations
|
|
|
|
! counter on spin polarizations
|
|
|
|
! counter on the i modes
|
|
|
|
! counter on the j modes
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: ZDOTC, dynwrk (3 * nat, 3 * nat)
|
|
|
|
complex(DP), allocatable :: dvloc (:)
|
2003-01-20 05:58:50 +08:00
|
|
|
! d Vloc / dtau
|
|
|
|
|
2007-02-08 21:07:07 +08:00
|
|
|
nspin0=nspin
|
|
|
|
if (nspin==4) nspin0=1
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (dvloc( nrxxs))
|
2004-03-07 21:47:42 +08:00
|
|
|
dynwrk (:,:) = (0.d0, 0.d0)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! We need a sum over all perturbations
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do nu_j = 1, 3 * nat
|
|
|
|
call compute_dvloc (nu_j, dvloc)
|
|
|
|
do ipert = 1, nper
|
|
|
|
nu_i = nu_i0 + ipert
|
2007-02-08 21:07:07 +08:00
|
|
|
do is = 1, nspin0
|
2004-03-07 21:47:42 +08:00
|
|
|
dynwrk (nu_i, nu_j) = dynwrk (nu_i, nu_j) + &
|
|
|
|
ZDOTC (nrxxs, drhoscf (1, is, ipert), 1, dvloc, 1) * &
|
|
|
|
omega / (nr1s * nr2s * nr3s)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
2003-02-21 22:57:00 +08:00
|
|
|
#ifdef __PARA
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! collect contributions from nodes of a pool (sum over G & R space)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call reduce (18 * nat * nat, dynwrk)
|
2003-01-20 05:58:50 +08:00
|
|
|
#endif
|
|
|
|
|
2004-03-07 21:47:42 +08:00
|
|
|
wdyn(:,:) = wdyn(:,:) + dynwrk(:,:)
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate(dvloc)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine drhodvloc
|