10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-10-19 22:41:48 +02:00

cleaning lengthy variables

This commit is contained in:
Emmanuel Giner 2018-12-21 14:15:55 +01:00
parent 92a6be000d
commit d6bb9dbe96
33 changed files with 121 additions and 87 deletions

View File

@ -19,7 +19,7 @@ IRPF90_FLAGS : --ninja --align=32
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 1 ; Enable cache_compile.py
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags

View File

@ -1,7 +1,7 @@
program save_one_body_dm
implicit none
BEGIN_DOC
! programs that computes the one body density on the mo basis for alpha and beta electrons from the wave function stored in the EZFIO folder, and then save it into the EZFIO folder data_energy_and_density.
! programs that computes the one body density on the mo basis for alpha and beta electrons from the wave function stored in the EZFIO folder, and then save it into the EZFIO folder aux_quantities.
!
! Then, the global variable data_one_body_alpha_dm_mo and data_one_body_beta_dm_mo will automatically read the density in a further calculation.
!
@ -15,6 +15,6 @@ end
subroutine routine
call ezfio_set_data_energy_and_density_data_one_body_alpha_dm_mo(one_body_dm_mo_alpha)
call ezfio_set_data_energy_and_density_data_one_body_beta_dm_mo(one_body_dm_mo_beta)
call ezfio_set_aux_quantities_data_one_body_alpha_dm_mo(one_body_dm_mo_alpha)
call ezfio_set_aux_quantities_data_one_body_beta_dm_mo(one_body_dm_mo_beta)
end

View File

@ -304,7 +304,7 @@ subroutine H_S2_u_0_bielec_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istar
ASSERT (lrow <= N_det_alpha_unique)
tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow)
call i_H_j_mono_spin_bielec( tmp_det, tmp_det2, $N_int, 1, hij)
call i_Wee_j_mono( tmp_det, tmp_det2, $N_int, 1, hij)
do l=1,N_st
v_t(l,k_a) = v_t(l,k_a) + hij * u_t(l,l_a)
@ -384,7 +384,7 @@ subroutine H_S2_u_0_bielec_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istar
ASSERT (lcol <= N_det_beta_unique)
tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol)
call i_H_j_mono_spin_bielec( tmp_det, tmp_det2, $N_int, 2, hij)
call i_Wee_j_mono( tmp_det, tmp_det2, $N_int, 2, hij)
l_a = psi_bilinear_matrix_transp_order(l_b)
ASSERT (l_a <= N_det)
do l=1,N_st
@ -430,9 +430,9 @@ subroutine H_S2_u_0_bielec_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istar
tmp_det(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, krow)
tmp_det(1:$N_int,2) = psi_det_beta_unique (1:$N_int, kcol)
double precision, external :: diag_H_mat_elem_bielec, diag_S_mat_elem
double precision, external :: diag_wee_mat_elem, diag_S_mat_elem
hij = diag_H_mat_elem_bielec(tmp_det,$N_int)
hij = diag_wee_mat_elem(tmp_det,$N_int)
sij = diag_S_mat_elem(tmp_det,$N_int)
do l=1,N_st
v_t(l,k_a) = v_t(l,k_a) + hij * u_t(l,k_a)

View File

@ -1,3 +1,3 @@
determinants
dft_keywords
data_energy_and_density
aux_quantities

View File

