From dee440747fe438287b4f48f36fdeaa755f3eab95 Mon Sep 17 00:00:00 2001 From: Abdallah Ammar Date: Sun, 4 Aug 2024 11:58:19 +0200 Subject: [PATCH] devide BH jast coeff by 2 direct --- plugins/local/jastrow/bh_param.irp.f | 8 +++++++ .../non_h_ints_mu/jast_deriv_utils_vect.irp.f | 3 --- plugins/local/non_h_ints_mu/tc_integ.irp.f | 2 +- plugins/local/tc_int/compute_tc_int.irp.f | 4 ++-- plugins/local/tc_int/cutc_module.F90 | 4 ++-- plugins/local/tc_int/deb_tc_int_cuda.irp.f | 21 ++----------------- plugins/local/tc_int/jast_grad_full.irp.f | 5 ----- plugins/local/tc_int/write_tc_int_cuda.irp.f | 4 ++-- plugins/local/tc_scf/tc_scf_energy.irp.f | 2 +- 9 files changed, 18 insertions(+), 35 deletions(-) diff --git a/plugins/local/jastrow/bh_param.irp.f b/plugins/local/jastrow/bh_param.irp.f index 1ed871bc..b9d51dd3 100644 --- a/plugins/local/jastrow/bh_param.irp.f +++ b/plugins/local/jastrow/bh_param.irp.f @@ -232,6 +232,14 @@ ! --- + do i_nucl = 1, nucl_num + do p = 1, jBH_size + if(jBH_m(p,i_nucl) .eq. jBH_n(p,i_nucl)) then + jBH_c(p,i_nucl) = 0.5d0 * jBH_c(p,i_nucl) + endif + enddo + enddo + print *, ' parameters for Boys-Handy Jastrow' print *, ' nb of terms per nucleus = ', jBH_size diff --git a/plugins/local/non_h_ints_mu/jast_deriv_utils_vect.irp.f b/plugins/local/non_h_ints_mu/jast_deriv_utils_vect.irp.f index 2c41b535..4fc537c8 100644 --- a/plugins/local/non_h_ints_mu/jast_deriv_utils_vect.irp.f +++ b/plugins/local/non_h_ints_mu/jast_deriv_utils_vect.irp.f @@ -335,9 +335,6 @@ subroutine grad1_j12_r1_seq(r1, n_grid2, gradx, grady, gradz) npA = jBH_n(p,i_nucl) opA = jBH_o(p,i_nucl) tmp = jBH_c(p,i_nucl) - if(mpA .eq. npA) then - tmp = tmp * 0.5d0 - endif tmp1 = double_p(mpA) * f1A_power(mpA-1) * f2A_power(npA) + double_p(npA) * f1A_power(npA-1) * f2A_power(mpA) tmp1 = tmp1 * g12_power(opA) * tmp diff --git a/plugins/local/non_h_ints_mu/tc_integ.irp.f b/plugins/local/non_h_ints_mu/tc_integ.irp.f index 58e3db48..ce7ab101 100644 --- a/plugins/local/non_h_ints_mu/tc_integ.irp.f +++ b/plugins/local/non_h_ints_mu/tc_integ.irp.f @@ -204,7 +204,7 @@ BEGIN_PROVIDER [double precision, int2_grad1_u12_ao, (ao_num, ao_num, n_points_f print*, ' Writing int2_grad1_u12_ao in ', trim(ezfio_filename) // '/work/int2_grad1_u12_ao' open(unit=11, form="unformatted", file=trim(ezfio_filename)//'/work/int2_grad1_u12_ao', action="write") - call ezfio_set_work_empty(.False.) + call ezfio_set_work_empty(.False.) write(11) int2_grad1_u12_ao close(11) call ezfio_set_tc_keywords_io_tc_integ('Read') diff --git a/plugins/local/tc_int/compute_tc_int.irp.f b/plugins/local/tc_int/compute_tc_int.irp.f index 97815904..e6881f34 100644 --- a/plugins/local/tc_int/compute_tc_int.irp.f +++ b/plugins/local/tc_int/compute_tc_int.irp.f @@ -200,7 +200,7 @@ subroutine provide_int2_grad1_u12_ao() do k = 1, ao_num do ipoint = 1, n_points_final_grid - weight1 = 0.5d0 * final_weight_at_r_vector(ipoint) + weight1 = final_weight_at_r_vector(ipoint) ao_i_r = aos_in_r_array_transp(ipoint,i) ao_k_r = aos_in_r_array_transp(ipoint,k) @@ -211,7 +211,7 @@ subroutine provide_int2_grad1_u12_ao() !$OMP END DO !$OMP END PARALLEL - call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, -1.d0 & + call dgemm( "N", "N", ao_num*ao_num, ao_num*ao_num, n_points_final_grid, -0.5d0 & , int2_grad1_u12_ao(1,1,1,m), ao_num*ao_num, c_mat(1,1,1), n_points_final_grid & , 1.d0, tc_int_2e_ao(1,1,1,1), ao_num*ao_num) enddo diff --git a/plugins/local/tc_int/cutc_module.F90 b/plugins/local/tc_int/cutc_module.F90 index b96c1bef..1f55d763 100644 --- a/plugins/local/tc_int/cutc_module.F90 +++ b/plugins/local/tc_int/cutc_module.F90 @@ -34,7 +34,7 @@ module cutc_module integer(c_int), intent(in) :: m_bh(size_bh,n_nuc) integer(c_int), intent(in) :: n_bh(size_bh,n_nuc) integer(c_int), intent(in) :: o_bh(size_bh,n_nuc) - real(c_double), intent(out) :: int2_grad1_u12_ao(n_ao,n_ao,n_grid1,4) + real(c_double), intent(out) :: int2_grad1_u12_ao(n_ao,n_ao,n_grid1,3) real(c_double), intent(out) :: int_2e_ao(n_ao,n_ao,n_ao,n_ao) end subroutine tc_int_c @@ -66,7 +66,7 @@ module cutc_module integer(c_int), intent(in) :: m_bh(size_bh,n_nuc) integer(c_int), intent(in) :: n_bh(size_bh,n_nuc) integer(c_int), intent(in) :: o_bh(size_bh,n_nuc) - real(c_double), intent(out) :: int2_grad1_u12_ao(n_ao,n_ao,n_grid1,4) + real(c_double), intent(out) :: int2_grad1_u12_ao(n_ao,n_ao,n_grid1,3) real(c_double), intent(out) :: int_2e_ao(n_ao,n_ao,n_ao,n_ao) end subroutine deb_int_2e_ao diff --git a/plugins/local/tc_int/deb_tc_int_cuda.irp.f b/plugins/local/tc_int/deb_tc_int_cuda.irp.f index 75e3b4fe..1a43141c 100644 --- a/plugins/local/tc_int/deb_tc_int_cuda.irp.f +++ b/plugins/local/tc_int/deb_tc_int_cuda.irp.f @@ -119,7 +119,7 @@ subroutine deb_int_2e_ao_gpu() call ezfio_set_tc_int_blockxSize(sB) call ezfio_set_tc_int_nxBlocks(nB) - allocate(int2_grad1_u12_ao_gpu(ao_num,ao_num,n_points_final_grid,4)) + allocate(int2_grad1_u12_ao_gpu(ao_num,ao_num,n_points_final_grid,3)) allocate(int_2e_ao_gpu(ao_num,ao_num,ao_num,ao_num)) call deb_int_2e_ao(nxBlocks, nyBlocks, nzBlocks, blockxSize, blockySize, blockzSize, & @@ -268,7 +268,7 @@ subroutine deb_int_2e_ao_gpu() print *, ' precision on int2_grad1_u12_ao ' err_tot = 0.d0 nrm_tot = 0.d0 - do m = 1, 4 + do m = 1, 3 do ipoint = 1, n_points_final_grid do j = 1, ao_num do i = 1, ao_num @@ -310,23 +310,6 @@ subroutine deb_int_2e_ao_gpu() enddo print *, ' absolute accuracy on int_2e_ao (%) =', 100.d0 * err_tot / nrm_tot - - ! --- - - print*, ' Writing int2_grad1_u12_ao in ', trim(ezfio_filename) // '/work/int2_grad1_u12_ao' - open(unit=11, form="unformatted", file=trim(ezfio_filename)//'/work/int2_grad1_u12_ao', action="write") - call ezfio_set_work_empty(.False.) - write(11) int2_grad1_u12_ao_gpu(:,:,:,1:3) - close(11) - - print*, ' Saving tc_int_2e_ao in ', trim(ezfio_filename) // '/work/ao_two_e_tc_tot' - open(unit=11, form="unformatted", file=trim(ezfio_filename)//'/work/ao_two_e_tc_tot', action="write") - call ezfio_set_work_empty(.False.) - do k = 1, ao_num - write(11) int_2e_ao_gpu(:,:,:,k) - enddo - close(11) - ! --- deallocate(int_fct_long_range, grad1_u12, c_mat) diff --git a/plugins/local/tc_int/jast_grad_full.irp.f b/plugins/local/tc_int/jast_grad_full.irp.f index 2f6abf39..943d8567 100644 --- a/plugins/local/tc_int/jast_grad_full.irp.f +++ b/plugins/local/tc_int/jast_grad_full.irp.f @@ -170,11 +170,6 @@ subroutine grad1_j12_r1_seq(r1, n_grid2, gradx, grady, gradz) npA = jBH_n(p,i_nucl) opA = jBH_o(p,i_nucl) - ! TODO to it when reading the parameters - if(mpA .eq. npA) then - tmp = tmp * 0.5d0 - endif - tmp1 = double_p(mpA) * f1A_power(mpA-1) * f2A_power(npA) + double_p(npA) * f1A_power(npA-1) * f2A_power(mpA) tmp1 = tmp1 * g12_power(opA) * tmp tmp2 = double_p(opA) * g12_power(opA-1) * (f1A_power(mpA) * f2A_power(npA) + f1A_power(npA) * f2A_power(mpA)) * tmp diff --git a/plugins/local/tc_int/write_tc_int_cuda.irp.f b/plugins/local/tc_int/write_tc_int_cuda.irp.f index b74cd0cd..7d0a0385 100644 --- a/plugins/local/tc_int/write_tc_int_cuda.irp.f +++ b/plugins/local/tc_int/write_tc_int_cuda.irp.f @@ -75,7 +75,7 @@ subroutine do_work_on_gpu() allocate(rn(3,nucl_num)) allocate(aos_data1(n_points_final_grid,ao_num,4)) allocate(aos_data2(n_points_extra_final_grid,ao_num,4)) - allocate(int2_grad1_u12_ao(ao_num,ao_num,n_points_final_grid,4)) + allocate(int2_grad1_u12_ao(ao_num,ao_num,n_points_final_grid,3)) allocate(int_2e_ao(ao_num,ao_num,ao_num,ao_num)) @@ -166,7 +166,7 @@ subroutine do_work_on_gpu() print*, ' Writing int2_grad1_u12_ao in ', trim(ezfio_filename) // '/work/int2_grad1_u12_ao' open(unit=11, form="unformatted", file=trim(ezfio_filename)//'/work/int2_grad1_u12_ao', action="write") call ezfio_set_work_empty(.False.) - write(11) int2_grad1_u12_ao(:,:,:,1:3) + write(11) int2_grad1_u12_ao close(11) deallocate(int2_grad1_u12_ao) diff --git a/plugins/local/tc_scf/tc_scf_energy.irp.f b/plugins/local/tc_scf/tc_scf_energy.irp.f index 74ab9d05..80ef2afb 100644 --- a/plugins/local/tc_scf/tc_scf_energy.irp.f +++ b/plugins/local/tc_scf/tc_scf_energy.irp.f @@ -28,7 +28,7 @@ enddo enddo - if((three_body_h_tc .eq. .False.) .and. (.not. noL_standard)) then + if((three_body_h_tc .eqv. .False.) .and. (.not. noL_standard)) then TC_HF_three_e_energy = 0.d0 else TC_HF_three_e_energy = noL_0e