From ba73d91fd397af199ca92085f7b7a33b916589a9 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Thu, 18 Jan 2024 12:10:49 +0100 Subject: [PATCH] AOs deb --- plugins/local/jastrow/env_param.irp.f | 8 ++- plugins/local/non_h_ints_mu/deb_aos.irp.f | 56 +++++++++++++++++++ plugins/local/non_h_ints_mu/jast_1e.irp.f | 48 +++++++++++++--- .../local/non_h_ints_mu/jast_1e_utils.irp.f | 8 +++ 4 files changed, 109 insertions(+), 11 deletions(-) create mode 100644 plugins/local/non_h_ints_mu/deb_aos.irp.f diff --git a/plugins/local/jastrow/env_param.irp.f b/plugins/local/jastrow/env_param.irp.f index 6d26baa3..689b22cd 100644 --- a/plugins/local/jastrow/env_param.irp.f +++ b/plugins/local/jastrow/env_param.irp.f @@ -1,11 +1,13 @@ ! --- - BEGIN_PROVIDER [ double precision, env_expo , (nucl_num) ] -&BEGIN_PROVIDER [ double precision, env_coef, (nucl_num) ] + BEGIN_PROVIDER [double precision, env_expo, (nucl_num)] +&BEGIN_PROVIDER [double precision, env_coef, (nucl_num)] BEGIN_DOC - ! parameters of the 1-body Jastrow + ! + ! parameters of the env of the 2e-Jastrow + ! END_DOC implicit none diff --git a/plugins/local/non_h_ints_mu/deb_aos.irp.f b/plugins/local/non_h_ints_mu/deb_aos.irp.f new file mode 100644 index 00000000..c9bc9c9a --- /dev/null +++ b/plugins/local/non_h_ints_mu/deb_aos.irp.f @@ -0,0 +1,56 @@ + +! --- + +program deb_Aos + + implicit none + + my_grid_becke = .True. + PROVIDE tc_grid1_a tc_grid1_r + my_n_pt_r_grid = tc_grid1_r + my_n_pt_a_grid = tc_grid1_a + touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid + + if(tc_integ_type .eq. "numeric") then + my_extra_grid_becke = .True. + PROVIDE tc_grid2_a tc_grid2_r + my_n_pt_r_extra_grid = tc_grid2_r + my_n_pt_a_extra_grid = tc_grid2_a + touch my_extra_grid_becke my_n_pt_r_extra_grid my_n_pt_a_extra_grid + endif + + call print_aos() + +end + +! --- + +subroutine print_aos() + + implicit none + integer :: i, ipoint + double precision :: r(3) + double precision :: ao_val, ao_der(3), ao_lap + + PROVIDE final_grid_points aos_in_r_array aos_grad_in_r_array aos_lapl_in_r_array + + do ipoint = 1, n_points_final_grid + r(:) = final_grid_points(:,ipoint) + print*, r + enddo + + do ipoint = 1, n_points_final_grid + r(:) = final_grid_points(:,ipoint) + do i = 1, ao_num + ao_val = aos_in_r_array (i,ipoint) + ao_der(:) = aos_grad_in_r_array(i,ipoint,:) + ao_lap = aos_lapl_in_r_array(1,i,ipoint) + aos_lapl_in_r_array(2,i,ipoint) + aos_lapl_in_r_array(3,i,ipoint) + write(*, '(5(f15.7, 3X))') ao_val, ao_der, ao_lap + enddo + enddo + + return +end + +! --- + diff --git a/plugins/local/non_h_ints_mu/jast_1e.irp.f b/plugins/local/non_h_ints_mu/jast_1e.irp.f index b2eef504..47245938 100644 --- a/plugins/local/non_h_ints_mu/jast_1e.irp.f +++ b/plugins/local/non_h_ints_mu/jast_1e.irp.f @@ -71,6 +71,8 @@ END_PROVIDER implicit none integer :: ipoint, i, j, p + integer :: ierr + logical :: exists double precision :: x, y, z, dx, dy, dz, d2 double precision :: a, c, g, tmp_x, tmp_y, tmp_z double precision :: time0, time1 @@ -116,15 +118,15 @@ END_PROVIDER a = j1e_expo(p,j) g = c * a * dexp(-a*d2) - tmp_x = tmp_x - g * dx - tmp_y = tmp_y - g * dy - tmp_z = tmp_z - g * dz + tmp_x = tmp_x + g * dx + tmp_y = tmp_y + g * dy + tmp_z = tmp_z + g * dz enddo enddo - j1e_gradx(ipoint) = 2.d0 * tmp_x - j1e_grady(ipoint) = 2.d0 * tmp_y - j1e_gradz(ipoint) = 2.d0 * tmp_z + j1e_gradx(ipoint) = -2.d0 * tmp_x + j1e_grady(ipoint) = -2.d0 * tmp_y + j1e_gradz(ipoint) = -2.d0 * tmp_z enddo elseif(j1e_type .eq. "Charge_Harmonizer") then @@ -173,8 +175,38 @@ END_PROVIDER allocate(coef_fit(ao_num)) - call get_j1e_coef_fit_ao(ao_num, coef_fit) - call ezfio_set_jastrow_j1e_coef_ao(coef_fit) + if(mpi_master) then + call ezfio_has_jastrow_j1e_coef_ao(exists) + endif + IRP_IF MPI_DEBUG + print *, irp_here, mpi_rank + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + IRP_ENDIF + IRP_IF MPI + include 'mpif.h' + call MPI_BCAST(coef_fit, ao_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read j1e_coef_ao with MPI' + endif + IRP_ENDIF + if(exists) then + if(mpi_master) then + write(6,'(A)') '.. >>>>> [ IO READ: j1e_coef_ao ] <<<<< ..' + call ezfio_get_jastrow_j1e_coef_ao(coef_fit) + IRP_IF MPI + call MPI_BCAST(coef_fit, ao_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read j1e_coef_ao with MPI' + endif + IRP_ENDIF + endif + else + + call get_j1e_coef_fit_ao(ao_num, coef_fit) + call ezfio_set_jastrow_j1e_coef_ao(coef_fit) + + endif + !$OMP PARALLEL & !$OMP DEFAULT (NONE) & diff --git a/plugins/local/non_h_ints_mu/jast_1e_utils.irp.f b/plugins/local/non_h_ints_mu/jast_1e_utils.irp.f index ba7477cc..b9ea2d6f 100644 --- a/plugins/local/non_h_ints_mu/jast_1e_utils.irp.f +++ b/plugins/local/non_h_ints_mu/jast_1e_utils.irp.f @@ -9,16 +9,21 @@ subroutine get_j1e_coef_fit_ao(dim_fit, coef_fit) integer :: i, ipoint double precision :: g + double precision :: t0, t1 double precision, allocatable :: A(:,:), b(:), A_inv(:,:) double precision, allocatable :: Pa(:,:), Pb(:,:), Pt(:,:) double precision, allocatable :: u1e_tmp(:) + PROVIDE j1e_type PROVIDE int2_u2e_ao PROVIDE elec_alpha_num elec_beta_num elec_num PROVIDE mo_coef PROVIDE ao_overlap + call wall_time(t0) + print*, ' PROVIDING the representation of 1e-Jastrow in AOs ... ' + ! --- --- --- ! get u1e(r) @@ -94,6 +99,9 @@ subroutine get_j1e_coef_fit_ao(dim_fit, coef_fit) deallocate(A_inv, b) + call wall_time(t1) + print*, ' END after (min) ', (t1-t0)/60.d0 + return end