From c12693fc9f9aeaa0d3dc20e242d5b9282476aef6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Apr 2025 11:01:41 +0200 Subject: [PATCH] Added jastrow_jast_qmckl_spin_independent --- plugins/local/jastrow/EZFIO.cfg | 6 ++ plugins/local/non_h_ints_mu/qmckl.irp.f | 5 +- scripts/import_champ_jastrow.py | 1 + src/ao_basis/spherical_to_cartesian.irp.f | 71 ++++++++++++++++++++++ src/ao_one_e_ints/ao_ortho_canonical.irp.f | 71 ---------------------- 5 files changed, 82 insertions(+), 72 deletions(-) diff --git a/plugins/local/jastrow/EZFIO.cfg b/plugins/local/jastrow/EZFIO.cfg index 9d4cf431..9f3bd573 100644 --- a/plugins/local/jastrow/EZFIO.cfg +++ b/plugins/local/jastrow/EZFIO.cfg @@ -95,6 +95,12 @@ type: double precision size: (jastrow.jast_qmckl_c_vector_size) interface: ezfio, provider +[jast_qmckl_spin_independent] +doc: If True, cusp is 0.25 for same-spin pairs and 0.5 for opposite. Otherwise, 0.5 for both +type: logical +interface: ezfio, provider +default: True + [j1e_size] type: integer doc: number of functions per atom in 1e-Jastrow diff --git a/plugins/local/non_h_ints_mu/qmckl.irp.f b/plugins/local/non_h_ints_mu/qmckl.irp.f index 48eee7b9..6b5f80b4 100644 --- a/plugins/local/non_h_ints_mu/qmckl.irp.f +++ b/plugins/local/non_h_ints_mu/qmckl.irp.f @@ -9,7 +9,10 @@ BEGIN_PROVIDER [ integer*8, qmckl_ctx_jastrow ] qmckl_ctx_jastrow = qmckl_context_create() - rc = qmckl_set_jastrow_champ_spin_independent(qmckl_ctx_jastrow, 1) + if (.not.jast_qmckl_spin_independent) then + print *, 'WARNING: In QMCkl Jastrow, jast_qmckl_spin_independent should to be set to True' + endif + rc = qmckl_set_jastrow_champ_spin_independent(qmckl_ctx_jastrow, jast_qmckl_spin_independent) rc = qmckl_check(qmckl_ctx_jastrow, rc) if (rc /= QMCKL_SUCCESS) stop -1 diff --git a/scripts/import_champ_jastrow.py b/scripts/import_champ_jastrow.py index 4bc58ff4..eee85356 100755 --- a/scripts/import_champ_jastrow.py +++ b/scripts/import_champ_jastrow.py @@ -66,4 +66,5 @@ if __name__ == '__main__': ezfio.set_jastrow_jast_qmckl_a_vector(jastrow['vec_a']) ezfio.set_jastrow_jast_qmckl_b_vector(jastrow['vec_b']) ezfio.set_jastrow_jast_qmckl_c_vector(jastrow['vec_c']) + ezfio.set_jastrow_jast_qmckl_spin_independent(True) diff --git a/src/ao_basis/spherical_to_cartesian.irp.f b/src/ao_basis/spherical_to_cartesian.irp.f index 53a60413..5dec78a4 100644 --- a/src/ao_basis/spherical_to_cartesian.irp.f +++ b/src/ao_basis/spherical_to_cartesian.irp.f @@ -805,3 +805,74 @@ END_PROVIDER + BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] +&BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_normalization, (ao_num)] + implicit none + BEGIN_DOC +! Coefficients to go from cartesian to spherical coordinates in the current +! basis set +! +! S_cart^-1 + END_DOC + integer :: i + integer, external :: ao_power_index + integer :: ibegin,j,k + integer :: prev, ao_sphe_count + prev = 0 + ao_cart_to_sphe_coef(:,:) = 0.d0 + ao_cart_to_sphe_normalization(:) = 1.d0 + + if (ao_cartesian) then + ! Identity matrix + do i=1,ao_sphe_num + ao_cart_to_sphe_coef(i,i) = 1.d0 + enddo + + else + ! Assume order provided by ao_power_index + i = 1 + ao_sphe_count = 0 + do while (i <= ao_num) + select case ( ao_l(i) ) + case (0) + ao_sphe_count += 1 + ao_cart_to_sphe_coef(i,ao_sphe_count) = 1.d0 + ao_cart_to_sphe_normalization(i) = 1.d0 + i += 1 + BEGIN_TEMPLATE + case ($SHELL) + if (ao_power(i,1) == $SHELL) then + do k=1,size(cart_to_sphe_$SHELL,2) + do j=1,size(cart_to_sphe_$SHELL,1) + ao_cart_to_sphe_coef(i+j-1,ao_sphe_count+k) = cart_to_sphe_$SHELL(j,k) + enddo + enddo + do j=1,size(cart_to_sphe_$SHELL,1) + ao_cart_to_sphe_normalization(i+j-1) = cart_to_sphe_norm_$SHELL(j) + enddo + i += size(cart_to_sphe_$SHELL,1) + ao_sphe_count += size(cart_to_sphe_$SHELL,2) + endif + SUBST [ SHELL ] + 1;; + 2;; + 3;; + 4;; + 5;; + 6;; + 7;; + 8;; + 9;; + END_TEMPLATE + case default + stop 'Error in ao_cart_to_sphe : angular momentum too high' + end select + enddo + + endif + + if (ao_sphe_count /= ao_sphe_num) then + call qp_bug(irp_here, ao_sphe_count, "ao_sphe_count /= ao_sphe_num") + endif +END_PROVIDER + diff --git a/src/ao_one_e_ints/ao_ortho_canonical.irp.f b/src/ao_one_e_ints/ao_ortho_canonical.irp.f index e015c89e..c61a848d 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,74 +1,3 @@ - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] -&BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_normalization, (ao_num)] - implicit none - BEGIN_DOC -! Coefficients to go from cartesian to spherical coordinates in the current -! basis set -! -! S_cart^-1 - END_DOC - integer :: i - integer, external :: ao_power_index - integer :: ibegin,j,k - integer :: prev, ao_sphe_count - prev = 0 - ao_cart_to_sphe_coef(:,:) = 0.d0 - ao_cart_to_sphe_normalization(:) = 1.d0 - - if (ao_cartesian) then - ! Identity matrix - do i=1,ao_sphe_num - ao_cart_to_sphe_coef(i,i) = 1.d0 - enddo - - else - ! Assume order provided by ao_power_index - i = 1 - ao_sphe_count = 0 - do while (i <= ao_num) - select case ( ao_l(i) ) - case (0) - ao_sphe_count += 1 - ao_cart_to_sphe_coef(i,ao_sphe_count) = 1.d0 - ao_cart_to_sphe_normalization(i) = 1.d0 - i += 1 - BEGIN_TEMPLATE - case ($SHELL) - if (ao_power(i,1) == $SHELL) then - do k=1,size(cart_to_sphe_$SHELL,2) - do j=1,size(cart_to_sphe_$SHELL,1) - ao_cart_to_sphe_coef(i+j-1,ao_sphe_count+k) = cart_to_sphe_$SHELL(j,k) - enddo - enddo - do j=1,size(cart_to_sphe_$SHELL,1) - ao_cart_to_sphe_normalization(i+j-1) = cart_to_sphe_norm_$SHELL(j) - enddo - i += size(cart_to_sphe_$SHELL,1) - ao_sphe_count += size(cart_to_sphe_$SHELL,2) - endif - SUBST [ SHELL ] - 1;; - 2;; - 3;; - 4;; - 5;; - 6;; - 7;; - 8;; - 9;; - END_TEMPLATE - case default - stop 'Error in ao_cart_to_sphe : angular momentum too high' - end select - enddo - - endif - - if (ao_sphe_count /= ao_sphe_num) then - call qp_bug(irp_here, ao_sphe_count, "ao_sphe_count /= ao_sphe_num") - endif -END_PROVIDER - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] implicit none BEGIN_DOC