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 .
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine drhod2v
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
! It calls the routines which calculate the term containing the first
|
|
|
|
! variation of the charge and the secon variation of the potential with
|
|
|
|
! respect to the perturbation.
|
|
|
|
! d0rhod2v: contains the terms depending on the first variation of the c
|
|
|
|
! with respect to a perturbaation at q=0
|
|
|
|
! dqrhod2v: contains the terms depending on the first variation of the c
|
|
|
|
! with respect to a perturbaation at a generic q
|
|
|
|
! The variation of the charge can be read from a file or calculated dire
|
|
|
|
! --this last option is to be used for testing pourposes--
|
|
|
|
!
|
2004-06-14 15:30:47 +08:00
|
|
|
USE ions_base, ONLY : nat
|
2004-02-04 19:06:45 +08:00
|
|
|
USE kinds, only : DP
|
2003-01-20 05:58:50 +08:00
|
|
|
use pwcom
|
|
|
|
use phcom
|
|
|
|
use d3com
|
|
|
|
!
|
|
|
|
implicit none
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: irr, irr1, imode0, ipert, ir
|
2005-08-28 22:09:42 +08:00
|
|
|
real (DP) :: xq0 (3)
|
|
|
|
complex (DP), allocatable :: drhoscf (:)
|
2003-01-20 05:58:50 +08:00
|
|
|
! the change of density due to perturbations
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (drhoscf( nrxx))
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call read_ef
|
|
|
|
if (.not.allmodes) then
|
|
|
|
do ipert = 1, 3 * nat
|
|
|
|
call davcio_drho (drhoscf, lrdrho, iudrho, ipert, - 1)
|
|
|
|
call dqrhod2v (ipert, drhoscf)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
|
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
do ipert = 1, 3 * nat
|
|
|
|
if (q0mode (ipert) ) then
|
|
|
|
call davcio_drho (drhoscf, lrdrho, iud0rho, ipert, - 1)
|
|
|
|
call d0rhod2v (ipert, drhoscf)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate (drhoscf)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
end subroutine drhod2v
|