1
C====================================================================
3
C Calculates the time-dependent occupations of the molecular orbitals.
5
C n_k(t) = C'_k^+ P'(t) C'_k
7
C where C'_k is the k^th eigenvector of the ground state Fock
8
C matrix, and P' is the density matrix in the MO basis. Note that P
9
C is complex, but C' is real since it is from the SCF. This means
10
C that we can just use the real part of the dens mat, and take
11
C transpose of C' instead of conjg transpose.
13
C Note, you can send this either the full dens mat, or just the
14
C alpha or beta spin part.
16
C Note, can also compute using matrix multiplications (XXX double check):
17
C n_k(t) = [C'^+ P'(t) C']_kk
19
subroutine rt_tddft_moocc_calc (params, g_densre_mo, g_movecs_gs,
24
#include "mafdecls.fh"
30
#include "rt_tddft.fh"
31
#include "matutils.fh"
34
type (rt_params_t), intent(in) :: params
35
integer, intent(in) :: g_densre_mo !re part of density matrix in MO basis
36
integer, intent(in) :: g_movecs_gs !ground state movecs
40
double precision, intent(out) :: moocc(*) !MO occupations
44
character(*),parameter :: pname = "rt_tddft_moocc: "
50
integer lveck, iveck !handle and index for kth eigenvector
51
double precision occk !occupation of orbital k
52
integer g_veck, g_tmp, g_veckt
59
if (.not. ga_create(mt_dbl, params%ns_mo, 1,
60
$ "k^th evec", 0, 0, g_veck))
61
$ call errquit ("failed to create veck", 0, GA_ERR)
63
if (.not. ga_duplicate(g_veck, g_tmp, "moocc tmp"))
64
$ call errquit ("failed to create g_tmp", 0, GA_ERR)
66
if (.not. ga_duplicate(g_veck, g_veckt, "col of transpose C"))
67
$ call errquit ("failed to create g_tmp", 0, GA_ERR)
70
C Load k^th evec in g_veck and k^th column of C in g_vectk.
72
do k = 1, params%ns_mo
73
CXXX [KAL]: its redundant to have two g_veck
76
call ga_zero (g_veckt)
79
call ga_copy_patch ("N",
80
$ g_movecs_gs, 1, params%ns_mo, k, k,
81
$ g_veck, 1, params%ns_mo, 1, 1)
82
call ga_copy_patch ("T",
83
$ g_movecs_gs, 1, params%ns_mo, k, k,
84
$ g_veckt, 1, params%ns_mo, 1, 1)
88
call ga_dgemm ("N", "N", params%ns_mo, 1, params%ns_mo,
89
$ 1d0, g_densre_mo, g_veck, 0d0, g_tmp)
92
C Compute n_k = C'_k^T P'(t) C'_k.
94
moocc(k) = ga_ddot (g_veckt, g_tmp)
99
if (.not. ga_destroy(g_veck))
100
$ call errquit ("failed to destroy g_veck", 0, GA_ERR)
101
if (.not. ga_destroy(g_tmp))
102
$ call errquit ("failed to destroy g_tmp", 0, GA_ERR)
103
if (.not. ga_destroy(g_veckt))
104
$ call errquit ("failed to destroy g_tmp", 0, GA_ERR)
109
C====================================================================
110
subroutine rt_tddft_moocc_print (params, tt, moocc, moocc_tag)
115
#include "rt_tddft.fh"
119
type(rt_params_t), intent(in) :: params
120
C integer, intent(in) :: it
121
double precision, intent(in) :: tt
122
double precision, intent(in) :: moocc(params%ns_mo)
123
character(*), intent(in) :: moocc_tag
127
character(*), parameter :: pname = "rt_tddft_moocc_print: "
136
if (params%nt < 1) call errquit (pname//"nt must be > 0", 0, 0)
142
C Write rt-tddft tag and current time
144
write (luout, "(a,2x,1f11.5)", advance="no")
145
$ trim(params%tag), tt
147
C $ trim(params%tag), it*100/params%nt, "% ", tt
151
C Loop over all MOs and print
153
do k = 1, params%ns_mo
154
write (luout, "(1es22.12e3)", advance="no") moocc(k)
158
C Print tag and finish line
160
write(luout, *) " "//moocc_tag
164
call util_flush (luout)