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-11-04 20:09:48 +08:00
|
|
|
SUBROUTINE d3_exc
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! Calculates the contribution to the derivative of the dynamical
|
|
|
|
! matrix due to the third derivative of the exchange and correlation
|
|
|
|
! energy
|
2004-06-14 15:30:47 +08:00
|
|
|
!
|
|
|
|
USE ions_base, ONLY : nat
|
2004-11-04 20:09:48 +08:00
|
|
|
USE kinds, ONLY : DP
|
|
|
|
USE pwcom
|
2007-10-31 22:28:18 +08:00
|
|
|
USE scf, only : rho, rho_core
|
2004-11-04 20:09:48 +08:00
|
|
|
USE phcom
|
|
|
|
USE d3com
|
2004-03-09 01:21:27 +08:00
|
|
|
USE io_global, ONLY : ionode_id
|
2009-10-15 21:20:18 +08:00
|
|
|
USE mp_global, ONLY : inter_pool_comm, my_pool_id, &
|
|
|
|
npool, intra_pool_comm
|
2008-04-14 02:31:27 +08:00
|
|
|
USE mp, ONLY : mp_bcast, mp_sum
|
2004-03-24 17:36:50 +08:00
|
|
|
|
2004-11-04 20:09:48 +08:00
|
|
|
IMPLICIT NONE
|
2004-03-24 17:36:50 +08:00
|
|
|
|
2004-11-04 20:09:48 +08:00
|
|
|
INTEGER :: errcode, ir, ipert, jpert, kpert, npert1, npert2
|
2005-08-28 22:09:42 +08:00
|
|
|
REAL (DP) :: d2mxc, rhotot, xq0 (3)
|
|
|
|
REAL (DP), ALLOCATABLE :: d2muxc (:)
|
|
|
|
COMPLEX (DP) :: aux
|
|
|
|
COMPLEX (DP), ALLOCATABLE :: work1 (:), work2 (:), &
|
2004-11-04 20:09:48 +08:00
|
|
|
work3 (:), d3dyn1 (:,:,:)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-11-04 20:09:48 +08:00
|
|
|
ALLOCATE (d2muxc( nrxx))
|
|
|
|
ALLOCATE (work1 ( nrxx))
|
|
|
|
ALLOCATE (work2 ( nrxx))
|
|
|
|
ALLOCATE (work3 ( nrxx))
|
|
|
|
ALLOCATE (d3dyn1( 3*nat, 3*nat, 3*nat))
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2009-10-17 15:22:42 +08:00
|
|
|
! IF ( my_pool_id == 0 ) THEN
|
2004-11-04 20:09:48 +08:00
|
|
|
!
|
|
|
|
! Calculates third derivative of Exc
|
|
|
|
!
|
|
|
|
d2muxc(:) = 0.d0
|
|
|
|
DO ir = 1, nrxx
|
2007-11-01 19:19:31 +08:00
|
|
|
rhotot = rho%of_r (ir, 1) + rho_core (ir)
|
2004-11-04 20:09:48 +08:00
|
|
|
IF (rhotot > 1.d-30) d2muxc (ir) = d2mxc (rhotot)
|
|
|
|
IF (rhotot < - 1.d-30) d2muxc (ir) = - d2mxc ( - rhotot)
|
|
|
|
ENDDO
|
|
|
|
!
|
|
|
|
! Calculates the contribution to d3dyn
|
|
|
|
!
|
|
|
|
d3dyn1 (:,:,:) = (0.d0, 0.d0)
|
|
|
|
DO ipert = 1, 3 * nat
|
|
|
|
IF (q0mode (ipert) ) THEN
|
|
|
|
CALL davcio_drho (work1, lrdrho, iud0rho, ipert, - 1)
|
|
|
|
DO jpert = 1, 3 * nat
|
|
|
|
CALL davcio_drho (work2, lrdrho, iudrho, jpert, - 1)
|
|
|
|
DO kpert = 1, 3 * nat
|
|
|
|
CALL davcio_drho (work3, lrdrho, iudrho, kpert, - 1)
|
2009-08-03 17:19:02 +08:00
|
|
|
aux = CMPLX(0.d0, 0.d0,kind=DP)
|
2004-11-04 20:09:48 +08:00
|
|
|
DO ir = 1, nrxx
|
|
|
|
aux = aux + &
|
|
|
|
d2muxc (ir) * work1 (ir) * &
|
|
|
|
CONJG (work2 (ir) ) * work3 (ir)
|
|
|
|
ENDDO
|
|
|
|
!
|
2008-04-14 02:31:27 +08:00
|
|
|
CALL mp_sum ( aux, intra_pool_comm )
|
2004-11-04 20:09:48 +08:00
|
|
|
!
|
|
|
|
d3dyn1 (ipert, jpert, kpert) = omega * aux / (nr1 * nr2 * nr3)
|
|
|
|
!
|
|
|
|
ENDDO
|
|
|
|
ENDDO
|
|
|
|
ENDIF
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-11-04 20:09:48 +08:00
|
|
|
ENDDO
|
|
|
|
!
|
2009-10-17 15:22:42 +08:00
|
|
|
! END IF
|
2004-11-04 20:09:48 +08:00
|
|
|
!
|
|
|
|
IF ( npool /= 1 ) CALL mp_bcast( d3dyn1, ionode_id, inter_pool_comm )
|
|
|
|
!
|
2004-03-07 21:47:42 +08:00
|
|
|
d3dyn = d3dyn + d3dyn1
|
|
|
|
d3dyn_aux9 = d3dyn1
|
2004-11-04 20:09:48 +08:00
|
|
|
!
|
|
|
|
DEALLOCATE (d2muxc)
|
|
|
|
DEALLOCATE (work1)
|
|
|
|
DEALLOCATE (work2)
|
|
|
|
DEALLOCATE (work3)
|
|
|
|
DEALLOCATE (d3dyn1)
|
|
|
|
!
|
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE d3_exc
|