From 7fa6dc933456ee0e962f222cfece748191ac35e7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 13 Mar 2019 16:04:00 +0100 Subject: [PATCH 1/9] Updated research.bib --- docs/source/research.bib | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/source/research.bib b/docs/source/research.bib index f22ca682..348c5a15 100644 --- a/docs/source/research.bib +++ b/docs/source/research.bib @@ -19,21 +19,23 @@ Programs}}, url = {https://arxiv.org/abs/1812.06902} } -@article{Loos2019Jan, + +%%%% PUBLISHED PAPERS + +@article{Loos2019Mar, author = {Loos, Pierre-Fran\c{c}ois and Boggio-Pasqua, Martial and Scemama, Anthony and Caffarel, Michel and Jacquemin, Denis}, title = {{Reference Energies for Double Excitations}}, journal = {J. Chem. Theory Comput.}, + volume = {15}, + number = {3}, + pages = {1939--1956}, year = {2019}, - month = {Jan}, + month = {Mar}, issn = {1549-9618}, publisher = {American Chemical Society}, doi = {10.1021/acs.jctc.8b01205} } - - - -%%%% PUBLISHED PAPERS @article{PinedaFlores2019Feb, author = {Pineda Flores, Sergio and Neuscamman, Eric}, title = {{Excited State Specific Multi-Slater Jastrow Wave Functions}}, From b60c235623603e61f5d00fd90136cd86fa1a9fac Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Tue, 19 Mar 2019 17:09:36 +0100 Subject: [PATCH 2/9] added no core densities --- ocaml/.gitignore | 8 +- src/density_for_dft/density_for_dft.irp.f | 72 ++++++++++++- src/dft_utils_in_r/dm_in_r.irp.f | 125 ++++++++++++++++++++++ 3 files changed, 198 insertions(+), 7 deletions(-) diff --git a/ocaml/.gitignore b/ocaml/.gitignore index 95a2d185..683292ee 100644 --- a/ocaml/.gitignore +++ b/ocaml/.gitignore @@ -13,19 +13,21 @@ Input_davidson.ml Input_density_for_dft.ml Input_determinants.ml Input_dft_keywords.ml +Input_dft_mu_of_r.ml Input_dressing.ml -<<<<<<< HEAD Input_firth_order_der.ml Input_ijkl_ints_in_r3.ml -======= ->>>>>>> 1f647c595d643cf44700972bdf2363b557091c8f Input_mo_one_e_ints.ml Input_mo_two_e_erf_ints.ml Input_mo_two_e_ints.ml +Input_mu_of_r_ints.ml +Input_mu_of_r.ml Input_nuclei.ml Input_perturbation.ml Input_pseudo.ml +Input_rsdft_ecmd.ml Input_scf_utils.ml +Input_two_body_dm.ml qp_create_ezfio qp_create_ezfio.native qp_edit diff --git a/src/density_for_dft/density_for_dft.irp.f b/src/density_for_dft/density_for_dft.irp.f index 7a907418..84f3d349 100644 --- a/src/density_for_dft/density_for_dft.irp.f +++ b/src/density_for_dft/density_for_dft.irp.f @@ -21,8 +21,9 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_s endif if(no_core_density .EQ. "no_core_dm")then - integer :: i,j - do i = 1, n_core_orb + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) do j = 1, mo_num one_e_dm_mo_alpha_for_dft(j,i,:) = 0.d0 one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0 @@ -55,8 +56,9 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_st endif if(no_core_density .EQ. "no_core_dm")then - integer :: i,j - do i = 1, n_core_orb + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) do j = 1, mo_num one_e_dm_mo_beta_for_dft(j,i,:) = 0.d0 one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0 @@ -119,3 +121,65 @@ END_PROVIDER one_body_dm_mo_beta_one_det(i,i, 1:N_states) = 1.d0 enddo END_PROVIDER + + + + +BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft_no_core, (mo_num,mo_num, N_states)] + implicit none + BEGIN_DOC +! density matrix for alpha electrons in the MO basis without the core orbitals + END_DOC + one_e_dm_mo_alpha_for_dft_no_core = one_e_dm_mo_alpha_for_dft + + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) + do j = 1, mo_num + one_e_dm_mo_alpha_for_dft_no_core(j,i,:) = 0.d0 + one_e_dm_mo_alpha_for_dft_no_core(i,j,:) = 0.d0 + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft_no_core, (mo_num,mo_num, N_states)] + implicit none + BEGIN_DOC +! density matrix for beta electrons in the MO basis without the core orbitals + END_DOC + one_e_dm_mo_beta_for_dft_no_core = one_e_dm_mo_beta_for_dft + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) + do j = 1, mo_num + one_e_dm_mo_beta_for_dft_no_core(j,i,:) = 0.d0 + one_e_dm_mo_beta_for_dft_no_core(i,j,:) = 0.d0 + enddo + enddo +END_PROVIDER + + BEGIN_PROVIDER [ double precision, one_e_dm_alpha_ao_for_dft_no_core, (ao_num,ao_num,N_states) ] +&BEGIN_PROVIDER [ double precision, one_e_dm_beta_ao_for_dft_no_core, (ao_num,ao_num,N_states) ] + BEGIN_DOC +! one body density matrix on the AO basis based on one_e_dm_mo_alpha_for_dft_no_core + END_DOC + implicit none + integer :: istate + double precision :: mo_alpha,mo_beta + + one_e_dm_alpha_ao_for_dft_no_core = 0.d0 + one_e_dm_beta_ao_for_dft_no_core = 0.d0 + do istate = 1, N_states + call mo_to_ao_no_overlap( one_e_dm_mo_alpha_for_dft_no_core(1,1,istate), & + size(one_e_dm_mo_alpha_for_dft_no_core,1), & + one_e_dm_alpha_ao_for_dft_no_core(1,1,istate), & + size(one_e_dm_alpha_ao_for_dft_no_core,1) ) + call mo_to_ao_no_overlap( one_e_dm_mo_beta_for_dft_no_core(1,1,istate), & + size(one_e_dm_mo_beta_for_dft_no_core,1), & + one_e_dm_beta_ao_for_dft_no_core(1,1,istate), & + size(one_e_dm_beta_ao_for_dft_no_core,1) ) + enddo + +END_PROVIDER + diff --git a/src/dft_utils_in_r/dm_in_r.irp.f b/src/dft_utils_in_r/dm_in_r.irp.f index 774061cf..cc8dc4b4 100644 --- a/src/dft_utils_in_r/dm_in_r.irp.f +++ b/src/dft_utils_in_r/dm_in_r.irp.f @@ -109,6 +109,90 @@ end grad_dm_b *= 2.d0 end +subroutine dm_dft_alpha_beta_no_core_at_r(r,dm_a,dm_b) + implicit none + BEGIN_DOC +! input: r(1) ==> r(1) = x, r(2) = y, r(3) = z +! output : dm_a = alpha density evaluated at r(3) without the core orbitals +! output : dm_b = beta density evaluated at r(3) without the core orbitals + END_DOC + double precision, intent(in) :: r(3) + double precision, intent(out) :: dm_a(N_states),dm_b(N_states) + integer :: istate + double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v + call give_all_aos_at_r(r,aos_array) + do istate = 1, N_states + aos_array_bis = aos_array + ! alpha density + call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1) + dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + ! beta density + aos_array_bis = aos_array + call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1) + dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + enddo +end + + subroutine dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, aos_array, grad_aos_array) + implicit none + BEGIN_DOC +! input: +! +! * r(1) ==> r(1) = x, r(2) = y, r(3) = z +! +! output: +! +! * dm_a = alpha density evaluated at r without the core orbitals +! * dm_b = beta density evaluated at r without the core orbitals +! * aos_array(i) = ao(i) evaluated at r without the core orbitals +! * grad_dm_a(1) = X gradient of the alpha density evaluated in r without the core orbitals +! * grad_dm_a(1) = X gradient of the beta density evaluated in r without the core orbitals +! * grad_aos_array(1) = X gradient of the aos(i) evaluated at r +! + END_DOC + double precision, intent(in) :: r(3) + double precision, intent(out) :: dm_a(N_states),dm_b(N_states) + double precision, intent(out) :: grad_dm_a(3,N_states),grad_dm_b(3,N_states) + double precision, intent(out) :: grad_aos_array(3,ao_num) + integer :: i,j,istate + double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v + double precision :: aos_grad_array(ao_num,3), aos_grad_array_bis(ao_num,3) + + call give_all_aos_and_grad_at_r(r,aos_array,grad_aos_array) + do i = 1, ao_num + do j = 1, 3 + aos_grad_array(i,j) = grad_aos_array(j,i) + enddo + enddo + + do istate = 1, N_states + ! alpha density + ! aos_array_bis = \rho_ao * aos_array + call dsymv('U',ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),size(one_e_dm_alpha_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1) + dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + + ! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i) + grad_dm_a(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num) + grad_dm_a(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num) + grad_dm_a(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num) + ! aos_grad_array_bis = \rho_ao * aos_grad_array + + ! beta density + call dsymv('U',ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),size(one_e_dm_beta_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1) + dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + + ! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i) + grad_dm_b(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num) + grad_dm_b(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num) + grad_dm_b(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num) + ! aos_grad_array_bis = \rho_ao * aos_grad_array + enddo + grad_dm_a *= 2.d0 + grad_dm_b *= 2.d0 + end + + + BEGIN_PROVIDER [double precision, one_e_dm_alpha_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ] &BEGIN_PROVIDER [double precision, one_e_dm_beta_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ] implicit none @@ -209,3 +293,44 @@ END_PROVIDER enddo END_PROVIDER + + + BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_alpha_in_r, (4,n_points_final_grid,N_states) ] +&BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_beta_in_r, (4,n_points_final_grid,N_states) ] + BEGIN_DOC +! one_e_dm_no_core_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) without core orbitals +! where r_i is the ith point of the grid and istate is the state number + END_DOC + implicit none + integer :: i,j,k,l,m,istate + double precision :: contrib + double precision :: r(3) + double precision, allocatable :: aos_array(:),grad_aos_array(:,:) + double precision, allocatable :: dm_a(:),dm_b(:), dm_a_grad(:,:), dm_b_grad(:,:) + allocate(dm_a(N_states),dm_b(N_states), dm_a_grad(3,N_states), dm_b_grad(3,N_states)) + allocate(aos_array(ao_num),grad_aos_array(3,ao_num)) + 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) + !!!! Works also with the ao basis + call dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, dm_a_grad, dm_b_grad, aos_array, grad_aos_array) + one_e_dm_no_core_and_grad_alpha_in_r(1,i,istate) = dm_a_grad(1,istate) + one_e_dm_no_core_and_grad_alpha_in_r(2,i,istate) = dm_a_grad(2,istate) + one_e_dm_no_core_and_grad_alpha_in_r(3,i,istate) = dm_a_grad(3,istate) + one_e_dm_no_core_and_grad_alpha_in_r(4,i,istate) = dm_a(istate) + + one_e_dm_no_core_and_grad_beta_in_r(1,i,istate) = dm_b_grad(1,istate) + one_e_dm_no_core_and_grad_beta_in_r(2,i,istate) = dm_b_grad(2,istate) + one_e_dm_no_core_and_grad_beta_in_r(3,i,istate) = dm_b_grad(3,istate) + one_e_dm_no_core_and_grad_beta_in_r(4,i,istate) = dm_b(istate) + enddo + enddo + +END_PROVIDER + + From 43f921fffb4d523df9b85e967bc30a9a0c59fde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 23 Mar 2019 12:51:53 +0100 Subject: [PATCH 3/9] Add the posiblity to set custom name when we download git repo --- bin/qp_plugins | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/qp_plugins b/bin/qp_plugins index 1a591e53..564be940 100755 --- a/bin/qp_plugins +++ b/bin/qp_plugins @@ -3,7 +3,7 @@ """ Usage: qp_plugins list [-iuq] - qp_plugins download + qp_plugins download [-n ] qp_plugins install ... qp_plugins uninstall qp_plugins create -n [-r ] [...] @@ -186,7 +186,10 @@ def main(arguments): url.endswith(".zip")) os.chdir(QP_PLUGINS) if is_repo: - subprocess.check_call(["git", "clone", url]) + cmd=["git", "clone", url] + if arguments["--name"]: + cmd=cmd+[arguments["--name"]] + subprocess.check_call(cmd) else: filename = url.split('/')[-1] From c180a534d78f06777841bda4fe245ab12713e5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 23 Mar 2019 20:05:29 +0100 Subject: [PATCH 4/9] Cleaning code for qp_plugins download for git repo --- bin/qp_plugins | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/qp_plugins b/bin/qp_plugins index 564be940..dc14b8ea 100755 --- a/bin/qp_plugins +++ b/bin/qp_plugins @@ -186,10 +186,10 @@ def main(arguments): url.endswith(".zip")) os.chdir(QP_PLUGINS) if is_repo: - cmd=["git", "clone", url] + git_cmd=["git", "clone", url] if arguments["--name"]: - cmd=cmd+[arguments["--name"]] - subprocess.check_call(cmd) + git_cmd.append(arguments["--name"]) + subprocess.check_call(git_cmd) else: filename = url.split('/')[-1] From 02968f569e6d3321c0ce54026dbb5fe431f69fa1 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Wed, 27 Mar 2019 12:56:32 +0100 Subject: [PATCH 5/9] fixed bug for dummy atoms X --- src/becke_numerical_grid/grid_becke.irp.f | 20 ++++++++++++++++++++ src/dft_utils_in_r/dm_in_r.irp.f | 2 ++ src/nuclei/atomic_radii.irp.f | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/becke_numerical_grid/grid_becke.irp.f b/src/becke_numerical_grid/grid_becke.irp.f index 4da9f4c9..38d4053f 100644 --- a/src/becke_numerical_grid/grid_becke.irp.f +++ b/src/becke_numerical_grid/grid_becke.irp.f @@ -195,6 +195,20 @@ BEGIN_PROVIDER [double precision, weight_at_r, (n_points_integration_angular,n_p enddo accu = 1.d0/accu weight_at_r(l,k,j) = tmp_array(j) * accu + if(isnan(weight_at_r(l,k,j)))then + print*,'isnan(weight_at_r(l,k,j))' + print*,l,k,j + accu = 0.d0 + do i = 1, nucl_num + ! function defined for each atom "i" by equation (13) and (21) with k == 3 + tmp_array(i) = cell_function_becke(r,i) ! P_n(r) + print*,i,tmp_array(i) + ! Then you compute the summ the P_n(r) function for each of the "r" points + accu += tmp_array(i) + enddo + write(*,'(100(F16.10,X))')tmp_array(j) , accu + stop + endif enddo enddo enddo @@ -221,6 +235,12 @@ BEGIN_PROVIDER [double precision, final_weight_at_r, (n_points_integration_angul contrib_integration = derivative_knowles_function(alpha_knowles(int(nucl_charge(j))),m_knowles,x)& *knowles_function(alpha_knowles(int(nucl_charge(j))),m_knowles,x)**2 final_weight_at_r(k,i,j) = weights_angular_points(k) * weight_at_r(k,i,j) * contrib_integration * dr_radial_integral + if(isnan(final_weight_at_r(k,i,j)))then + print*,'isnan(final_weight_at_r(k,i,j))' + print*,k,i,j + write(*,'(100(F16.10,X))')weights_angular_points(k) , weight_at_r(k,i,j) , contrib_integration , dr_radial_integral + stop + endif enddo enddo enddo diff --git a/src/dft_utils_in_r/dm_in_r.irp.f b/src/dft_utils_in_r/dm_in_r.irp.f index cc8dc4b4..6a19fed0 100644 --- a/src/dft_utils_in_r/dm_in_r.irp.f +++ b/src/dft_utils_in_r/dm_in_r.irp.f @@ -227,6 +227,8 @@ END_PROVIDER BEGIN_PROVIDER [double precision, one_e_dm_alpha_at_r, (n_points_final_grid,N_states) ] &BEGIN_PROVIDER [double precision, one_e_dm_beta_at_r, (n_points_final_grid,N_states) ] +&BEGIN_PROVIDER [double precision, elec_beta_num_grid_becke , (N_states) ] +&BEGIN_PROVIDER [double precision, elec_alpha_num_grid_becke , (N_states) ] implicit none BEGIN_DOC ! one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate) diff --git a/src/nuclei/atomic_radii.irp.f b/src/nuclei/atomic_radii.irp.f index 7210980d..82487b9d 100644 --- a/src/nuclei/atomic_radii.irp.f +++ b/src/nuclei/atomic_radii.irp.f @@ -1,4 +1,4 @@ -BEGIN_PROVIDER [ double precision, slater_bragg_radii, (100)] +BEGIN_PROVIDER [ double precision, slater_bragg_radii, (0:100)] implicit none BEGIN_DOC ! atomic radii in Angstrom defined in table I of JCP 41, 3199 (1964) Slater @@ -54,10 +54,10 @@ BEGIN_PROVIDER [ double precision, slater_bragg_radii, (100)] END_PROVIDER -BEGIN_PROVIDER [double precision, slater_bragg_radii_ua, (100)] +BEGIN_PROVIDER [double precision, slater_bragg_radii_ua, (0:100)] implicit none integer :: i - do i = 1, 100 + do i = 0, 100 slater_bragg_radii_ua(i) = slater_bragg_radii(i) * 1.889725989d0 enddo END_PROVIDER From 2cd5694e0fbe2d621869d55910a77ca934fbfd84 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Wed, 27 Mar 2019 13:14:55 +0100 Subject: [PATCH 6/9] fixed bug for X atoms in grid DFT --- src/becke_numerical_grid/step_function_becke.irp.f | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/becke_numerical_grid/step_function_becke.irp.f b/src/becke_numerical_grid/step_function_becke.irp.f index 2905c6c0..b6335c3d 100644 --- a/src/becke_numerical_grid/step_function_becke.irp.f +++ b/src/becke_numerical_grid/step_function_becke.irp.f @@ -31,6 +31,10 @@ double precision function cell_function_becke(r,atom_number) double precision :: mu_ij,nu_ij double precision :: distance_i,distance_j,step_function_becke integer :: j + if(int(nucl_charge(atom_number))==0)then + cell_function_becke = 0.d0 + return + endif distance_i = (r(1) - nucl_coord_transp(1,atom_number) ) * (r(1) - nucl_coord_transp(1,atom_number)) distance_i += (r(2) - nucl_coord_transp(2,atom_number) ) * (r(2) - nucl_coord_transp(2,atom_number)) distance_i += (r(3) - nucl_coord_transp(3,atom_number) ) * (r(3) - nucl_coord_transp(3,atom_number)) @@ -38,6 +42,7 @@ double precision function cell_function_becke(r,atom_number) cell_function_becke = 1.d0 do j = 1, nucl_num if(j==atom_number)cycle + if(int(nucl_charge(j))==0)cycle distance_j = (r(1) - nucl_coord_transp(1,j) ) * (r(1) - nucl_coord_transp(1,j)) distance_j+= (r(2) - nucl_coord_transp(2,j) ) * (r(2) - nucl_coord_transp(2,j)) distance_j+= (r(3) - nucl_coord_transp(3,j) ) * (r(3) - nucl_coord_transp(3,j)) From e8d8f734755de66efbdf51436d85c5cefb67e04d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Mar 2019 17:37:35 +0100 Subject: [PATCH 7/9] Force sexplib version 0.11.0 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 1e6af5e7..f3186018 100755 --- a/configure +++ b/configure @@ -60,7 +60,7 @@ function execute () { } PACKAGES="" -OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt" +OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib.v0.11.0 ppx_sexp_conv ppx_deriving getopt" while true ; do case "$1" in From d616e9c566ff589b661bad57d49dad5def5a2e45 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Wed, 27 Mar 2019 18:29:08 +0100 Subject: [PATCH 8/9] add normalize_dm --- src/density_for_dft/EZFIO.cfg | 7 ++++++ src/density_for_dft/density_for_dft.irp.f | 27 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/density_for_dft/EZFIO.cfg b/src/density_for_dft/EZFIO.cfg index d4d40546..86bbaeb1 100644 --- a/src/density_for_dft/EZFIO.cfg +++ b/src/density_for_dft/EZFIO.cfg @@ -16,3 +16,10 @@ doc: Type of density doc: if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero interface: ezfio, provider, ocaml default: full_density + +[normalize_dm] +type: logical +doc: Type of density +doc: if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb +interface: ezfio, provider, ocaml +default: True diff --git a/src/density_for_dft/density_for_dft.irp.f b/src/density_for_dft/density_for_dft.irp.f index 84f3d349..2c6aa46e 100644 --- a/src/density_for_dft/density_for_dft.irp.f +++ b/src/density_for_dft/density_for_dft.irp.f @@ -29,6 +29,20 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_s one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0 enddo enddo + if(normalize_dm)then + double precision :: elec_alpha_frozen_num, elec_alpha_valence(N_states) + elec_alpha_frozen_num = elec_alpha_num - n_core_orb + elec_alpha_valence = 0.d0 + integer :: istate + do istate = 1, N_states + do i = 1, mo_num + elec_alpha_valence(istate) += one_e_dm_mo_alpha_for_dft(i,i,istate) + enddo + elec_alpha_valence(istate) = elec_alpha_frozen_num/elec_alpha_valence(istate) + one_e_dm_mo_alpha_for_dft(:,:,istate) = one_e_dm_mo_alpha_for_dft(:,:,istate) * elec_alpha_valence(istate) + enddo + + endif endif END_PROVIDER @@ -64,6 +78,19 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_st one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0 enddo enddo + if(normalize_dm)then + double precision :: elec_beta_valence(N_states),elec_beta_frozen_num + elec_beta_frozen_num = elec_beta_num - n_core_orb + elec_beta_valence = 0.d0 + integer :: istate + do istate = 1, N_states + do i = 1, mo_num + elec_beta_valence(istate) += one_e_dm_mo_beta_for_dft(i,i,istate) + enddo + elec_beta_valence(istate) = elec_beta_frozen_num/elec_beta_valence(istate) + one_e_dm_mo_beta_for_dft(:,:,istate) = one_e_dm_mo_beta_for_dft(:,:,istate) * elec_beta_valence(istate) + enddo + endif endif END_PROVIDER From c23b99da6aab21ef40b8a0a4c2f775629a88d4b1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 28 Mar 2019 16:09:03 +0100 Subject: [PATCH 9/9] merge master (#35) * Updated research.bib * added no core densities * Force sexplib version 0.11.0 --- configure | 2 +- docs/source/research.bib | 14 +-- ocaml/.gitignore | 38 ------- src/density_for_dft/density_for_dft.irp.f | 72 ++++++++++++- src/dft_utils_in_r/dm_in_r.irp.f | 125 ++++++++++++++++++++++ 5 files changed, 202 insertions(+), 49 deletions(-) delete mode 100644 ocaml/.gitignore diff --git a/configure b/configure index 1e6af5e7..f3186018 100755 --- a/configure +++ b/configure @@ -60,7 +60,7 @@ function execute () { } PACKAGES="" -OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt" +OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib.v0.11.0 ppx_sexp_conv ppx_deriving getopt" while true ; do case "$1" in diff --git a/docs/source/research.bib b/docs/source/research.bib index f22ca682..348c5a15 100644 --- a/docs/source/research.bib +++ b/docs/source/research.bib @@ -19,21 +19,23 @@ Programs}}, url = {https://arxiv.org/abs/1812.06902} } -@article{Loos2019Jan, + +%%%% PUBLISHED PAPERS + +@article{Loos2019Mar, author = {Loos, Pierre-Fran\c{c}ois and Boggio-Pasqua, Martial and Scemama, Anthony and Caffarel, Michel and Jacquemin, Denis}, title = {{Reference Energies for Double Excitations}}, journal = {J. Chem. Theory Comput.}, + volume = {15}, + number = {3}, + pages = {1939--1956}, year = {2019}, - month = {Jan}, + month = {Mar}, issn = {1549-9618}, publisher = {American Chemical Society}, doi = {10.1021/acs.jctc.8b01205} } - - - -%%%% PUBLISHED PAPERS @article{PinedaFlores2019Feb, author = {Pineda Flores, Sergio and Neuscamman, Eric}, title = {{Excited State Specific Multi-Slater Jastrow Wave Functions}}, diff --git a/ocaml/.gitignore b/ocaml/.gitignore deleted file mode 100644 index 74e83c02..00000000 --- a/ocaml/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -_build -element_create_db -element_create_db.byte -ezfio.ml -.gitignore -Git.ml -Input_ao_one_e_ints.ml -Input_ao_two_e_erf_ints.ml -Input_ao_two_e_ints.ml -Input_auto_generated.ml -Input_becke_numerical_grid.ml -Input_champ.ml -Input_davidson.ml -Input_density_for_dft.ml -Input_determinants.ml -Input_dft_keywords.ml -Input_dressing.ml -Input_mo_one_e_ints.ml -Input_mo_two_e_erf_ints.ml -Input_mo_two_e_ints.ml -Input_nuclei.ml -Input_perturbation.ml -Input_pseudo.ml -Input_scf_utils.ml -Input_variance.ml -qp_create_ezfio -qp_create_ezfio.native -qp_edit -qp_edit.ml -qp_edit.native -qp_print_basis -qp_print_basis.native -qp_run -qp_run.native -qp_set_mo_class -qp_set_mo_class.native -qptypes_generator.byte -Qptypes.ml diff --git a/src/density_for_dft/density_for_dft.irp.f b/src/density_for_dft/density_for_dft.irp.f index 7a907418..84f3d349 100644 --- a/src/density_for_dft/density_for_dft.irp.f +++ b/src/density_for_dft/density_for_dft.irp.f @@ -21,8 +21,9 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_s endif if(no_core_density .EQ. "no_core_dm")then - integer :: i,j - do i = 1, n_core_orb + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) do j = 1, mo_num one_e_dm_mo_alpha_for_dft(j,i,:) = 0.d0 one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0 @@ -55,8 +56,9 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_st endif if(no_core_density .EQ. "no_core_dm")then - integer :: i,j - do i = 1, n_core_orb + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) do j = 1, mo_num one_e_dm_mo_beta_for_dft(j,i,:) = 0.d0 one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0 @@ -119,3 +121,65 @@ END_PROVIDER one_body_dm_mo_beta_one_det(i,i, 1:N_states) = 1.d0 enddo END_PROVIDER + + + + +BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft_no_core, (mo_num,mo_num, N_states)] + implicit none + BEGIN_DOC +! density matrix for alpha electrons in the MO basis without the core orbitals + END_DOC + one_e_dm_mo_alpha_for_dft_no_core = one_e_dm_mo_alpha_for_dft + + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) + do j = 1, mo_num + one_e_dm_mo_alpha_for_dft_no_core(j,i,:) = 0.d0 + one_e_dm_mo_alpha_for_dft_no_core(i,j,:) = 0.d0 + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft_no_core, (mo_num,mo_num, N_states)] + implicit none + BEGIN_DOC +! density matrix for beta electrons in the MO basis without the core orbitals + END_DOC + one_e_dm_mo_beta_for_dft_no_core = one_e_dm_mo_beta_for_dft + integer :: ii,i,j + do ii = 1, n_core_orb + i = list_core(ii) + do j = 1, mo_num + one_e_dm_mo_beta_for_dft_no_core(j,i,:) = 0.d0 + one_e_dm_mo_beta_for_dft_no_core(i,j,:) = 0.d0 + enddo + enddo +END_PROVIDER + + BEGIN_PROVIDER [ double precision, one_e_dm_alpha_ao_for_dft_no_core, (ao_num,ao_num,N_states) ] +&BEGIN_PROVIDER [ double precision, one_e_dm_beta_ao_for_dft_no_core, (ao_num,ao_num,N_states) ] + BEGIN_DOC +! one body density matrix on the AO basis based on one_e_dm_mo_alpha_for_dft_no_core + END_DOC + implicit none + integer :: istate + double precision :: mo_alpha,mo_beta + + one_e_dm_alpha_ao_for_dft_no_core = 0.d0 + one_e_dm_beta_ao_for_dft_no_core = 0.d0 + do istate = 1, N_states + call mo_to_ao_no_overlap( one_e_dm_mo_alpha_for_dft_no_core(1,1,istate), & + size(one_e_dm_mo_alpha_for_dft_no_core,1), & + one_e_dm_alpha_ao_for_dft_no_core(1,1,istate), & + size(one_e_dm_alpha_ao_for_dft_no_core,1) ) + call mo_to_ao_no_overlap( one_e_dm_mo_beta_for_dft_no_core(1,1,istate), & + size(one_e_dm_mo_beta_for_dft_no_core,1), & + one_e_dm_beta_ao_for_dft_no_core(1,1,istate), & + size(one_e_dm_beta_ao_for_dft_no_core,1) ) + enddo + +END_PROVIDER + diff --git a/src/dft_utils_in_r/dm_in_r.irp.f b/src/dft_utils_in_r/dm_in_r.irp.f index 774061cf..cc8dc4b4 100644 --- a/src/dft_utils_in_r/dm_in_r.irp.f +++ b/src/dft_utils_in_r/dm_in_r.irp.f @@ -109,6 +109,90 @@ end grad_dm_b *= 2.d0 end +subroutine dm_dft_alpha_beta_no_core_at_r(r,dm_a,dm_b) + implicit none + BEGIN_DOC +! input: r(1) ==> r(1) = x, r(2) = y, r(3) = z +! output : dm_a = alpha density evaluated at r(3) without the core orbitals +! output : dm_b = beta density evaluated at r(3) without the core orbitals + END_DOC + double precision, intent(in) :: r(3) + double precision, intent(out) :: dm_a(N_states),dm_b(N_states) + integer :: istate + double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v + call give_all_aos_at_r(r,aos_array) + do istate = 1, N_states + aos_array_bis = aos_array + ! alpha density + call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1) + dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + ! beta density + aos_array_bis = aos_array + call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1) + dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + enddo +end + + subroutine dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, aos_array, grad_aos_array) + implicit none + BEGIN_DOC +! input: +! +! * r(1) ==> r(1) = x, r(2) = y, r(3) = z +! +! output: +! +! * dm_a = alpha density evaluated at r without the core orbitals +! * dm_b = beta density evaluated at r without the core orbitals +! * aos_array(i) = ao(i) evaluated at r without the core orbitals +! * grad_dm_a(1) = X gradient of the alpha density evaluated in r without the core orbitals +! * grad_dm_a(1) = X gradient of the beta density evaluated in r without the core orbitals +! * grad_aos_array(1) = X gradient of the aos(i) evaluated at r +! + END_DOC + double precision, intent(in) :: r(3) + double precision, intent(out) :: dm_a(N_states),dm_b(N_states) + double precision, intent(out) :: grad_dm_a(3,N_states),grad_dm_b(3,N_states) + double precision, intent(out) :: grad_aos_array(3,ao_num) + integer :: i,j,istate + double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v + double precision :: aos_grad_array(ao_num,3), aos_grad_array_bis(ao_num,3) + + call give_all_aos_and_grad_at_r(r,aos_array,grad_aos_array) + do i = 1, ao_num + do j = 1, 3 + aos_grad_array(i,j) = grad_aos_array(j,i) + enddo + enddo + + do istate = 1, N_states + ! alpha density + ! aos_array_bis = \rho_ao * aos_array + call dsymv('U',ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),size(one_e_dm_alpha_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1) + dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + + ! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i) + grad_dm_a(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num) + grad_dm_a(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num) + grad_dm_a(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num) + ! aos_grad_array_bis = \rho_ao * aos_grad_array + + ! beta density + call dsymv('U',ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),size(one_e_dm_beta_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1) + dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num) + + ! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i) + grad_dm_b(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num) + grad_dm_b(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num) + grad_dm_b(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num) + ! aos_grad_array_bis = \rho_ao * aos_grad_array + enddo + grad_dm_a *= 2.d0 + grad_dm_b *= 2.d0 + end + + + BEGIN_PROVIDER [double precision, one_e_dm_alpha_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ] &BEGIN_PROVIDER [double precision, one_e_dm_beta_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ] implicit none @@ -209,3 +293,44 @@ END_PROVIDER enddo END_PROVIDER + + + BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_alpha_in_r, (4,n_points_final_grid,N_states) ] +&BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_beta_in_r, (4,n_points_final_grid,N_states) ] + BEGIN_DOC +! one_e_dm_no_core_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) without core orbitals +! one_e_dm_no_core_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) without core orbitals +! where r_i is the ith point of the grid and istate is the state number + END_DOC + implicit none + integer :: i,j,k,l,m,istate + double precision :: contrib + double precision :: r(3) + double precision, allocatable :: aos_array(:),grad_aos_array(:,:) + double precision, allocatable :: dm_a(:),dm_b(:), dm_a_grad(:,:), dm_b_grad(:,:) + allocate(dm_a(N_states),dm_b(N_states), dm_a_grad(3,N_states), dm_b_grad(3,N_states)) + allocate(aos_array(ao_num),grad_aos_array(3,ao_num)) + 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) + !!!! Works also with the ao basis + call dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, dm_a_grad, dm_b_grad, aos_array, grad_aos_array) + one_e_dm_no_core_and_grad_alpha_in_r(1,i,istate) = dm_a_grad(1,istate) + one_e_dm_no_core_and_grad_alpha_in_r(2,i,istate) = dm_a_grad(2,istate) + one_e_dm_no_core_and_grad_alpha_in_r(3,i,istate) = dm_a_grad(3,istate) + one_e_dm_no_core_and_grad_alpha_in_r(4,i,istate) = dm_a(istate) + + one_e_dm_no_core_and_grad_beta_in_r(1,i,istate) = dm_b_grad(1,istate) + one_e_dm_no_core_and_grad_beta_in_r(2,i,istate) = dm_b_grad(2,istate) + one_e_dm_no_core_and_grad_beta_in_r(3,i,istate) = dm_b_grad(3,istate) + one_e_dm_no_core_and_grad_beta_in_r(4,i,istate) = dm_b(istate) + enddo + enddo + +END_PROVIDER + +