4
C Computes the Coulomb part of the complex open shell Fock Matrix
5
C via charge density fitting.
7
subroutine zfock_os_coulcdfit (params, g_densre, Ecoul, g_vc)
11
#include "mafdecls.fh"
17
#include "matutils.fh"
18
#include "rt_tddft.fh"
21
type(rt_params_t), intent(in) :: params
22
integer, intent(in) :: g_densre(2) !alpha, beta
26
double precision, intent(out) :: Ecoul
27
integer, intent(in) :: g_vc(2)
31
character(*), parameter :: pname = "zfock_os_coulcdfit: "
32
integer, parameter :: iVcoul_opt = 1 !XXX HARDCODED
36
integer lcd_coef, icd_coef
37
double precision elapsed
41
C call rt_tddft_os_confirm (params)
44
if (params%prof) call prof_start (elapsed)
50
if (.not.ma_Push_Get (mt_dbl,nbf_cd,"cd_coef",lcd_coef, icd_coef))
51
$ call errquit (pname//"cannot allocate cd_coef", 0, MA_ERR)
53
if (.not.ga_duplicate (g_densre(1), g_densre_tot, "Ptot"))
54
$ call errquit (pname//"cannot allocate Ptot", 1, GA_ERR)
58
C Compute total dens mat.
60
call ga_add (1d0, g_densre(1), 1d0, g_densre(2), g_densre_tot)
64
C Fit charge density with CD basis.
66
call dft_fitcd (1, dbl_mb(icd_coef), dbl_mb(params%k_3ceri),
67
$ Ecoul, g_densre_tot, params%ntotel, params%n_batch,
68
$ params%n3c_int, int_mb(params%k_3cwhat), params%n3c_dbl,
69
$ params%iwhat_max, params%n_semi_bufs, params%fd,
70
$ params%iolgc, params%natoms, .false., 0d0, .false.)
74
C Compute Vcoul using least squares fitting; store in alpha part.
76
call dft_getvc(dbl_mb(icd_coef), dbl_mb(params%k_3ceri),
77
$ Ecoul, g_vc(1), iVcoul_opt, params%n_batch,
78
$ params%n3c_int, int_mb(params%k_3cwhat), params%n3c_dbl,
79
$ params%iwhat_max, params%n_semi_bufs, params%fd,
80
$ params%iolgc, .false., 1)
84
C Copy to coulomb part of Fock mat to beta part.
86
call ga_copy (g_vc(1), g_vc(2))
92
if (.not. ma_chop_stack (lcd_coef))
93
$ call errquit (pname//"failed to chop stack", 0, MA_ERR)
95
if (.not.ga_destroy (g_densre_tot))
96
$ call errquit (pname//"cannot destroy Ptot", 1, GA_ERR)
99
if (params%prof) call prof_end(elapsed, "Fock OS CD fitting coul")