mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-21 11:03:29 +01:00
merged
This commit is contained in:
commit
1e35816a61
2
TODO
2
TODO
@ -58,3 +58,5 @@ Doc: plugins et qp_plugins
|
||||
Ajouter les symetries dans devel
|
||||
|
||||
Compiler ezfio avec openmp
|
||||
|
||||
# Parallelize i_H_psi
|
||||
|
@ -17,3 +17,17 @@ BEGIN_PROVIDER [ character*(32), DFT_TYPE]
|
||||
DFT_TYPE = "GGA"
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ logical, same_xc_func ]
|
||||
BEGIN_DOC
|
||||
! true if the exchange and correlation functionals are the same
|
||||
END_DOC
|
||||
implicit none
|
||||
if(trim(correlation_functional).eq.trim(exchange_functional))then
|
||||
same_xc_func = .True.
|
||||
else
|
||||
same_xc_func = .False.
|
||||
endif
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
@ -133,3 +133,79 @@ END_PROVIDER
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, Trace_v_xc_new, (N_states)]
|
||||
implicit none
|
||||
integer :: i,j,istate
|
||||
double precision :: dm
|
||||
BEGIN_DOC
|
||||
! Trace_v_xc = \sum_{i,j} (rho_{ij}_\alpha v^{xc}_{ij}^\alpha + rho_{ij}_\beta v^{xc}_{ij}^\beta)
|
||||
END_DOC
|
||||
do istate = 1, N_states
|
||||
Trace_v_xc_new(istate) = 0.d0
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
Trace_v_xc_new(istate) += (potential_xc_alpha_mo(j,i,istate) ) * one_e_dm_mo_alpha_for_dft(j,i,istate)
|
||||
Trace_v_xc_new(istate) += (potential_xc_beta_mo(j,i,istate) ) * one_e_dm_mo_beta_for_dft(j,i,istate)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_xc_alpha_mo,(mo_num,mo_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_xc_beta_mo,(mo_num,mo_num,N_states)]
|
||||
implicit none
|
||||
integer :: istate
|
||||
|
||||
do istate = 1, N_states
|
||||
call ao_to_mo( &
|
||||
potential_xc_alpha_ao(1,1,istate), &
|
||||
size(potential_xc_alpha_ao,1), &
|
||||
potential_xc_alpha_mo(1,1,istate), &
|
||||
size(potential_xc_alpha_mo,1) &
|
||||
)
|
||||
|
||||
call ao_to_mo( &
|
||||
potential_xc_beta_ao(1,1,istate), &
|
||||
size(potential_xc_beta_ao,1), &
|
||||
potential_xc_beta_mo(1,1,istate), &
|
||||
size(potential_xc_beta_mo,1) &
|
||||
)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_xc_alpha_ao,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_xc_beta_ao,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! general providers for the alpha/beta exchange/correlation potentials on the AO basis
|
||||
END_DOC
|
||||
|
||||
if(trim(exchange_functional)=="short_range_LDA")then
|
||||
potential_xc_alpha_ao = potential_sr_xc_alpha_ao_LDA
|
||||
potential_xc_beta_ao = potential_sr_xc_beta_ao_LDA
|
||||
else if(trim(exchange_functional)=="LDA")then
|
||||
potential_xc_alpha_ao = potential_xc_alpha_ao_LDA
|
||||
potential_xc_beta_ao = potential_xc_beta_ao_LDA
|
||||
else if(exchange_functional.EQ."None")then
|
||||
potential_xc_alpha_ao = 0.d0
|
||||
potential_xc_beta_ao = 0.d0
|
||||
else if(trim(exchange_functional)=="short_range_PBE")then
|
||||
potential_xc_alpha_ao = potential_sr_xc_alpha_ao_PBE
|
||||
potential_xc_beta_ao = potential_sr_xc_beta_ao_PBE
|
||||
else if(trim(exchange_functional)=="PBE")then
|
||||
potential_xc_alpha_ao = potential_xc_alpha_ao_PBE
|
||||
potential_xc_beta_ao = potential_xc_beta_ao_PBE
|
||||
else if(exchange_functional.EQ."None")then
|
||||
potential_xc_alpha_ao = 0.d0
|
||||
potential_xc_beta_ao = 0.d0
|
||||
else
|
||||
print*, 'Exchange functional required does not exist ...'
|
||||
print*,'exchange_functional',exchange_functional
|
||||
stop
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
@ -21,14 +21,10 @@
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_grad_in_r_array, (ao_num,n_points_final_grid,3)]
|
||||
&BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp, (n_points_final_grid,ao_num,3)]
|
||||
&BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp_xyz, (3,n_points_final_grid,ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith ao on the jth grid point
|
||||
!
|
||||
! aos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth ao on the ith grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: i,j,m
|
||||
@ -42,10 +38,59 @@
|
||||
do m = 1, 3
|
||||
do j = 1, ao_num
|
||||
aos_grad_in_r_array(j,i,m) = aos_grad_array(m,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp, (n_points_final_grid,ao_num,3)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth ao on the ith grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: i,j,m
|
||||
double precision :: aos_array(ao_num), r(3)
|
||||
double precision :: aos_grad_array(3,ao_num)
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
call give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array)
|
||||
do m = 1, 3
|
||||
do j = 1, ao_num
|
||||
aos_grad_in_r_array_transp(i,j,m) = aos_grad_array(m,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp_xyz, (3,ao_num,n_points_final_grid)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_grad_in_r_array_transp_xyz(k,i,j) = value of the kth component of the gradient of jth ao on the ith grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: i,j,m
|
||||
double precision :: aos_array(ao_num), r(3)
|
||||
double precision :: aos_grad_array(3,ao_num)
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
call give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array)
|
||||
do m = 1, 3
|
||||
do j = 1, ao_num
|
||||
aos_grad_in_r_array_transp_xyz(m,j,i) = aos_grad_array(m,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_lapl_in_r_array, (ao_num,n_points_final_grid,3)]
|
||||
|
@ -1,192 +0,0 @@
|
||||
BEGIN_PROVIDER[double precision, aos_vc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_beta_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,vc_a,vc_b,e_x,vx_a,vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
double precision :: mu_local
|
||||
mu_local = 1.d-9
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do j =1, ao_num
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,vc_a,vc_b)
|
||||
call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,vx_a,vx_b)
|
||||
aos_vc_alpha_LDA_w(i,j,istate) = vc_a * aos_in_r_array_transp(i,j)*weight
|
||||
aos_vc_beta_LDA_w(i,j,istate) = vc_b * aos_in_r_array_transp(i,j)*weight
|
||||
aos_vx_alpha_LDA_w(i,j,istate) = vx_a * aos_in_r_array_transp(i,j)*weight
|
||||
aos_vx_beta_LDA_w(i,j,istate) = vx_b * aos_in_r_array_transp(i,j)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_x_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_x_beta_ao_LDA ,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_beta_ao_LDA ,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vc_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_c_alpha_ao_LDA(1,1,istate),ao_num)
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vc_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_c_beta_ao_LDA(1,1,istate),ao_num)
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vx_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_x_alpha_ao_LDA(1,1,istate),ao_num)
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vx_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_x_beta_ao_LDA(1,1,istate),ao_num)
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
print*,'time to provide potential_x/c_alpha/beta_ao_LDA = ',wall_2 - wall_1
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvc_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvc_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvx_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvx_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: vc_rho_a(:), vc_rho_b(:), vx_rho_a(:), vx_rho_b(:)
|
||||
double precision, allocatable :: vx_grad_rho_a_2(:), vx_grad_rho_b_2(:), vx_grad_rho_a_b(:), vc_grad_rho_a_2(:), vc_grad_rho_b_2(:), vc_grad_rho_a_b(:)
|
||||
allocate(vc_rho_a(N_states), vc_rho_b(N_states), vx_rho_a(N_states), vx_rho_b(N_states))
|
||||
allocate(vx_grad_rho_a_2(N_states), vx_grad_rho_b_2(N_states), vx_grad_rho_a_b(N_states), vc_grad_rho_a_2(N_states), vc_grad_rho_b_2(N_states), vc_grad_rho_a_b(N_states))
|
||||
|
||||
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b )
|
||||
vx_rho_a(istate) *= weight
|
||||
vc_rho_a(istate) *= weight
|
||||
vx_rho_b(istate) *= weight
|
||||
vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_vc_alpha_PBE_w(j,i,istate) = vc_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vc_beta_PBE_w (j,i,istate) = vc_rho_b(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_alpha_PBE_w(j,i,istate) = vx_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_beta_PBE_w (j,i,istate) = vx_rho_b(istate) * aos_in_r_array(j,i)
|
||||
enddo
|
||||
do m = 1,3
|
||||
do j = 1, ao_num
|
||||
aos_dvc_alpha_PBE_w(j,i,m,istate) = contrib_grad_ca(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dvc_beta_PBE_w (j,i,m,istate) = contrib_grad_cb(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dvx_alpha_PBE_w(j,i,m,istate) = contrib_grad_xa(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dvx_beta_PBE_w (j,i,m,istate) = contrib_grad_xb(m,istate) * aos_in_r_array(j,i)
|
||||
|
||||
grad_aos_dvc_alpha_PBE_w (j,i,m,istate) = contrib_grad_ca(m,istate) * aos_grad_in_r_array(m,j,i)
|
||||
grad_aos_dvc_beta_PBE_w (j,i,m,istate) = contrib_grad_cb(m,istate) * aos_grad_in_r_array(m,j,i)
|
||||
grad_aos_dvx_alpha_PBE_w (j,i,m,istate) = contrib_grad_xa(m,istate) * aos_grad_in_r_array(m,j,i)
|
||||
grad_aos_dvx_beta_PBE_w (j,i,m,istate) = contrib_grad_xb(m,istate) * aos_grad_in_r_array(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange/correlation alpha/beta potentials with the short range PBE functional on the AO basis
|
||||
END_DOC
|
||||
integer :: istate, m
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
potential_c_alpha_ao_PBE = 0.d0
|
||||
potential_x_alpha_ao_PBE = 0.d0
|
||||
potential_c_beta_ao_PBE = 0.d0
|
||||
potential_x_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_vc_alpha_PBE_w(1,1,istate),size(aos_vc_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_c_alpha_ao_PBE(1,1,istate),size(potential_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_vc_beta_PBE_w(1,1,istate),size(aos_vc_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_c_beta_ao_PBE(1,1,istate),size(potential_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_vx_alpha_PBE_w(1,1,istate),size(aos_vx_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_x_alpha_ao_PBE(1,1,istate),size(potential_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_vx_beta_PBE_w(1,1,istate),size(aos_vx_beta_PBE_w,1), aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_x_beta_ao_PBE(1,1,istate), size(potential_x_beta_ao_PBE,1))
|
||||
do m= 1,3
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dvc_alpha_PBE_w(1,1,m,istate),size(aos_dvc_alpha_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_c_alpha_ao_PBE(1,1,istate),size(potential_c_alpha_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dvc_alpha_PBE_w(1,1,m,istate),size(grad_aos_dvc_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_c_alpha_ao_PBE(1,1,istate),size(potential_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dvc_beta_PBE_w(1,1,m,istate),size(aos_dvc_beta_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_c_beta_ao_PBE(1,1,istate),size(potential_c_beta_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dvc_beta_PBE_w(1,1,m,istate),size(grad_aos_dvc_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_c_beta_ao_PBE(1,1,istate),size(potential_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dvx_alpha_PBE_w(1,1,m,istate),size(aos_dvx_alpha_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_x_alpha_ao_PBE(1,1,istate),size(potential_x_alpha_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dvx_alpha_PBE_w(1,1,m,istate),size(grad_aos_dvx_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_x_alpha_ao_PBE(1,1,istate),size(potential_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dvx_beta_PBE_w(1,1,m,istate),size(aos_dvx_beta_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_x_beta_ao_PBE(1,1,istate),size(potential_x_beta_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dvx_beta_PBE_w(1,1,m,istate),size(grad_aos_dvx_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_x_beta_ao_PBE(1,1,istate),size(potential_x_beta_ao_PBE,1))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
83
src/dft_utils_one_e/pot_ao_lda.irp.f
Normal file
83
src/dft_utils_one_e/pot_ao_lda.irp.f
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_vc_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vc_beta_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_beta_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,vc_a,vc_b,e_x,vx_a,vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
double precision :: mu_local
|
||||
mu_local = 1.d-9
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,vc_a,vc_b)
|
||||
call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,vx_a,vx_b)
|
||||
do j =1, ao_num
|
||||
aos_vc_alpha_LDA_w(j,i,istate) = vc_a * aos_in_r_array(j,i)*weight
|
||||
aos_vc_beta_LDA_w(j,i,istate) = vc_b * aos_in_r_array(j,i)*weight
|
||||
aos_vx_alpha_LDA_w(j,i,istate) = vx_a * aos_in_r_array(j,i)*weight
|
||||
aos_vx_beta_LDA_w(j,i,istate) = vx_b * aos_in_r_array(j,i)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_x_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_x_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_vx_alpha_LDA_w(1,1,istate),size(aos_vx_alpha_LDA_w,1),0.d0,&
|
||||
potential_x_alpha_ao_LDA(1,1,istate),size(potential_x_alpha_ao_LDA,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_vx_beta_LDA_w(1,1,istate),size(aos_vx_beta_LDA_w,1),0.d0,&
|
||||
potential_x_beta_ao_LDA(1,1,istate),size(potential_x_beta_ao_LDA,1))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range correlation alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_vc_alpha_LDA_w(1,1,istate),size(aos_vc_alpha_LDA_w,1),0.d0,&
|
||||
potential_c_alpha_ao_LDA(1,1,istate),size(potential_c_alpha_ao_LDA,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_vc_beta_LDA_w(1,1,istate),size(aos_vc_beta_LDA_w,1),0.d0,&
|
||||
potential_c_beta_ao_LDA(1,1,istate),size(potential_c_beta_ao_LDA,1))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
53
src/dft_utils_one_e/pot_ao_lda_smashed.irp.f
Normal file
53
src/dft_utils_one_e/pot_ao_lda_smashed.irp.f
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_vxc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vxc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,vc_a,vc_b,e_x,vx_a,vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
double precision :: mu_local
|
||||
mu_local = 1.d-9
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,vc_a,vc_b)
|
||||
call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,vx_a,vx_b)
|
||||
do j =1, ao_num
|
||||
aos_vxc_alpha_LDA_w(i,j,istate) = (vc_a + vx_a) * aos_in_r_array(j,i)*weight
|
||||
aos_vxc_beta_LDA_w(i,j,istate) = (vc_b + vx_b) * aos_in_r_array(j,i)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_xc_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_xc_beta_ao_LDA ,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
print*,'providing the XC potentials LDA '
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vxc_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_xc_alpha_ao_LDA(1,1,istate),ao_num)
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vxc_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_xc_beta_ao_LDA(1,1,istate),ao_num)
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
191
src/dft_utils_one_e/pot_ao_pbe.irp.f
Normal file
191
src/dft_utils_one_e/pot_ao_pbe.irp.f
Normal file
@ -0,0 +1,191 @@
|
||||
BEGIN_PROVIDER[double precision, aos_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: vc_rho_a(:), vc_rho_b(:), vx_rho_a(:), vx_rho_b(:)
|
||||
double precision, allocatable :: vx_grad_rho_a_2(:), vx_grad_rho_b_2(:), vx_grad_rho_a_b(:), vc_grad_rho_a_2(:), vc_grad_rho_b_2(:), vc_grad_rho_a_b(:)
|
||||
allocate(vc_rho_a(N_states), vc_rho_b(N_states), vx_rho_a(N_states), vx_rho_b(N_states))
|
||||
allocate(vx_grad_rho_a_2(N_states), vx_grad_rho_b_2(N_states), vx_grad_rho_a_b(N_states), vc_grad_rho_a_2(N_states), vc_grad_rho_b_2(N_states), vc_grad_rho_a_b(N_states))
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
|
||||
aos_dvc_alpha_PBE_w = 0.d0
|
||||
aos_dvc_beta_PBE_w = 0.d0
|
||||
aos_dvx_alpha_PBE_w = 0.d0
|
||||
aos_dvx_beta_PBE_w = 0.d0
|
||||
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b )
|
||||
vx_rho_a(istate) *= weight
|
||||
vc_rho_a(istate) *= weight
|
||||
vx_rho_b(istate) *= weight
|
||||
vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_vc_alpha_PBE_w(j,i,istate) = vc_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vc_beta_PBE_w (j,i,istate) = vc_rho_b(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_alpha_PBE_w(j,i,istate) = vx_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_beta_PBE_w (j,i,istate) = vx_rho_b(istate) * aos_in_r_array(j,i)
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
do m = 1,3
|
||||
aos_dvc_alpha_PBE_w(j,i,istate) += contrib_grad_ca(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvc_beta_PBE_w (j,i,istate) += contrib_grad_cb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvx_alpha_PBE_w(j,i,istate) += contrib_grad_xa(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvx_beta_PBE_w (j,i,istate) += contrib_grad_xb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_scal_x_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_scal_c_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_scal_x_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_scal_c_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
integer :: istate
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the scalar part of the potential
|
||||
END_DOC
|
||||
pot_scal_c_alpha_ao_PBE = 0.d0
|
||||
pot_scal_x_alpha_ao_PBE = 0.d0
|
||||
pot_scal_c_beta_ao_PBE = 0.d0
|
||||
pot_scal_x_beta_ao_PBE = 0.d0
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vc_alpha_PBE_w(1,1,istate),size(aos_vc_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_c_alpha_ao_PBE(1,1,istate),size(pot_scal_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vc_beta_PBE_w(1,1,istate),size(aos_vc_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_c_beta_ao_PBE(1,1,istate),size(pot_scal_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vx_alpha_PBE_w(1,1,istate),size(aos_vx_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_x_alpha_ao_PBE(1,1,istate),size(pot_scal_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vx_beta_PBE_w(1,1,istate),size(aos_vx_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_x_beta_ao_PBE(1,1,istate), size(pot_scal_x_beta_ao_PBE,1))
|
||||
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_grad_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_grad_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_grad_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_grad_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the gradienst of the density and orbitals
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
pot_grad_c_alpha_ao_PBE = 0.d0
|
||||
pot_grad_x_alpha_ao_PBE = 0.d0
|
||||
pot_grad_c_beta_ao_PBE = 0.d0
|
||||
pot_grad_x_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvc_alpha_PBE_w(1,1,istate),size(aos_dvc_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_c_alpha_ao_PBE(1,1,istate),size(pot_grad_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvc_beta_PBE_w(1,1,istate),size(aos_dvc_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_c_beta_ao_PBE(1,1,istate),size(pot_grad_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvx_alpha_PBE_w(1,1,istate),size(aos_dvx_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_x_alpha_ao_PBE(1,1,istate),size(pot_grad_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvx_beta_PBE_w(1,1,istate),size(aos_dvx_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_x_beta_ao_PBE(1,1,istate),size(pot_grad_x_beta_ao_PBE,1))
|
||||
enddo
|
||||
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange / correlation potential for alpha / beta electrons with the Perdew-Burke-Ernzerhof GGA functional
|
||||
END_DOC
|
||||
integer :: i,j,istate
|
||||
do istate = 1, n_states
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
potential_x_alpha_ao_PBE(j,i,istate) = pot_scal_x_alpha_ao_PBE(j,i,istate) + pot_grad_x_alpha_ao_PBE(j,i,istate) + pot_grad_x_alpha_ao_PBE(i,j,istate)
|
||||
potential_x_beta_ao_PBE(j,i,istate) = pot_scal_x_beta_ao_PBE(j,i,istate) + pot_grad_x_beta_ao_PBE(j,i,istate) + pot_grad_x_beta_ao_PBE(i,j,istate)
|
||||
|
||||
potential_c_alpha_ao_PBE(j,i,istate) = pot_scal_c_alpha_ao_PBE(j,i,istate) + pot_grad_c_alpha_ao_PBE(j,i,istate) + pot_grad_c_alpha_ao_PBE(i,j,istate)
|
||||
potential_c_beta_ao_PBE(j,i,istate) = pot_scal_c_beta_ao_PBE(j,i,istate) + pot_grad_c_beta_ao_PBE(j,i,istate) + pot_grad_c_beta_ao_PBE(i,j,istate)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
147
src/dft_utils_one_e/pot_ao_pbe_smashed.irp.f
Normal file
147
src/dft_utils_one_e/pot_ao_pbe_smashed.irp.f
Normal file
@ -0,0 +1,147 @@
|
||||
BEGIN_PROVIDER[double precision, aos_vxc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vxc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvxc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvxc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: vc_rho_a(:), vc_rho_b(:), vx_rho_a(:), vx_rho_b(:)
|
||||
double precision, allocatable :: vx_grad_rho_a_2(:), vx_grad_rho_b_2(:), vx_grad_rho_a_b(:), vc_grad_rho_a_2(:), vc_grad_rho_b_2(:), vc_grad_rho_a_b(:)
|
||||
allocate(vc_rho_a(N_states), vc_rho_b(N_states), vx_rho_a(N_states), vx_rho_b(N_states))
|
||||
allocate(vx_grad_rho_a_2(N_states), vx_grad_rho_b_2(N_states), vx_grad_rho_a_b(N_states), vc_grad_rho_a_2(N_states), vc_grad_rho_b_2(N_states), vc_grad_rho_a_b(N_states))
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
|
||||
aos_dvxc_alpha_PBE_w = 0.d0
|
||||
aos_dvxc_beta_PBE_w = 0.d0
|
||||
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b )
|
||||
vx_rho_a(istate) *= weight
|
||||
vc_rho_a(istate) *= weight
|
||||
vx_rho_b(istate) *= weight
|
||||
vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_vxc_alpha_PBE_w(j,i,istate) = ( vc_rho_a(istate) + vx_rho_a(istate) ) * aos_in_r_array(j,i)
|
||||
aos_vxc_beta_PBE_w (j,i,istate) = ( vc_rho_b(istate) + vx_rho_b(istate) ) * aos_in_r_array(j,i)
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
do m = 1,3
|
||||
aos_dvxc_alpha_PBE_w(j,i,istate) += ( contrib_grad_ca(m,istate) + contrib_grad_xa(m,istate) ) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvxc_beta_PBE_w (j,i,istate) += ( contrib_grad_cb(m,istate) + contrib_grad_xb(m,istate) ) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_scal_xc_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_scal_xc_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
integer :: istate
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the scalar part of the potential
|
||||
END_DOC
|
||||
pot_scal_xc_alpha_ao_PBE = 0.d0
|
||||
pot_scal_xc_beta_ao_PBE = 0.d0
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
do istate = 1, N_states
|
||||
! exchange - correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vxc_alpha_PBE_w(1,1,istate),size(aos_vxc_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_xc_alpha_ao_PBE(1,1,istate),size(pot_scal_xc_alpha_ao_PBE,1))
|
||||
! exchange - correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_vxc_beta_PBE_w(1,1,istate),size(aos_vxc_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_scal_xc_beta_ao_PBE(1,1,istate),size(pot_scal_xc_beta_ao_PBE,1))
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_grad_xc_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_grad_xc_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the gradienst of the density and orbitals
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
pot_grad_xc_alpha_ao_PBE = 0.d0
|
||||
pot_grad_xc_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvxc_alpha_PBE_w(1,1,istate),size(aos_dvxc_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_xc_alpha_ao_PBE(1,1,istate),size(pot_grad_xc_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dvxc_beta_PBE_w(1,1,istate),size(aos_dvxc_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_grad_xc_beta_ao_PBE(1,1,istate),size(pot_grad_xc_beta_ao_PBE,1))
|
||||
enddo
|
||||
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_xc_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_xc_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange / correlation potential for alpha / beta electrons with the Perdew-Burke-Ernzerhof GGA functional
|
||||
END_DOC
|
||||
integer :: i,j,istate
|
||||
do istate = 1, n_states
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
potential_xc_alpha_ao_PBE(j,i,istate) = pot_scal_xc_alpha_ao_PBE(j,i,istate) + pot_grad_xc_alpha_ao_PBE(j,i,istate) + pot_grad_xc_alpha_ao_PBE(i,j,istate)
|
||||
potential_xc_beta_ao_PBE(j,i,istate) = pot_scal_xc_beta_ao_PBE(j,i,istate) + pot_grad_xc_beta_ao_PBE(j,i,istate) + pot_grad_xc_beta_ao_PBE(i,j,istate)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
@ -1,16 +0,0 @@
|
||||
BEGIN_PROVIDER [double precision, shifting_constant, (N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! shifting_constant = (E_{Hxc} - <\Psi | V_{Hxc} | \Psi>) / N_elec
|
||||
! constant to add to the potential in order to obtain the variational energy as
|
||||
! the eigenvalue of the effective long-range Hamiltonian
|
||||
! (see original paper of Levy PRL 113, 113002 (2014), equation (17) )
|
||||
END_DOC
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
shifting_constant(istate) = energy_x(istate) + energy_c(istate) + short_range_Hartree(istate) - Trace_v_Hxc(istate)
|
||||
enddo
|
||||
shifting_constant = shifting_constant / dble(elec_num)
|
||||
|
||||
|
||||
END_PROVIDER
|
@ -1,235 +0,0 @@
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_beta_LDA_w, (n_points_final_grid,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_sr_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (sr_v^x_alpha(r_j) + sr_v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,sr_vc_a,sr_vc_b,e_x,sr_vx_a,sr_vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight=final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_c,sr_vc_a,sr_vc_b)
|
||||
call ex_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_x,sr_vx_a,sr_vx_b)
|
||||
do j =1, ao_num
|
||||
aos_sr_vc_alpha_LDA_w(i,j,istate) = sr_vc_a * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vc_beta_LDA_w(i,j,istate) = sr_vc_b * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vx_alpha_LDA_w(i,j,istate) = sr_vx_a * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vx_beta_LDA_w(i,j,istate) = sr_vx_b * aos_in_r_array(j,i)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vx_alpha_LDA_w,size(aos_sr_vx_alpha_LDA_w,1),0.d0,&
|
||||
potential_sr_x_alpha_ao_LDA,size(potential_sr_x_alpha_ao_LDA,1))
|
||||
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vx_beta_LDA_w,size(aos_sr_vx_beta_LDA_w,1),0.d0,&
|
||||
potential_sr_x_beta_ao_LDA,size(potential_sr_x_beta_ao_LDA,1))
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range correlation alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vc_alpha_LDA_w,size(aos_sr_vc_alpha_LDA_w,1),0.d0,&
|
||||
potential_sr_c_alpha_ao_LDA,size(potential_sr_c_alpha_ao_LDA,1))
|
||||
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vc_beta_LDA_w,size(aos_sr_vc_beta_LDA_w,1),0.d0,&
|
||||
potential_sr_c_beta_ao_LDA,size(potential_sr_c_beta_ao_LDA,1))
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] !(n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]!(n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] !(n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]!(n_points_final_grid,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vc_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vx_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dsr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dsr_vc_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dsr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dsr_vx_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: sr_vc_rho_a(:), sr_vc_rho_b(:), sr_vx_rho_a(:), sr_vx_rho_b(:)
|
||||
double precision, allocatable :: sr_vx_grad_rho_a_2(:), sr_vx_grad_rho_b_2(:), sr_vx_grad_rho_a_b(:), sr_vc_grad_rho_a_2(:), sr_vc_grad_rho_b_2(:), sr_vc_grad_rho_a_b(:)
|
||||
allocate(sr_vc_rho_a(N_states), sr_vc_rho_b(N_states), sr_vx_rho_a(N_states), sr_vx_rho_b(N_states))
|
||||
allocate(sr_vx_grad_rho_a_2(N_states), sr_vx_grad_rho_b_2(N_states), sr_vx_grad_rho_a_b(N_states), sr_vc_grad_rho_a_2(N_states), sr_vc_grad_rho_b_2(N_states), sr_vc_grad_rho_a_b(N_states))
|
||||
|
||||
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_sr_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,sr_vx_rho_a,sr_vx_rho_b,sr_vx_grad_rho_a_2,sr_vx_grad_rho_b_2,sr_vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,sr_vc_rho_a,sr_vc_rho_b,sr_vc_grad_rho_a_2,sr_vc_grad_rho_b_2,sr_vc_grad_rho_a_b )
|
||||
sr_vx_rho_a(istate) *= weight
|
||||
sr_vc_rho_a(istate) *= weight
|
||||
sr_vx_rho_b(istate) *= weight
|
||||
sr_vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * sr_vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + sr_vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * sr_vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + sr_vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * sr_vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + sr_vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * sr_vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + sr_vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_sr_vc_alpha_PBE_w(j,i,istate) = sr_vc_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vc_beta_PBE_w (j,i,istate) = sr_vc_rho_b(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vx_alpha_PBE_w(j,i,istate) = sr_vx_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vx_beta_PBE_w (j,i,istate) = sr_vx_rho_b(istate) * aos_in_r_array(j,i)
|
||||
do m = 1,3
|
||||
aos_dsr_vc_alpha_PBE_w(j,i,m,istate) = contrib_grad_ca(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dsr_vc_beta_PBE_w (j,i,m,istate) = contrib_grad_cb(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dsr_vx_alpha_PBE_w(j,i,m,istate) = contrib_grad_xa(m,istate) * aos_in_r_array(j,i)
|
||||
aos_dsr_vx_beta_PBE_w (j,i,m,istate) = contrib_grad_xb(m,istate) * aos_in_r_array(j,i)
|
||||
|
||||
grad_aos_dsr_vc_alpha_PBE_w (j,i,m,istate) = contrib_grad_ca(m,istate) * aos_grad_in_r_array(j,i,m)
|
||||
grad_aos_dsr_vc_beta_PBE_w (j,i,m,istate) = contrib_grad_cb(m,istate) * aos_grad_in_r_array(j,i,m)
|
||||
grad_aos_dsr_vx_alpha_PBE_w (j,i,m,istate) = contrib_grad_xa(m,istate) * aos_grad_in_r_array(j,i,m)
|
||||
grad_aos_dsr_vx_beta_PBE_w (j,i,m,istate) = contrib_grad_xb(m,istate) * aos_grad_in_r_array(j,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange/correlation alpha/beta potentials with the short range PBE functional on the AO basis
|
||||
END_DOC
|
||||
integer :: istate, m
|
||||
double precision :: wall_1,wall_2
|
||||
potential_sr_c_alpha_ao_PBE = 0.d0
|
||||
potential_sr_x_alpha_ao_PBE = 0.d0
|
||||
potential_sr_c_beta_ao_PBE = 0.d0
|
||||
potential_sr_x_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vc_alpha_PBE_w(1,1,istate),size(aos_sr_vc_alpha_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vc_beta_PBE_w(1,1,istate),size(aos_sr_vc_beta_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vx_alpha_PBE_w(1,1,istate),size(aos_sr_vx_alpha_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vx_beta_PBE_w(1,1,istate),size(aos_sr_vx_beta_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_x_beta_ao_PBE(1,1,istate), size(potential_sr_x_beta_ao_PBE,1))
|
||||
do m= 1,3
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vc_alpha_PBE_w,1),&
|
||||
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,&
|
||||
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
grad_aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_alpha_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(aos_dsr_vc_beta_PBE_w,1),&
|
||||
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,&
|
||||
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
grad_aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_beta_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vx_alpha_PBE_w,1),&
|
||||
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,&
|
||||
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
grad_aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_alpha_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(aos_dsr_vx_beta_PBE_w,1),&
|
||||
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,&
|
||||
potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
grad_aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_beta_PBE_w,1),&
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
79
src/dft_utils_one_e/sr_pot_ao_lda.irp.f
Normal file
79
src/dft_utils_one_e/sr_pot_ao_lda.irp.f
Normal file
@ -0,0 +1,79 @@
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_beta_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_sr_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (sr_v^x_alpha(r_j) + sr_v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,sr_vc_a,sr_vc_b,e_x,sr_vx_a,sr_vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_c,sr_vc_a,sr_vc_b)
|
||||
call ex_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_x,sr_vx_a,sr_vx_b)
|
||||
do j =1, ao_num
|
||||
aos_sr_vc_alpha_LDA_w(j,i,istate) = sr_vc_a * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vc_beta_LDA_w(j,i,istate) = sr_vc_b * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vx_alpha_LDA_w(j,i,istate) = sr_vx_a * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vx_beta_LDA_w(j,i,istate) = sr_vx_b * aos_in_r_array(j,i)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vx_alpha_LDA_w,size(aos_sr_vx_alpha_LDA_w,1),0.d0,&
|
||||
potential_sr_x_alpha_ao_LDA,size(potential_sr_x_alpha_ao_LDA,1))
|
||||
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vx_beta_LDA_w(1,1,istate),size(aos_sr_vx_beta_LDA_w,1),0.d0,&
|
||||
potential_sr_x_beta_ao_LDA(1,1,istate),size(potential_sr_x_beta_ao_LDA,1))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range correlation alpha/beta potentials with LDA functional on the |AO| basis
|
||||
END_DOC
|
||||
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vc_alpha_LDA_w(1,1,istate),size(aos_sr_vc_alpha_LDA_w,1),0.d0,&
|
||||
potential_sr_c_alpha_ao_LDA(1,1,istate),size(potential_sr_c_alpha_ao_LDA,1))
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vc_beta_LDA_w(1,1,istate),size(aos_sr_vc_beta_LDA_w,1),0.d0,&
|
||||
potential_sr_c_beta_ao_LDA(1,1,istate),size(potential_sr_c_beta_ao_LDA,1))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
58
src/dft_utils_one_e/sr_pot_ao_lda_smashed.irp.f
Normal file
58
src/dft_utils_one_e/sr_pot_ao_lda_smashed.irp.f
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vxc_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vxc_beta_LDA_w, (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_sr_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision :: e_c,sr_vc_a,sr_vc_b,e_x,sr_vx_a,sr_vx_b
|
||||
double precision, allocatable :: rhoa(:),rhob(:)
|
||||
double precision :: mu_local
|
||||
mu_local = mu_erf_dft
|
||||
allocate(rhoa(N_states), rhob(N_states))
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rhoa(istate) = one_e_dm_alpha_at_r(i,istate)
|
||||
rhob(istate) = one_e_dm_beta_at_r(i,istate)
|
||||
call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,sr_vc_a,sr_vc_b)
|
||||
call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,sr_vx_a,sr_vx_b)
|
||||
do j =1, ao_num
|
||||
aos_sr_vxc_alpha_LDA_w(j,i,istate) = (sr_vc_a + sr_vx_a) * aos_in_r_array(j,i)*weight
|
||||
aos_sr_vxc_beta_LDA_w(j,i,istate) = (sr_vc_b + sr_vx_b) * aos_in_r_array(j,i)*weight
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_xc_alpha_ao_LDA,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_xc_beta_ao_LDA ,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis
|
||||
END_DOC
|
||||
|
||||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vxc_alpha_LDA_w(1,1,istate),size(aos_sr_vxc_alpha_LDA_w,1),0.d0,&
|
||||
potential_sr_xc_alpha_ao_LDA(1,1,istate),size(potential_sr_xc_alpha_ao_LDA,1))
|
||||
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_in_r_array,size(aos_in_r_array,1), &
|
||||
aos_sr_vxc_beta_LDA_w(1,1,istate),size(aos_sr_vxc_beta_LDA_w,1),0.d0,&
|
||||
potential_sr_xc_beta_ao_LDA(1,1,istate),size(potential_sr_xc_beta_ao_LDA,1))
|
||||
enddo
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
191
src/dft_utils_one_e/sr_pot_ao_pbe.irp.f
Normal file
191
src/dft_utils_one_e/sr_pot_ao_pbe.irp.f
Normal file
@ -0,0 +1,191 @@
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vx_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_sr_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: vc_rho_a(:), vc_rho_b(:), vx_rho_a(:), vx_rho_b(:)
|
||||
double precision, allocatable :: vx_grad_rho_a_2(:), vx_grad_rho_b_2(:), vx_grad_rho_a_b(:), vc_grad_rho_a_2(:), vc_grad_rho_b_2(:), vc_grad_rho_a_b(:)
|
||||
allocate(vc_rho_a(N_states), vc_rho_b(N_states), vx_rho_a(N_states), vx_rho_b(N_states))
|
||||
allocate(vx_grad_rho_a_2(N_states), vx_grad_rho_b_2(N_states), vx_grad_rho_a_b(N_states), vc_grad_rho_a_2(N_states), vc_grad_rho_b_2(N_states), vc_grad_rho_a_b(N_states))
|
||||
|
||||
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
aos_dsr_vc_alpha_PBE_w= 0.d0
|
||||
aos_dsr_vc_beta_PBE_w = 0.d0
|
||||
aos_dsr_vx_alpha_PBE_w= 0.d0
|
||||
aos_dsr_vx_beta_PBE_w = 0.d0
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_sr_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b )
|
||||
vx_rho_a(istate) *= weight
|
||||
vc_rho_a(istate) *= weight
|
||||
vx_rho_b(istate) *= weight
|
||||
vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_sr_vc_alpha_PBE_w(j,i,istate) = vc_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vc_beta_PBE_w (j,i,istate) = vc_rho_b(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vx_alpha_PBE_w(j,i,istate) = vx_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_sr_vx_beta_PBE_w (j,i,istate) = vx_rho_b(istate) * aos_in_r_array(j,i)
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
do m = 1,3
|
||||
aos_dsr_vc_alpha_PBE_w(j,i,istate) += contrib_grad_ca(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dsr_vc_beta_PBE_w (j,i,istate) += contrib_grad_cb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dsr_vx_alpha_PBE_w(j,i,istate) += contrib_grad_xa(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dsr_vx_beta_PBE_w (j,i,istate) += contrib_grad_xb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_sr_scal_x_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_scal_c_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_scal_x_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_scal_c_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
integer :: istate
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the scalar part of the potential
|
||||
END_DOC
|
||||
pot_sr_scal_c_alpha_ao_PBE = 0.d0
|
||||
pot_sr_scal_x_alpha_ao_PBE = 0.d0
|
||||
pot_sr_scal_c_beta_ao_PBE = 0.d0
|
||||
pot_sr_scal_x_beta_ao_PBE = 0.d0
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vc_alpha_PBE_w(1,1,istate),size(aos_sr_vc_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_c_alpha_ao_PBE(1,1,istate),size(pot_sr_scal_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vc_beta_PBE_w(1,1,istate),size(aos_sr_vc_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_c_beta_ao_PBE(1,1,istate),size(pot_sr_scal_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vx_alpha_PBE_w(1,1,istate),size(aos_sr_vx_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_x_alpha_ao_PBE(1,1,istate),size(pot_sr_scal_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vx_beta_PBE_w(1,1,istate),size(aos_sr_vx_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_x_beta_ao_PBE(1,1,istate), size(pot_sr_scal_x_beta_ao_PBE,1))
|
||||
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_sr_grad_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_grad_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_grad_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_grad_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the gradienst of the density and orbitals
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
pot_sr_grad_c_alpha_ao_PBE = 0.d0
|
||||
pot_sr_grad_x_alpha_ao_PBE = 0.d0
|
||||
pot_sr_grad_c_beta_ao_PBE = 0.d0
|
||||
pot_sr_grad_x_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! correlation alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vc_alpha_PBE_w(1,1,istate),size(aos_dsr_vc_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_c_alpha_ao_PBE(1,1,istate),size(pot_sr_grad_c_alpha_ao_PBE,1))
|
||||
! correlation beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vc_beta_PBE_w(1,1,istate),size(aos_dsr_vc_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_c_beta_ao_PBE(1,1,istate),size(pot_sr_grad_c_beta_ao_PBE,1))
|
||||
! exchange alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vx_alpha_PBE_w(1,1,istate),size(aos_dsr_vx_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_x_alpha_ao_PBE(1,1,istate),size(pot_sr_grad_x_alpha_ao_PBE,1))
|
||||
! exchange beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vx_beta_PBE_w(1,1,istate),size(aos_dsr_vx_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_x_beta_ao_PBE(1,1,istate),size(pot_sr_grad_x_beta_ao_PBE,1))
|
||||
enddo
|
||||
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange / correlation potential for alpha / beta electrons with the Perdew-Burke-Ernzerhof GGA functional
|
||||
END_DOC
|
||||
integer :: i,j,istate
|
||||
do istate = 1, n_states
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
potential_sr_x_alpha_ao_PBE(j,i,istate) = pot_sr_scal_x_alpha_ao_PBE(j,i,istate) + pot_sr_grad_x_alpha_ao_PBE(j,i,istate) + pot_sr_grad_x_alpha_ao_PBE(i,j,istate)
|
||||
potential_sr_x_beta_ao_PBE(j,i,istate) = pot_sr_scal_x_beta_ao_PBE(j,i,istate) + pot_sr_grad_x_beta_ao_PBE(j,i,istate) + pot_sr_grad_x_beta_ao_PBE(i,j,istate)
|
||||
|
||||
potential_sr_c_alpha_ao_PBE(j,i,istate) = pot_sr_scal_c_alpha_ao_PBE(j,i,istate) + pot_sr_grad_c_alpha_ao_PBE(j,i,istate) + pot_sr_grad_c_alpha_ao_PBE(i,j,istate)
|
||||
potential_sr_c_beta_ao_PBE(j,i,istate) = pot_sr_scal_c_beta_ao_PBE(j,i,istate) + pot_sr_grad_c_beta_ao_PBE(j,i,istate) + pot_sr_grad_c_beta_ao_PBE(i,j,istate)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
149
src/dft_utils_one_e/sr_pot_ao_pbe_smashed.irp.f
Normal file
149
src/dft_utils_one_e/sr_pot_ao_pbe_smashed.irp.f
Normal file
@ -0,0 +1,149 @@
|
||||
BEGIN_PROVIDER[double precision, aos_sr_vxc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_sr_vxc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vxc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dsr_vxc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_sr_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
|
||||
END_DOC
|
||||
integer :: istate,i,j,m
|
||||
double precision :: r(3)
|
||||
double precision :: mu,weight
|
||||
double precision, allocatable :: ex(:), ec(:)
|
||||
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
|
||||
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
|
||||
double precision, allocatable :: vc_rho_a(:), vc_rho_b(:), vx_rho_a(:), vx_rho_b(:)
|
||||
double precision, allocatable :: vx_grad_rho_a_2(:), vx_grad_rho_b_2(:), vx_grad_rho_a_b(:), vc_grad_rho_a_2(:), vc_grad_rho_b_2(:), vc_grad_rho_a_b(:)
|
||||
allocate(vc_rho_a(N_states), vc_rho_b(N_states), vx_rho_a(N_states), vx_rho_b(N_states))
|
||||
allocate(vx_grad_rho_a_2(N_states), vx_grad_rho_b_2(N_states), vx_grad_rho_a_b(N_states), vc_grad_rho_a_2(N_states), vc_grad_rho_b_2(N_states), vc_grad_rho_a_b(N_states))
|
||||
|
||||
|
||||
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
|
||||
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
|
||||
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
|
||||
|
||||
aos_dsr_vxc_alpha_PBE_w = 0.d0
|
||||
aos_dsr_vxc_beta_PBE_w = 0.d0
|
||||
|
||||
do istate = 1, N_states
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
weight = final_weight_at_r_vector(i)
|
||||
rho_a(istate) = one_e_dm_and_grad_alpha_in_r(4,i,istate)
|
||||
rho_b(istate) = one_e_dm_and_grad_beta_in_r(4,i,istate)
|
||||
grad_rho_a(1:3,istate) = one_e_dm_and_grad_alpha_in_r(1:3,i,istate)
|
||||
grad_rho_b(1:3,istate) = one_e_dm_and_grad_beta_in_r(1:3,i,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2(istate) += grad_rho_a(m,istate) * grad_rho_a(m,istate)
|
||||
grad_rho_b_2(istate) += grad_rho_b(m,istate) * grad_rho_b(m,istate)
|
||||
grad_rho_a_b(istate) += grad_rho_a(m,istate) * grad_rho_b(m,istate)
|
||||
enddo
|
||||
|
||||
! inputs
|
||||
call GGA_sr_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_a_b, & ! outputs exchange
|
||||
ex,vx_rho_a,vx_rho_b,vx_grad_rho_a_2,vx_grad_rho_b_2,vx_grad_rho_a_b, & ! outputs correlation
|
||||
ec,vc_rho_a,vc_rho_b,vc_grad_rho_a_2,vc_grad_rho_b_2,vc_grad_rho_a_b )
|
||||
vx_rho_a(istate) *= weight
|
||||
vc_rho_a(istate) *= weight
|
||||
vx_rho_b(istate) *= weight
|
||||
vc_rho_b(istate) *= weight
|
||||
do m= 1,3
|
||||
contrib_grad_ca(m,istate) = weight * (2.d0 * vc_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_xa(m,istate) = weight * (2.d0 * vx_grad_rho_a_2(istate) * grad_rho_a(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_b(m,istate))
|
||||
contrib_grad_cb(m,istate) = weight * (2.d0 * vc_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vc_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
contrib_grad_xb(m,istate) = weight * (2.d0 * vx_grad_rho_b_2(istate) * grad_rho_b(m,istate) + vx_grad_rho_a_b(istate) * grad_rho_a(m,istate))
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
aos_sr_vxc_alpha_PBE_w(j,i,istate) = ( vc_rho_a(istate) + vx_rho_a(istate) ) * aos_in_r_array(j,i)
|
||||
aos_sr_vxc_beta_PBE_w (j,i,istate) = ( vc_rho_b(istate) + vx_rho_b(istate) ) * aos_in_r_array(j,i)
|
||||
enddo
|
||||
do j = 1, ao_num
|
||||
do m = 1,3
|
||||
aos_dsr_vxc_alpha_PBE_w(j,i,istate) += ( contrib_grad_ca(m,istate) + contrib_grad_xa(m,istate) ) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dsr_vxc_beta_PBE_w (j,i,istate) += ( contrib_grad_cb(m,istate) + contrib_grad_xb(m,istate) ) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_sr_scal_xc_alpha_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_scal_xc_beta_ao_PBE, (ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
integer :: istate
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the scalar part of the potential
|
||||
END_DOC
|
||||
pot_sr_scal_xc_alpha_ao_PBE = 0.d0
|
||||
pot_sr_scal_xc_beta_ao_PBE = 0.d0
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
do istate = 1, N_states
|
||||
! exchange - correlation alpha
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vxc_alpha_PBE_w(1,1,istate),size(aos_sr_vxc_alpha_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_xc_alpha_ao_PBE(1,1,istate),size(pot_sr_scal_xc_alpha_ao_PBE,1))
|
||||
! exchange - correlation beta
|
||||
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_sr_vxc_beta_PBE_w(1,1,istate),size(aos_sr_vxc_beta_PBE_w,1), &
|
||||
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
|
||||
pot_sr_scal_xc_beta_ao_PBE(1,1,istate),size(pot_sr_scal_xc_beta_ao_PBE,1))
|
||||
enddo
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, pot_sr_grad_xc_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, pot_sr_grad_xc_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! intermediate quantity for the calculation of the vxc potentials for the GGA functionals related to the gradienst of the density and orbitals
|
||||
END_DOC
|
||||
integer :: istate
|
||||
double precision :: wall_1,wall_2
|
||||
call wall_time(wall_1)
|
||||
pot_sr_grad_xc_alpha_ao_PBE = 0.d0
|
||||
pot_sr_grad_xc_beta_ao_PBE = 0.d0
|
||||
do istate = 1, N_states
|
||||
! exchange - correlation alpha
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vxc_alpha_PBE_w(1,1,istate),size(aos_dsr_vxc_alpha_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_xc_alpha_ao_PBE(1,1,istate),size(pot_sr_grad_xc_alpha_ao_PBE,1))
|
||||
! exchange - correlation beta
|
||||
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0, &
|
||||
aos_dsr_vxc_beta_PBE_w(1,1,istate),size(aos_dsr_vxc_beta_PBE_w,1), &
|
||||
aos_in_r_array_transp,size(aos_in_r_array_transp,1),1.d0, &
|
||||
pot_sr_grad_xc_beta_ao_PBE(1,1,istate),size(pot_sr_grad_xc_beta_ao_PBE,1))
|
||||
enddo
|
||||
|
||||
call wall_time(wall_2)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, potential_sr_xc_alpha_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_sr_xc_beta_ao_PBE,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! exchange / correlation potential for alpha / beta electrons with the Perdew-Burke-Ernzerhof GGA functional
|
||||
END_DOC
|
||||
integer :: i,j,istate
|
||||
do istate = 1, n_states
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
potential_sr_xc_alpha_ao_PBE(j,i,istate) = pot_sr_scal_xc_alpha_ao_PBE(j,i,istate) + pot_sr_grad_xc_alpha_ao_PBE(j,i,istate) + pot_sr_grad_xc_alpha_ao_PBE(i,j,istate)
|
||||
potential_sr_xc_beta_ao_PBE(j,i,istate) = pot_sr_scal_xc_beta_ao_PBE(j,i,istate) + pot_sr_grad_xc_beta_ao_PBE(j,i,istate) + pot_sr_grad_xc_beta_ao_PBE(i,j,istate)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
@ -68,7 +68,7 @@ subroutine GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho
|
||||
double precision :: mu_local
|
||||
mu_local = 1.d-9
|
||||
do istate = 1, N_states
|
||||
if(exchange_functional.EQ."short_range_PBE")then
|
||||
if(exchange_functional.EQ."PBE")then
|
||||
call ex_pbe_sr(mu_local,rho_a(istate),rho_b(istate),grad_rho_a_2(istate),grad_rho_b_2(istate),grad_rho_a_b(istate),ex(istate),vx_rho_a(istate),vx_rho_b(istate),vx_grad_rho_a_2(istate),vx_grad_rho_b_2(istate),vx_grad_rho_a_b(istate))
|
||||
else if(exchange_functional.EQ."None")then
|
||||
ex = 0.d0
|
||||
@ -84,7 +84,7 @@ subroutine GGA_type_functionals(r,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho
|
||||
endif
|
||||
|
||||
double precision :: rhoc,rhoo,sigmacc,sigmaco,sigmaoo,vrhoc,vrhoo,vsigmacc,vsigmaco,vsigmaoo
|
||||
if(correlation_functional.EQ."short_range_PBE")then
|
||||
if(correlation_functional.EQ."PBE")then
|
||||
! convertion from (alpha,beta) formalism to (closed, open) formalism
|
||||
call rho_ab_to_rho_oc(rho_a(istate),rho_b(istate),rhoo,rhoc)
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2(istate),grad_rho_b_2(istate),grad_rho_a_b(istate),sigmaoo,sigmacc,sigmaco)
|
||||
|
@ -1 +1,2 @@
|
||||
mpi
|
||||
zmq
|
||||
|
@ -109,10 +109,7 @@
|
||||
integer(key_kind), allocatable :: keys(:)
|
||||
double precision, allocatable :: values(:)
|
||||
|
||||
|
||||
|
||||
|
||||
!$OMP PARALLEL DEFAULT(NONE) &
|
||||
!$OMP PARALLEL DEFAULT(NONE) if (ao_num > 100) &
|
||||
!$OMP PRIVATE(i,j,l,k1,k,integral,ii,jj,kk,ll,i8,keys,values,n_elements_max, &
|
||||
!$OMP n_elements,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp)&
|
||||
!$OMP SHARED(ao_num,SCF_density_matrix_ao_alpha,SCF_density_matrix_ao_beta,&
|
||||
@ -125,7 +122,7 @@
|
||||
ao_two_e_integral_alpha_tmp = 0.d0
|
||||
ao_two_e_integral_beta_tmp = 0.d0
|
||||
|
||||
!$OMP DO SCHEDULE(dynamic,64)
|
||||
!$OMP DO SCHEDULE(static,1)
|
||||
!DIR$ NOVECTOR
|
||||
do i8=0_8,ao_integrals_map%map_size
|
||||
n_elements = n_elements_max
|
||||
@ -153,8 +150,6 @@
|
||||
!$OMP END DO NOWAIT
|
||||
!$OMP CRITICAL
|
||||
ao_two_e_integral_alpha += ao_two_e_integral_alpha_tmp
|
||||
!$OMP END CRITICAL
|
||||
!$OMP CRITICAL
|
||||
ao_two_e_integral_beta += ao_two_e_integral_beta_tmp
|
||||
!$OMP END CRITICAL
|
||||
deallocate(keys,values,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp)
|
||||
|
@ -36,7 +36,7 @@ subroutine check_coherence_functional
|
||||
ifound_c = index(correlation_functional,"short_range")
|
||||
endif
|
||||
print*,ifound_x,ifound_c
|
||||
if(ifound_x .eq.0 .or. ifound_c .eq. 0)then
|
||||
if(ifound_x .ne.0 .or. ifound_c .ne. 0)then
|
||||
print*,'YOU ARE USING THE RANGE SEPARATED KS PROGRAM BUT YOUR INPUT KEYWORD FOR '
|
||||
print*,'exchange_functional is ',exchange_functional
|
||||
print*,'correlation_functional is ',correlation_functional
|
||||
|
@ -4,12 +4,21 @@
|
||||
integer :: i,j,k,l
|
||||
ao_potential_alpha_xc = 0.d0
|
||||
ao_potential_beta_xc = 0.d0
|
||||
if(same_xc_func)then
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_potential_alpha_xc(i,j) = potential_xc_alpha_ao(i,j,1)
|
||||
ao_potential_beta_xc(i,j) = potential_xc_beta_ao(i,j,1)
|
||||
enddo
|
||||
enddo
|
||||
else
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_potential_alpha_xc(i,j) = potential_c_alpha_ao(i,j,1) + potential_x_alpha_ao(i,j,1)
|
||||
ao_potential_beta_xc(i,j) = potential_c_beta_ao(i,j,1) + potential_x_beta_ao(i,j,1)
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, e_exchange_dft]
|
||||
|
@ -3,7 +3,7 @@
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Alpha Fock matrix in AO basis set
|
||||
! Alpha Fock matrix in ao basis set
|
||||
END_DOC
|
||||
|
||||
integer :: i,j,k,l,k1,r,s
|
||||
@ -35,7 +35,7 @@
|
||||
ao_two_e_integral_beta_tmp = 0.d0
|
||||
|
||||
q = ao_num*ao_num*ao_num*ao_num
|
||||
!$OMP DO SCHEDULE(static,64)
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do p=1_8,q
|
||||
call two_e_integrals_index_reverse(kk,ii,ll,jj,p)
|
||||
if ( (kk(1)>ao_num).or. &
|
||||
@ -91,6 +91,8 @@
|
||||
!$OMP END DO NOWAIT
|
||||
!$OMP CRITICAL
|
||||
ao_two_e_integral_alpha += ao_two_e_integral_alpha_tmp
|
||||
!$OMP END CRITICAL
|
||||
!$OMP CRITICAL
|
||||
ao_two_e_integral_beta += ao_two_e_integral_beta_tmp
|
||||
!$OMP END CRITICAL
|
||||
deallocate(keys,values,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp)
|
||||
@ -203,19 +205,18 @@
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, Fock_matrix_ao_alpha, (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, Fock_matrix_ao_beta, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Alpha Fock matrix in AO basis set
|
||||
! Alpha Fock matrix in ao basis set
|
||||
END_DOC
|
||||
|
||||
integer :: i,j
|
||||
do j=1,ao_num
|
||||
do i=1,ao_num
|
||||
Fock_matrix_ao_alpha(i,j) = Fock_matrix_alpha_no_xc_ao(i,j) + ao_potential_alpha_xc(i,j)
|
||||
Fock_matrix_ao_beta (i,j) = Fock_matrix_beta_no_xc_ao(i,j) + ao_potential_beta_xc(i,j)
|
||||
Fock_matrix_ao_beta(i,j) = Fock_matrix_beta_no_xc_ao(i,j) + ao_potential_beta_xc(i,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
@ -226,7 +227,7 @@ END_PROVIDER
|
||||
&BEGIN_PROVIDER [ double precision, Fock_matrix_beta_no_xc_ao, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Mono electronic an Coulomb matrix in AO basis set
|
||||
! Mono electronic an Coulomb matrix in ao basis set
|
||||
END_DOC
|
||||
|
||||
integer :: i,j
|
||||
|
@ -4,12 +4,22 @@
|
||||
integer :: i,j,k,l
|
||||
ao_potential_alpha_xc = 0.d0
|
||||
ao_potential_beta_xc = 0.d0
|
||||
if(same_xc_func)then
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_potential_alpha_xc(i,j) = potential_c_alpha_ao(i,j,1) + potential_x_alpha_ao(i,j,1)
|
||||
ao_potential_beta_xc(i,j) = potential_c_beta_ao(i,j,1) + potential_x_beta_ao(i,j,1)
|
||||
ao_potential_alpha_xc(j,i) = potential_xc_alpha_ao(j,i,1)
|
||||
ao_potential_beta_xc(j,i) = potential_xc_beta_ao(j,i,1)
|
||||
enddo
|
||||
enddo
|
||||
else
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_potential_alpha_xc(j,i) = potential_c_alpha_ao(j,i,1) + potential_x_alpha_ao(j,i,1)
|
||||
ao_potential_beta_xc(j,i) = potential_c_beta_ao(j,i,1) + potential_x_beta_ao(j,i,1)
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, e_exchange_dft]
|
||||
|
Loading…
Reference in New Issue
Block a user