@ -1,5 +1,5 @@
use bitmasks
subroutine get_mono_excitation_from_fock_bielec(det_1,det_2,h,p,spin,phase,hij)
subroutine mono_excitation_wee(det_1,det_2,h,p,spin,phase,hij)
use bitmasks
implicit none
integer,intent(in) :: h,p,spin
@ -23,7 +23,7 @@ subroutine get_mono_excitation_from_fock_bielec(det_1,det_2,h,p,spin,phase,hij)
enddo
call bitstring_to_list_ab(hole, occ_hole, n_occ_ab_hole, N_int)
call bitstring_to_list_ab(partcl, occ_partcl, n_occ_ab_partcl, N_int)
hij = fock_operator_bielec_closed_shell_ref_bitmask(h,p)
hij = fock_wee_closed_shell(h,p)
! holes :: direct terms
do i0 = 1, n_occ_ab_hole(1)
i = occ_hole(i0,1)
@ -60,7 +60,7 @@ subroutine get_mono_excitation_from_fock_bielec(det_1,det_2,h,p,spin,phase,hij)
end
BEGIN_PROVIDER [double precision, fock_operator_bielec_closed_shell_ref_bitmask, (mo_tot_num, mo_tot_num) ]
BEGIN_PROVIDER [double precision, fock_wee_closed_shell, (mo_tot_num, mo_tot_num) ]
implicit none
integer :: i0,j0,i,j,k0,k
integer :: n_occ_ab(2)
@ -92,8 +92,8 @@ BEGIN_PROVIDER [double precision, fock_operator_bielec_closed_shell_ref_bitmask,
k = occ(k0,1)
accu += 2.d0 * array_coulomb(k) - array_exchange(k)
enddo
fock_operator_bielec_closed_shell_ref_bitmask(i,j) = accu
fock_operator_bielec_closed_shell_ref_bitmask(j,i) = accu
fock_wee_closed_shell(i,j) = accu
fock_wee_closed_shell(j,i) = accu
enddo
enddo
@ -109,8 +109,8 @@ BEGIN_PROVIDER [double precision, fock_operator_bielec_closed_shell_ref_bitmask,
k = occ(k0,1)
accu += 2.d0 * array_coulomb(k) - array_exchange(k)
enddo
fock_operator_bielec_closed_shell_ref_bitmask(i,j) = accu
fock_operator_bielec_closed_shell_ref_bitmask(j,i) = accu
fock_wee_closed_shell(i,j) = accu
fock_wee_closed_shell(j,i) = accu
enddo
enddo
@ -126,8 +126,8 @@ BEGIN_PROVIDER [double precision, fock_operator_bielec_closed_shell_ref_bitmask,
k = occ(k0,1)
accu += 2.d0 * array_coulomb(k) - array_exchange(k)
enddo
fock_operator_bielec_closed_shell_ref_bitmask(i,j) = accu
fock_operator_bielec_closed_shell_ref_bitmask(j,i) = accu
fock_wee_closed_shell(i,j) = accu
fock_wee_closed_shell(j,i) = accu
enddo
enddo

View File

@ -1,5 +1,5 @@
subroutine i_H_j_mono_spin_bielec(key_i,key_j,Nint,spin,hij)
subroutine i_Wee_j_mono(key_i,key_j,Nint,spin,hij)
use bitmasks
implicit none
BEGIN_DOC
@ -15,11 +15,11 @@ subroutine i_H_j_mono_spin_bielec(key_i,key_j,Nint,spin,hij)
PROVIDE big_array_exchange_integrals mo_bielec_integrals_in_map
call get_mono_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint)
call get_mono_excitation_from_fock_bielec(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij)
call mono_excitation_wee(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij)
end
double precision function diag_H_mat_elem_bielec(det_in,Nint)
double precision function diag_wee_mat_elem(det_in,Nint)
implicit none
BEGIN_DOC
! Computes <i|H|i>
@ -52,7 +52,7 @@ double precision function diag_H_mat_elem_bielec(det_in,Nint)
nexc(2) = nexc(2) + popcnt(hole(i,2))
enddo
diag_H_mat_elem_bielec = bi_elec_ref_bitmask_energy
diag_wee_mat_elem = bi_elec_ref_bitmask_energy
if (nexc(1)+nexc(2) == 0) then
return
endif
@ -74,9 +74,9 @@ double precision function diag_H_mat_elem_bielec(det_in,Nint)
nb = elec_num_tab(iand(ispin,1)+1)
do i=1,nexc(ispin)
!DIR$ FORCEINLINE
call ac_operator_bielec( occ_particle(i,ispin), ispin, det_tmp, diag_H_mat_elem_bielec, Nint,na,nb)
call ac_operator_bielec( occ_particle(i,ispin), ispin, det_tmp, diag_wee_mat_elem, Nint,na,nb)
!DIR$ FORCEINLINE
call a_operator_bielec ( occ_hole (i,ispin), ispin, det_tmp, diag_H_mat_elem_bielec, Nint,na,nb)
call a_operator_bielec ( occ_hole (i,ispin), ispin, det_tmp, diag_wee_mat_elem, Nint,na,nb)
enddo
enddo
end
@ -352,10 +352,10 @@ subroutine i_H_j_bielec(key_i,key_j,Nint,hij)
p = exc(1,2,2)
spin = 2
endif
call get_mono_excitation_from_fock_bielec(key_i,key_j,p,m,spin,phase,hij)
call mono_excitation_wee(key_i,key_j,p,m,spin,phase,hij)
case (0)
double precision :: diag_H_mat_elem_bielec
hij = diag_H_mat_elem_bielec(key_i,Nint)
double precision :: diag_wee_mat_elem
hij = diag_wee_mat_elem(key_i,Nint)
end select
end

View File

@ -1,5 +1,5 @@
density_for_dft
dft_utils_on_grid
dft_utils_in_r
mo_one_e_integrals
mo_two_e_integrals
ao_one_e_integrals

View File

@ -0,0 +1,38 @@
BEGIN_PROVIDER [double precision, energy_x, (N_states)]
&BEGIN_PROVIDER [double precision, energy_c, (N_states)]
implicit none
BEGIN_DOC
! correlation and exchange energies general providers.
END_DOC
if(trim(exchange_functional)=="short_range_LDA")then
energy_x = energy_sr_x_LDA
energy_x = energy_sr_x_LDA
else if(exchange_functional.EQ."short_range_PBE")then
energy_x = energy_sr_x_PBE
energy_x = energy_sr_x_PBE
else if(exchange_functional.EQ."None")then
energy_x = 0.d0
energy_x = 0.d0
else
print*, 'Exchange functional required does not exist ...'
print*,'exchange_functional',exchange_functional
stop
endif
if(trim(correlation_functional)=="short_range_LDA")then
energy_c = energy_sr_c_LDA
energy_c = energy_sr_c_LDA
else if(correlation_functional.EQ."short_range_PBE")then
energy_c = energy_sr_c_PBE
energy_c = energy_sr_c_PBE
else if(correlation_functional.EQ."None")then
energy_c = 0.d0
energy_c = 0.d0
else
print*, 'Correlation functional required does not ecist ...'
print*,'correlation_functional',correlation_functional
stop
endif
END_PROVIDER

View File

@ -1,19 +1,42 @@
subroutine ec_pbe_sr(mu,rhoc,rhoo,sigmacc,sigmaco,sigmaoo,ec,vrhoc,vrhoo,vsigmacc,vsigmaco,vsigmaoo)
!************************************************************************
! Short-range PBE correlation energy functional for erf interaction
BEGIN_DOC
! Short-range PBE correlation energy functional for erf interaction
!
! input : ==========
!
! mu = range separated parameter
!
!************************************************************************
! rhoc, rhoo = total density and spin density
!
! sigmacc = square of the gradient of the total density
!
! sigmaco = square of the gradient of the spin density
!
! sigmaoo = scalar product between the gradient of the total density and the one of the spin density
!
! output: ==========
!
! ec = correlation energy
!
! all variables v** are energy derivatives with respect to components of the density
!
! vrhoc = derivative with respect to the total density
!
! vrhoo = derivative with respect to spin density
!
! vsigmacc = derivative with respect to the square of the gradient of the total density
!
! vsigmaco = derivative with respect to scalar product between the gradients of total and spin densities
!
! vsigmaoo = derivative with respect to the square of the gradient of the psin density
END_DOC
include 'constants.include.F'
implicit none
! input
double precision, intent(in) :: rhoc,rhoo,mu
double precision, intent(in) :: sigmacc,sigmaco,sigmaoo
! output
double precision, intent(out) :: ec
double precision, intent(out) :: vrhoc,vrhoo
double precision, intent(out) :: vsigmacc,vsigmaco,vsigmaoo
! local
double precision tol
parameter(tol=1d-12)
@ -82,8 +105,6 @@ include 'constants.include.F'
double precision :: vc_a_lda,vc_b_lda
call ec_lda(rhoa,rhob,ecclda,vc_a_lda,vc_b_lda)
eclda = ecclda
!decldadrho = 0.5d0 * (vc_a_lda+vc_b_lda)
!decldadrho = 0.5d0 * (vc_a_lda-vc_b_lda)
if ((ecerflda/eclda).le.0d0) then
beta=0d0
@ -108,7 +129,6 @@ include 'constants.include.F'
ec = ecerfpbe
! if(ldebug) write(*,*)"ecerfpbe=",ecerfpbe
! Derive
@ -168,12 +188,13 @@ end
subroutine ex_pbe_sr(mu,rho_a,rho_b,grd_rho_a_2,grd_rho_b_2,grd_rho_a_b,ex,vx_rho_a,vx_rho_b,vx_grd_rho_a_2,vx_grd_rho_b_2,vx_grd_rho_a_b)
BEGIN_DOC
!mu = range separation parameter
!rho_a = density alpha
!rho_b = density beta
!grd_rho_a_2 = (gradient rho_a)^2
!grd_rho_b_2 = (gradient rho_b)^2
!grd_rho_a_b = (gradient rho_a).(gradient rho_b)
!ex = exchange energy density at point r
!ex = exchange energy density at the density and corresponding gradients of the density
!vx_rho_a = d ex / d rho_a
!vx_rho_b = d ex / d rho_b
!vx_grd_rho_a_2 = d ex / d grd_rho_a_2
@ -374,11 +395,26 @@ END_DOC
subroutine ec_pbe_only(mu,rhoc,rhoo,sigmacc,sigmaco,sigmaoo,ec)
!************************************************************************
! Short-range PBE correlation energy functional for erf interaction
BEGIN_DOC
! Short-range PBE correlation energy functional for erf interaction
!
! input : ==========
!
! mu = range separated parameter
!
!************************************************************************
! rhoc, rhoo = total density and spin density
!
! sigmacc = square of the gradient of the total density
!
! sigmaco = square of the gradient of the spin density
!
! sigmaoo = scalar product between the gradient of the total density and the one of the spin density
!
! output: ==========
!
! ec = correlation energy
!
END_DOC
include 'constants.include.F'
implicit none
! input

View File

@ -88,46 +88,6 @@ END_PROVIDER
END_PROVIDER
BEGIN_PROVIDER [double precision, energy_x, (N_states)]
&BEGIN_PROVIDER [double precision, energy_c, (N_states)]
implicit none
BEGIN_DOC
! correlation and exchange energies general providers.
END_DOC
if(trim(exchange_functional)=="short_range_LDA")then
energy_x = energy_sr_x_LDA
energy_x = energy_sr_x_LDA
else if(exchange_functional.EQ."short_range_PBE")then
energy_x = energy_sr_x_PBE
energy_x = energy_sr_x_PBE
else if(exchange_functional.EQ."None")then
energy_x = 0.d0
energy_x = 0.d0
else
print*, 'Exchange functional required does not exist ...'
print*,'exchange_functional',exchange_functional
stop
endif
if(trim(correlation_functional)=="short_range_LDA")then
energy_c = energy_sr_c_LDA
energy_c = energy_sr_c_LDA
else if(correlation_functional.EQ."short_range_PBE")then
energy_c = energy_sr_c_PBE
energy_c = energy_sr_c_PBE
else if(correlation_functional.EQ."None")then
energy_c = 0.d0
energy_c = 0.d0
else
print*, 'Correlation functional required does not ecist ...'
print*,'correlation_functional',correlation_functional
stop
endif
END_PROVIDER
BEGIN_PROVIDER [double precision, Trace_v_xc, (N_states)]
&BEGIN_PROVIDER [double precision, Trace_v_H, (N_states)]
&BEGIN_PROVIDER [double precision, Trace_v_Hxc, (N_states)]

View File

@ -1,3 +1,3 @@
dft_utils_one_body
dft_utils_one_e
determinants
davidson_undressed

View File

@ -26,8 +26,8 @@ end
subroutine routines_compute_energy
implicit none
call print_variational_energy_dft
call ezfio_set_data_energy_and_density_data_one_body_alpha_dm_mo(one_body_dm_mo_alpha)
call ezfio_set_data_energy_and_density_data_one_body_beta_dm_mo(one_body_dm_mo_beta)
call ezfio_set_aux_quantities_data_one_body_alpha_dm_mo(one_body_dm_mo_alpha)
call ezfio_set_aux_quantities_data_one_body_beta_dm_mo(one_body_dm_mo_beta)
end

View File

@ -9,7 +9,7 @@ davidson
davidson_dressed
davidson_undressed
determinants
dft_utils_one_body
dft_utils_one_e
dressing
electrons
ezfio_files

View File

@ -1,2 +1,2 @@
dft_utils_one_body
dft_utils_one_e
scf_utils

View File

@ -1,2 +1,2 @@
dft_utils_one_body
dft_utils_one_e
scf_utils