4
1
mirror of https://github.com/pfloos/quack synced 2024-06-23 13:42:19 +02:00
quack/src/eDFT/gradient_density.f90

46 lines
1.0 KiB
Fortran
Raw Normal View History

2019-03-13 11:07:31 +01:00
subroutine gradient_density(nGrid,nBas,P,AO,dAO,drho)
! Calculate gradient of the one-electron density
implicit none
include 'parameters.h'
! Input variables
double precision,parameter :: thresh = 1d-15
integer,intent(in) :: nGrid
integer,intent(in) :: nBas
double precision,intent(in) :: P(nBas,nBas)
double precision,intent(in) :: AO(nBas,nGrid)
2020-03-15 16:29:43 +01:00
double precision,intent(in) :: dAO(ncart,nBas,nGrid)
2019-03-13 11:07:31 +01:00
! Local variables
integer :: ixyz,iG,mu,nu
double precision,external :: trace_matrix
! Output variables
2020-03-15 16:29:43 +01:00
double precision,intent(out) :: drho(ncart,nGrid)
2019-03-13 11:07:31 +01:00
drho(:,:) = 0d0
do iG=1,nGrid
do mu=1,nBas
do nu=1,nBas
2020-03-15 16:29:43 +01:00
do ixyz=1,ncart
2019-03-13 11:07:31 +01:00
drho(ixyz,iG) = drho(ixyz,iG) &
+ P(mu,nu)*(dAO(ixyz,mu,iG)*AO(nu,iG) + AO(mu,iG)*dAO(ixyz,nu,iG))
enddo
enddo
enddo
enddo
2020-03-15 16:29:43 +01:00
! do iG=1,nGrid
! do ixyz=1,ncart
! if(abs(drho(ixyz,iG)) < thresh) drho(ixyz,iG) = thresh
! enddo
! enddo
2019-03-13 11:07:31 +01:00
end subroutine gradient_density