mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-10-30 10:18:07 +01:00
improved pot pbe
This commit is contained in:
parent
a298349f8a
commit
0e530b9ad3
@ -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)]
|
||||
|
@ -75,10 +75,10 @@
|
||||
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)
|
||||
grad_aos_dvc_alpha_PBE_w (j,i,m,istate) = contrib_grad_ca(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
grad_aos_dvc_beta_PBE_w (j,i,m,istate) = contrib_grad_cb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
grad_aos_dvx_alpha_PBE_w (j,i,m,istate) = contrib_grad_xa(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
grad_aos_dvx_beta_PBE_w (j,i,m,istate) = contrib_grad_xb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
185
src/dft_utils_one_e/pot_ao_pbe_new.irp.f
Normal file
185
src/dft_utils_one_e/pot_ao_pbe_new.irp.f
Normal file
@ -0,0 +1,185 @@
|
||||
BEGIN_PROVIDER[double precision, aos_vc_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vc_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_vx_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvc_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, aos_dvx_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvc_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvc_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvx_alpha_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
&BEGIN_PROVIDER[double precision, grad_aos_dvx_beta_PBE_w_new , (ao_num,n_points_final_grid,N_states)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! aos_vxc_alpha_PBE_w_new(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_new(j,i,istate) = vc_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vc_beta_PBE_w_new (j,i,istate) = vc_rho_b(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_alpha_PBE_w_new(j,i,istate) = vx_rho_a(istate) * aos_in_r_array(j,i)
|
||||
aos_vx_beta_PBE_w_new (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_new(j,i,istate) += contrib_grad_ca(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvc_beta_PBE_w_new (j,i,istate) += contrib_grad_cb(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvx_alpha_PBE_w_new(j,i,istate) += contrib_grad_xa(m,istate) * aos_grad_in_r_array_transp_xyz(m,j,i)
|
||||
aos_dvx_beta_PBE_w_new (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
|
||||
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_new(1,1,istate),size(aos_vc_alpha_PBE_w_new,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_new(1,1,istate),size(aos_vc_beta_PBE_w_new,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_new(1,1,istate),size(aos_vx_alpha_PBE_w_new,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_new(1,1,istate),size(aos_vx_beta_PBE_w_new,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
|
||||
! exchange/correlation alpha/beta pot_grads with the short range PBE functional on the AO basis
|
||||
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_new(1,1,istate),size(aos_dvc_alpha_PBE_w_new,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_new(1,1,istate),size(aos_dvc_beta_PBE_w_new,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_dvc_alpha_PBE_w_new(1,1,istate),size(aos_dvc_alpha_PBE_w_new,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_dvc_beta_PBE_w_new(1,1,istate),size(aos_dvc_beta_PBE_w_new,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_new,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_x_beta_ao_PBE_new,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_alpha_ao_PBE_new,(ao_num,ao_num,N_states)]
|
||||
&BEGIN_PROVIDER [double precision, potential_c_beta_ao_PBE_new,(ao_num,ao_num,N_states)]
|
||||
implicit none
|
||||
integer :: i,j,istate
|
||||
do istate = 1, n_states
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
potential_x_alpha_ao_PBE_new(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_c_alpha_ao_PBE_new(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_x_beta_ao_PBE_new(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_beta_ao_PBE_new(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
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user