2020-08-01 11:45:17 +02:00
|
|
|
subroutine restricted_density_matrix(nBas,nEns,nO,c,P,occnum)
|
2020-03-15 14:34:18 +01:00
|
|
|
|
|
|
|
! Calculate density matrices
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
include 'parameters.h'
|
|
|
|
|
|
|
|
! Input variables
|
|
|
|
|
|
|
|
integer,intent(in) :: nBas
|
|
|
|
integer,intent(in) :: nEns
|
|
|
|
integer,intent(in) :: nO
|
|
|
|
double precision,intent(in) :: c(nBas,nBas)
|
2020-09-11 11:55:04 +02:00
|
|
|
double precision,intent(in) :: occnum(nBas,nspin,nEns)
|
2020-08-01 11:45:17 +02:00
|
|
|
|
2020-03-15 14:34:18 +01:00
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
|
|
|
integer :: iEns
|
|
|
|
|
|
|
|
! Output variables
|
|
|
|
|
|
|
|
double precision,intent(out) :: P(nBas,nBas,nEns)
|
|
|
|
|
|
|
|
! Ground state density matrix
|
|
|
|
|
|
|
|
iEns = 1
|
2020-03-23 08:53:19 +01:00
|
|
|
|
2020-08-01 11:45:17 +02:00
|
|
|
P(:,:,iEns) = 2.d0*matmul(c(:,1:nO),transpose(c(:,1:nO)))
|
2020-03-15 14:34:18 +01:00
|
|
|
|
|
|
|
! Doubly-excited state density matrix
|
|
|
|
|
|
|
|
iEns = 2
|
2020-03-23 08:53:19 +01:00
|
|
|
|
2020-03-15 16:29:43 +01:00
|
|
|
if(nO > 1) then
|
|
|
|
P(:,:,iEns) = 2d0*matmul(c(:,1:nO-1),transpose(c(:,1:nO-1)))
|
2020-03-23 08:53:19 +01:00
|
|
|
else
|
|
|
|
P(:,:,iEns) = 0d0
|
2020-03-15 16:29:43 +01:00
|
|
|
end if
|
2020-08-01 11:45:17 +02:00
|
|
|
P(:,:,iEns) = P(:,:,iEns) + sum(occnum(:,1,iEns))*matmul(c(:,nO:nO),transpose(c(:,nO:nO))) &
|
|
|
|
+ sum(occnum(:,2,iEns))*matmul(c(:,nO+1:nO+1),transpose(c(:,nO+1:nO+1)))
|
2020-04-26 23:17:27 +02:00
|
|
|
|
|
|
|
! Doubly-excited state density matrix
|
|
|
|
|
|
|
|
iEns = 3
|
|
|
|
|
|
|
|
if(nO > 1) then
|
|
|
|
P(:,:,iEns) = 2d0*matmul(c(:,1:nO-1),transpose(c(:,1:nO-1)))
|
|
|
|
else
|
|
|
|
P(:,:,iEns) = 0d0
|
|
|
|
end if
|
2020-08-01 11:45:17 +02:00
|
|
|
P(:,:,iEns) = P(:,:,iEns) + sum(occnum(:,1,iEns))*matmul(c(:,nO:nO),transpose(c(:,nO:nO))) &
|
|
|
|
+ sum(occnum(:,2,iEns))*matmul(c(:,nO+1:nO+1),transpose(c(:,nO+1:nO+1)))
|
2020-03-15 14:34:18 +01:00
|
|
|
|
|
|
|
end subroutine restricted_density_matrix
|